about summary refs log tree commit diff
path: root/app/lib/formatter.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-12-11 23:08:46 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-12-11 23:08:46 +0100
commit6a5036ab19276b57a44f2d81d7df85a83e872800 (patch)
tree5bec00f2ed156caf1674ad7edef18db38e37c467 /app/lib/formatter.rb
parente90fcb46e3e5bc4144d8777c2267bec638e327a0 (diff)
Fix whitespace preservation in status text
Diffstat (limited to 'app/lib/formatter.rb')
-rw-r--r--app/lib/formatter.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb
index 5748680af..04386d295 100644
--- a/app/lib/formatter.rb
+++ b/app/lib/formatter.rb
@@ -15,6 +15,7 @@ class Formatter
     html = status.text
     html = encode(html)
     html = simple_format(html, sanitize: false)
+    html = html.gsub(/\n/, '')
     html = link_urls(html)
     html = link_mentions(html, status.mentions)
     html = link_hashtags(html)
@@ -42,7 +43,7 @@ class Formatter
   end
 
   def link_urls(html)
-    auto_link(html, link: :urls, html: { rel: 'nofollow noopener' }) do |text|
+    auto_link(html, link: :urls, html: { rel: 'nofollow noopener', target: '_blank' }) do |text|
       truncate(text.gsub(/\Ahttps?:\/\/(www\.)?/, ''), length: 30)
     end
   end