Skip to content

Commit bfafc10

Browse files
author
Brian Muenzenmeyer
committed
Merge pull request #167 from pattern-lab/dev
Dev push for v0.13.1
2 parents 8a4d4c6 + b962551 commit bfafc10

File tree

5 files changed

+73
-3
lines changed

5 files changed

+73
-3
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
language: node_js
22

33
node_js:
4-
- 4.1
5-
- 4.0
64
- 0.12
75
- 0.11
86

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
THIS CHANGELOG IS AN ATTEMPT TO DOCUMENT CHANGES TO THIS PROJECT.
22

3+
PL-node-v0.13.1
4+
- FIX: Allow verbose partials for list items
5+
- THX: Thanks @e2tha-e
6+
37
PL-node-v0.13.0
48
- FIX: Cleanup an old file and an incorrect entry in the .gitignore file
59
- CHG: Change order of pattern addition and ~variant pattern addition so they build naturally in the menu.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This repository contains the vanilla builder logic, grunt and gulp configuration
1010

1111
* Download the [latest release of patternlab-node](https://github.com/pattern-lab/patternlab-node/releases/latest) from Github
1212
* Via npm, run `npm install patternlab-node` (Note this will auto install the grunt version currently. see below)
13+
* **NOTE** Node version 4.X is not officially supported yet, citing [a lot of Windows issues](https://github.com/nodejs/node-gyp/issues/629), including [mine](https://github.com/pattern-lab/patternlab-node/issues/162). Upgrade node at your own risk until otherwise stated.
1314

1415
### Choose Your Adventure! Now Vanilla, Grunt & Gulp
1516

builder/list_item_hunter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
for(var j = 0; j < foundPartials.length; j++){
6969

7070
//get the partial
71-
var partialName = foundPartials[j].match(/([a-z-]+)/ig)[0];
71+
var partialName = foundPartials[j].match(/([\w\-\.\/~]+)/g)[0];
7272
var partialPattern = pattern_assembler.get_pattern_by_key(partialName, patternlab);
7373

7474
//replace its reference within the block with the extended template

test/list_item_hunter_tests.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,73 @@
100100
test.done();
101101
},
102102

103+
'process_list_item_partials finds verbose partials and outputs repeated renders' : function(test){
104+
var pattern1 = {
105+
"template": "{{#listItems.one}}{{> 00-test/00-foo }}{{/listItems.one}}",
106+
"extendedTemplate" : "{{#listItems.one}}{{> 00-test/00-foo }}{{/listItems.one}}",
107+
"key": "test-patternName1",
108+
"jsonFileData" : {}
109+
};
110+
111+
var pattern2 = {
112+
"template": "{{#listItems.two}}{{> 00-test/01-bar.mustache }}{{/listItems.two}}",
113+
"extendedTemplate" : "{{#listItems.two}}{{> 00-test/01-bar.mustache }}{{/listItems.two}}",
114+
"key": "test-patternName2",
115+
"jsonFileData" : {}
116+
};
117+
118+
var patternlab = {
119+
"listitems": {
120+
"1": [
121+
{
122+
"title": "Foo"
123+
}
124+
],
125+
"2": [
126+
{
127+
"title": "Foo"
128+
},
129+
{
130+
"title": "Bar"
131+
}
132+
]
133+
},
134+
"data": {
135+
"link": {},
136+
"partials": []
137+
},
138+
"config": {"debug": false},
139+
"patterns": [
140+
{
141+
"template": "{{ title }}",
142+
"extendedTemplate" : "{{ title }}",
143+
"subdir": "00-test",
144+
"fileName": "00-foo",
145+
"jsonFileData" : {}
146+
},
147+
{
148+
"template": "{{ title }}",
149+
"extendedTemplate" : "{{ title }}",
150+
"subdir": "00-test",
151+
"fileName": "01-bar",
152+
"jsonFileData" : {}
153+
}
154+
]
155+
};
156+
157+
var list_item_hunter = new lih();
158+
159+
//act
160+
list_item_hunter.process_list_item_partials(pattern1, patternlab);
161+
list_item_hunter.process_list_item_partials(pattern2, patternlab);
162+
163+
//assert
164+
test.equals(pattern1.extendedTemplate, "Foo" );
165+
test.equals(pattern2.extendedTemplate, "FooBar" );
166+
167+
test.done();
168+
},
169+
103170
'process_list_item_partials overwrites listItem property if that property is in local .listitem.json' : function(test){
104171
//arrange
105172
//setup current pattern from what we would have during execution

0 commit comments

Comments
 (0)