noha / mustache Goto Github PK
View Code? Open in Web Editor NEWA mustache template implementation in smalltalk
License: MIT License
A mustache template implementation in smalltalk
License: MIT License
I would like to add character set conversion to mustache for my port on VA Smalltalk.
Background: VA Smalltalk doesn't natively speak UTF-8, so I'd like to convert all insertions into a template to UTF-8.
So I wonder what a good place for such an extension would be. My first impulse would be to add an inst var to MustacheTemplate, maybe named #charSet.
Then I think the next best thing to do would be to add a parameter to all implementors of #mustacheLookup: which is either nil or the charset to convert to.
The problem: a MustachePart doesn't know the MustacheTemplate, so there is no way of asking a template for the value of its charSet when it is trying to fill in text....
Any ideas?
Variable should walk up the contexts in order to resolve a name:
Variables
The most basic tag type is the variable. A {{name}} tag in a basic template will try to find the name key in the current context. If there is no name key, the parent contexts will be checked recursively. If the top context is reached and the name key is still not found, nothing will be rendered.
I've noticed that here
there is a dependency with JSON from SmalltalkHub.Can we update Mustache to use it from maintained origin in GitHub?
Thanks for making Mustache, it's looking great
Given this simple template:
template := MustacheTemplate on: '{{#items}}
{{#first}}
<li><strong>{{name}}</strong></li>
{{/first}}
{{#link}}
<li><a href="{{link}}">{{name}}</a></li>
{{/link}}
{{/items}}'.
I evaluate the template using this data:
template value: {
'items' -> {
{'name'-> 'red' . 'first' -> true . 'url' -> #Red } asDictionary .
{'name' -> 'green' . 'link' -> 'https://pharo.org' . 'url' -> #Green } asDictionary
} } asDictionary.
I would expect the following output:
<li><strong>red</strong></li>
<li><a href="https://pharo.org"></a></li>
but I get:
<li><strong>red</strong></li>
<li><a href=""></a></li>
If link is set to nil, the second list element will not be displayed (as expected). It looks like the section variable value is well handled but then impossible to use in the section
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.