lib/ronn/document.rb in ronn-0.6.0 vs lib/ronn/document.rb in ronn-0.6.6

- old
+ new

@@ -2,10 +2,11 @@ require 'cgi' require 'hpricot' require 'rdiscount' require 'ronn/roff' require 'ronn/template' +require 'ronn/utils' module Ronn # The Document class can be used to load and inspect a ronn document # and to convert a ronn document into other formats, like roff or # HTML. @@ -13,10 +14,12 @@ # Ronn files may optionally follow the naming convention: # "<name>.<section>.ronn". The <name> and <section> are used in # generated documentation unless overridden by the information # extracted from the document's name section. class Document + include Ronn::Utils + attr_reader :path, :data # The man pages name: usually a single word name of # a program or filename; displayed along with the section in # the left and right portions of the header as well as the bottom @@ -316,11 +319,11 @@ def angle_quote_pre_filter(data) data.gsub(/\<([^:.\/]+?)\>/) do |match| contents = $1 tag, attrs = contents.split(' ', 2) if attrs =~ /\/=/ || - HTML.include?(tag.sub(/^\//, '')) || + html_element?(tag.sub(/^\//, '')) || data.include?("</#{tag}>") match.to_s else "<var>#{contents}</var>" end @@ -338,19 +341,9 @@ anchor = title.gsub(/\W+/, '-').gsub(/(^-+|-+$)/, '') data << "[#{title}]: ##{anchor} \"#{title}\"\n" end data end - - HTML = %w[ - a abbr acronym b bdo big br cite code dfn - em i img input kbd label q samp select - small span strong sub sup textarea tt var - address blockquote div dl fieldset form - h1 h2 h3 h4 h5 h6 hr noscript ol p pre - table ul - ].to_set - private def parse_html(html) if html.respond_to?(:doc?) && html.doc? html else