File tree 3 files changed +28
-4
lines changed
3 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -1041,7 +1041,8 @@ def self._(str); str end
1041
1041
". Expected end of file." ) ,
1042
1042
"unexpected-end-table-in-caption" =>
1043
1043
_ ( "Unexpected end table tag in caption. Generates implied end caption." ) ,
1044
- "end-html-in-innerhtml" => _ ( "Unexpected html end tag in inner html mode." )
1044
+ "end-html-in-innerhtml" => _ ( "Unexpected html end tag in inner html mode." ) ,
1045
+ "expected-self-closing-tag" => _ ( "Expected a > after the /." )
1045
1046
}
1046
1047
1047
1048
end
Original file line number Diff line number Diff line change @@ -428,8 +428,7 @@ def tag_name_state
428
428
elsif data == ">"
429
429
emit_current_token
430
430
elsif data == "/"
431
- process_solidus_in_tag
432
- @state = :before_attribute_name_state
431
+ @state = :self_closing_tag_state
433
432
else
434
433
@current_token [ :name ] += data
435
434
end
@@ -627,6 +626,11 @@ def after_attribute_value_state
627
626
if !process_solidus_in_tag
628
627
@state = :before_attribute_name_state
629
628
end
629
+ elsif data == :EOF
630
+ @token_queue << { :type => :ParseError , :data => "unexpected-EOF-after-attribute-value" }
631
+ emit_current_token
632
+ @stream . unget ( data )
633
+ @state = :data_state
630
634
else
631
635
@token_queue . push ( { :type => :ParseError , :data => "unexpected-character-after-attribute-value" } )
632
636
@stream . unget ( data )
@@ -635,6 +639,25 @@ def after_attribute_value_state
635
639
true
636
640
end
637
641
642
+ def self_closing_tag_state
643
+ c = @stream . char
644
+ case c
645
+ when ">"
646
+ emit_current_token
647
+ @current_token [ :self_closing ] = true
648
+ @state = :data_state
649
+ when :EOF
650
+ @token_queue << { :type => :ParseError , :data => "eof-in-tag-name" }
651
+ @stream . unget ( c )
652
+ @state = :data_state
653
+ else
654
+ @token_queue << { :type => :ParseError , :data => "expected-self-closing-tag" }
655
+ @stream . unget ( c )
656
+ @state = :before_attribute_name_state
657
+ end
658
+ true
659
+ end
660
+
638
661
def bogus_comment_state
639
662
# Make a new comment token and give it as value all the characters
640
663
# until the first > or :EOF (chars_until checks for :EOF automatically)
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ def tokenizer_test(data)
63
63
'' ] * "\n "
64
64
65
65
assert_nothing_raised message do
66
- tokenizer = HTML5 ::HTMLTokenizer . new ( data [ 'input' ] )
66
+ tokenizer = HTML5 ::HTMLTokenizer . new ( data [ 'input' ] , :encoding => 'utf-8' )
67
67
68
68
tokenizer . content_model_flag = content_model_flag . to_sym
69
69
You can’t perform that action at this time.
0 commit comments