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

Attributes Expression Syntax Error #127

Closed
porkloin opened this issue Jan 9, 2018 · 2 comments
Closed

Attributes Expression Syntax Error #127

porkloin opened this issue Jan 9, 2018 · 2 comments

Comments

@porkloin
Copy link

porkloin commented Jan 9, 2018

I'm trying to use the attributes expression (https://mannequin.io/extensions/drupal/expressions/#attributes) but am encountering an error.

Unable to parse YAML metadata in themes/custom/arby/templates/patterns/base/input.twig. A colon cannot be used in an unquoted mapping value at line 7 (near "attributes: ~attributes({class: [ 'foo' ] })").

My component looks like:

{# @Component
name: Input
group: Base
description: An input form element
samples:
  Button:
    type: submit
    attributes: ~attributes({class: [ 'foo' ] })
#}

FWIW, I'm on the latest version of Mannequin. I tried modifying the syntax within the curly braces in hopes of fixing it, but to no avail.

@rbayliss
Copy link
Contributor

rbayliss commented Jan 9, 2018

Hmm, yeah, that's problematic. I think if you enclose the entire value in double quotes, you should be ok. Eg:

attributes: "~attributes({class: [ 'foo' ] })"

Can you see if that works for you?

@porkloin
Copy link
Author

porkloin commented Jan 9, 2018

D'oh, I should have thought to try that.

Enclosed in double quotes works perfectly.

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

2 participants