Skip to content

Hopefully fix #347. Use Path tools and regex instead of hackish #348

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/lib/object_factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion core/lib/ui_builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, ' ');
Expand Down