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

Custom behaviour on missing variable #120

Open
hovi opened this issue Feb 26, 2023 · 2 comments
Open

Custom behaviour on missing variable #120

hovi opened this issue Feb 26, 2023 · 2 comments

Comments

@hovi
Copy link

hovi commented Feb 26, 2023

I would like the renderer to fail with exception when he can't find a value rather than rendering nothing.
Any hopes for implementing that?

@dcmoore-gd
Copy link

dcmoore-gd commented Feb 27, 2023

That's built into the mustache syntax via inverted section:

{{#repo}}
  <b>{{name}}</b>
{{/repo}}
{{^repo}}
  No repos :(
{{/repo}}

@hovi
Copy link
Author

hovi commented Feb 27, 2023

That is slightly different. I have my templates and I expect my values to be there and just fail when the values are not there rather then have processed template with empty values.

For example this is how it's handled in jmustache:
https://github.com/samskivert/jmustache#default-values

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