diff --git a/lib/oga/lexer.rl b/lib/oga/lexer.rl index 3f27445..aedf3e9 100644 --- a/lib/oga/lexer.rl +++ b/lib/oga/lexer.rl @@ -320,7 +320,7 @@ module Oga action start_cdata { emit_buffer - t(:T_CDATA_START) + add_token(:T_CDATA_START, nil) start_buffer @@ -332,7 +332,7 @@ module Oga cdata := |* cdata_end => { emit_buffer - t(:T_CDATA_END) + add_token(:T_CDATA_END, nil) fret; }; diff --git a/spec/oga/lexer/cdata_spec.rb b/spec/oga/lexer/cdata_spec.rb index bf41f24..f641a4f 100644 --- a/spec/oga/lexer/cdata_spec.rb +++ b/spec/oga/lexer/cdata_spec.rb @@ -4,25 +4,25 @@ describe Oga::Lexer do context 'cdata tags' do example 'lex a cdata tag' do lex('').should == [ - [:T_CDATA_START, '', 1] + [:T_CDATA_END, nil, 1] ] end example 'lex tags inside CDATA tags as regular text' do lex('Foo

]]>').should == [ - [:T_CDATA_START, 'Foo

', 1], - [:T_CDATA_END, ']]>', 1] + [:T_CDATA_END, nil, 1] ] end example 'lex double brackets inside a CDATA tag' do lex('').should == [ - [:T_CDATA_START, '', 1] + [:T_CDATA_END, nil, 1] ] end end