Nested data gets removed
Closed this issue · 4 comments
jonas-schulze commented
If you iterate over some nested property, all other properties under that context seem to be removed. Notice how {{nested.foo}}
vanishes from the following example, leaving only an empty line:
julia> tpl = mt"""
{{#nested.vec}}
{{.}}
{{/nested.vec}}
{{nested.foo}}
"""
julia> data2 = Dict("nested" => Dict("vec" => [1,2], "foo" => "bar"))
julia> render(tpl2, data2) |> print
1
2
If we move {{nested.foo}}
to the top, it renders as expected.
jonas-schulze commented
If we split the iteration and the test, the data exists for slightly longer:
{{#nested}}
{{#vec}}
{{.}}
{{/vec}}
{{foo}}
{{/nested}}
{{nested.foo}}
renders to
1
2
bar
which misses a final bar
.
jverzani commented
Thanks for this. I'll see what I can do.
jonas-schulze commented
There must have been some hiccup that this issue hasn't been closed automatically. I just verified on Mustache.jl
at version v1.0.0
and Julia version v1.3.0
that this is truly fixed.
jverzani commented
Sorry about not ensuring that this close and many thanks for your report!
--
John Verzani
Department of Mathematics
College of Staten Island, CUNY
verzani@math.csi.cuny.edu