Inverted sections
Closed this issue · 5 comments
Should the following:
render("""{{^repos}}No repos :({{/repos}}""", Dict("repos" => []))
Not return No repo :(
? Currently it just returns "".
This example is based on the mustach docs (Inverted sections):
https://mustache.github.io/mustache.5.html
I am using Mustache 0.3.0 and Julia 0.6.1.
Thanks !
Here is the corresponding test with the javascript library of Mustache for the test case above:
I guess this line -- https://github.com/jverzani/Mustache.jl/blob/master/src/utils.jl#L21 -- is wrong. Want to see and if so put in a PR?
Thanks!
Thanks, this was lurking elsewhere. I special cased the iteration over arrays. I should systematically go over those js tests...
Thanks a lot for fixing this!
In fact, there is still a problem I belief.
Consider the slight more complex test case from the Mustache documentation (https://github.com/janl/mustache.js/):
render("{{#repos}}<b>{{name}}</b>{{/repos}}{{^repos}}No repos :({{/repos}}",Dict("repos" => []))
gives in Julia <b></b>No repos :(
while it should produce No repos :(
.
Also when repo is non-empty, both sections seems to be rendered:
render("{{#repos}}<b>{{name}}</b>{{/repos}}{{^repos}}No repos :({{/repos}}",Dict("repos" => [Dict("name" => "repo name")]))
produces <b>repo name</b>No repos :(
while it should, as far I understand, return just <b>repo name</b>
.
I am using Mustache 0.3.1.