Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nunjucks inline if statement #83

Open
ArmorDarks opened this issue Feb 20, 2015 · 5 comments
Open

Nunjucks inline if statement #83

ArmorDarks opened this issue Feb 20, 2015 · 5 comments

Comments

@ArmorDarks
Copy link

Hi

It seems that Nunjucks inline if statement causing error in parsing:

Whenever I try to parse that file https://github.com/LotusTM/Kotsu/blob/master/source/layouts/_layout.nj it throughs following error:

λ grunt abideExtract
Running "abideExtract:html" (abideExtract) task

C:\Users\ArmorDarks\AppData\Roaming\npm\node_modules\jsxgettext\node_modules\acorn\acorn.js:321
    throw err;
          ^
SyntaxError: Unexpected token (19:11)
    at raise (C:\Users\ArmorDarks\AppData\Roaming\npm\node_modules\jsxgettext\node_modules\acorn\acorn.js:319:15)
    at unexpected (C:\Users\ArmorDarks\AppData\Roaming\npm\node_modules\jsxgettext\node_modules\acorn\acorn.js:1311:5)
    at semicolon (C:\Users\ArmorDarks\AppData\Roaming\npm\node_modules\jsxgettext\node_modules\acorn\acorn.js:1298:47)
    at parseExpressionStatement (C:\Users\ArmorDarks\AppData\Roaming\npm\node_modules\jsxgettext\node_modules\acorn\acorn.js:1736:5)
    at parseStatement (C:\Users\ArmorDarks\AppData\Roaming\npm\node_modules\jsxgettext\node_modules\acorn\acorn.js:1525:19)
    at parseTopLevel (C:\Users\ArmorDarks\AppData\Roaming\npm\node_modules\jsxgettext\node_modules\acorn\acorn.js:1469:18)
    at Object.exports.parse (C:\Users\ArmorDarks\AppData\Roaming\npm\node_modules\jsxgettext\node_modules\acorn\acorn.js:47:12)
    at C:\Users\ArmorDarks\AppData\Roaming\npm\node_modules\jsxgettext\lib\jsxgettext.js:128:27
    at Array.forEach (native)
    at parse (C:\Users\ArmorDarks\AppData\Roaming\npm\node_modules\jsxgettext\lib\jsxgettext.js:125:24)
Fatal error: Command "C:\Users\ArmorDarks\AppData\Roaming\npm\jsxgettext source/layouts/_layout.nj -o locale\templates\LC_MESSAGES\messages.pot --join-existing --language Jinja" exited with a non-zero status

It appears only if I try to run particularly this file — no issues with other.

Seems that following line causing troubles:

<title>{{ pageTitle if pageTitle else site.name }}</title>

Nunjucks is pretty close to Jinja and if I'm not wrong, that inline statement shouldn't cause any troubles for parser, but it does.

@BYK
Copy link
Collaborator

BYK commented Mar 16, 2015

@ArmorDarks - I'm not very familiar with this part of the code. Do you think you can create a patch that resolves this? I'd be more than happy to review it.

@muffinresearch
Copy link

Looks like #78 is the same issue.

@ArmorDarks
Copy link
Author

Thanks for reply

I'd be glad to, but, unfortunately, I'm not an JS developer :(

@BYK
Copy link
Collaborator

BYK commented Mar 18, 2015

I'd be glad to, but, unfortunately, I'm not an JS developer :(

Eh, fat chance huh? Well then we should probably wait until #82 is done.

@ArmorDarks
Copy link
Author

This is quite old issue, and seems that 82 doesn't move fast either because of complexity... Is there any chances to see fix for inline if at least? it's most often encountered issue in Jinja and Nunjucks templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants