diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-03-19 00:16:04 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-03-19 00:16:04 +0100 |
commit | 071f64d317408b556c4f85e2f2abd80fe815de8b (patch) | |
tree | 7cf5fe781a674c637c0a999b37551b27613aebdb /app/helpers/application_helper.rb | |
parent | 580b91c38740620488816755a5ccb2ec16ff8b1c (diff) |
Fix #13, Atom feeds now contain formatted post content
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r-- | app/helpers/application_helper.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 18aec6dbe..56207c4bb 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -12,6 +12,17 @@ module ApplicationHelper id.start_with?("tag:#{Rails.configuration.x.local_domain}") end + def linkify(status) + mention_hash = {} + status.mentions.each { |m| mention_hash[m.acct] = m } + coder = HTMLEntities.new + + auto_link(coder.encode(status.text), link: :urls, html: { rel: 'nofollow noopener' }).gsub(Account::MENTION_RE) do |m| + account = mention_hash[Account::MENTION_RE.match(m)[1]] + return "#{m.split('@').first}<a href=\"#{url_for_target(account)}\" class=\"mention\">@<span>#{account.acct}</span></a>" + end.html_safe + end + def active_nav_class(path) current_page?(path) ? 'active' : '' end |