Class: Gammo::Parser::AfterHead
Overview
Instance Attribute Summary
#parser
Instance Method Summary
collapse
#initialize, #process
Instance Method Details
#character_token(token) ⇒ Object
5
6
7
8
9
10
11
12
13
|
# File 'lib/gammo/parser/insertion_mode/after_head.rb', line 5
def character_token(token)
s = token.data.lstrip
if s.length < token.data.length
parser.add_text token.data.slice(0, token.data.length - s.length)
halt true if s == ''
token.data = s
end
end
|
53
54
55
56
|
# File 'lib/gammo/parser/insertion_mode/after_head.rb', line 53
def (token)
parser.add_child Node::Comment.new(data: token.data)
halt true
end
|
#default(_) ⇒ Object
63
64
65
66
67
|
# File 'lib/gammo/parser/insertion_mode/after_head.rb', line 63
def default(_)
parser.parse_implied_token(Tokenizer::StartTagToken, Tags::Body, Tags::Body.to_s)
parser.frameset_ok = true
halt false
end
|
#doctype_token(token) ⇒ Object
58
59
60
61
|
# File 'lib/gammo/parser/insertion_mode/after_head.rb', line 58
def doctype_token(token)
halt true
end
|
#end_tag_token(token) ⇒ Object
#start_tag_token(token) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/gammo/parser/insertion_mode/after_head.rb', line 15
def start_tag_token(token)
case token.tag
when Tags::Html then halt InBody.new(parser).process
when Tags::Body
parser.add_element
parser.frameset_ok = false
parser.insertion_mode = InBody
halt true
when Tags::Frameset
parser.add_element
parser.insertion_mode = InFrameset
halt true
when Tags::Base, Tags::Basefont, Tags::Bgsound, Tags::Link, Tags::Meta,
Tags::Noframes, Tags::Script, Tags::Style, Tags::Template, Tags::Title
parser.open_elements << parser.head
begin
halt InHead.new(parser).process
ensure
parser.open_elements.delete(parser.head)
end
when Tags::Head
halt true
end
end
|