From 5208bbf0af2a48091b795a4e3bf8cd6b2007b7ca Mon Sep 17 00:00:00 2001 From: Jacques Distler Date: Sat, 27 Oct 2007 17:34:29 -0500 Subject: [PATCH] Sanitize url refs in SVG attributes Add some tests. Sync with latest HTML5lib (includes above sanitization improvements). --- test/fixtures/revisions.yml | 4 +- test/functional/wiki_controller_test.rb | 2 +- test/unit/page_renderer_test.rb | 28 +- test/unit/page_test.rb | 2 +- vendor/plugins/HTML5lib/History.txt | 5 + vendor/plugins/HTML5lib/bin/html5 | 5 +- .../plugins/HTML5lib/lib/core_ext/kernel.rb | 13 + .../plugins/HTML5lib/lib/html5/constants.rb | 4 +- .../lib/html5/html5parser/in_body_phase.rb | 42 +- .../lib/html5/html5parser/in_caption_phase.rb | 13 +- .../lib/html5/html5parser/in_cell_phase.rb | 2 +- .../html5parser/in_column_group_phase.rb | 2 +- .../html5/html5parser/in_frameset_phase.rb | 3 +- .../lib/html5/html5parser/in_row_phase.rb | 7 +- .../html5/html5parser/in_table_body_phase.rb | 10 +- .../lib/html5/html5parser/in_table_phase.rb | 2 +- .../plugins/HTML5lib/lib/html5/inputstream.rb | 28 +- .../plugins/HTML5lib/lib/html5/sanitizer.rb | 6 + .../lib/html5/serializer/htmlserializer.rb | 2 +- vendor/plugins/HTML5lib/lib/html5/version.rb | 2 +- .../HTML5lib/testdata/encoding/tests2.dat | 33 + .../HTML5lib/testdata/sanitizer/tests1.dat | 32 + .../testdata/tree-construction/tests1.dat | 1030 ++++++++--------- .../testdata/tree-construction/tests2.dat | 184 +-- .../testdata/tree-construction/tests3.dat | 40 +- .../testdata/tree-construction/tests4.dat | 4 +- .../testdata/tree-construction/tests5.dat | 34 +- .../testdata/tree-construction/tests6.dat | 473 +++++++- 28 files changed, 1277 insertions(+), 735 deletions(-) create mode 100644 vendor/plugins/HTML5lib/lib/core_ext/kernel.rb diff --git a/test/fixtures/revisions.yml b/test/fixtures/revisions.yml index 48bf2cfd..6fab1755 100644 --- a/test/fixtures/revisions.yml +++ b/test/fixtures/revisions.yml @@ -50,7 +50,7 @@ home_page_second_revision: updated_at: <%= Time.local(2004, 4, 4, 16, 50).to_formatted_s(:db) %> revised_at: <%= Time.local(2004, 4, 4, 16, 50).to_formatted_s(:db) %> page_id: 1 - content: HisWay would be MyWay $\sin(x)\begin{svg}\end{svg}$ in kinda ThatWay in HisWay though MyWay \OverThere -- see SmartEngine in that SmartEngineGUI + content: HisWay would be MyWay $\sin(x)\begin{svg}\end{svg}\includegraphics[width=3em]{foo}$ in kinda ThatWay in HisWay though MyWay \OverThere -- see SmartEngine in that SmartEngineGUI author: DavidHeinemeierHansson first_page_first_revision: @@ -59,7 +59,7 @@ first_page_first_revision: updated_at: <%= Time.local(2004, 4, 4, 16, 55).to_formatted_s(:db) %> revised_at: <%= Time.local(2004, 4, 4, 16, 55).to_formatted_s(:db) %> page_id: 6 - content: HisWay would be MyWay $\sin(x)\begin{svg}\end{svg}$ in kinda ThatWay in HisWay though MyWay \\OverThere -- see SmartEngine in that SmartEngineGUI + content: HisWay would be MyWay $\sin(x)\begin{svg}\end{svg}\includegraphics[width=3em]{foo}$ in kinda ThatWay in HisWay though MyWay \\OverThere -- see SmartEngine in that SmartEngineGUI author: DavidHeinemeierHansson oak_first_revision: diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index c434c942..27bee12b 100755 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -867,7 +867,7 @@ class WikiControllerTest < Test::Unit::TestCase \section*{HomePage} -HisWay would be MyWay $\sin(x) $ in kinda ThatWay in HisWay though MyWay $\backslash$OverThere --{} see SmartEngine in that SmartEngineGUI +HisWay would be MyWay $\sin(x) \includegraphics[width=3em]{foo}$ in kinda ThatWay in HisWay though MyWay $\backslash$OverThere --{} see SmartEngine in that SmartEngineGUI diff --git a/test/unit/page_renderer_test.rb b/test/unit/page_renderer_test.rb index c9840b8f..f5fc6a03 100644 --- a/test/unit/page_renderer_test.rb +++ b/test/unit/page_renderer_test.rb @@ -57,7 +57,13 @@ class PageRendererTest < Test::Unit::TestCase end def test_markdown - set_web_property :markup, :markdown + set_web_property :markup, :markdownMML + + assert_markup_parsed_as( + %{

equation } + + %{sin(x)

}, + "equation $\\sin(x)$") assert_markup_parsed_as( %{

My Headline

\n\n

that } + @@ -70,13 +76,11 @@ class PageRendererTest < Test::Unit::TestCase "#My Headline#\n\nthat SmartEngineGUI") assert_markup_parsed_as( - %{ecuasi\303\263n } + - %{sin(x)}, - "ecuasi\303\263n $\\sin(x)$") - - assert_markup_parsed_as( - %{ecuasi\303\263n } + - %{sin(x)}, + %{

sin} + + %{(x)} + + %{
} + + %{\\sin(x) \\begin{svg}\\end{svg}
}, "$$\\sin(x) \\begin{svg}\\end{svg}$$") code_block = [ @@ -92,6 +96,14 @@ class PageRendererTest < Test::Unit::TestCase %{

This is a code block:

\n\n
def a_method(arg)\n} +
         %{return ThatWay
\n\n

Nice!

}, code_block) + +#FIXME + assert_markup_parsed_as( + %{

