html5 0.1.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. data/History.txt +9 -2
  2. data/Manifest.txt +61 -2
  3. data/README +41 -5
  4. data/Rakefile.rb +22 -6
  5. data/{parse.rb → bin/html5} +11 -11
  6. data/lib/core_ext/string.rb +17 -0
  7. data/lib/html5/constants.rb +228 -0
  8. data/lib/html5/filters/iso639codes.rb +752 -0
  9. data/lib/html5/filters/rfc2046.rb +30 -0
  10. data/lib/html5/filters/rfc3987.rb +89 -0
  11. data/lib/html5/filters/validator.rb +830 -0
  12. data/lib/html5/html5parser.rb +25 -25
  13. data/lib/html5/html5parser/after_body_phase.rb +3 -3
  14. data/lib/html5/html5parser/after_frameset_phase.rb +3 -4
  15. data/lib/html5/html5parser/after_head_phase.rb +6 -6
  16. data/lib/html5/html5parser/before_head_phase.rb +1 -1
  17. data/lib/html5/html5parser/in_body_phase.rb +54 -48
  18. data/lib/html5/html5parser/in_caption_phase.rb +7 -6
  19. data/lib/html5/html5parser/in_cell_phase.rb +3 -3
  20. data/lib/html5/html5parser/in_column_group_phase.rb +1 -1
  21. data/lib/html5/html5parser/in_frameset_phase.rb +5 -5
  22. data/lib/html5/html5parser/in_head_phase.rb +10 -10
  23. data/lib/html5/html5parser/in_row_phase.rb +4 -2
  24. data/lib/html5/html5parser/in_select_phase.rb +7 -6
  25. data/lib/html5/html5parser/in_table_body_phase.rb +8 -5
  26. data/lib/html5/html5parser/in_table_phase.rb +12 -7
  27. data/lib/html5/html5parser/initial_phase.rb +5 -6
  28. data/lib/html5/html5parser/phase.rb +5 -9
  29. data/lib/html5/html5parser/root_element_phase.rb +1 -2
  30. data/lib/html5/html5parser/trailing_end_phase.rb +3 -3
  31. data/lib/html5/inputstream.rb +25 -31
  32. data/lib/html5/liberalxmlparser.rb +2 -2
  33. data/lib/html5/sanitizer.rb +6 -6
  34. data/lib/html5/serializer/htmlserializer.rb +2 -3
  35. data/lib/html5/sniffer.rb +45 -0
  36. data/lib/html5/tokenizer.rb +57 -59
  37. data/lib/html5/treebuilders/rexml.rb +7 -6
  38. data/lib/html5/treebuilders/simpletree.rb +1 -1
  39. data/lib/html5/treewalkers/base.rb +8 -0
  40. data/lib/html5/version.rb +3 -0
  41. data/testdata/encoding/chardet/test_big5.txt +51 -0
  42. data/testdata/encoding/test-yahoo-jp.dat +10 -0
  43. data/testdata/encoding/tests1.dat +394 -0
  44. data/testdata/encoding/tests2.dat +81 -0
  45. data/testdata/sanitizer/tests1.dat +416 -0
  46. data/testdata/serializer/core.test +104 -0
  47. data/testdata/serializer/injectmeta.test +65 -0
  48. data/testdata/serializer/optionaltags.test +900 -0
  49. data/testdata/serializer/options.test +60 -0
  50. data/testdata/serializer/whitespace.test +51 -0
  51. data/testdata/sites/google-results.htm +1 -0
  52. data/testdata/sites/python-ref-import.htm +1 -0
  53. data/testdata/sites/web-apps-old.htm +1 -0
  54. data/testdata/sites/web-apps.htm +34275 -0
  55. data/testdata/sniffer/htmlOrFeed.json +43 -0
  56. data/testdata/tokenizer/contentModelFlags.test +48 -0
  57. data/testdata/tokenizer/entities.test +2339 -0
  58. data/testdata/tokenizer/escapeFlag.test +21 -0
  59. data/testdata/tokenizer/test1.test +172 -0
  60. data/testdata/tokenizer/test2.test +129 -0
  61. data/testdata/tokenizer/test3.test +367 -0
  62. data/testdata/tokenizer/test4.test +198 -0
  63. data/testdata/tree-construction/tests1.dat +1950 -0
  64. data/testdata/tree-construction/tests2.dat +773 -0
  65. data/testdata/tree-construction/tests3.dat +270 -0
  66. data/testdata/tree-construction/tests4.dat +60 -0
  67. data/testdata/tree-construction/tests5.dat +175 -0
  68. data/testdata/tree-construction/tests6.dat +196 -0
  69. data/testdata/validator/attributes.test +1035 -0
  70. data/testdata/validator/base-href-attribute.test +787 -0
  71. data/testdata/validator/base-target-attribute.test +35 -0
  72. data/testdata/validator/blockquote-cite-attribute.test +7 -0
  73. data/testdata/validator/classattribute.test +152 -0
  74. data/testdata/validator/contenteditableattribute.test +59 -0
  75. data/testdata/validator/contextmenuattribute.test +115 -0
  76. data/testdata/validator/dirattribute.test +59 -0
  77. data/testdata/validator/draggableattribute.test +63 -0
  78. data/testdata/validator/html-xmlns-attribute.test +23 -0
  79. data/testdata/validator/idattribute.test +115 -0
  80. data/testdata/validator/inputattributes.test +2795 -0
  81. data/testdata/validator/irrelevantattribute.test +63 -0
  82. data/testdata/validator/langattribute.test +5579 -0
  83. data/testdata/validator/li-value-attribute.test +7 -0
  84. data/testdata/validator/link-href-attribute.test +7 -0
  85. data/testdata/validator/link-hreflang-attribute.test +7 -0
  86. data/testdata/validator/link-rel-attribute.test +271 -0
  87. data/testdata/validator/ol-start-attribute.test +7 -0
  88. data/testdata/validator/starttags.test +375 -0
  89. data/testdata/validator/style-scoped-attribute.test +7 -0
  90. data/testdata/validator/tabindexattribute.test +79 -0
  91. data/tests/preamble.rb +7 -17
  92. data/tests/test_encoding.rb +1 -1
  93. data/tests/test_lxp.rb +16 -0
  94. data/tests/test_parser.rb +2 -2
  95. data/tests/test_sniffer.rb +27 -0
  96. data/tests/test_treewalkers.rb +41 -22
  97. data/tests/test_validator.rb +31 -0
  98. metadata +65 -6
