Merge remote-tracking branch 'parent/main' into upstream-20241216
This commit is contained in:
commit
3784ad273c
555 changed files with 7564 additions and 3363 deletions
|
@ -7,7 +7,7 @@ class TextFormatter
|
|||
|
||||
URL_PREFIX_REGEX = %r{\A(https?://(www\.)?|xmpp:)}
|
||||
|
||||
DEFAULT_REL = %w(nofollow noopener noreferrer).freeze
|
||||
DEFAULT_REL = %w(nofollow noopener).freeze
|
||||
|
||||
DEFAULT_OPTIONS = {
|
||||
multiline: true,
|
||||
|
@ -71,6 +71,12 @@ class TextFormatter
|
|||
suffix = url[prefix.length + 30..]
|
||||
cutoff = url[prefix.length..].length > 30
|
||||
|
||||
if suffix && suffix.length == 1 # revert truncation to account for ellipsis
|
||||
display_url += suffix
|
||||
suffix = nil
|
||||
cutoff = false
|
||||
end
|
||||
|
||||
tag.a href: url, target: '_blank', rel: rel.join(' '), translate: 'no' do
|
||||
tag.span(prefix, class: 'invisible') +
|
||||
tag.span(display_url, class: (cutoff ? 'ellipsis' : '')) +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue