File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change 17
17
this . subdir = subdir ;
18
18
this . name = subdir . replace ( / [ \/ \\ ] / g, '-' ) + '-' + this . fileName ; //this is the unique name with the subDir
19
19
this . jsonFileData = data || { } ;
20
- this . patternName = this . fileName . substring ( this . fileName . indexOf ( '-' ) + 1 ) ; //this is the display name for the ui
20
+ this . patternName = this . fileName . replace ( / ^ \d * \- / , '' ) ; //this is the display name for the ui. strip numeric + hyphen prefixes
21
21
this . patternLink = this . name + '/' + this . name + '.html' ;
22
22
this . patternGroup = this . name . substring ( this . name . indexOf ( '-' ) + 1 , this . name . indexOf ( '-' , 4 ) + 1 - this . name . indexOf ( '-' ) + 1 ) ;
23
23
this . patternSubGroup = subdir . substring ( subdir . indexOf ( '/' ) + 4 ) ;
Original file line number Diff line number Diff line change @@ -272,7 +272,10 @@ var patternlab_engine = function () {
272
272
var bucket = patternlab . buckets [ bucketIndex ] ;
273
273
274
274
//get the navItem
275
- var navItemName = pattern . subdir . split ( '-' ) . pop ( ) ;
275
+ //if there is one or more slashes in the subdir, get everything after
276
+ //the last slash. if no slash, get the whole subdir string and strip
277
+ //any numeric + hyphen prefix
278
+ var navItemName = pattern . subdir . split ( '/' ) . pop ( ) . replace ( / ^ \d * \- / , '' ) ;
276
279
277
280
//get the navSubItem
278
281
var navSubItemName = pattern . patternName . replace ( / - / g, ' ' ) ;
You can’t perform that action at this time.
0 commit comments