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

Inheritable Blocks Sections #473

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

damyon
Copy link

@damyon damyon commented Jul 23, 2015

This is a patch for a feature that is not in the spec, but is proposed here:

mustache/spec#75

It is implemented in at least GRMustache, mustache.php and hogan.js.

See mustache.php docs here: https://github.com/bobthecow/mustache.php/wiki/BLOCKS-pragma (note the caveat about lazy evaluation on that page has been fixed).

The tests in this pull request mostly come from GRMustache, but I couldn't add all his tests, because some require multiple partials.

Damyon Wiese added 2 commits July 23, 2015 12:38
(from GRMustache src/tests/Public/v7.0/Suites/groue/GRMustache/GRMustacheSuites/inheritable_partials.json)
@damyon
Copy link
Author

damyon commented Jul 23, 2015

Note - I don't mind if this is or isn't merged as it looks like you are only accepting things that are already agreed to and in the spec - I just wanted create this pull request in case someone else is looking for this feature.

@groue
Copy link

groue commented Jul 29, 2015

FYI, GRMustache.swift has a cleaner implementation than its Objective-C ancestor, and passes more tests. I don't know if those extra tests involve the "multiple partials" you refer to.

As stated in mustache/spec#38 (comment), GRMustache.swift implementation and tests have a simple goal: any part of a template can be refactored with partials and inherited partials, without requiring any modification anywhere else (in other templates that depend on it, or in application code).

@damyon
Copy link
Author

damyon commented Jul 29, 2015

My comment about not including some tests was only because of the way unit tests are created for this mustache.js. These tests are only ever expecting a single file named blah.partial - which is added to the config as a partial named 'partial' in the test. So tests requiring more than one partial cannot be executed by this test suite.

damyon pushed a commit to damyon/moodle that referenced this pull request Aug 10, 2015
damyon pushed a commit to damyon/mustache.js that referenced this pull request Aug 19, 2015
Add template inheritance feature.
damyon pushed a commit to damyon/moodle that referenced this pull request Aug 20, 2015
dmonllao pushed a commit to dmonllao/moodle that referenced this pull request Aug 20, 2015
@ChesterOfTheSemester
Copy link

Is this still supported?

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

Successfully merging this pull request may close these issues.

None yet

3 participants