lazd / lazd/DOMly

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

Open
#22 15 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
54
Forks
9
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by reviewing DOMly’s template data-scope behavior and how data, this, and parent references work; the issue needs a design decision between merged data and a per-template option. Done would require agreed semantics and coverage for the nested foreach examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.