More fixes, sync with HTML5lib

Do a better job with the wrapper <div>s added by xhtmldiff and Maruku's to_html_tree method.
More tests fixed.
This commit is contained in:
Jacques Distler 2007-06-13 23:05:15 -05:00
parent 3ca33e52b5
commit 3de374d6c1
20 changed files with 541 additions and 118 deletions

View file

@ -1,4 +1,5 @@
require 'xhtmldiff'
# Temporary class containing all rendering stuff from a Revision
# I want to shift all rendering loguc to the controller eventually
@ -43,7 +44,9 @@ class PageRenderer
previous_content = "<div>" + WikiContent.new(previous_revision, @@url_generator).render!.to_s + "</div>"
current_content = "<div>" + display_content.to_s + "</div>"
diff_doc = REXML::Document.new
diff_doc << (div = REXML::Element.new 'div')
div = REXML::Element.new('div', nil, {:respect_whitespace =>:all})
div.attributes['class'] = 'xhtmldiff_wrapper'
diff_doc << div
hd = XHTMLDiff.new(div)
parsed_previous_revision = REXML::HashableElementDelegator.new(
@ -54,7 +57,7 @@ class PageRenderer
diffs = ''
diff_doc.write(diffs, -1, true, true)
diffs.gsub(/^<div>(.*)<\/div>$/, '\1')
diffs.gsub(/\A<div class='xhtmldiff_wrapper'>(.*)<\/div>\Z/m, '\1')
else
display_content
end