@@ -18,7 +18,7 @@ module HTML5
18
18
  end
19
19
 
20
20
  def startTagTableElement(name, attributes)
21
- parse_error
21
+ parse_error "unexpected-end-tag", {"name" => name}
22
22
  #XXX Have to duplicate logic here to find out if the tag is ignored
23
23
  ignoreEndTag = ignoreEndTagCaption
24
24
  @parser.phase.processEndTag('caption')
@@ -33,13 +33,15 @@ module HTML5
33
33
  if ignoreEndTagCaption
34
34
  # inner_html case
35
35
  assert @parser.inner_html
36
- parse_error
36
+ parse_error "unexpected-end-tag", {"name" => name}
37
37
  else
38
38
  # AT this code is quite similar to endTagTable in "InTable"
39
39
  @tree.generateImpliedEndTags
40
40
 
41
41
  unless @tree.open_elements[-1].name == 'caption'
42
- parse_error(_("Unexpected end tag (caption). Missing end tags."))
42
+ parse_error("expected-one-end-tag-but-got-another",
43
+ {"gotName" => "caption",
44
+ "expectedName" => @tree.open_elements.last.name})
43
45
  end
44
46
 
45
47
  remove_open_elements_until('caption')
@@ -50,19 +52,18 @@ module HTML5
50
52
  end