ecuasi\303\263n } + + %{sin(x)

}, + "ecuasi\303\263n $\\sin(x)$") + end def test_markdown_hyperlink_with_slash diff --git a/test/unit/page_test.rb b/test/unit/page_test.rb index 5513cd48..66fe1deb 100644 --- a/test/unit/page_test.rb +++ b/test/unit/page_test.rb @@ -117,6 +117,6 @@ class PageTest < Test::Unit::TestCase assert_equal 3, @page.revisions(true).length, "Should have three revisions" @page.current_revision(true) @page.rollback(0, Time.now, '127.0.0.1', test_renderer) - assert_equal "HisWay would be MyWay in kinda ThatWay in HisWay though MyWay \\\\OverThere -- see SmartEngine in that SmartEngineGUI", @page.current_revision(true).content + assert_equal "HisWay would be MyWay $\\sin(x)\\begin{svg}\\end{svg}\\includegraphics[width=3em]{foo}$ in kinda ThatWay in HisWay though MyWay \\\\OverThere -- see SmartEngine in that SmartEngineGUI", @page.current_revision(true).content end end diff --git a/vendor/plugins/HTML5lib/History.txt b/vendor/plugins/HTML5lib/History.txt index d64c86c3..2c8f6321 100644 --- a/vendor/plugins/HTML5lib/History.txt +++ b/vendor/plugins/HTML5lib/History.txt @@ -1,3 +1,8 @@ +== 0.10.0 2007-10-08 +* proof-of-concept validator +* easier to localize error reporting +* many unit tests + == 0.1.0 / 2007-08-07 * 1 major enhancement diff --git a/vendor/plugins/HTML5lib/bin/html5 b/vendor/plugins/HTML5lib/bin/html5 index 870e5117..e16e9248 100755 --- a/vendor/plugins/HTML5lib/bin/html5 +++ b/vendor/plugins/HTML5lib/bin/html5 @@ -39,7 +39,7 @@ def parse(opts, args) if opts.parsemethod == :parse args = [f, encoding] else - args = [f, 'div', encoding] + args = [f, (opts.container || 'div'), encoding] end if opts.profile @@ -113,8 +113,9 @@ opts = OptionParser.new do |opts| options.treebuilder = treebuilder end - opts.on("-f", "--fragment", "Parse as a fragment") do |parse| + opts.on("-f", "--fragment CONTAINER", "Parse as a fragment") do |container| options.parsemethod = :parse_fragment + options.container = container if container end opts.separator "" diff --git a/vendor/plugins/HTML5lib/lib/core_ext/kernel.rb b/vendor/plugins/HTML5lib/lib/core_ext/kernel.rb new file mode 100644 index 00000000..3bb75ad8 --- /dev/null +++ b/vendor/plugins/HTML5lib/lib/core_ext/kernel.rb @@ -0,0 +1,13 @@ +module Kernel + def silence + if $VERBOSE + $VERBOSE = false + yield + $VERBOSE = true + else + yield + end + end +end + + \ No newline at end of file diff --git a/vendor/plugins/HTML5lib/lib/html5/constants.rb b/vendor/plugins/HTML5lib/lib/html5/constants.rb index 9a4580fa..ed34b086 100755 --- a/vendor/plugins/HTML5lib/lib/html5/constants.rb +++ b/vendor/plugins/HTML5lib/lib/html5/constants.rb @@ -999,7 +999,7 @@ module HTML5 _("Unexpected select start tag in the select phase " + "implies select start tag."), "unexpected-start-tag-in-select" => - _("Unexpected start tag token (%(name) in the select phase. " + + _("Unexpected start tag token (%(name)) in the select phase. " + "Ignored."), "unexpected-end-tag-in-select" => _("Unexpected end tag (%(name)) in the select phase. Ignored."), @@ -1039,6 +1039,8 @@ module HTML5 "expected-eof-but-got-end-tag" => _("Unexpected end tag (%(name))" + ". Expected end of file."), + "unexpected-end-table-in-caption" => + _("Unexpected end table tag in caption. Generates implied end caption.") } end diff --git a/vendor/plugins/HTML5lib/lib/html5/html5parser/in_body_phase.rb b/vendor/plugins/HTML5lib/lib/html5/html5parser/in_body_phase.rb index f0254a08..8b8ed02e 100644 --- a/vendor/plugins/HTML5lib/lib/html5/html5parser/in_body_phase.rb +++ b/vendor/plugins/HTML5lib/lib/html5/html5parser/in_body_phase.rb @@ -1,4 +1,5 @@ require 'html5/html5parser/phase' +require 'core_ext/kernel' module HTML5 class InBodyPhase < Phase @@ -50,13 +51,12 @@ module HTML5 super(parser, tree) # for special handling of whitespace in
-      @processSpaceCharactersDropNewline = false
       if $-w
         $-w = false
