Skip to content

Conversation

@jobol
Copy link
Contributor

@jobol jobol commented Jan 20, 2017

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.

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.

Signed-off-by: José Bollo <jose.bollo@iot.bzh>
@jobol
Copy link
Contributor Author

jobol commented Jan 20, 2017

I propose the character : but I agree that any character is possible.

I had in fact the issue with a name starting with #

@jobol
Copy link
Contributor Author

jobol commented Mar 1, 2017

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

@jobol
Copy link
Contributor Author

jobol commented Mar 2, 2018

Maybe the character = is better

@jgonggrijp
Copy link
Member

Sorry to keep you hanging for so long and then brutally closing the pull request. As I detailed in mustache/spec#174 (reply in thread), 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.)

@jgonggrijp jgonggrijp closed this Nov 13, 2023
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

Successfully merging this pull request may close these issues.

2 participants