diff options
author | Eugen <eugen@zeonfederated.com> | 2017-01-24 21:56:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-24 21:56:06 +0100 |
commit | f8da0dd4907490f57cb14b052b767c66c95c4db3 (patch) | |
tree | 871a1b902872d22d0c28e96dbc733533d33ac397 /app/lib | |
parent | bf0f6eb62d0f5bd1f0d8e4e2a6e9e8fd3b297b6c (diff) | |
parent | 8a880a3d464daf486a10d85b8ee49305aa6b1e5b (diff) |
Merge branch 'master' into master
Diffstat (limited to 'app/lib')
-rw-r--r-- | app/lib/formatter.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb index ccdef0382..72cd3d234 100644 --- a/app/lib/formatter.rb +++ b/app/lib/formatter.rb @@ -80,8 +80,11 @@ class Formatter end def link_html(url) - link_text = truncate(url.gsub(/\Ahttps?:\/\/(www\.)?/, ''), length: 30) - "<a rel=\"nofollow noopener\" target=\"_blank\" href=\"#{url}\">#{link_text}</a>" + prefix = url.match(/\Ahttps?:\/\/(www\.)?/).to_s + text = url[prefix.length, 30] + suffix = url[prefix.length + 30..-1] + + "<a rel=\"nofollow noopener\" target=\"_blank\" href=\"#{url}\"><span class=\"invisible\">#{prefix}</span><span class=\"ellipsis\">#{text}</span><span class=\"invisible\">#{suffix}</span></a>" end def hashtag_html(match) |