Skip to content

Commit

Permalink
Added support for multi-line attrs without commas. Closes #65
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Mar 5, 2011
1 parent f7ab201 commit 6cf09ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 0 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ Multiple lines work too:
name='agreement',
checked)


### Doctypes

To add a doctype simply use `!!!` followed by an optional value:
Expand Down
5 changes: 4 additions & 1 deletion lib/lexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,15 @@ Lexer.prototype = {
function parse(c) {
switch (c) {
case ',':
case '\n':
if ('string' == state) {
val += c;
} else {
state = 'key';
val = val.trim();
tok.attrs[key.trim().replace(/^['"]|['"]$/g, '')] = '' == val
key = key.trim();
if ('' == key) return;
tok.attrs[key.replace(/^['"]|['"]$/g, '')] = '' == val
? true
: val;
key = val = '';
Expand Down

0 comments on commit 6cf09ee

Please sign in to comment.