lib/govspeak.rb in govspeak-1.5.2 vs lib/govspeak.rb in govspeak-1.5.3
- old
+ new
@@ -94,39 +94,39 @@
content = parser ? parser.new("#{body.strip}\n").to_html : body.strip
%{\n<div class="#{class_name}">\n#{content}</div>\n}
}
end
- def insert_strong_inside_p(body, parser=Kramdown::Document)
+ def insert_strong_inside_p(body, parser=Govspeak::Document)
parser.new(body.strip).to_html.sub(/^<p>(.*)<\/p>$/,"<p><strong>\\1</strong></p>")
end
extension('reverse') { |body|
body.reverse
}
extension('highlight-answer') { |body|
%{\n\n<div class="highlight-answer">
-#{Kramdown::Document.new(body.strip).to_html}</div>\n}
+#{Govspeak::Document.new(body.strip).to_html}</div>\n}
}
# FIXME: these surrounded_by arguments look dodgy
extension('external', surrounded_by("x[", ")x")) { |body|
Kramdown::Document.new("[#{body.strip}){:rel='external'}").to_html
}
extension('informational', surrounded_by("^")) { |body|
%{\n\n<div class="application-notice info-notice">
-#{Kramdown::Document.new(body.strip).to_html}</div>\n}
+#{Govspeak::Document.new(body.strip).to_html}</div>\n}
}
extension('important', surrounded_by("@")) { |body|
%{\n\n<div class="advisory">#{insert_strong_inside_p(body)}</div>\n}
}
extension('helpful', surrounded_by("%")) { |body|
- %{\n\n<div class="application-notice help-notice">\n#{Kramdown::Document.new(body.strip).to_html}</div>\n}
+ %{\n\n<div class="application-notice help-notice">\n#{Govspeak::Document.new(body.strip).to_html}</div>\n}
}
extension('attached-image', /^!!([0-9]+)/) do |image_number|
image = images[image_number.to_i - 1]
if image
@@ -160,11 +160,11 @@
}
extension("numbered list", /^\s*((s\d+\.\s.*(?:\n|$))+)/) do |body|
steps ||= 0
body.gsub!(/s(\d+)\.\s(.*)(?:\n|$)/) do |b|
- "<li>#{Kramdown::Document.new($2.strip).to_html}</li>\n"
+ "<li>#{Govspeak::Document.new($2.strip).to_html}</li>\n"
end
%{<ol class="steps">\n#{body}</ol>}
end
def self.devolved_options
@@ -178,18 +178,18 @@
devolved_options.each do |k,v|
extension("devolved-#{k}",/:#{k}:(.*?):#{k}:/m) do |body|
%{<div class="devolved-content #{k}">
<p class="devolved-header">This section applies to #{v}</p>
-<div class="devolved-body">#{Kramdown::Document.new(body.strip).to_html}</div>
+<div class="devolved-body">#{Govspeak::Document.new(body.strip).to_html}</div>
</div>\n}
end
end
extension("Priority list", /\$PriorityList:(\d+)\s*$(.*?)(?:^\s*$|\Z)/m) do |number_to_show, body|
number_to_show = number_to_show.to_i
tagged = 0
- Kramdown::Document.new(body.strip).to_html.gsub(/<li>/) do |match|
+ Govspeak::Document.new(body.strip).to_html.gsub(/<li>/) do |match|
if tagged < number_to_show
tagged += 1
'<li class="primary-item">'
else
match