51
53
 
52
54
  def endTagTable(name)
53
- parse_error
55
+ parse_error "unexpected-end-table-in-caption"
54
56
  ignoreEndTag = ignoreEndTagCaption
55
57
  @parser.phase.processEndTag('caption')
56
58
  @parser.phase.processEndTag(name) unless ignoreEndTag
57
59
  end
58
60
 
59
61
  def endTagIgnore(name)
60
- parse_error(_("Unexpected end tag (#{name}). Ignored."))
62
+ parse_error("unexpected-end-tag", {"name" => name})
61
63
  end
62
64
 
63
65
  def endTagOther(name)
64
66
  @parser.phases[:inBody].processEndTag(name)
65
67
  end
66
-
67
68
  end
68
69
  end
@@ -33,7 +33,7 @@ module HTML5
33
33
  if in_scope?(name, true)
34
34
  @tree.generateImpliedEndTags(name)
35
35
  if @tree.open_elements.last.name != name
36
- parse_error("Got table cell end tag (#{name}) while required end tags are missing.")
36
+ parse_error("unexpected-cell-end-tag", {"name" => name})
37
37
 
38
38
  remove_open_elements_until(name)
39
39
  else
@@ -42,12 +42,12 @@ module HTML5
42
42
  @tree.clearActiveFormattingElements
43
43
  @parser.phase = @parser.phases[:inRow]
44
44
  else
45
- parse_error(_("Unexpected end tag (#{name}). Ignored."))
45
+ parse_error("unexpected-end-tag", {"name" => name})
46
46
  end
47
47
  end
48
48
 
49
49
  def endTagIgnore(name)
50
- parse_error(_("Unexpected end tag (#{name}). Ignored."))
50
+ parse_error("unexpected-end-tag", {"name" => name})
51
51
  end
52
52
 
53
53
  def endTagImply(name)
@@ -42,7 +42,7 @@ module HTML5
42
42
  end
43
43
 
44
44
  def endTagCol(name)
45
- parse_error(_('Unexpected end tag (col). col has no end tag.'))
45
+ parse_error("no-end-tag", {"name" => "col"})
46
46
  end
47
47
 
48
48
  def endTagOther(name)
@@ -10,7 +10,7 @@ module HTML5
10
10
  handle_end 'frameset', 'noframes'
11
11
 
12
12
  def processCharacters(data)
13
- parse_error(_('Unexpected characters in the frameset phase. Characters ignored.'))
13
+ parse_error("unexpected-char-in-frameset")
14
14
  end
15
15
 
16
16
  def startTagFrameset(name, attributes)
@@ -27,13 +27,14 @@ module HTML5
27
27
  end
28
28
 
29
29
  def startTagOther(name, attributes)
30
- parse_error(_("Unexpected start tag token (#{name}) in the frameset phase. Ignored"))
30
+ parse_error("unexpected-start-tag-in-frameset",
31
+ {"name" => name})
31
32
  end
32
33
 
33
34
  def endTagFrameset(name)
34
35
  if @tree.open_elements.last.name == 'html'
35
36
  # inner_html case
36
- parse_error(_("Unexpected end tag token (frameset) in the frameset phase (inner_html)."))
37
+ parse_error("unexpected-frameset-in-frameset-innerhtml")
37
38
  else
38
39
  @tree.open_elements.pop
39
40
  end
@@ -50,8 +51,7 @@ module HTML5
50
51
  end
51
52
 
52
53
  def endTagOther(name)
53
- parse_error(_("Unexpected end tag token (#{name}) in the frameset phase. Ignored."))
54
+ parse_error("unexpected-end-tag-in-frameset", {"name" => name})
54
55
  end
55
-
56
56
  end
57
57
  end
@@ -12,10 +12,10 @@ module HTML5
12
12
 
13
13
  def process_eof
