Closed MikeMitterer closed 8 years ago
I follow the mustache spec closely. I'm not convinced that it makes sense to add extra features outside of the spec.
I also think it is a good idea to save detailed documentation about advanced features for the mustache manual. There is a link at the top of the readme. http://mustache.github.io/mustache.5.html
Hmmm, I thought this is part of the spec - sorry! I'm using your lib for some of my components in my http://mdl.mikemitterer.at/#/repeat lib - I want to get rid of this "comment"-construct from above.
Something like this would be appropriate:
<template>
<div>Repeat me {{name}} {{name2}}</div>
</template>
The part within should not be interpreted by the parser... One way is to fork your lib but I want to avoid this - to you have another idea?
I don't remember seeing this in the spec. Can you send me a link?
Perhaps this is part of handlebars.js or one of the other template libraries similar to mustache.
I agree the change delimiter syntax is pretty ugly. One other possibility would be to add an option to the library to change the default delimiter for the entire file. Something like:
var t = new Template(' {{ I am plain text }} [[ i_am_a_tag ]]', delimiter: '[[ ]]');
t.renderString({'i_am_tag': 'foo'});
This is actually implemented already internally, I just don't think it is exposed.
And - feel free to fork - the more the merrier ;)
Changing the delimiter like that would be awesome. Angular and polymer are using {{ }} as delimiters and combination with mustache makes it hard to combine these.
Should be super easy to implement. Have a look at template.dart
Just need to change the hard-coded delimiters passed to parse() to be an optional named argument with a default of '{{ }}'.
Template.fromSource(String source,
{bool lenient: false,
bool htmlEscapeValues : true,
String name,
m.PartialResolver partialResolver})
: source = source,
_nodes = parser.parse(source, lenient, name, '{{ }}'),
_lenient = lenient,
_htmlEscapeValues = htmlEscapeValues,
_name = name,
_partialResolver = partialResolver;
Need to write a few tests etc. I'll happily accept a patch.
Thanks Joris.
I've merged this. https://github.com/xxgreg/mustache/pull/25
Let me know if it solves your problems.
I will test it by referencing it to the github version, I will tell you if this works on my implementation in shelf_mvc ;)
Much appreciated.
It works! You can make a new release with this fix in it :)
:thumbsup::thumbsup::thumbsup::thumbsup: Thanks!
Hi, is there really no better way to escape curly brackets than this: (The output should be:
<div>Repeat me {{name}} {{name2}}</div>
)Something like
\{{name}}
for example...If this is the only way at the moment - could you please add a note to your README? Would be cool - it took my quite a while to figure out this workaround... Thanks!