Lex open tags with newlines in them.

This commit is contained in:
Yorick Peterse 2014-03-20 23:39:29 +01:00
parent ba17996bfc
commit 91fb7523fd
2 changed files with 10 additions and 0 deletions

View File

@ -404,6 +404,8 @@ module Oga
element_head := |*
whitespace | '=';
newline => { advance_line };
# Attribute names.
element_name => { t(:T_ATTR) };

View File

@ -33,6 +33,14 @@ describe Oga::Lexer do
[:T_ELEM_NAME, 'p', 1]
]
end
example 'lex an element with a newline in the open tag' do
lex("<p\n></p>").should == [
[:T_ELEM_OPEN, nil, 1],
[:T_ELEM_NAME, 'p', 1],
[:T_ELEM_CLOSE, nil, 2]
]
end
end
context 'elements with attributes' do