14
14
  if ['title', 'style', 'script'].include?(name = @tree.open_elements.last.name)
15
- parse_error(_("Unexpected end of file. Expected end tag (#{name})."))
15
+ parse_error("expected-named-closing-tag-but-got-eof", {"name" => @tree.open_elements.last.name})
16
16
  @tree.open_elements.pop
17
17
  end
18
- anythingElse
18
+ anything_else
19
19
  @parser.phase.process_eof
20
20
  end
21
21
 
@@ -23,13 +23,13 @@ module HTML5
23
23
  if %w[title style script noscript].include?(@tree.open_elements.last.name)
24
24
  @tree.insertText(data)
25
25
  else
26
- anythingElse
26
+ anything_else
27
27
  @parser.phase.processCharacters(data)
28
28
  end
29
29
  end
30
30
 
31
31
  def startTagHead(name, attributes)
32
- parse_error(_('Unexpected start tag head in existing head. Ignored'))
32
+ parse_error("two-heads-are-not-better-than-one")
33
33
  end
34
34
 
35
35
  def startTagTitle(name, attributes)
@@ -85,7 +85,7 @@ module HTML5
85
85
  end
86
86
 
87
87
  def startTagOther(name, attributes)
88
- anythingElse
88
+ anything_else
89
89
  @parser.phase.processStartTag(name, attributes)
90
90
  end
91
91
 
@@ -93,13 +93,13 @@ module HTML5
93
93
  if @tree.open_elements.last.name == 'head'
94
94
  @tree.open_elements.pop
95
95
  else
96
- parse_error(_("Unexpected end tag (head). Ignored."))
96
+ parse_error("unexpected-end-tag", {"name" => "head"})
97
97
  end
98
98
  @parser.phase = @parser.phases[:afterHead]
99
99
  end
100
100
 
101
101
  def endTagImplyAfterHead(name)
102
- anythingElse
102
+ anything_else
103
103
  @parser.phase.processEndTag(name)
104
104
  end
105
105
 
@@ -107,15 +107,15 @@ module HTML5
107
107
  if @tree.open_elements.last.name == name
108
108
  @tree.open_elements.pop
109
109
  else
110
- parse_error(_("Unexpected end tag (#{name}). Ignored."))
110
+ parse_error("unexpected-end-tag", {"name" => name})
111
111
  end
112
112
  end
113
113
 
114
114
  def endTagOther(name)
115
- parse_error(_("Unexpected end tag (#{name}). Ignored."))
115
+ parse_error("unexpected-end-tag", {"name" => name})
116
116
  end
117
117
 
118
- def anythingElse
118
+ def anything_else
119
119
  if @tree.open_elements.last.name == 'head'
120
120
  endTagHead('head')
121
121
  else
@@ -62,7 +62,8 @@ module HTML5
62
62
  end
63
63
 
64
64
  def endTagIgnore(name)
65
- parse_error(_("Unexpected end tag (#{name}) in the row phase. Ignored."))
65
+ parse_error("unexpected-end-tag-in-table-row",
66
+ {"name" => name})
66
67
  end
67
68
 
68
69
  def endTagOther(name)
@@ -74,7 +75,8 @@ module HTML5
74
75
  # XXX unify this with other table helper methods
75
76
  def clearStackToTableRowContext
76
77
  until %w[tr html].include?(name = @tree.open_elements.last.name)
77
- parse_error(_("Unexpected implied end tag (#{name}) in the row phase."))
78
+ parse_error("unexpected-implied-end-tag-in-table-row",
79
+ {"name" => @tree.open_elements.last.name})
78
80
  @tree.open_elements.pop
79
81
  end
80
82
  end
@@ -26,19 +26,19 @@ module HTML5
26
26
  end
27
27
 
28
28
  def startTagSelect(name, attributes)
29
- parse_error(_('Unexpected start tag (select) in the select phase implies select start tag.'))
29
+ parse_error("unexpected-select-in-select")
30
30
  endTagSelect('select')
