diff options
author | re4k <re4k@re4k.info> | 2013-03-13 21:40:06 +0900 |
---|---|---|
committer | re4k <re4k@re4k.info> | 2013-03-13 21:40:06 +0900 |
commit | 2c56dbdb9b19584c5f3bc2ced20c684bd84fa46f (patch) | |
tree | 8784072141eef2354dcab82e5df675a361e04485 /app/helpers/application_helper.rb | |
parent | 5d2a13afc4f08ba752a30e204367d028d09ad538 (diff) | |
download | aclog-2c56dbdb9b19584c5f3bc2ced20c684bd84fa46f.tar.gz |
Update (no new features)
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r-- | app/helpers/application_helper.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index bb410cd..8415602 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -7,14 +7,15 @@ module ApplicationHelper def format_tweet_text(text) text - .gsub(/<url:((?:https?|ftp).+?):(.+?)>/){link_to($2, $1, :target => "_blank")} - .gsub(/<hashtag:(.+?)>/){link_to("##{URI.decode($1)}", "https://twitter.com/search?q=%23#{$1}")} - .gsub(/<mention:(.+?)>/){link_to("@#{$1}", "/#{$1}")} + .gsub(/<url:(.+?):(.+?)>/){link_to(CGI.unescape($2), CGI.unescape($1), :target => "_blank")} + .gsub(/<hashtag:(.+?)>/){link_to("##{CGI.unescape($1)}", "https://twitter.com/search?q=%23#{$1}")} + .gsub(/<cashtag:(.+?)>/){link_to("$#{CGI.unescape($1)}", "https://twitter.com/search?q=%23#{$1}")} + .gsub(/<mention:(.+?)>/){link_to("@#{CGI.unescape($1)}", "/#{$1}")} .gsub(/\r\n|\r|\n/, "<br />") end def format_source_text(text) - text.gsub("&", "&") + format_tweet_text(text) end def status_url(tweet) |