diff --git a/CHANGELOG b/CHANGELOG index c01f4e782..f9d65d0c4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ THIS CHANGELOG IS AN ATTEMPT TO DOCUMENT CHANGES TO THIS PROJECT. +PL-node-v1.0.1 +- FIX: Fix issue where partials containing styleModifiers with integers were not found correctly under all circumstances + PL-node-v1.0.0 - FIX: Resolve issue with not hiding underscored patterns. - THX: Thanks @ivancamilov for reporting this regression. diff --git a/builder/pattern_assembler.js b/builder/pattern_assembler.js index f175dc115..ecb49c428 100644 --- a/builder/pattern_assembler.js +++ b/builder/pattern_assembler.js @@ -1,10 +1,10 @@ -/* - * patternlab-node - v1.0.0 - 2015 - * +/* + * patternlab-node - v1.0.0 - 2015 + * * 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. * */ @@ -204,7 +204,7 @@ //do something with the regular old partials for(i = 0; i < foundPatternPartials.length; i++){ - var partialKey = foundPatternPartials[i].replace(/{{>([ ])?([\w\-\.\/~]+)(:[A-z-_|]+)?(?:\:[A-Za-z0-9-_]+)?(?:(| )\(.*)?([ ])?}}/g, '$2'); + var partialKey = foundPatternPartials[i].replace(/{{>([ ])?([\w\-\.\/~]+)(:[A-z0-9-_|]+)?(?:\:[A-Za-z0-9-_]+)?(?:(| )\(.*)?([ ])?}}/g, '$2'); var partialPath; diff --git a/package.gulp.json b/package.gulp.json index dbece6e4b..06defb19b 100644 --- a/package.gulp.json +++ b/package.gulp.json @@ -1,7 +1,7 @@ { "name": "patternlab-node", "description": "Pattern Lab is a collection of tools to help you create atomic design systems. This is the node command line interface (CLI).", - "version": "1.0.0", + "version": "1.0.1", "devDependencies": { "browser-sync": "^2.10.0", "del": "^2.0.2", diff --git a/package.json b/package.json index 157d4cc66..10f31955c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "patternlab-node", "description": "Pattern Lab is a collection of tools to help you create atomic design systems. This is the node command line interface (CLI).", - "version": "1.0.0", + "version": "1.0.1", "devDependencies": { "bs-html-injector": "^3.0.0", "diveSync": "^0.3.0", diff --git a/test/files/_patterns/00-test/10-multiple-classes-numeric.mustache b/test/files/_patterns/00-test/10-multiple-classes-numeric.mustache new file mode 100644 index 000000000..307439ce4 --- /dev/null +++ b/test/files/_patterns/00-test/10-multiple-classes-numeric.mustache @@ -0,0 +1,5 @@ +
+ {{> test-styled-atom:foo1 }} + {{> test-styled-atom:foo1|foo2 }} + {{> test-styled-atom:foo1|foo2(message: "bar") }} +
diff --git a/test/pattern_assembler_tests.js b/test/pattern_assembler_tests.js index 6953e2324..6c72802e0 100644 --- a/test/pattern_assembler_tests.js +++ b/test/pattern_assembler_tests.js @@ -319,6 +319,41 @@ test.equals(groupPattern.extendedTemplate.replace(/\s\s+/g, ' ').replace(/\n/g, ' ').trim(), expectedValue.trim()); test.done(); }, + 'processPatternRecursive - correctly replaces multiple stylemodifier classes on same partial' : function(test){ + //arrange + var fs = require('fs-extra'); + var pattern_assembler = new pa(); + var patterns_dir = './test/files/_patterns'; + + var pl = {}; + pl.config = {}; + pl.data = {}; + pl.data.link = {}; + pl.config.debug = false; + pl.patterns = []; + pl.config.patterns = { source: patterns_dir}; + + var atomPattern = new object_factory.oPattern('test/files/_patterns/00-test/03-styled-atom.mustache', '00-test', '03-styled-atom.mustache'); + atomPattern.template = fs.readFileSync(patterns_dir + '/00-test/03-styled-atom.mustache', 'utf8'); + atomPattern.stylePartials = pattern_assembler.find_pattern_partials_with_style_modifiers(atomPattern); + atomPattern.parameteredPartials = pattern_assembler.find_pattern_partials_with_parameters(atomPattern); + + var groupPattern = new object_factory.oPattern('test/files/_patterns/00-test/10-multiple-classes-numeric.mustache', '00-test', '10-multiple-classes-numeric.mustache'); + groupPattern.template = fs.readFileSync(patterns_dir + '/00-test/10-multiple-classes-numeric.mustache', 'utf8'); + groupPattern.stylePartials = pattern_assembler.find_pattern_partials_with_style_modifiers(groupPattern); + groupPattern.parameteredPartials = pattern_assembler.find_pattern_partials_with_parameters(groupPattern); + + pl.patterns.push(atomPattern); + pl.patterns.push(groupPattern); + + //act + pattern_assembler.process_pattern_recursive('test/files/_patterns/00-test/10-multiple-classes-numeric.mustache', pl, {}); + + //assert + var expectedValue = '
{{message}} {{message}} bar
'; + test.equals(groupPattern.extendedTemplate.replace(/\s\s+/g, ' ').replace(/\n/g, ' ').trim(), expectedValue.trim()); + test.done(); + }, 'processPatternRecursive - correctly ignores a partial without a style modifier when the same partial later has a style modifier' : function(test){ //arrange var fs = require('fs-extra');