diff options
Diffstat (limited to 'app/lib/formatter.rb')
-rw-r--r-- | app/lib/formatter.rb | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb index 5cc4761e5..5559ddb73 100644 --- a/app/lib/formatter.rb +++ b/app/lib/formatter.rb @@ -61,7 +61,7 @@ class Formatter html = "📄 #{html}" if summary_mode return html if options[:plaintext] - linkable_accounts = status.active_mentions.map(&:account) + linkable_accounts = status.mentions.map(&:account) linkable_accounts << status.account keep_html = !summary_mode && %w(text/markdown text/html).include?(status.content_type) @@ -73,20 +73,31 @@ class Formatter unless keep_html html = simple_format(html, {}, sanitize: false) - html = html.delete("\n") + html.delete!("\n") end html = summary_mode ? format_article_summary(html, status) : format_article_content(summary, html) if summary.present? + html = format_footer(html, status.footer, linkable_accounts, status.emojis, **options) if status.footer.present? html.html_safe # rubocop:disable Rails/OutputSafety end def format_remote_content(html, emojis, **options) - html = reformat(html) + html = reformat(html, options[:outgoing]) html = encode_custom_emojis(html, emojis, options[:autoplay]) if options[:custom_emojify] html = format_article_content(options[:summary], html) if options[:article_content] && options[:summary].present? html.html_safe # rubocop:disable Rails/OutputSafety end + def format_footer(html, footer, linkable_accounts, emojis, **options) + footer = encode_and_link_urls(footer, linkable_accounts) + footer = encode_custom_emojis(footer, emojis, options[:autoplay]) if options[:custom_emojify] + footer = "<span class=\"invisible\">– </span>#{footer}" + footer = simple_format(footer, { 'data-name': 'footer' }, sanitize: false) + footer.delete!("\n") + + "#{html}#{footer}" + end + def format_markdown(html) html = markdown_formatter.render(html) html.delete("\r").delete("\n") |