Pretty print with nokogiri
This commit is contained in:
+13
-1
@@ -68,10 +68,22 @@ def write file, content
|
||||
end
|
||||
end
|
||||
|
||||
@@format_xslt = File.expand_path(File.join(File.dirname(__FILE__), 'format.xslt'))
|
||||
|
||||
def to_html html
|
||||
# Remove blank nodes for proper formatting
|
||||
doc = Nokogiri.XML(html) do |cfg|
|
||||
cfg.default_xml.noblanks
|
||||
end
|
||||
|
||||
# Save as XHTML
|
||||
doc.to_xml( { :save_with => Nokogiri::XML::Node::SaveOptions::DEFAULT_XHTML, :indent => 2, :encoding => 'UTF-8' } )
|
||||
end
|
||||
|
||||
def check name, pages_array
|
||||
pages = FakePages.new pages_array
|
||||
expected = read name
|
||||
actual = view pages
|
||||
actual = to_html view pages
|
||||
|
||||
# Uncomment when updating tests
|
||||
# write name, actual
|
||||
|
||||
Reference in New Issue
Block a user