-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fallback value #2
Comments
Pystache/Mustache doesn't offer the described syntax (it tries to use as little programming logic as possible) but any variable not defined in a variable set falls back to whatever is in Recently I've been working to expand the documentation on the behaviors of whizkers, so hopefully the way it works will become more clear in the future. The README in example is useful to explain some convenient uses of mustache to make variable assignment somewhat simpler. |
Thanks for the prompt reply. Indeed the readme in the example folder helped me a long way before I stumbled into this. I'm not sure if I can exactly put your suggestion into action in my setup. Let say that the variable sets have either 8 or 16 colors defined. I would like to switch between them without needing to know if the set has 8 or 16. If it has 8, then the second half of color variables in Xcolors need to be a duplicate of the first 8 - this is where the I thought the fallback would come in handy. My situation is the exact opposite - I have Thanks |
Assuming you have your colors set up as they are outlined in the example folder readme, the easiest strategy I foresee to accomplish that specific goal is to make a variable set resembling the following:
While I know this isn't as favourable as having a "true" fallback, as of right now, this is probably the best way to approach what you've described. I hope this helps. |
@fullsalvo is correct, and there are no plans to support anything outside of standard Mustache and YAML syntax, outside of two exceptions: Mustache directives within YAML strings and the special black: "{` {{ colors }}['black'].get('bold') or {{ colors }}['black']['normal'] `}"
|
That's exaclty the syntax I was looking for, but couldn't figure it out. Thanks for you help. |
Is there a way to have something like
which would mean the the var
special
would be assigned the value ofcolor15
if it's defind, if not, it would grab the value ofcolor4
?My question stems from the not knowing what where to find documentation on how
defaults.yaml
is parsed. Is that just pystache? Any pointers?btw. Thanks for sharing your work!
The text was updated successfully, but these errors were encountered: