Skip to content

Commit c15d488

Browse files
committed
some regex helpers for style modifiers and pattern parameters, with unit test coverage
1 parent 016e9ce commit c15d488

15 files changed

+192
-13
lines changed

CHANGELOG

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

3+
PL-node-v0.14.0
4+
- ADD: Support for style modifiers
5+
36
PL-node-v0.13.1
47
- FIX: Allow verbose partials for list items
58
- THX: Thanks @e2tha-e

builder/lineage_hunter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.13.0 - 2015
2+
* patternlab-node - v0.14.0 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/list_item_hunter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.13.0 - 2015
2+
* patternlab-node - v0.14.0 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/media_hunter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.13.0 - 2015
2+
* patternlab-node - v0.14.0 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/object_factory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.13.0 - 2015
2+
* patternlab-node - v0.14.0 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/parameter_hunter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.13.0 - 2015
2+
* patternlab-node - v0.14.0 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/pattern_assembler.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.13.0 - 2015
2+
* patternlab-node - v0.14.0 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.
@@ -22,6 +22,17 @@
2222
return true;
2323
}
2424

25+
// returns any patterns that match {{> value:mod }} or {{> value:mod(foo:"bar") }} within the pattern
26+
function findPartialsWithStyleModifiers(pattern){
27+
var matches = pattern.template.match(/{{>([ ])?([\w\-\.\/~]+)(?!\()(\:[A-Za-z0-9-]+)+(?:(| )\(.*)?([ ])?}}/g);
28+
return matches;
29+
}
30+
31+
// returns any patterns that match {{> value(foo:"bar") }} or {{> value:mod(foo:"bar") }} within the pattern
32+
function findPartialsWithPatternParameters(pattern){
33+
var matches = pattern.template.match(/{{>([ ])?([\w\-\.\/~]+)(?:\:[A-Za-z0-9-]+)?(?:(| )\(.*)+([ ])?}}/g);
34+
return matches;
35+
}
2536

2637
//find and return any {{> template-name }} within pattern
2738
function findPartials(pattern){
@@ -300,6 +311,12 @@
300311
find_pattern_partials: function(pattern){
301312
return findPartials(pattern);
302313
},
314+
find_pattern_partials_with_style_modifiers: function(pattern){
315+
return findPartialsWithStyleModifiers(pattern);
316+
},
317+
find_pattern_partials_with_parameters: function(pattern){
318+
return findPartialsWithPatternParameters(pattern);
319+
},
303320
find_list_items: function(pattern){
304321
return findListItems(pattern)
305322
},

builder/pattern_exporter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.13.0 - 2015
2+
* patternlab-node - v0.14.0 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/patternlab.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.13.0 - 2015
2+
* patternlab-node - v0.14.0 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/patternlab_grunt.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.13.0 - 2015
2+
* patternlab-node - v0.14.0 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

0 commit comments

Comments
 (0)