Commit b53f9d90 authored by Aleksei Lipniagov's avatar Aleksei Lipniagov

Cache repeated class method calls

parent b9baf938
...@@ -24,7 +24,6 @@ module Banzai ...@@ -24,7 +24,6 @@ module Banzai
end end
def call def call
ref_pattern = Project.markdown_reference_pattern
ref_pattern_start = /\A#{ref_pattern}\z/ ref_pattern_start = /\A#{ref_pattern}\z/
nodes.each do |node| nodes.each do |node|
...@@ -83,7 +82,7 @@ module Banzai ...@@ -83,7 +82,7 @@ module Banzai
refs = Set.new refs = Set.new
nodes.each do |node| nodes.each do |node|
node.to_html.scan(Project.markdown_reference_pattern) do node.to_html.scan(ref_pattern) do
refs << "#{$~[:namespace]}/#{$~[:project]}" refs << "#{$~[:namespace]}/#{$~[:project]}"
end end
end end
...@@ -112,6 +111,10 @@ module Banzai ...@@ -112,6 +111,10 @@ module Banzai
def link_tag(url, data, link_content, title) def link_tag(url, data, link_content, title)
%(<a href="#{url}" #{data} class="#{link_class}" title="#{escape_once(title)}">#{link_content}</a>) %(<a href="#{url}" #{data} class="#{link_class}" title="#{escape_once(title)}">#{link_content}</a>)
end end
def ref_pattern
@ref_pattern ||= Project.markdown_reference_pattern
end
end end
end end
end 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