jverzani / Mustache.jl

Port of mustache.js to julia
MIT License
128 stars 36 forks source link

scan until right tag with "{{{VAR}}}" #116

Open jverzani opened 4 years ago

jverzani commented 4 years ago

In closinig issue #114, it was seen that the scanning the above for a closing tag "}}" seems to find the first pair, no the last. This leaves the token "{VAR" which works for what is desired. It should probably leave the token as "{VAR}" though. There might be an edge case that exposes the difference. For now, will leave this issue as a reminder.

jverzani commented 4 years ago

Here are two incorrectly parsed things:

julia> Mustache.parse("{{{variable}} stuff")
Mustache.MustacheTokens(Mustache.Token[Mustache.TextToken("text", ""), Mustache.TagToken("{", "variable", "{{", "}}", ""), Mustache.TextToken("text", " stuff")])

julia> Mustache.parse("[[{variable]] stuff", ("[[","]]"))
Mustache.MustacheTokens(Mustache.Token[Mustache.TextToken("text", ""), Mustache.TagToken("{", "variable", "[[", "]]", ""), Mustache.TextToken("text", " stuff")])