Skip to content

Merge parent data with child data (like dust.js, velocity etc) #22

Description

@georgkoester

I can create a patch - but would like to know if this has any chance. I am working in a project that is undergoing a change towards DOMly and would really like to have this in the default distribution. Maybe only as a per-template option or as new data variable 'merged' maybe (total would be: 'data', 'this', 'parent', 'merged').

Moustache works different I know, but seriously, I never understood this:

<div><h1 class="data.class">{{data.i18n("major_heading")}}</h1></div>
<ul>
  <foreach data.items>
    <li>parent.i18n(data.type): <span class="{{parent.class}} description">data.text </span>
  </foreach>
</ul>

Why can't this just be:

<div><h1 class="data.class">{{data.i18n("major_heading")}}</h1></div>
<ul>
  <foreach data.items>
    <li>data.i18n(data.type): <span class="{{data.class}} description">data.text </span>
  </foreach>
</ul>

In the moustache case if an extension requires another iteration to be added I also needn't add all those extra parent references:

<div><h1 class="data.class">{{data.i18n("major_heading")}}</h1></div>
<foreach data.groups>
  <h2>data.name</h2>
  <ul>
    <foreach data.items>
      <li>parent.parent.i18n(data.type): <span class="{{parent.parent.class}} description">data.text </span>
    </foreach>
  </ul>
</foreach>

I would love to look at this from a design perspective, maybe I am missing something that supports the moustache case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions