@@ -107,7 +107,7 @@ const main = async () => {
107107
108108 for ( const row of testsRows ) {
109109 const { versions, full_name, name, parent_test_full_name } = row ;
110- const slug = slugify ( full_name ) ;
110+ const slug = slugifyTestName ( full_name ) ;
111111
112112 if ( ! groups [ parent_test_full_name ] ) {
113113 groups [ parent_test_full_name ] = { } ;
@@ -285,7 +285,7 @@ const main = async () => {
285285
286286 const testResults = { } ;
287287 for ( const row of rows ) {
288- testResults [ row . full_name ] = { ...row , slug : slugify ( row . full_name ) } ;
288+ testResults [ row . full_name ] = { ...row , slug : slugifyTestName ( row . full_name ) } ;
289289 }
290290 outputJSON ( `data/testresults/${ id } /${ version } .json` , testResults ) ;
291291 }
@@ -310,8 +310,9 @@ const main = async () => {
310310
311311 const testsTaxonomy = { } ;
312312 for ( const row of testsTaxonomyRows ) {
313- const { full_name, name, test_run_implementation_id, test_run_version } = row ;
314- const slug = slugify ( full_name ) ;
313+ const { full_name, test_run_implementation_id, test_run_version } = row ;
314+ const slug = slugifyTestName ( full_name ) ;
315+ const name = decodeURIComponent ( row . name ) ;
315316
316317 if ( ! testsTaxonomy [ full_name ] ) {
317318 testsTaxonomy [ full_name ] = {
@@ -349,6 +350,7 @@ const main = async () => {
349350 test_run_implementation_id AS implementation_id,
350351 test_run_version AS version,
351352 full_name,
353+ name,
352354 outcome
353355 FROM TestResult
354356 ORDER BY test_run_implementation_id, test_run_version, full_name
@@ -358,7 +360,8 @@ const main = async () => {
358360 const resultsTaxonomy = { } ;
359361 for ( const row of resultsTaxonomyRows ) {
360362 const { implementation_id, version, full_name, outcome } = row ;
361- const slug = slugify ( full_name ) ;
363+ const slug = slugifyTestName ( full_name ) ;
364+ const name = decodeURIComponent ( row . name ) ;
362365
363366 if ( ! resultsTaxonomy [ implementation_id ] ) {
364367 resultsTaxonomy [ implementation_id ] = { } ;
@@ -371,6 +374,7 @@ const main = async () => {
371374 if ( ! resultsTaxonomy [ implementation_id ] [ version ] [ full_name ] ) {
372375 resultsTaxonomy [ implementation_id ] [ version ] [ full_name ] = {
373376 slug,
377+ name,
374378 full_name,
375379 outcome,
376380 } ;
@@ -395,7 +399,7 @@ const main = async () => {
395399 ...test ,
396400 implementation_id,
397401 version,
398- title : test . full_name
402+ title : test . name
399403 } ) ;
400404 }
401405 }
@@ -418,12 +422,23 @@ const slugify = (str) => {
418422 . trim ( ) // trim leading or trailing whitespace
419423 . toLowerCase ( ) // convert to lowercase
420424 . replace ( / \s + / g, '_' ) // replace spaces with underscore
425+ . replace ( / [ . , ( ) " / ] / g, '-' ) // remove the characters (, ) and ~
426+ . replace ( / [ ^ a - z 0 - 9 -\/ ] / g, '-' ) // remove non-alphanumeric characters
421427 . replace ( / _ + / g, '_' ) // remove consecutive underscores
422- . replace ( / [ \/ ] / g, "__" )
423- . replace ( / [ ^ a - z 0 - 9 - ] / g, '-' ) // remove non-alphanumeric characters
424428 . replace ( / - + / g, '-' ) // remove consecutive dashes
425429}
426430
431+ const slugifyTestName = ( str ) => {
432+ let x = String ( str ) . split ( '/' ) ;
433+ x = x . map ( part => {
434+ // url decode to handle %20, etc
435+ part = decodeURIComponent ( part ) ;
436+ return slugify ( part . replace ( / ( [ a - z ] ) ( [ A - Z ] ) / g, '$1-$2' ) // Convert CamelCase to kebab-case
437+ )
438+ } )
439+ return x . join ( '/' ) ;
440+ }
441+
427442const outputJSON = ( p , data ) => {
428443 const json = JSON . stringify ( data , null , 2 ) ;
429444 const fullPath = `${ hugoOutput } /${ p } ` ;
0 commit comments