Class: HTML5::InTablePhase

Inherits:
Phase
  • Object
show all
Defined in:
lib/feed_tools/vendor/html5/lib/html5/html5parser/in_table_phase.rb

Instance Method Summary collapse

Methods inherited from Phase

#assert, end_tag_handlers, handle_end, handle_start, #in_scope?, #initialize, #processComment, #processDoctype, #processEndTag, #processSpaceCharacters, #processStartTag, #process_eof, #remove_open_elements_until, #startTagHtml, start_tag_handlers, tag_handlers

Constructor Details

This class inherits a constructor from HTML5::Phase

Instance Method Details

#endTagIgnore(name) ⇒ Object



89
90
91
# File 'lib/feed_tools/vendor/html5/lib/html5/html5parser/in_table_phase.rb', line 89

def endTagIgnore(name)
  parse_error("unexpected-end-tag", {"name" => name})
end

#endTagOther(name) ⇒ Object



93
94
95
96
97
98
99
100
# File 'lib/feed_tools/vendor/html5/lib/html5/html5parser/in_table_phase.rb', line 93

def endTagOther(name)
  parse_error("unexpected-end-tag-implies-table-voodoo", {"name" => name})
  # Make all the special element rearranging voodoo kick in
  @tree.insert_from_table = true
  # Process the end tag in the "in body" mode
  @parser.phases[:inBody].processEndTag(name)
  @tree.insert_from_table = false
end

#endTagTable(name) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/feed_tools/vendor/html5/lib/html5/html5parser/in_table_phase.rb', line 69

def endTagTable(name)
  if in_scope?('table', true)
    @tree.generateImpliedEndTags

    unless @tree.open_elements.last.name == 'table'
      parse_error("end-tag-too-early-named",
                {"gotName" => "table",
                 "expectedName" => @tree.open_elements.last.name})
    end

    remove_open_elements_until('table')

    @parser.reset_insertion_mode
  else
    # inner_html case
    assert @parser.inner_html
    parse_error
  end
end

#processCharacters(data) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/feed_tools/vendor/html5/lib/html5/html5parser/in_table_phase.rb', line 14

def processCharacters(data)
  parse_error("unexpected-char-implies-table-voodoo")
  # Make all the special element rearranging voodoo kick in
  @tree.insert_from_table = true
  # Process the character in the "in body" mode
  @parser.phases[:inBody].processCharacters(data)
  @tree.insert_from_table = false
end

#startTagCaption(name, attributes) ⇒ Object



23
24
25
26
27
28
# File 'lib/feed_tools/vendor/html5/lib/html5/html5parser/in_table_phase.rb', line 23

def startTagCaption(name, attributes)
  clearStackToTableContext
  @tree.activeFormattingElements.push(Marker)
  @tree.insert_element(name, attributes)
  @parser.phase = @parser.phases[:inCaption]
end

#startTagCol(name, attributes) ⇒ Object



36
37
38
39
# File 'lib/feed_tools/vendor/html5/lib/html5/html5parser/in_table_phase.rb', line 36

def startTagCol(name, attributes)
  startTagColgroup('colgroup', {})
  @parser.phase.processStartTag(name, attributes)
end

#startTagColgroup(name, attributes) ⇒ Object



30
31
32
33
34
# File 'lib/feed_tools/vendor/html5/lib/html5/html5parser/in_table_phase.rb', line 30

def startTagColgroup(name, attributes)
  clearStackToTableContext
  @tree.insert_element(name, attributes)
  @parser.phase = @parser.phases[:inColumnGroup]
end

#startTagImplyTbody(name, attributes) ⇒ Object



47
48
49
50
# File 'lib/feed_tools/vendor/html5/lib/html5/html5parser/in_table_phase.rb', line 47

def startTagImplyTbody(name, attributes)
  startTagRowGroup('tbody', {})
  @parser.phase.processStartTag(name, attributes)
end

#startTagOther(name, attributes) ⇒ Object



59
60
61
62
63
64
65
66
67
# File 'lib/feed_tools/vendor/html5/lib/html5/html5parser/in_table_phase.rb', line 59

def startTagOther(name, attributes)
  parse_error("unexpected-start-tag-implies-table-voodoo",
          {"name" => name})
  # Make all the special element rearranging voodoo kick in
  @tree.insert_from_table = true
  # Process the start tag in the "in body" mode
  @parser.phases[:inBody].processStartTag(name, attributes)
  @tree.insert_from_table = false
end

#startTagRowGroup(name, attributes) ⇒ Object



41
42
43
44
45
# File 'lib/feed_tools/vendor/html5/lib/html5/html5parser/in_table_phase.rb', line 41

def startTagRowGroup(name, attributes)
  clearStackToTableContext
  @tree.insert_element(name, attributes)
  @parser.phase = @parser.phases[:inTableBody]
end

#startTagTable(name, attributes) ⇒ Object



52
53
54
55
56
57
# File 'lib/feed_tools/vendor/html5/lib/html5/html5parser/in_table_phase.rb', line 52

def startTagTable(name, attributes)
  parse_error("unexpected-start-tag-implies-end-tag",
        {"startName" => "table", "endName" => "table"})
  @parser.phase.processEndTag('table')
  @parser.phase.processStartTag(name, attributes) unless @parser.inner_html
end