Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bmuenzenmeyer committed Apr 17, 2016
2 parents c2bf904 + 7e5e0c1 commit d019a8d
Show file tree
Hide file tree
Showing 18 changed files with 446 additions and 175 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
npm-debug.log
.DS_Store
latest-change.txt
patternlab.json
Expand Down
19 changes: 10 additions & 9 deletions core/lib/lineage_hunter.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* patternlab-node - v1.2.2 - 2016
*
/*
* patternlab-node - v1.3.0 - 2016
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
*
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
* Licensed under the MIT license.
*
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
*
*/

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

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

if (patternlab.config.debug) {
console.log('Found a lower common denominator pattern state: ' + pattern.patternState + ' on ' + pattern.key + '. Setting reverse lineage pattern ' + lineageRPattern.key + ' from ' + lineageRPattern.patternState);
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));
}

lineageRPattern.patternState = pattern.patternState;
Expand Down
40 changes: 30 additions & 10 deletions core/lib/list_item_hunter.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* patternlab-node - v1.2.2 - 2016
*
/*
* patternlab-node - v1.3.0 - 2016
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
*
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
* Licensed under the MIT license.
*
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
*
*/

Expand All @@ -13,6 +13,7 @@
var list_item_hunter = function () {

var extend = require('util')._extend,
JSON5 = require('json5'),
pa = require('./pattern_assembler'),
smh = require('./style_modifier_hunter'),
pattern_assembler = new pa(),
Expand Down Expand Up @@ -44,7 +45,13 @@ var list_item_hunter = function () {
}

//check for a local listitems.json file
var listData = JSON.parse(JSON.stringify(patternlab.listitems));
var listData;
try {
listData = JSON5.parse(JSON5.stringify(patternlab.listitems));
} catch (err) {
console.log('There was an error parsing JSON for ' + pattern.abspath);
console.log(err);
}
listData = pattern_assembler.merge_data(listData, pattern.listitems);

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

//combine listItem data with pattern data with global data
var itemData = listData['' + items.indexOf(loopNumberString)]; //this is a property like "2"
var globalData = JSON.parse(JSON.stringify(patternlab.data));
var localData = JSON.parse(JSON.stringify(pattern.jsonFileData));
var globalData;
var localData;
try {
globalData = JSON5.parse(JSON5.stringify(patternlab.data));
localData = JSON5.parse(JSON5.stringify(pattern.jsonFileData));
} catch (err) {
console.log('There was an error parsing JSON for ' + pattern.abspath);
console.log(err);
}

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

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

//if partial has style modifier data, replace the styleModifier value
if (foundPartials[j].indexOf(':') > -1) {
Expand Down
12 changes: 6 additions & 6 deletions core/lib/media_hunter.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* patternlab-node - v1.2.2 - 2016
*
/*
* patternlab-node - v1.3.0 - 2016
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
*
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
* Licensed under the MIT license.
*
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
*
*/

Expand Down
12 changes: 6 additions & 6 deletions core/lib/object_factory.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* patternlab-node - v1.2.2 - 2016
*
/*
* patternlab-node - v1.3.0 - 2016
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
*
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
* Licensed under the MIT license.
*
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
*
*/

Expand Down
Loading

0 comments on commit d019a8d

Please sign in to comment.