31
31
  end
32
32
 
33
33
  def startTagOther(name, attributes)
34
- parse_error(_('Unexpected start tag token (#{name}) in the select phase. Ignored.'))
34
+ parse_error("unexpected-start-tag-in-select", {"name" => name})
35
35
  end
36
36
 
37
37
  def endTagOption(name)
38
38
  if @tree.open_elements.last.name == 'option'
39
39
  @tree.open_elements.pop
40
40
  else
41
- parse_error(_('Unexpected end tag (option) in the select phase. Ignored.'))
41
+ parse_error("unexpected-end-tag-in-select", {"name" => "option"})
42
42
  end
43
43
  end
44
44
 
@@ -52,7 +52,8 @@ module HTML5
52
52
  @tree.open_elements.pop
53
53
  # But nothing else
54
54
  else
55
- parse_error(_('Unexpected end tag (optgroup) in the select phase. Ignored.'))
55
+ parse_error("unexpected-end-tag-in-select",
56
+ {"name" => "optgroup"})
56
57
  end
57
58
  end
58
59
 
@@ -68,7 +69,7 @@ module HTML5
68
69
  end
69
70
 
70
71
  def endTagTableElements(name)
71
- parse_error(_("Unexpected table end tag (#{name}) in the select phase."))
72
+ parse_error("unexpected-end-tag-in-select", {"name" => name})
72
73
 
73
74
  if in_scope?(name, true)
74
75
  endTagSelect('select')
@@ -77,7 +78,7 @@ module HTML5
77
78
  end
78
79
 
79
80
  def endTagOther(name)
80
- parse_error(_("Unexpected end tag token (#{name}) in the select phase. Ignored."))
81
+ parse_error("unexpected-end-tag-in-select", {"name" => name})
81
82
  end
82
83
 
83
84
  end
@@ -7,7 +7,7 @@ module HTML5
7
7
 
8
8
  handle_start 'html', 'tr', %w( td th ) => 'TableCell', %w( caption col colgroup tbody tfoot thead ) => 'TableOther'
9
9
 
10
- handle_end 'table', %w( tbody tfoot thead ) => 'TableRowGroup', %w( body caption col colgroup html td th tr ) => 'Ingore'
10
+ handle_end 'table', %w( tbody tfoot thead ) => 'TableRowGroup', %w( body caption col colgroup html td th tr ) => 'Ignore'
11
11
 
12
12
  def processCharacters(data)
13
13
  @parser.phases[:inTable].processCharacters(data)
@@ -20,7 +20,7 @@ module HTML5
20
20
  end
21
21
 
22
22
  def startTagTableCell(name, attributes)
23
- parse_error(_("Unexpected table cell start tag (#{name}) in the table body phase."))
23
+ parse_error("unexpected-cell-in-table-body", {"name" => name})
24
24
  startTagTr('tr', {})
25
25
  @parser.phase.processStartTag(name, attributes)
26
26
  end
@@ -47,7 +47,8 @@ module HTML5
47
47
  @tree.open_elements.pop
48
48
  @parser.phase = @parser.phases[:inTable]
49
49
  else
50
- parse_error(_("Unexpected end tag (#{name}) in the table body phase. Ignored."))
50
+ parse_error("unexpected-end-tag-in-table-body",
51
+ {"name" => name})
51
52
  end
52
53
  end
53
54
 
@@ -63,7 +64,8 @@ module HTML5
63
64
  end
64
65
 
65
66
  def endTagIgnore(name)
66
- parse_error(_("Unexpected end tag (#{name}) in the table body phase. Ignored."))
67
+ parse_error("unexpected-end-tag-in-table-body",
68
+ {"name" => name})
67
69
  end
68
70
 
69
71
  def endTagOther(name)
@@ -74,7 +76,8 @@ module HTML5
74
76
 
75
77
  def clearStackToTableBodyContext
