From cac925a711ceb14c3764221a3fae3b05602eacb0 Mon Sep 17 00:00:00 2001 From: Geoffrey Pursell Date: Fri, 3 Jun 2016 11:44:29 -0500 Subject: [PATCH 1/2] Hopefully fix #347. Use Path tools and regex instead of hackish string-length tomfoolery --- core/lib/object_factory.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/lib/object_factory.js b/core/lib/object_factory.js index 7dad7637d..8fe9aa902 100644 --- a/core/lib/object_factory.js +++ b/core/lib/object_factory.js @@ -37,7 +37,7 @@ var Pattern = function (relPath, data) { this.patternGroup = this.name.substring(this.name.indexOf('-') + 1, this.name.indexOf('-', 4) + 1 - this.name.indexOf('-') + 1); // the sub-group this pattern belongs to. - this.patternSubGroup = this.subdir.substring(this.subdir.indexOf('/') + 4); // 'global' + this.patternSubGroup = path.basename(this.subdir).replace(/^\d*-/, ''); // 'global' // Not sure what this is used for. this.flatPatternPath = this.subdir.replace(/[\/\\]/g, '-'); // '00-atoms-00-global' From 8966f66c34d5f18d60daabbe0bb051c9d64f7bec Mon Sep 17 00:00:00 2001 From: Geoffrey Pursell Date: Fri, 3 Jun 2016 12:01:27 -0500 Subject: [PATCH 2/2] Hopefully fix the nav issue --- core/lib/ui_builder.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/lib/ui_builder.js b/core/lib/ui_builder.js index f2f548066..7e99135ee 100644 --- a/core/lib/ui_builder.js +++ b/core/lib/ui_builder.js @@ -84,7 +84,7 @@ function buildNavigation(patternlab) { //if there is one or more slashes in the subdir, get everything after //the last slash. if no slash, get the whole subdir string and strip //any numeric + hyphen prefix - patternSubTypeName = pattern.subdir.split('/').pop().replace(/^\d*\-/, ''); + patternSubTypeName = pattern.subdir.split(path.sep).pop().replace(/^\d*\-/, ''); //get the patternSubTypeItem patternSubTypeItemName = pattern.patternName.replace(/-/g, ' ');