-        alias processSpaceCharactersNonPre processSpaceCharacters
+        class << self; alias processSpaceCharactersNonPre processSpaceCharacters; end
         $-w = true
       else
-        alias processSpaceCharactersNonPre processSpaceCharacters
+        class << self; alias processSpaceCharactersNonPre processSpaceCharacters; end
       end
     end
 
@@ -65,10 +65,18 @@ module HTML5
 
       if $-w
         $-w = false
-        alias processSpaceCharacters processSpaceCharactersNonPre
+        class << self
+          silence do
+            alias processSpaceCharacters processSpaceCharactersNonPre
+          end
+        end
         $-w = true
       else
-        alias processSpaceCharacters processSpaceCharactersNonPre
+        class << self
+          silence do
+            alias processSpaceCharacters processSpaceCharactersNonPre
+          end
+        end
       end
 
       if (data.length > 0 and data[0] == ?\n && 
@@ -121,7 +129,13 @@ module HTML5
     def startTagCloseP(name, attributes)
       endTagP('p') if in_scope?('p')
       @tree.insert_element(name, attributes)
-      @processSpaceCharactersDropNewline = true if name == 'pre'
+      if name == 'pre'
+        class << self
+          silence do
+            alias processSpaceCharacters processSpaceCharactersDropNewline
+          end
+        end
+      end
     end
 
     def startTagForm(name, attributes)
@@ -291,8 +305,7 @@ module HTML5
       # XXX Form element pointer checking here as well...
       @tree.insert_element(name, attributes)
       @parser.tokenizer.content_model_flag = :RCDATA
-      @processSpaceCharactersDropNewline = true
-      alias processSpaceCharacters processSpaceCharactersDropNewline
+      class << self; alias processSpaceCharacters processSpaceCharactersDropNewline; end
     end
 
     # iframe, noembed noframes, noscript(if scripting enabled)
@@ -344,9 +357,9 @@ module HTML5
       # XXX Need to take open 

tags into account here. We shouldn't imply #

but we should not throw a parse error either. Specification is # likely to be updated. - unless @tree.open_elements[1].name == 'body' + unless @tree.open_elements[1] && @tree.open_elements[1].name == 'body' # inner_html case - parse_error + parse_error "unexpected-end-tag", {:name => 'body'} return end unless @tree.open_elements.last.name == 'body' @@ -364,7 +377,14 @@ module HTML5 def endTagBlock(name) #Put us back in the right whitespace handling mode - @processSpaceCharactersDropNewline = false if name == 'pre' + if name == 'pre' + class << self; + silence do + alias processSpaceCharacters processSpaceCharactersNonPre; + end + end + end + @tree.generateImpliedEndTags if in_scope?(name) diff --git a/vendor/plugins/HTML5lib/lib/html5/html5parser/in_caption_phase.rb b/vendor/plugins/HTML5lib/lib/html5/html5parser/in_caption_phase.rb index 541b2d14..ae56603d 100644 --- a/vendor/plugins/HTML5lib/lib/html5/html5parser/in_caption_phase.rb +++ b/vendor/plugins/HTML5lib/lib/html5/html5parser/in_caption_phase.rb @@ -5,9 +5,9 @@ module HTML5 # http://www.whatwg.org/specs/web-apps/current-work/#in-caption - handle_start 'html', %w( caption col colgroup tbody td tfoot th thead tr ) => 'TableElement' + handle_start 'html', %w(caption col colgroup tbody td tfoot th thead tr) => 'TableElement' - handle_end 'caption', 'table', %w( body col colgroup html tbody td tfoot th thead tr ) => 'Ignore' + handle_end 'caption', 'table', %w(body col colgroup html tbody td tfoot th thead tr) => 'Ignore' def ignoreEndTagCaption !in_scope?('caption', true) @@ -18,7 +18,7 @@ module HTML5 end def startTagTableElement(name, attributes) - parse_error + parse_error "unexpected-end-tag", {"name" => name} #XXX Have to duplicate logic here to find out if the tag is ignored ignoreEndTag = ignoreEndTagCaption @parser.phase.processEndTag('caption') @@ -33,7 +33,7 @@ module HTML5 if ignoreEndTagCaption # inner_html case assert @parser.inner_html - parse_error + parse_error "unexpected-end-tag", {"name" => name} else # AT this code is quite similar to endTagTable in "InTable" @tree.generateImpliedEndTags @@ -41,7 +41,7 @@ module HTML5 unless @tree.open_elements[-1].name == 'caption' parse_error("expected-one-end-tag-but-got-another", {"gotName" => "caption", - "expectedNmae" => @tree.open_elements.last.name}) + "expectedName" => @tree.open_elements.last.name}) end remove_open_elements_until('caption') @@ -52,7 +52,7 @@ module HTML5 end def endTagTable(name) - parse_error + parse_error "unexpected-end-table-in-caption" ignoreEndTag = ignoreEndTagCaption @parser.phase.processEndTag('caption') @parser.phase.processEndTag(name) unless ignoreEndTag @@ -65,6 +65,5 @@ module HTML5 def endTagOther(name) @parser.phases[:inBody].processEndTag(name) end - end end \ No newline at end of file diff --git a/vendor/plugins/HTML5lib/lib/html5/html5parser/in_cell_phase.rb b/vendor/plugins/HTML5lib/lib/html5/html5parser/in_cell_phase.rb index 30081422..29453735 100644 --- a/vendor/plugins/HTML5lib/lib/html5/html5parser/in_cell_phase.rb +++ b/vendor/plugins/HTML5lib/lib/html5/html5parser/in_cell_phase.rb @@ -56,7 +56,7 @@ module HTML5 @parser.phase.processEndTag(name) else # sometimes inner_html case - parse_error + parse_error "unexpected-end-tag", {:name => name} end end diff --git a/vendor/plugins/HTML5lib/lib/html5/html5parser/in_column_group_phase.rb b/vendor/plugins/HTML5lib/lib/html5/html5parser/in_column_group_phase.rb index 9e1dec2a..0689af9f 100644 --- a/vendor/plugins/HTML5lib/lib/html5/html5parser/in_column_group_phase.rb +++ b/vendor/plugins/HTML5lib/lib/html5/html5parser/in_column_group_phase.rb @@ -34,7 +34,7 @@ module HTML5 if ignoreEndTagColgroup # inner_html case assert @parser.inner_html - parse_error + parse_error "unexpected-end-tag", {:name => name} else @tree.open_elements.pop @parser.phase = @parser.phases[:inTable] diff --git a/vendor/plugins/HTML5lib/lib/html5/html5parser/in_frameset_phase.rb b/vendor/plugins/HTML5lib/lib/html5/html5parser/in_frameset_phase.rb index 5ff9bd6b..19c42a53 100644 --- a/vendor/plugins/HTML5lib/lib/html5/html5parser/in_frameset_phase.rb +++ b/vendor/plugins/HTML5lib/lib/html5/html5parser/in_frameset_phase.rb @@ -27,8 +27,7 @@ module HTML5 end def startTagOther(name, attributes) - parse_error("unexpected-start-tag-in-frameset", - {"name" => name}) + parse_error("unexpected-start-tag-in-frameset", {"name" => name}) end def endTagFrameset(name) diff --git a/vendor/plugins/HTML5lib/lib/html5/html5parser/in_row_phase.rb b/vendor/plugins/HTML5lib/lib/html5/html5parser/in_row_phase.rb index 12af6212..1b8e6c09 100644 --- a/vendor/plugins/HTML5lib/lib/html5/html5parser/in_row_phase.rb +++ b/vendor/plugins/HTML5lib/lib/html5/html5parser/in_row_phase.rb @@ -35,7 +35,7 @@ module HTML5 if ignoreEndTagTr # inner_html case assert @parser.inner_html - parse_error + parse_error "unexpected-end-tag", {:name => name} else clearStackToTableRowContext @tree.open_elements.pop @@ -57,7 +57,7 @@ module HTML5 @parser.phase.processEndTag(name) else # inner_html case - parse_error + parse_error "unexpected-end-tag", {:name => name} end end @@ -75,8 +75,7 @@ module HTML5 # XXX unify this with other table helper methods def clearStackToTableRowContext until %w[tr html].include?(name = @tree.open_elements.last.name) - parse_error("unexpected-implied-end-tag-in-table-row", - {"name" => @tree.open_elements.last.name}) + parse_error("unexpected-implied-end-tag-in-table-row", {"name" => @tree.open_elements.last.name}) @tree.open_elements.pop end end diff --git a/vendor/plugins/HTML5lib/lib/html5/html5parser/in_table_body_phase.rb b/vendor/plugins/HTML5lib/lib/html5/html5parser/in_table_body_phase.rb index 0685d34e..8e77bf98 100644 --- a/vendor/plugins/HTML5lib/lib/html5/html5parser/in_table_body_phase.rb +++ b/vendor/plugins/HTML5lib/lib/html5/html5parser/in_table_body_phase.rb @@ -33,7 +33,7 @@ module HTML5 @parser.phase.processStartTag(name, attributes) else # inner_html case - parse_error + parse_error "unexpected-start-tag", {:name => name} end end @@ -47,8 +47,7 @@ module HTML5 @tree.open_elements.pop @parser.phase = @parser.phases[:inTable] else - parse_error("unexpected-end-tag-in-table-body", - {"name" => name}) + parse_error("unexpected-end-tag-in-table-body", {"name" => name}) end end @@ -59,13 +58,12 @@ module HTML5 @parser.phase.processEndTag(name) else # inner_html case - parse_error + parse_error "unexpected-end-tag", {:name => name} end end def endTagIgnore(name) - parse_error("unexpected-end-tag-in-table-body", - {"name" => name}) + parse_error("unexpected-end-tag-in-table-body", {"name" => name}) end def endTagOther(name) diff --git a/vendor/plugins/HTML5lib/lib/html5/html5parser/in_table_phase.rb b/vendor/plugins/HTML5lib/lib/html5/html5parser/in_table_phase.rb index 6ffa8812..c87011ad 100644 --- a/vendor/plugins/HTML5lib/lib/html5/html5parser/in_table_phase.rb +++ b/vendor/plugins/HTML5lib/lib/html5/html5parser/in_table_phase.rb @@ -82,7 +82,7 @@ module HTML5 else # inner_html case assert @parser.inner_html - parse_error + parse_error "unexpected-end-tag", {:name => name} end end diff --git a/vendor/plugins/HTML5lib/lib/html5/inputstream.rb b/vendor/plugins/HTML5lib/lib/html5/inputstream.rb index f763bf69..a07aa815 100755 --- a/vendor/plugins/HTML5lib/lib/html5/inputstream.rb +++ b/vendor/plugins/HTML5lib/lib/html5/inputstream.rb @@ -47,7 +47,7 @@ module HTML5 #Encoding to use if no other information can be found @DEFAULT_ENCODING = 'windows-1252' - + #Detect encoding iff no explicit "transport level" encoding is supplied if @encoding.nil? or not HTML5.is_valid_encoding(@encoding) @char_encoding = detect_encoding @@ -235,14 +235,16 @@ module HTML5 # Returns (line, col) of the current position in the stream. def position line, col = @line, @col - @queue.reverse.each do |c| - if c == "\n" - line -= 1 - raise RuntimeError.new("col=#{col}") unless col == 0 - col = @line_lengths[line] - else - col -= 1 - end + if @queue and @queue.last != :EOF + @queue.reverse.each do |c| + if c == "\n" + line -= 1 + raise RuntimeError.new("col=#{col}") unless col == 0 + col = @line_lengths[line] + else + col -= 1 + end + end end return [line + 1, col] end @@ -434,7 +436,13 @@ module HTML5 end break unless keep_parsing end - @encoding = @encoding.strip unless @encoding.nil? + unless @encoding.nil? + @encoding = @encoding.strip + if ["UTF-16", "UTF-16BE", "UTF-16LE", "UTF-32", "UTF-32BE", "UTF-32LE"].include?(@encoding.upcase) + @encoding = 'utf-8' + end + end + return @encoding end diff --git a/vendor/plugins/HTML5lib/lib/html5/sanitizer.rb b/vendor/plugins/HTML5lib/lib/html5/sanitizer.rb index 23c9d38c..26977ba4 100644 --- a/vendor/plugins/HTML5lib/lib/html5/sanitizer.rb +++ b/vendor/plugins/HTML5lib/lib/html5/sanitizer.rb @@ -78,6 +78,9 @@ module HTML5 ATTR_VAL_IS_URI = %w[href src cite action longdesc xlink:href xml:base] + SVG_ATTR_VAL_ALLOWS_REF = %w[clip-path fill filter marker marker-start + marker-mid marker-end mask stroke textpath] + ACCEPTABLE_CSS_PROPERTIES = %w[azimuth background-color border-bottom-color border-collapse border-color border-left-color border-right-color border-top-color clear color cursor direction @@ -120,6 +123,9 @@ module HTML5 if val_unescaped =~ /^[a-z0-9][-+.a-z0-9]*:/ and !self.class.const_get("ALLOWED_PROTOCOLS").include?(val_unescaped.split(':')[0]) attrs.delete attr end + SVG_ATTR_VAL_ALLOWS_REF.each do |attr| + attrs.delete attr if attrs[attr].to_s.downcase =~ /url\(\s*[^#]/m + end end if attrs['style'] attrs['style'] = sanitize_css(attrs['style']) diff --git a/vendor/plugins/HTML5lib/lib/html5/serializer/htmlserializer.rb b/vendor/plugins/HTML5lib/lib/html5/serializer/htmlserializer.rb index 467c5e95..ae799f83 100644 --- a/vendor/plugins/HTML5lib/lib/html5/serializer/htmlserializer.rb +++ b/vendor/plugins/HTML5lib/lib/html5/serializer/htmlserializer.rb @@ -144,7 +144,7 @@ module HTML5 elsif type == :Comment data = token[:data] - serialize_error(_("Comment contains --")) if data.index("--") + serialize_error("Comment contains --") if data.index("--") comment = "" % token[:data] result << comment diff --git a/vendor/plugins/HTML5lib/lib/html5/version.rb b/vendor/plugins/HTML5lib/lib/html5/version.rb index 47c0b716..655548e5 100644 --- a/vendor/plugins/HTML5lib/lib/html5/version.rb +++ b/vendor/plugins/HTML5lib/lib/html5/version.rb @@ -1,3 +1,3 @@ module HTML5 - VERSION = '0.1.0' + VERSION = '0.10.0' end \ No newline at end of file diff --git a/vendor/plugins/HTML5lib/testdata/encoding/tests2.dat b/vendor/plugins/HTML5lib/testdata/encoding/tests2.dat index dc74859c..a905a48c 100644 --- a/vendor/plugins/HTML5lib/testdata/encoding/tests2.dat +++ b/vendor/plugins/HTML5lib/testdata/encoding/tests2.dat @@ -79,3 +79,36 @@ windows-1252 +#encoding +utf-8 + +#data + +#encoding +utf-8 + +#data + +#encoding +utf-8 + +#data + + +#encoding +utf-8 + +#data + + +#encoding +utf-8 + +#data +ñ + +#encoding +utf-8 diff --git a/vendor/plugins/HTML5lib/testdata/sanitizer/tests1.dat b/vendor/plugins/HTML5lib/testdata/sanitizer/tests1.dat index 89a7d451..6ef50d41 100644 --- a/vendor/plugins/HTML5lib/testdata/sanitizer/tests1.dat +++ b/vendor/plugins/HTML5lib/testdata/sanitizer/tests1.dat @@ -412,5 +412,37 @@ "input": "", "rexml": "", "output": "" + }, + + { + "name": "uri_refs_in_svg_attributes", + "input": "", + "rexml": "", + "xhtml": "", + "output": "" + }, + + { + "name": "absolute_uri_refs_in_svg_attributes", + "input": "", + "rexml": "", + "xhtml": "", + "output": "" + }, + + { + "name": "uri_ref_with_space_in svg_attribute", + "input": "", + "rexml": "", + "xhtml": "", + "output": "" + }, + + { + "name": "absolute_uri_ref_with_space_in svg_attribute", + "input": "", + "rexml": "", + "xhtml": "", + "output": "" } ] diff --git a/vendor/plugins/HTML5lib/testdata/tree-construction/tests1.dat b/vendor/plugins/HTML5lib/testdata/tree-construction/tests1.dat index 5c7f894c..628bff68 100644 --- a/vendor/plugins/HTML5lib/testdata/tree-construction/tests1.dat +++ b/vendor/plugins/HTML5lib/testdata/tree-construction/tests1.dat @@ -1,7 +1,7 @@ #data Test #errors -5: missing document type declaration +Line: 1 Col: 4 Unexpected non-space characters. Expected DOCTYPE. #document | | @@ -11,7 +11,7 @@ Test #data

One

Two #errors -3: missing document type declaration +Line: 1 Col: 3 Unexpected start tag (p). Expected DOCTYPE. #document | | @@ -24,7 +24,7 @@ Test #data Line1
Line2
Line3
Line4 #errors -7: missing document type declaration +Line: 1 Col: 5 Unexpected non-space characters. Expected DOCTYPE. #document | | @@ -40,7 +40,7 @@ Line1
Line2
Line3
Line4 #data #errors -6: missing document type declaration +Line: 1 Col: 6 Unexpected start tag (html). Expected DOCTYPE. #document | | @@ -49,7 +49,7 @@ Line1
Line2
Line3
Line4 #data #errors -6: missing document type declaration +Line: 1 Col: 6 Unexpected start tag (head). Expected DOCTYPE. #document | | @@ -58,7 +58,7 @@ Line1
Line2
Line3
Line4 #data #errors -6: missing document type declaration +Line: 1 Col: 6 Unexpected start tag (body). Expected DOCTYPE. #document | | @@ -67,7 +67,7 @@ Line1
Line2
Line3
Line4 #data #errors -6: missing document type declaration +Line: 1 Col: 6 Unexpected start tag (html). Expected DOCTYPE. #document | | @@ -76,7 +76,7 @@ Line1
Line2
Line3
Line4 #data #errors -6: missing document type declaration +Line: 1 Col: 6 Unexpected start tag (html). Expected DOCTYPE. #document | | @@ -85,7 +85,7 @@ Line1
Line2
Line3
Line4 #data #errors -6: missing document type declaration +Line: 1 Col: 6 Unexpected start tag (html). Expected DOCTYPE. #document | | @@ -94,7 +94,7 @@ Line1
Line2
Line3
Line4 #data #errors -6: missing document type declaration +Line: 1 Col: 6 Unexpected start tag (html). Expected DOCTYPE. #document | | @@ -103,7 +103,7 @@ Line1
Line2
Line3
Line4 #data #errors -6: missing document type declaration +Line: 1 Col: 6 Unexpected start tag (html). Expected DOCTYPE. #document | | @@ -112,7 +112,7 @@ Line1
Line2
Line3
Line4 #data #errors -6: missing document type declaration +Line: 1 Col: 6 Unexpected start tag (html). Expected DOCTYPE. #document | | @@ -121,7 +121,7 @@ Line1
Line2
Line3
Line4 #data #errors -6: missing document type declaration +Line: 1 Col: 6 Unexpected start tag (html). Expected DOCTYPE. #document | | @@ -130,7 +130,7 @@ Line1
Line2
Line3
Line4 #data #errors -6: missing document type declaration +Line: 1 Col: 6 Unexpected start tag (html). Expected DOCTYPE. #document | | @@ -139,7 +139,7 @@ Line1
Line2
Line3
Line4 #data #errors -6: missing document type declaration +Line: 1 Col: 6 Unexpected start tag (body). Expected DOCTYPE. #document | | @@ -148,7 +148,7 @@ Line1
Line2
Line3
Line4 #data #errors -6: missing document type declaration +Line: 1 Col: 6 Unexpected start tag (head). Expected DOCTYPE. #document | | @@ -157,7 +157,7 @@ Line1
Line2
Line3
Line4 #data #errors -7: missing document type declaration +Line: 1 Col: 7 Unexpected end tag (head). Expected DOCTYPE. #document | | @@ -166,7 +166,7 @@ Line1
Line2
Line3
Line4 #data #errors -7: missing document type declaration +Line: 1 Col: 7 Unexpected end tag (body). Expected DOCTYPE. #document | | @@ -175,7 +175,7 @@ Line1
Line2
Line3
Line4 #data #errors -7: missing document type declaration +Line: 1 Col: 7 Unexpected end tag (html). Expected DOCTYPE. #document | | @@ -184,10 +184,10 @@ Line1
Line2
Line3
Line4 #data
#errors -3: missing document type declaration -14: required tr element start tag implied by unexpected td element start tag -25: unexpected td element end tag implied other end tags -26: mismatched body element end tag (premature end of file?) +Line: 1 Col: 3 Unexpected start tag (b). Expected DOCTYPE. +Line: 1 Col: 14 Unexpected table cell start tag (td) in the table body phase. +Line: 1 Col: 25 Got table cell end tag (td) while required end tags are missing. +Line: 1 Col: 25 Expected closing tag. Unexpected end of file. #document | | @@ -202,11 +202,11 @@ Line1
Line2
Line3
Line4 #data
X #errors -3: missing document type declaration -14: required tr element start tag implied by unexpected td element start tag -18: mismatched b element end tag (no matching start tag) -29: unexpected td element end tag implied other end tags -31: mismatched body element end tag (premature end of file?) +Line: 1 Col: 3 Unexpected start tag (b). Expected DOCTYPE. +Line: 1 Col: 14 Unexpected table cell start tag (td) in the table body phase. +Line: 1 Col: 18 End tag (b) violates step 1, paragraph 1 of the adoption agency algorithm. +Line: 1 Col: 29 Got table cell end tag (td) while required end tags are missing. +Line: 1 Col: 30 Expected closing tag. Unexpected end of file. #document | | @@ -222,8 +222,8 @@ Line1
Line2
Line3
Line4 #data

Hello

World #errors -4: missing document type declaration -19: mismatched body element end tag (premature end of file?) +Line: 1 Col: 4 Unexpected start tag (h1). Expected DOCTYPE. +Line: 1 Col: 18 Expected closing tag. Unexpected end of file. #document | | @@ -236,10 +236,10 @@ Line1
Line2
Line3
Line4 #data

XYZ

#errors -3: missing document type declaration -10: a element start tag implying a element end tag -10: mismatched a element end tag (misnested tags) -24: mismatched a element end tag (no matching start tag) +Line: 1 Col: 3 Unexpected start tag (a). Expected DOCTYPE. +Line: 1 Col: 10 Unexpected start tag (a) implies end tag (a). +Line: 1 Col: 10 End tag (a) violates step 1, paragraph 3 of the adoption agency algorithm. +Line: 1 Col: 24 End tag (a) violates step 1, paragraph 1 of the adoption agency algorithm. #document | | @@ -255,8 +255,8 @@ Line1
Line2
Line3
Line4 #data
#errors -3: missing document type declaration -15: mismatched b element end tag (no matching start tag) +Line: 1 Col: 3 Unexpected start tag (b). Expected DOCTYPE. +Line: 1 Col: 15 End tag (b) violates step 1, paragraph 1 of the adoption agency algorithm. #document | | @@ -267,12 +267,12 @@ Line1
Line2
Line3
Line4 #data

X #errors -3: missing document type declaration -11: mismatched p element end tag -24: mismatched p element end tag -28: mismatched b element end tag (no matching start tag) -34: mismatched div element end tag -36: mismatched body element end tag (premature end of file?) +Line: 1 Col: 3 Unexpected start tag (p). Expected DOCTYPE. +Line: 1 Col: 11 Unexpected end tag (p). Ignored. +Line: 1 Col: 24 Unexpected end tag (p). Ignored. +Line: 1 Col: 28 End tag (b) violates step 1, paragraph 1 of the adoption agency algorithm. +Line: 1 Col: 34 End tag (div) seen too early. Expected other end tag. +Line: 1 Col: 35 Expected closing tag. Unexpected end of file. #document | | @@ -288,8 +288,8 @@ Line1
Line2
Line3
Line4 #data <p>

#errors -8: missing document type declaration -28: unexpected div element end tag in head +Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE. +Line: 1 Col: 28 Unexpected end tag (div). Ignored. #document | | @@ -304,10 +304,10 @@ Line1
Line2
Line3
Line4 #data

-- #errors -Incorrect comment token -Missing document type declaration -Incorrect comment token -Unexpected end of file +Line: 1 Col: 5 Incorrect comment. +Line: 1 Col: 10 Unexpected start tag (div). Expected DOCTYPE. +Line: 1 Col: 17 Incorrect comment. +Line: 1 Col: 17 Expected closing tag. Unexpected end of file. #document | | @@ -320,8 +320,8 @@ Unexpected end of file #data


#errors -3: missing document type declaration -11: mismatched p element end tag +Line: 1 Col: 3 Unexpected start tag (p). Expected DOCTYPE. +Line: 1 Col: 11 Unexpected end tag (p). Ignored. #document | | @@ -333,12 +333,12 @@ Unexpected end of file #data