76
78
  until %w[tbody tfoot thead html].include?(name = @tree.open_elements.last.name)
77
- parse_error(_("Unexpected implied end tag (#{name}) in the table body phase."))
79
+ parse_error("unexpected-implied-end-tag-in-table",
80
+ {"name" => @tree.open_elements.last.name})
78
81
  @tree.open_elements.pop
79
82
  end
80
83
  end
@@ -12,7 +12,7 @@ module HTML5
12
12
  handle_end 'table', %w( body caption col colgroup html tbody td tfoot th thead tr ) => 'Ignore'
13
13
 
14
14
  def processCharacters(data)
15
- parse_error(_("Unexpected non-space characters in table context caused voodoo mode."))
15
+ parse_error("unexpected-char-implies-table-voodoo")
16
16
  # Make all the special element rearranging voodoo kick in
17
17
  @tree.insert_from_table = true
18
18
  # Process the character in the "in body" mode
@@ -50,13 +50,15 @@ module HTML5
50
50
  end
51
51
 
52
52
  def startTagTable(name, attributes)
53
- parse_error(_("Unexpected start tag (table) in table phase. Implies end tag (table)."))
53
+ parse_error("unexpected-start-tag-implies-end-tag",
54
+ {"startName" => "table", "endName" => "table"})
54
55
  @parser.phase.processEndTag('table')
55
56
  @parser.phase.processStartTag(name, attributes) unless @parser.inner_html
56
57
  end
57
58
 
58
59
  def startTagOther(name, attributes)
59
- parse_error(_("Unexpected start tag (#{name}) in table context caused voodoo mode."))
60
+ parse_error("unexpected-start-tag-implies-table-voodoo",
61
+ {"name" => name})
60
62
  # Make all the special element rearranging voodoo kick in
61
63
  @tree.insert_from_table = true
62
64
  # Process the start tag in the "in body" mode
@@ -69,7 +71,9 @@ module HTML5
69
71
  @tree.generateImpliedEndTags
70
72
 
71
73
  unless @tree.open_elements.last.name == 'table'
72
- parse_error(_("Unexpected end tag (table). Expected end tag (#{@tree.open_elements.last.name})."))
74
+ parse_error("end-tag-too-early-named",
75
+ {"gotName" => "table",
76
+ "expectedName" => @tree.open_elements.last.name})
73
77
  end
74
78
 
75
79
  remove_open_elements_until('table')
@@ -83,11 +87,11 @@ module HTML5
83
87
  end
84
88
 
85
89
  def endTagIgnore(name)
86
- parse_error(_("Unexpected end tag (#{name}). Ignored."))
90
+ parse_error("unexpected-end-tag", {"name" => name})
87
91
  end
88
92
 
89
93
  def endTagOther(name)
90
- parse_error(_("Unexpected end tag (#{name}) in table context caused voodoo mode."))
94
+ parse_error("unexpected-end-tag-implies-table-voodoo", {"name" => name})
91
95
  # Make all the special element rearranging voodoo kick in
92
96
  @tree.insert_from_table = true
93
97
  # Process the end tag in the "in body" mode
@@ -100,7 +104,8 @@ module HTML5
100
104
  def clearStackToTableContext
101
105
  # "clear the stack back to a table context"
102
106
  until %w[table html].include?(name = @tree.open_elements.last.name)
103
- parse_error(_("Unexpected implied end tag (#{name}) in the table phase."))
107
+ parse_error("unexpected-implied-end-tag-in-table",
108
+ {"name" => @tree.open_elements.last.name})
104
109
  @tree.open_elements.pop
105
110
  end
106
111
  # When the current node is <html> it's an inner_html case
@@ -8,7 +8,7 @@ module HTML5
8
8
  # "quirks mode". It is expected that a future version of HTML5 will define this.
9
9
 
10
10
  def process_eof
