-
Notifications
You must be signed in to change notification settings - Fork 407
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
Only able to use top level elements in data.json for pattern parameter keys #189
Comments
Hey @dmolsen If you happen to have an up-to-date copy of PL PHP that you could test this on, I'd appreciate it. I am fairly certain it would be an enhancement to PL NODE in that patternParameter keys were not built to support mustache:
|
PL PHP doesn't support mustache in patternParameter keys either. That said, it is just a simple find and replace so I can get the example working with a small tweak to the initial example. Mustache tends to fall on its face using mustache tags in a pattern parameter. This is because Mustache is just looking for the closing bracket. It doesn't understand nesting. Instead we need to define a different delimiter for the pattern partial. So the example should look like:
That produces the expected results for me in the dev version of PL2. |
Sorry Dave but I don't understand this syntax
Are these working in isolation? In tandem? The first looks inverted, the second just empty Either way, I doubt this is making it into v.1.0.0 |
The = sets a delimiter. Eg what the mustache parser will see as a valid mustache tag. The first call changes the delimiter from {{ }} to <% %>. That way the mustache var in the pattern parameter doesn't get parsed and is instead seen just as a string. The second call switches the delimiter back. More info:
|
Oh!!!! Cool 💃 👯 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
If I try to use any nested element inside the data.json for a pattern include, I get
[SyntaxError: Unexpected token .]
andWarning: Invalid template! Template should be a "string" but "undefined" was given as the first argument for mustache#render(template, view, partials) Use --force to continue.
The build does not fail, but the offending patterns are broken.
data.json:
pattern.mustache:
pattern include call examples that throw the error:
If I use the
toplevel
value, the above works as expected.The text was updated successfully, but these errors were encountered: