Remove local checks from formatter
This commit is contained in:
parent
1def861fa0
commit
c30f600f09
|
@ -19,11 +19,11 @@ class HTMLRenderer < Redcarpet::Render::HTML
|
||||||
def double_emphasis(text)
|
def double_emphasis(text)
|
||||||
"<strong>#{text}</strong>"
|
"<strong>#{text}</strong>"
|
||||||
end
|
end
|
||||||
|
|
||||||
def emphasis(text)
|
def emphasis(text)
|
||||||
"<em>#{text}</em>"
|
"<em>#{text}</em>"
|
||||||
end
|
end
|
||||||
|
|
||||||
def header(text, header_level)
|
def header(text, header_level)
|
||||||
"<h1>#{text}</h1>"
|
"<h1>#{text}</h1>"
|
||||||
end
|
end
|
||||||
|
@ -31,15 +31,15 @@ class HTMLRenderer < Redcarpet::Render::HTML
|
||||||
def paragraph(text)
|
def paragraph(text)
|
||||||
"<p>#{text}</p>"
|
"<p>#{text}</p>"
|
||||||
end
|
end
|
||||||
|
|
||||||
def triple_emphasis(text)
|
def triple_emphasis(text)
|
||||||
"<b><em>#{text}</em></b>"
|
"<b><em>#{text}</em></b>"
|
||||||
end
|
end
|
||||||
|
|
||||||
def strikethrough(text)
|
def strikethrough(text)
|
||||||
"<del>#{text}</del>"
|
"<del>#{text}</del>"
|
||||||
end
|
end
|
||||||
|
|
||||||
def underline(text)
|
def underline(text)
|
||||||
"<u>#{text}</u>"
|
"<u>#{text}</u>"
|
||||||
end
|
end
|
||||||
|
@ -53,7 +53,7 @@ class HTMLRenderer < Redcarpet::Render::HTML
|
||||||
content
|
content
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def list_item(text, list_type)
|
def list_item(text, list_type)
|
||||||
"<li>#{text}</li>"
|
"<li>#{text}</li>"
|
||||||
end
|
end
|
||||||
|
@ -115,11 +115,11 @@ class Formatter
|
||||||
|
|
||||||
return '' if raw_content.blank?
|
return '' if raw_content.blank?
|
||||||
|
|
||||||
unless status.local?
|
# unless status.local?
|
||||||
html = reformat(raw_content)
|
# html = reformat(raw_content)
|
||||||
html = encode_custom_emojis(html, status.emojis, options[:autoplay]) if options[:custom_emojify]
|
# html = encode_custom_emojis(html, status.emojis, options[:autoplay]) if options[:custom_emojify]
|
||||||
return html.html_safe # rubocop:disable Rails/OutputSafety
|
# return html.html_safe # rubocop:disable Rails/OutputSafety
|
||||||
end
|
# end
|
||||||
|
|
||||||
linkable_accounts = status.active_mentions.map(&:account)
|
linkable_accounts = status.active_mentions.map(&:account)
|
||||||
linkable_accounts << status.account
|
linkable_accounts << status.account
|
||||||
|
@ -167,14 +167,15 @@ class Formatter
|
||||||
end
|
end
|
||||||
|
|
||||||
def plaintext(status)
|
def plaintext(status)
|
||||||
return status.text if status.local?
|
return status.text
|
||||||
|
#if status.local?
|
||||||
|
|
||||||
text = status.text.gsub(/(<br \/>|<br>|<\/p>)+/) { |match| "#{match}\n" }
|
#text = status.text.gsub(/(<br \/>|<br>|<\/p>)+/) { |match| "#{match}\n" }
|
||||||
strip_tags(text)
|
#strip_tags(text)
|
||||||
end
|
end
|
||||||
|
|
||||||
def simplified_format(account, **options)
|
def simplified_format(account, **options)
|
||||||
html = account.local? ? linkify(account.note) : reformat(account.note)
|
html = linkify(account.note)
|
||||||
html = encode_custom_emojis(html, account.emojis, options[:autoplay]) if options[:custom_emojify]
|
html = encode_custom_emojis(html, account.emojis, options[:autoplay]) if options[:custom_emojify]
|
||||||
html.html_safe # rubocop:disable Rails/OutputSafety
|
html.html_safe # rubocop:disable Rails/OutputSafety
|
||||||
end
|
end
|
||||||
|
@ -202,7 +203,7 @@ class Formatter
|
||||||
end
|
end
|
||||||
|
|
||||||
def format_field(account, str, **options)
|
def format_field(account, str, **options)
|
||||||
html = account.local? ? encode_and_link_urls(str, me: true) : reformat(str)
|
html = encode_and_link_urls(str, me: true)
|
||||||
html = encode_custom_emojis(html, account.emojis, options[:autoplay]) if options[:custom_emojify]
|
html = encode_custom_emojis(html, account.emojis, options[:autoplay]) if options[:custom_emojify]
|
||||||
html.html_safe # rubocop:disable Rails/OutputSafety
|
html.html_safe # rubocop:disable Rails/OutputSafety
|
||||||
end
|
end
|
||||||
|
@ -481,8 +482,8 @@ class Formatter
|
||||||
end
|
end
|
||||||
|
|
||||||
def mention_html(account)
|
def mention_html(account)
|
||||||
return "<span>@#{encode(account.acct)}</span>" unless account.local?
|
# return "<span>@#{encode(account.acct)}</span>" unless account.local?
|
||||||
"<a data-focusable=\"true\" role=\"link\" href=\"#{encode(TagManager.instance.url_for(account))}\" class=\"u-url mention\">@#{encode(account.acct)}</a>"
|
"<a data-focusable=\"true\" role=\"link\" href=\"#{encode(TagManager.instance.url_for(account))}\" class=\"u-url mention\">@#{encode(account.acct)}</a>"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue