pugjs / pug

Pug – robust, elegant, feature rich template engine for Node.js
https://pugjs.org
21.66k stars 1.95k forks source link

parser problem with quotes #183

Closed gendalf closed 12 years ago

gendalf commented 13 years ago

sample: div(ref1:"dsdasd", ref2:'{ dsfd: "data1"}')

this line will except error. Escape also ignored in params!

my fast fix in this lines in lexer.js

line 324: case '\': skipq = true; break; case '"': case "'": if (!skipq) { if('key' == state) { skipq = false; break; } state = 'string' == state ? 'val' : 'string'; val += c; break; } default: skipq = false; if ( c == '"' ) c = '\'+c; switch (state) { case 'key': key += c; break; case 'val': val += c; break; case 'string': val += c; break; }

after div(ref1:"dsdasd", ref2:'{ dsfd: \"data1\"}') - working div(ref1:"dsdasd", ref2:'{ dsfd: "data1"}') - working

tj commented 13 years ago

hmm I dont get an error, but I get escaped quotes since all attributes are escaped

tj commented 12 years ago

This issue has been inactive for over 2 months so I'm closing it. If you think it's still an issue re-open. - tjbot