Commit 331154ff authored by Douwe Maan's avatar Douwe Maan

Escape reference link text

parent e622259d
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment