Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sections don't inherit context #12

Open
KingDuckZ opened this issue Sep 14, 2015 · 1 comment
Open

Sections don't inherit context #12

KingDuckZ opened this issue Sep 14, 2015 · 1 comment

Comments

@KingDuckZ
Copy link

Given this input on mustache's online demo:

{{category}}
{{#items}}
  {{#first}}
    <li>{{category}}: <strong>{{name}}</strong></li>
  {{/first}}
  {{#link}}
    <li>{{category}}: <a href="{{url}}">{{name}}</a></li>
  {{/link}}
{{/items}}

and

{
  "category": "Color",
  "items": [
      {"name": "red", "first": true, "url": "#Red"},
      {"name": "green", "link": true, "url": "#Green"},
      {"name": "blue", "link": true, "url": "#Blue"}
  ]
}

I get this output:

Color
<li>Color: <strong>red</strong></li>
<li>Color: <a href="#Green">green</a></li>
<li>Color: <a href="#Blue">blue</a></li>

meaning that while in a subsection, parent contextes are inherited. From the tests I ran on example3.cpp (I might have done something wrong), I see this is not the case with Boostache.
This behaviour is not very clear from mustache's man page, but the online demo does lookup parent contextes.

@mjcaisse
Copy link
Member

Indeed, this is a known issue and we are working on a more complex "context" wrapper design that allows moving up the context tree to resolve parent things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants