Skip to content

Commit 0fb1e9b

Browse files
committed
Skip the partial expansion for listitems when using the handlebars engine
1 parent 0607e06 commit 0fb1e9b

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

core/lib/list_item_hunter.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,17 @@ var list_item_hunter = function () {
7373
allData = plutils.mergeData(allData, itemData !== undefined ? itemData[i] : {}); //itemData could be undefined if the listblock contains no partial, just markup
7474
allData.link = extend({}, patternlab.data.link);
7575

76-
//check for partials within the repeated block
77-
var foundPartials = Pattern.createEmpty({'template': thisBlockTemplate}).findPartials();
76+
var foundPartials;
77+
var thisBlockPattern;
78+
// Don't explode the partials if using handlebars
79+
if (pattern.engine.engineName === 'handlebars') {
80+
thisBlockPattern = Pattern.createEmpty({extendedTemplate: thisBlockTemplate});
81+
// assume the children are also handlebars patterns
82+
thisBlockPattern.engine = pattern.engine;
83+
} else {
84+
//check for partials within the repeated block
85+
var foundPartials = Pattern.createEmpty({'template': thisBlockTemplate}).findPartials();
86+
}
7887

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

@@ -110,7 +119,7 @@ var list_item_hunter = function () {
110119

111120
} else {
112121
//just render with mergedData
113-
thisBlockHTML = pattern_assembler.renderPattern(thisBlockTemplate, allData, patternlab.partials);
122+
thisBlockHTML = pattern_assembler.renderPattern(thisBlockPattern || thisBlockTemplate, allData, patternlab.partials);
114123
}
115124

116125
//add the rendered HTML to our string

0 commit comments

Comments
 (0)