Class: Gammo::Parser::InTableBody
- Inherits:
-
InsertionMode
- Object
- InsertionMode
- Gammo::Parser::InTableBody
- Defined in:
- lib/gammo/parser/insertion_mode/in_table_body.rb
Overview
Section 12.2.6.4.13.
Instance Attribute Summary
Attributes inherited from InsertionMode
Instance Method Summary collapse
- #comment_token(token) ⇒ Object
- #default(_) ⇒ Object
- #end_tag_token(token) ⇒ Object
- #start_tag_token(token) ⇒ Object
Methods inherited from InsertionMode
Constructor Details
This class inherits a constructor from Gammo::Parser::InsertionMode
Instance Method Details
#comment_token(token) ⇒ Object
45 46 47 48 |
# File 'lib/gammo/parser/insertion_mode/in_table_body.rb', line 45 def comment_token(token) parser.add_child(Node::Comment.new(data: token.data)) halt true end |
#default(_) ⇒ Object
50 51 52 |
# File 'lib/gammo/parser/insertion_mode/in_table_body.rb', line 50 def default(_) halt InTable.new(parser).process end |
#end_tag_token(token) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/gammo/parser/insertion_mode/in_table_body.rb', line 23 def end_tag_token(token) case token.tag when Tags::Tbody, Tags::Tfoot, Tags::Thead if parser.element_in_scope?(TABLE_SCOPE, token.tag) parser.clear_stack_to_context(TABLE_BODY_SCOPE) parser.open_elements.pop parser.insertion_mode = InTable end halt true when Tags::Table if parser.pop_until(TABLE_SCOPE, Tags::Tbody, Tags::Thead, Tags::Tfoot) parser.insertion_mode = InTable halt false end # ignore the token halt true when Tags::Body, Tags::Caption, Tags::Colgroup, Tags::Html, Tags::Td, Tags::Th, Tags::Tr # ignore the token halt true end end |
#start_tag_token(token) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/gammo/parser/insertion_mode/in_table_body.rb', line 5 def start_tag_token(token) case token.tag when Tags::Tr parser.clear_stack_to_context(TABLE_BODY_SCOPE) parser.add_element parser.insertion_mode = InRow halt true when Tags::Td, Tags::Th parser.parse_implied_token(Tokenizer::StartTagToken, Tags::Tr, Tags::Tr.to_s) halt false when Tags::Caption, Tags::Col, Tags::Colgroup, Tags::Tbody, Tags::Tfoot, Tags::Thead # ignore the token halt true unless parser.pop_until(TABLE_SCOPE, Tags::Tbody, Tags::Thead, Tags::Tfoot) parser.insertion_mode = InTable halt false end end |