pattern-lab / patternlab-php-core

This repository provides the core functionality for Pattern Lab. It is meant to be used from within an Edition with a PatternEngine and StarterKit.
http://patternlab.io/
MIT License
43 stars 62 forks source link

Patternlab mustache partials support broken, when using mustache blocks #88

Open sbuckpesch opened 7 years ago

sbuckpesch commented 7 years ago

As we discussed on gitter, I implemented mustache templates using the Blocks pragma. The rendering works, although php fails with "Fatal error: Maximum function nesting level of '250' reached, aborting!", when using blocks in low-level patterns like atoms (even increasing the nesting level to 10.000 will fail).

But here is the acutal bug: When using blocks, patternlab does not recognize any more that a mustache partial is used. In the two screenshots you can see this. "page-app-create" uses {{< templates-focused-task}} and will extend the focused task "template". In the focussed-task pattern info, the "this pattern is included in" reference to "page-app-create" is missing. I guess this is caused by the use of {{< templates-focused-task}} instead of {{> templates-focused-task}}. This problem causes that all partials within templates-focused-task, are not populated with data from my json documents (see the header in the link supplied below..

image

image

Here is a link to the github repo: https://github.com/apparena/patterns/tree/master/source/_patterns And here the deployed styleguide: https://styleguide.app-arena.com/?p=pages-app-create (header missing) https://styleguide.app-arena.com/?p=templates-focused-task (header working)

dmolsen commented 7 years ago

I haven't played with the blocks pragma at all but I'll definitely check it out to see what is going. I really appreciate you sharing the patterns. It'll make it easier to debug.

yfreeman commented 7 years ago

solution that got pragma blocks working Search/Replace in ./vendor/pattern-lab/patternengine-mustache* 'PRAGMA_FILTERS' with 'PRAGMA_BLOCKS' there is no setting yet that can be passed to the 'engine' available.

sbuckpesch commented 7 years ago

@yfreeman What exaxtly does this change? Does it solve the "Fatal error: Maximum function nesting level of '250' reached, aborting!" problem? I just did the changes you described, but the data inheritance problem and the problem of wrong pattern information have not been solved using this solution...

yfreeman commented 7 years ago

@sbuckpesch we were not able to get PRAGMA blocks working https://github.com/bobthecow/mustache.php/wiki/BLOCKS-pragma until we made those changes. They worked fine in v1 of patternlab, the above fix got them to work in v2. As for the Nesting issue, it seems to be a different issue.