Closed jobol closed 11 months ago
I propose the character : but I agree that any character is possible.
I had in fact the issue with a name starting with #
There is a good spec for JSON pointers: https://tools.ietf.org/html/rfc6901
So having a special character (like ':' ) for explicit value substitution would allow to write {{:/root/4}} that uses the json pointer
Maybe the character = is better
Sorry to keep you hanging for so long and then brutally closing the pull request. As I detailed in https://github.com/mustache/spec/discussions/174#discussioncomment-7555861, the spec should be updated before the manual, and the source file for the manual is also in a different repository.
(In my defense, I was not yet involved here when you opened the pull request.)
When the name of the variable starts with a character that is normally interpreted within mustache templating (i.e. "#^/{&!>:") it should be possible to use an escape character. This commit propose to use colon (:) as first character to escape the first character of variable name in the variable substitution with escaping. Writing {{:NAME}} is equivalent to writing {{NAME}} even when NAME begins with a special character.
It is interesting to see that it specify an optional character for variable substitution with escaping and not only an escaping character.