Hmmm. To easy for me to figure out :) https://github.com/noha/mustache/issues/2 <https://github.com/noha/mustache/issues/2>
Norbert > Am 13.08.2018 um 14:06 schrieb Sven Van Caekenberghe <[email protected]>: > > > >> On 13 Aug 2018, at 13:59, Norbert Hartl <[email protected]> wrote: >> >> Where did you read this about the parent context? Maybe I’m blind to see it. >> That would explain why I didn’t see it when implementing it :) > > Search for parent in http://mustache.github.io/mustache.5.html > > 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. > >> Norbert >> >>> Am 13.08.2018 um 10:24 schrieb Peter Uhnák <[email protected]>: >>> >>> Hi, >>> >>> I'm using Mustache for Pharo, and according to mustache docs ( >>> https://mustache.github.io/mustache.5.html ), when a key is not found, it >>> should look into parents contexts. >>> >>> However that does not seem to be the case: >>> >>> str := '{{root}} >>> {{#items}} >>> {{root}}.{{name}} >>> {{/items}}'. >>> >>> data := { >>> 'root' -> 'ROOT'. >>> 'items' -> { >>> { 'name' -> 'first' } asDictionary. >>> { 'name' -> 'second' } asDictionary. >>> } >>> } asDictionary. >>> >>> (MustacheTemplate on: str) value: data. >>> >>> I should get "ROOT.first", etc., but instead I get ".first", ".second". >>> >>> Thanks, >>> Peter >>> >> > >
