test
This commit is contained in:
parent
a26e39dd47
commit
563d706886
@ -21,6 +21,8 @@ class TextFormatter
|
|||||||
# @option options [Boolean] :with_domains
|
# @option options [Boolean] :with_domains
|
||||||
# @option options [Boolean] :with_rel_me
|
# @option options [Boolean] :with_rel_me
|
||||||
# @option options [Array<Account>] :preloaded_accounts
|
# @option options [Array<Account>] :preloaded_accounts
|
||||||
|
# @option options [Status] :quote
|
||||||
|
|
||||||
def initialize(text, options = {})
|
def initialize(text, options = {})
|
||||||
@text = text
|
@text = text
|
||||||
@options = DEFAULT_OPTIONS.merge(options)
|
@options = DEFAULT_OPTIONS.merge(options)
|
||||||
@ -30,8 +32,8 @@ class TextFormatter
|
|||||||
@entities ||= Extractor.extract_entities_with_indices(text, extract_url_without_protocol: false)
|
@entities ||= Extractor.extract_entities_with_indices(text, extract_url_without_protocol: false)
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_s(status, **options)
|
def to_s
|
||||||
return ''.html_safe if text.blank? & !status.quote?
|
return ''.html_safe if text.blank? & !quote?
|
||||||
|
|
||||||
html = rewrite do |entity|
|
html = rewrite do |entity|
|
||||||
if entity[:url]
|
if entity[:url]
|
||||||
@ -43,7 +45,7 @@ class TextFormatter
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
html += quotify if status.quote?
|
html += quotify if quote?
|
||||||
|
|
||||||
html = simple_format(html, {}, sanitize: false).delete("\n") if multiline?
|
html = simple_format(html, {}, sanitize: false).delete("\n") if multiline?
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user