fletcher / magnum Goto Github PK
View Code? Open in Web Editor NEWC implementation of Mustache "logic-less templates" (http://mustache.github.io/)
License: Other
C implementation of Mustache "logic-less templates" (http://mustache.github.io/)
License: Other
foo {{> bar}}
, where bar is {{! some comment}}some content
results in foosome comment
.
Given JSON:
{
"images": [{
"src": "http://www.fpoimg.com/20x20"
},
{
"src": "http://www.fpoimg.com/30x30"
},
{
"src": "http://www.fpoimg.com/40x40"
}
],
"anEmptyArray": []
}
and template:
{{#images.length}}
<h3>The images: this should only be rendered once.</h3>
<ul>
{{#images}}
<li><img src="{{src}}"/></li>
{{/images}}
</ul>
{{/images.length}}
{{#anEmptyArray.length}}
<h3>The empty array: this should NOT be rendered.</h3>
{{/anEmptyArray.length}}
Some Mustache implementations (including the Demo here return:
<h3>The images: this should only be rendered once.</h3>
<ul>
<li><img src="http://www.fpoimg.com/20x20"/></li>
<li><img src="http://www.fpoimg.com/30x30"/></li>
<li><img src="http://www.fpoimg.com/40x40"/></li>
</ul>
The {{#images.length}}
tag does not appear to be part of the Mustache spec. For that matter, neither does {{#images.0}}
which could be used to refer to the first element of the array.
It seems that we are in another "Markdown" scenario where the initial parent project is at least partially dead, whereas one or more child projects are still alive (including this one.) Which is unfortunate.
I will probably end up implementing these features, as they seem useful to me, and do not seem to violate the logic-less philosophy as demonstrated by other core features. But I don't have time at the moment, so this is a reminder to myself.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.