pugjs/pug
View on GitHubOrder of attributes matters when it includes a special character
Open
#2967 opened on Mar 1, 2018
Good First Issue
Description
Pug Version: pug version: 2.0.0-rc.2 pug-cli version: 1.0.0-alpha6
Result is as expected:
Input Pug
doctype html
p({{extra-attributes}} hello="there") hey
Expected and Actual HTML
<!DOCTYPE html><p {{extra-attributes}} hello="there">hey</p>
Problematic case:
Input Pug
doctype html
p(hello="there" {{extra-attributes}}) hey
Expected HTML
<!DOCTYPE html><p hello="there" {{extra-attributes}}>hey</p>
Error:
/usr/lib/node_modules/pug-cli/node_modules/pug-lexer/index.js:59
throw err;
^
Error: test.pug:2:17
1| doctype html
> 2| p(hello="there" {{extra-attributes}}) hey
-----------------------^
3|
Syntax Error: Unexpected token
at makeError (/usr/lib/node_modules/pug-cli/node_modules/pug-error/index.js:32:13)
at Lexer.error (/usr/lib/node_modules/pug-cli/node_modules/pug-lexer/index.js:58:15)
at Lexer.assertExpression (/usr/lib/node_modules/pug-cli/node_modules/pug-lexer/index.js:86:12)
at Lexer.attrs (/usr/lib/node_modules/pug-cli/node_modules/pug-lexer/index.js:1089:18)
at Lexer.callLexerFunction (/usr/lib/node_modules/pug-cli/node_modules/pug-lexer/index.js:1319:23)
at Lexer.advance (/usr/lib/node_modules/pug-cli/node_modules/pug-lexer/index.js:1356:15)
at Lexer.callLexerFunction (/usr/lib/node_modules/pug-cli/node_modules/pug-lexer/index.js:1319:23)
at Lexer.getTokens (/usr/lib/node_modules/pug-cli/node_modules/pug-lexer/index.js:1375:12)
at lex (/usr/lib/node_modules/pug-cli/node_modules/pug-lexer/index.js:12:42)
at Object.lex (/usr/lib/node_modules/pug-cli/node_modules/pug/lib/index.js:99:27)