Commit 879be428 authored by Robert Speicher's avatar Robert Speicher

Initialize the references result Hash in ReferenceFilter

parent 439b9f50
......@@ -12,7 +12,15 @@ module Gitlab
# :reference_class - Custom CSS class added to reference links.
# :only_path - Generate path-only links.
#
# Results:
# :references - A Hash of references that were found and replaced.
class ReferenceFilter < HTML::Pipeline::Filter
def initialize(*args)
super
result[:references] = Hash.new { |hash, type| hash[type] = [] }
end
def escape_once(html)
ERB::Util.html_escape_once(html)
end
......@@ -29,6 +37,14 @@ module Gitlab
context[:project]
end
# Add a reference to the pipeline's result Hash
#
# type - Singular Symbol reference type (e.g., :issue, :user, etc.)
# value - Object to add
def push_result(type, value)
result[:references][type].push(value)
end
def reference_class(type)
"gfm gfm-#{type} #{context[:reference_class]}".strip
end
......
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