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

Unable to parse '='bar')' #410

Open
abelmokadem opened this issue Aug 23, 2016 · 4 comments
Open

Unable to parse '='bar')' #410

abelmokadem opened this issue Aug 23, 2016 · 4 comments

Comments

@abelmokadem
Copy link

Right now we are using some functions that allow named arguments. Unfortunately this can't be rendered using Twig.js, is there a way to still support this?

e.g.

<div class="cc-alert__content">

    {{ ui_atom('icons/icon', foo='bar') }}

</div>

Twig version used: 0.9.5

Error message:

Error compiling twig template alert.twig: 
TwigException: Unable to parse '='bar')' at template position25
Error parsing twig template alert.twig: 
TypeError: Cannot read property 'forEach' of undefined
    at Object.Twig.forEach (/Users/ashbelmokadem/Projects/dev-machine/crowdcube-web/node_modules/twig/twig.js:151:24)
    at Twig.parse (/Users/ashbelmokadem/Projects/dev-machine/crowdcube-web/node_modules/twig/twig.js:830:19)
    at Twig.Template.render (/Users/ashbelmokadem/Projects/dev-machine/crowdcube-web/node_modules/twig/twig.js:1267:30)
    at /Users/ashbelmokadem/Projects/dev-machine/crowdcube-web/node_modules/kss/builder/base/twig/kss_builder_base_twig.js:554:39
    at tryCatcher (/Users/ashbelmokadem/Projects/dev-machine/crowdcube-web/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/ashbelmokadem/Projects/dev-machine/crowdcube-web/node_modules/bluebird/js/release/promise.js:504:31)
    at Promise._settlePromise (/Users/ashbelmokadem/Projects/dev-machine/crowdcube-web/node_modules/bluebird/js/release/promise.js:561:18)
    at Promise._settlePromiseCtx (/Users/ashbelmokadem/Projects/dev-machine/crowdcube-web/node_modules/bluebird/js/release/promise.js:598:10)
    at Async._drainQueue (/Users/ashbelmokadem/Projects/dev-machine/crowdcube-web/node_modules/bluebird/js/release/async.js:143:12)
    at Async._drainQueues (/Users/ashbelmokadem/Projects/dev-machine/crowdcube-web/node_modules/bluebird/js/release/async.js:148:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/Users/ashbelmokadem/Projects/dev-machine/crowdcube-web/node_modules/bluebird/js/release/async.js:17:14)
    at tryOnImmediate (timers.js:534:15)
    at processImmediate [as _immediateCallback] (timers.js:514:5)
@dave-irvine
Copy link
Contributor

Looks like named arguments landed in Twig in 1.12, its not something we support yet but I'd love a PR to add it!

@abelmokadem
Copy link
Author

Sweet! Would love to take some time outside of work to get this in. I'll have a look into this later this week.

@arakwar
Copy link

arakwar commented Jul 11, 2024

Any news on this?

@willrowe
Copy link
Collaborator

@arakwar it is not being worked on currently, feel free to create a PR.

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

No branches or pull requests

4 participants