Class: Gammo::Parser::BeforeHead
Overview
Instance Attribute Summary
#parser
Instance Method Summary
collapse
#initialize, #process
Instance Method Details
#character_token(token) ⇒ Object
5
6
7
8
|
# File 'lib/gammo/parser/insertion_mode/before_head.rb', line 5
def character_token(token)
token.data = token.data.lstrip
halt true if token.data.length.zero?
end
|
33
34
35
36
|
# File 'lib/gammo/parser/insertion_mode/before_head.rb', line 33
def (token)
parser.add_child(Node::.new(data: token.data))
halt true
end
|
#default(_) ⇒ Object
43
44
45
46
|
# File 'lib/gammo/parser/insertion_mode/before_head.rb', line 43
def default(_)
parser.parse_implied_token Tokenizer::StartTagToken, Tags::Head, Tags::Head.to_s
halt false
end
|
#doctype_token(token) ⇒ Object
38
39
40
41
|
# File 'lib/gammo/parser/insertion_mode/before_head.rb', line 38
def doctype_token(token)
halt true
end
|
#end_tag_token(token) ⇒ Object
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/gammo/parser/insertion_mode/before_head.rb', line 22
def end_tag_token(token)
case token.tag
when Tags::Head, Tags::Body, Tags::Html, Tags::Br
parser.parse_implied_token Tokenizer::StartTagToken, Tags::Head, Tags::Head.to_s
halt false
else
halt true
end
end
|
#start_tag_token(token) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/gammo/parser/insertion_mode/before_head.rb', line 10
def start_tag_token(token)
case token.tag
when Tags::Head
parser.add_element
parser.head = parser.top
parser.insertion_mode = InHead
halt true
when Tags::Html
halt InBody.new(parser).process
end
end
|