@@ -368,6 +368,35 @@ <h2>Table of Contents</h2>
368
368
return false ;
369
369
}
370
370
371
+ const specializedBreadcrumpbs = [
372
+ { pattern : / ^ e c l i p s e - s i m r e l \/ .g i t h u b \/ m a i n \/ $ / , replacement : { label : 'Eclipse SimRel' , href : getMarkdownSearch ( 'eclipse-simrel/.github\/main/profile/README.md' ) } } ,
373
+ { pattern : / ^ e c l i p s e - s i m r e l \/ .g i t h u b \/ m a i n \/ ( p r o f i l e \/ ? ) ? $ / , replacement : null } ,
374
+ { pattern : / ^ e c l i p s e - s i m r e l \/ .g i t h u b \/ m a i n \/ p r o f i l e \/ R E A D M E .m d ? $ / , replacement : null } ,
375
+ { pattern : / ^ e c l i p s e - s i m r e l \/ .g i t h u b \/ m a i n \/ w i k i \/ ? $ / , replacement : { label : 'Wiki' , href : getMarkdownSearch ( 'eclipse-simrel/.github\/main/wiki/README.md' ) } } ,
376
+ { pattern : / ^ e c l i p s e - s i m r e l \/ .g i t h u b \/ m a i n \/ w i k i \/ R E A D M E .m d $ / , replacement : null } ,
377
+ { pattern : / ^ e c l i p s e - s i m r e l \/ .g i t h u b \/ m a i n \/ w i k i \/ S i m R e l \/ ? $ / , replacement : null } ,
378
+ { pattern : / ^ e c l i p s e - s i m r e l \/ .g i t h u b \/ m a i n \/ w i k i \/ ? $ / , replacement : { label : 'Wiki' , href : getMarkdownSearch ( 'eclipse-simrel/.github\/main/wiki/README.md' ) } } ,
379
+ ] ;
380
+
381
+ function generatBreadcrumbPath ( crumbPath , segment ) {
382
+ const fullPath = `${ org } /${ repo } /${ branch } ${ crumbPath } ` ;
383
+ console . log ( fullPath ) ;
384
+
385
+ for ( const matcher of specializedBreadcrumpbs ) {
386
+ const match = matcher . pattern . exec ( fullPath ) ;
387
+ if ( match != null ) {
388
+ console . log ( match ) ;
389
+ const replacement = matcher . replacement ;
390
+ return replacement ;
391
+ }
392
+ }
393
+
394
+ return {
395
+ label : segment . length == 0 ? repoName : niceName ( segment . replace ( / \. m d $ / , '' ) ) ,
396
+ href : getMarkdownSearch ( fullPath )
397
+ } ;
398
+ }
399
+
371
400
if ( parts == null || parts . length == 0 ) {
372
401
targetElement . innerHTML = 'No well-formed query parameter of the form <code>?file=org/repo/branch/path</code> has been specified.' ;
373
402
} else {
@@ -391,8 +420,10 @@ <h2>Table of Contents</h2>
391
420
let crumbPath = '' ;
392
421
for ( const segment of segments ) {
393
422
crumbPath = ( crumbPath == '/' ? '/' : crumbPath + '/' ) + segment ;
394
- const href = getMarkdownSearch ( `${ org } /${ repo } /${ branch } ${ crumbPath } ` ) ;
395
- breadcrumb . append ( ...toElements ( `<li><a href="${ href } ">${ segment . length == 0 ? repoName : niceName ( segment . replace ( / \. m d $ / , '' ) ) } </a></li>` ) ) ;
423
+ const crumb = generatBreadcrumbPath ( crumbPath , segment ) ;
424
+ if ( crumb != null ) {
425
+ breadcrumb . append ( ...toElements ( `<li><a href="${ crumb . href } ">${ crumb . label } </a></li>` ) ) ;
426
+ }
396
427
}
397
428
}
398
429
0 commit comments