Skip to content

Commit d019a8d

Browse files
committed
Merge branch 'dev'
Conflicts: core/lib/lineage_hunter.js core/lib/list_item_hunter.js core/lib/media_hunter.js core/lib/object_factory.js core/lib/parameter_hunter.js core/lib/pattern_assembler.js core/lib/pattern_exporter.js core/lib/patternlab.js core/lib/patternlab_grunt.js core/lib/patternlab_gulp.js core/lib/pseudopattern_hunter.js core/lib/style_modifier_hunter.js package.gulp.json package.json
2 parents c2bf904 + 7e5e0c1 commit d019a8d

18 files changed

+446
-175
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules/
2+
npm-debug.log
23
.DS_Store
34
latest-change.txt
45
patternlab.json

core/lib/lineage_hunter.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
/*
2-
* patternlab-node - v1.2.2 - 2016
3-
*
1+
/*
2+
* patternlab-node - v1.3.0 - 2016
3+
*
44
* Brian Muenzenmeyer, and the web community.
5-
* Licensed under the MIT license.
6-
*
7-
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
5+
* Licensed under the MIT license.
6+
*
7+
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
88
*
99
*/
1010

@@ -123,12 +123,13 @@ var lineage_hunter = function () {
123123
var lineageRPattern = pattern_assembler.get_pattern_by_key(pattern.lineageRIndex[j], patternlab);
124124

125125
//only set patternState if pattern.patternState "is less than" the lineageRPattern.patternstate
126+
//or if lineageRPattern.patternstate (the consuming pattern) does not have a state
126127
//this makes patternlab apply the lowest common ancestor denominator
127-
if (patternlab.config.patternStateCascade.indexOf(pattern.patternState)
128-
< patternlab.config.patternStateCascade.indexOf(lineageRPattern.patternState)) {
128+
if (lineageRPattern.patternState === '' || (patternlab.config.patternStateCascade.indexOf(pattern.patternState)
129+
< patternlab.config.patternStateCascade.indexOf(lineageRPattern.patternState))) {
129130

130131
if (patternlab.config.debug) {
131-
console.log('Found a lower common denominator pattern state: ' + pattern.patternState + ' on ' + pattern.key + '. Setting reverse lineage pattern ' + lineageRPattern.key + ' from ' + lineageRPattern.patternState);
132+
console.log('Found a lower common denominator pattern state: ' + pattern.patternState + ' on ' + pattern.key + '. Setting reverse lineage pattern ' + lineageRPattern.key + ' from ' + (lineageRPattern.patternState === '' ? '<<blank>>' : lineageRPattern.patternState));
132133
}
133134

134135
lineageRPattern.patternState = pattern.patternState;

core/lib/list_item_hunter.js

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
/*
2-
* patternlab-node - v1.2.2 - 2016
3-
*
1+
/*
2+
* patternlab-node - v1.3.0 - 2016
3+
*
44
* Brian Muenzenmeyer, and the web community.
5-
* Licensed under the MIT license.
6-
*
7-
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
5+
* Licensed under the MIT license.
6+
*
7+
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
88
*
99
*/
1010

@@ -13,6 +13,7 @@
1313
var list_item_hunter = function () {
1414

1515
var extend = require('util')._extend,
16+
JSON5 = require('json5'),
1617
pa = require('./pattern_assembler'),
1718
smh = require('./style_modifier_hunter'),
1819
pattern_assembler = new pa(),
@@ -44,7 +45,13 @@ var list_item_hunter = function () {
4445
}
4546

4647
//check for a local listitems.json file
47-
var listData = JSON.parse(JSON.stringify(patternlab.listitems));
48+
var listData;
49+
try {
50+
listData = JSON5.parse(JSON5.stringify(patternlab.listitems));
51+
} catch (err) {
52+
console.log('There was an error parsing JSON for ' + pattern.abspath);
53+
console.log(err);
54+
}
4855
listData = pattern_assembler.merge_data(listData, pattern.listitems);
4956

5057
//iterate over each copied block, rendering its contents along with pattenlab.listitems[i]
@@ -54,8 +61,15 @@ var list_item_hunter = function () {
5461

5562
//combine listItem data with pattern data with global data
5663
var itemData = listData['' + items.indexOf(loopNumberString)]; //this is a property like "2"
57-
var globalData = JSON.parse(JSON.stringify(patternlab.data));
58-
var localData = JSON.parse(JSON.stringify(pattern.jsonFileData));
64+
var globalData;
65+
var localData;
66+
try {
67+
globalData = JSON5.parse(JSON5.stringify(patternlab.data));
68+
localData = JSON5.parse(JSON5.stringify(pattern.jsonFileData));
69+
} catch (err) {
70+
console.log('There was an error parsing JSON for ' + pattern.abspath);
71+
console.log(err);
72+
}
5973

6074
var allData = pattern_assembler.merge_data(globalData, localData);
6175
allData = pattern_assembler.merge_data(allData, itemData !== undefined ? itemData[i] : {}); //itemData could be undefined if the listblock contains no partial, just markup
@@ -71,7 +85,13 @@ var list_item_hunter = function () {
7185
var partialPattern = pattern_assembler.get_pattern_by_key(partialName, patternlab);
7286

7387
//create a copy of the partial so as to not pollute it after the get_pattern_by_key call.
74-
var cleanPartialPattern = JSON.parse(JSON.stringify(partialPattern));
88+
var cleanPartialPattern;
89+
try {
90+
cleanPartialPattern = JSON5.parse(JSON5.stringify(partialPattern));
91+
} catch (err) {
92+
console.log('There was an error parsing JSON for ' + pattern.abspath);
93+
console.log(err);
94+
}
7595

7696
//if partial has style modifier data, replace the styleModifier value
7797
if (foundPartials[j].indexOf(':') > -1) {

core/lib/media_hunter.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
/*
2-
* patternlab-node - v1.2.2 - 2016
3-
*
1+
/*
2+
* patternlab-node - v1.3.0 - 2016
3+
*
44
* Brian Muenzenmeyer, and the web community.
5-
* Licensed under the MIT license.
6-
*
7-
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
5+
* Licensed under the MIT license.
6+
*
7+
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
88
*
99
*/
1010

core/lib/object_factory.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
/*
2-
* patternlab-node - v1.2.2 - 2016
3-
*
1+
/*
2+
* patternlab-node - v1.3.0 - 2016
3+
*
44
* Brian Muenzenmeyer, and the web community.
5-
* Licensed under the MIT license.
6-
*
7-
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
5+
* Licensed under the MIT license.
6+
*
7+
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
88
*
99
*/
1010

0 commit comments

Comments
 (0)