diff options
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r-- | app/helpers/application_helper.rb | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5700099..4c3e5a4 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,31 +1,10 @@ module ApplicationHelper + include Twitter::Autolink + def format_time(dt) dt.to_time.localtime("+09:00").strftime("%Y-%m-%d %H:%M:%S") end - def format_tweet_text(text) - ret = text.gsub(/<([a-z]+?)(?<!\\):(.+?)(?:(?<!\\):(.+?))?>/) do - case $1 - when "mention" - screen_name = CGI.unescape($2) - link_to("@#{screen_name}", "/#{screen_name}") - when "url" - n = [$3, $2.gsub(/(https?)%3A/, "\\1:")].map {|m| m.gsub("\\:", ":") } - link_to(*n) - when "hashtag" - hashtag = CGI.unescape($2) - link_to("##{hashtag}", "https://twitter.com/search?q=#{CGI.escape("##{hashtag}")}") - when "symbol" - symbol = CGI.unescape($2) - link_to("$#{symbol}", "https://twitter.com/search?q=#{CGI.escape("$#{symbol}")}") - else - $& - end - end - return ret - end - alias format_source_text format_tweet_text - def title(*args) content_for :title do (args.compact).join(" - ") |