chevron icon indicating copy to clipboard operation
chevron copied to clipboard

Custom behaviour on missing variable

Open hovi opened this issue 3 years ago • 2 comments

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?

hovi avatar Feb 26 '23 10:02 hovi

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

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

dcmoore-gd avatar Feb 27 '23 12:02 dcmoore-gd

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

hovi avatar Feb 27 '23 13:02 hovi