Skip to content

Skip the partial expansion for listitems when using the handlebars engine #550

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions core/lib/list_item_hunter.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,17 @@ var list_item_hunter = function () {
allData = plutils.mergeData(allData, itemData !== undefined ? itemData[i] : {}); //itemData could be undefined if the listblock contains no partial, just markup
allData.link = extend({}, patternlab.data.link);

//check for partials within the repeated block
var foundPartials = Pattern.createEmpty({'template': thisBlockTemplate}).findPartials();
var foundPartials;
var thisBlockPattern;
// Don't explode the partials if using handlebars
if (pattern.engine.engineName === 'handlebars') {
thisBlockPattern = Pattern.createEmpty({extendedTemplate: thisBlockTemplate});
// assume the children are also handlebars patterns
thisBlockPattern.engine = pattern.engine;
} else {
//check for partials within the repeated block
var foundPartials = Pattern.createEmpty({'template': thisBlockTemplate}).findPartials();
}

if (foundPartials && foundPartials.length > 0) {

Expand Down Expand Up @@ -110,7 +119,7 @@ var list_item_hunter = function () {

} else {
//just render with mergedData
thisBlockHTML = pattern_assembler.renderPattern(thisBlockTemplate, allData, patternlab.partials);
thisBlockHTML = pattern_assembler.renderPattern(thisBlockPattern || thisBlockTemplate, allData, patternlab.partials);
}

//add the rendered HTML to our string
Expand Down