lib/govspeak.rb in govspeak-0.8.4 vs lib/govspeak.rb in govspeak-0.8.5
- old
+ new
@@ -1,6 +1,7 @@
require 'kramdown'
+require 'govspeak/header_extractor'
module Govspeak
class Document
@@ -19,10 +20,14 @@
def to_html
@doc.to_html
end
+ def headers
+ Govspeak::HeaderExtractor.convert(@doc).first
+ end
+
def preprocess(source)
@@extensions.each do |title,regexp,block|
source.gsub!(regexp) {|match|
block.call($1)
}
@@ -64,14 +69,14 @@
%{\n\n<div class="application-notice info-notice">
#{Kramdown::Document.new(body.strip).to_html}</div>\n}
}
extension('important', surrounded_by("@")) { |body|
- %{\n\n<h3 class="advisory"><span>#{body.strip}</span></h3>\n}
+ %{\n\n<h3 class="advisory">#{Kramdown::Document.new(body.strip).to_html}</h3>\n}
}
extension('helpful', surrounded_by("%")) { |body|
- %{\n\n<div class="application-notice help-notice">\n<p>#{body.strip}</p>\n</div>\n}
+ %{\n\n<div class="application-notice help-notice">\n#{Kramdown::Document.new(body.strip).to_html}</div>\n}
}
extension('map_link', surrounded_by("((", "))")) { |body|
%{<div class="map"><iframe width="200" height="200" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="#{body.strip}&output=embed"></iframe><br /><small><a href="#{body.strip}">View Larger Map</a></small></div>}
}