jverzani/Mustache.jl

Nested data gets removed

Closed this issue · 4 comments

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.

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.

Thanks for this. I'll see what I can do.

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.