Skip to content

Commit 20787f0

Browse files
author
Brian Muenzenmeyer
committed
Merge pull request #348 from pattern-lab/fix-347
Hopefully fix #347. Use Path tools and regex instead of hackish
2 parents dc6cd22 + 8966f66 commit 20787f0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

core/lib/object_factory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var Pattern = function (relPath, data) {
3737
this.patternGroup = this.name.substring(this.name.indexOf('-') + 1, this.name.indexOf('-', 4) + 1 - this.name.indexOf('-') + 1);
3838

3939
// the sub-group this pattern belongs to.
40-
this.patternSubGroup = this.subdir.substring(this.subdir.indexOf('/') + 4); // 'global'
40+
this.patternSubGroup = path.basename(this.subdir).replace(/^\d*-/, ''); // 'global'
4141

4242
// Not sure what this is used for.
4343
this.flatPatternPath = this.subdir.replace(/[\/\\]/g, '-'); // '00-atoms-00-global'

core/lib/ui_builder.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function buildNavigation(patternlab) {
8484
//if there is one or more slashes in the subdir, get everything after
8585
//the last slash. if no slash, get the whole subdir string and strip
8686
//any numeric + hyphen prefix
87-
patternSubTypeName = pattern.subdir.split('/').pop().replace(/^\d*\-/, '');
87+
patternSubTypeName = pattern.subdir.split(path.sep).pop().replace(/^\d*\-/, '');
8888

8989
//get the patternSubTypeItem
9090
patternSubTypeItemName = pattern.patternName.replace(/-/g, ' ');

0 commit comments

Comments
 (0)