11
- parse_error(_('Unexpected End of file. Expected DOCTYPE.'))
11
+ parse_error("expected-doctype-but-got-eof")
12
12
  @parser.phase = @parser.phases[:rootElement]
13
13
  @parser.phase.process_eof
14
14
  end
@@ -19,7 +19,7 @@ module HTML5
19
19
 
20
20
  def processDoctype(name, publicId, systemId, correct)
21
21
  if name.downcase != 'html' or publicId or systemId
22
- parse_error(_('Erroneous DOCTYPE.'))
22
+ parse_error("unknown-doctype")
23
23
  end
24
24
  # XXX need to update DOCTYPE tokens
25
25
  @tree.insertDoctype(name, publicId, systemId)
@@ -113,22 +113,21 @@ module HTML5
113
113
  end
114
114
 
115
115
  def processCharacters(data)
116
- parse_error(_('Unexpected non-space characters. Expected DOCTYPE.'))
116
+ parse_error("expected-doctype-but-got-chars")
117
117
  @parser.phase = @parser.phases[:rootElement]
118
118
  @parser.phase.processCharacters(data)
119
119
  end
120
120
 
121
121
  def processStartTag(name, attributes)
122
- parse_error(_("Unexpected start tag (#{name}). Expected DOCTYPE."))
122
+ parse_error("expected-doctype-but-got-start-tag", {"name" => name})
123
123
  @parser.phase = @parser.phases[:rootElement]
124
124
  @parser.phase.processStartTag(name, attributes)
125
125
  end
126
126
 
127
127
  def processEndTag(name)
128
- parse_error(_("Unexpected end tag (#{name}). Expected DOCTYPE."))
128
+ parse_error("expected-doctype-but-got-end-tag", {"name" => name})
129
129
  @parser.phase = @parser.phases[:rootElement]
130
130
  @parser.phase.processEndTag(name)
131
131
  end
132
-
133
132
  end
134
133
  end
@@ -87,13 +87,13 @@ module HTML5
87
87
  @tree.generateImpliedEndTags
88
88
 
89
89
  if @tree.open_elements.length > 2
90
- parse_error(_('Unexpected end of file. Missing closing tags.'))
90
+ parse_error("expected-closing-tag-but-got-eof")
91
91
  elsif @tree.open_elements.length == 2 and @tree.open_elements[1].name != 'body'
92
92
  # This happens for framesets or something?
93
- parse_error(_("Unexpected end of file. Expected end tag (#{@tree.open_elements[1].name}) first."))
93
+ parse_error("expected-closing-tag-but-got-eof")
94
94
  elsif @parser.inner_html and @tree.open_elements.length > 1
95
95
  # XXX This is not what the specification says. Not sure what to do here.
96
- parse_error(_('XXX inner_html EOF'))
96
+ parse_error("eof-in-innerhtml")
97
97
  end
98
98
  # Betting ends.
99
99
  end
@@ -105,7 +105,7 @@ module HTML5
105
105
  end
106
106
 
107
107
  def processDoctype(name, publicId, systemId, correct)
108
- parse_error(_('Unexpected DOCTYPE. Ignored.'))
108
+ parse_error("unexpected-doctype")
109
109
  end
110
110
 
111
111
  def processSpaceCharacters(data)
@@ -118,7 +118,7 @@ module HTML5
118
118
 
119
119
  def startTagHtml(name, attributes)
120
120
  if @parser.first_start_tag == false and name == 'html'
121
- parse_error(_('html needs to be the first start tag.'))
121
+ parse_error("non-html-root")
122
122
  end
123
123
  # XXX Need a check here to see if the first start tag token emitted is
124
124
  # this token... If it's not, invoke parse_error.
@@ -134,10 +134,6 @@ module HTML5
134
134
  send self.class.end_tag_handlers[name], name
135
135
  end
136
136
 
137
- def _(string)
138
- string
139
- end
140
-
141
137
  def assert(value)
142
138
  throw AssertionError.new unless value
143
139
  end