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
dot notation in manual #129
Comments
The man pages are definitely in need of some lovin'. We'll make sure that dot-notation gets into the next draft -- thanks! |
Couple of cool other things that could add to manual (assuming these are supported and not just hacks) Object Dot Notation works with Nested Objects
Array Numeric Lookup(though this is obvious, since most langs arrays are objects)
Dot Notation can be Iterated
Top-Level Arrays
Any other cool features not yet documented in manual? |
Could someone on the mustache team at least comment about whether the features above are meant to be publicly used or if they are non-standard hacks that should not be relied upon? |
It looks like the dot notation, at least, is not in the mustache spec (https://github.com/mustache/spec). |
Depending on what you mean by "dot notation"... if you mean the if you mean actual dot notation, e.g. |
The mustache manual doesn't mention `{{.}}` at all: http://mustache.github.io/mustache.5.html Mustache.js documentation does mention it: https://github.com/janl/mustache.js/#non-empty-lists But only what it should do when iterating over a list of strings. Some references in the "spec": mustache/mustache#129 https://github.com/mustache/spec/blob/master/specs/sections.yml#L141-L169 But no mention of what should happen in these edge cases / wrong usage. So, I don't think we should copy the behavior of the mustache demo in this case, because 1. It's not described anywhere in the spec 2. It seems accidental: Mustache template ``` {{.}} ``` Data: ``` [1,"a",{},[1,2]] ``` Output: ``` 1,a,[object Object],1,2 ``` JavaScript: ``` $ node Welcome to Node.js v14.15.0. Type ".help" for more information. > String([1,2,3]) '1,2,3' > String({}) '[object Object]' > String(["a","b","c"]) 'a,b,c' > String([1,"a",{},[1,2]]) '1,a,[object Object],1,2' ``` See JIRA tickets for further explanation: https://tracker.mender.io/browse/CFE-3457 https://tracker.mender.io/browse/CFE-3489 Ticket: CFE-3489 CFE-3457 Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
Nothing about this in https://mustache.github.io/mustache.5.html |
I wanted to use mustache to iterate through arrays. I found the following, about dot notations.
It would seem that dot notations is part of mustache, but it's not found in the manual.
Two part question.
Thanks, mustache is awesome btw :)
The text was updated successfully, but these errors were encountered: