Escape reference link text
This commit is contained in:
parent
e622259d5b
commit
331154ffdf
2 changed files with 11 additions and 8 deletions
|
@ -110,13 +110,7 @@ module Banzai
|
|||
url = matches[:url] if matches.names.include?("url")
|
||||
url ||= url_for_object(object, project)
|
||||
|
||||
text = link_text
|
||||
unless text
|
||||
text = object.reference_link_text(context[:project])
|
||||
|
||||
extras = object_link_text_extras(object, matches)
|
||||
text += " (#{extras.join(", ")})" if extras.any?
|
||||
end
|
||||
text = link_text || escape_once(object_link_text(object, matches))
|
||||
|
||||
%(<a href="#{url}" #{data}
|
||||
title="#{title}"
|
||||
|
@ -140,6 +134,15 @@ module Banzai
|
|||
def object_link_title(object)
|
||||
"#{object_class.name.titleize}: #{object.title}"
|
||||
end
|
||||
|
||||
def object_link_text(object, matches)
|
||||
text = object.reference_link_text(context[:project])
|
||||
|
||||
extras = object_link_text_extras(object, matches)
|
||||
text += " (#{extras.join(", ")})" if extras.any?
|
||||
|
||||
text
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -48,7 +48,7 @@ module Banzai
|
|||
end
|
||||
|
||||
def escape_once(html)
|
||||
ERB::Util.html_escape_once(html)
|
||||
html.html_safe? ? html : ERB::Util.html_escape_once(html)
|
||||
end
|
||||
|
||||
def ignore_parents
|
||||
|
|
Loading…
Reference in a new issue