@@ -595,9 +595,12 @@ class ObfProcessor extends BaseProcessor {
595595 tree . metadata . description = boardData . description_html ;
596596 tree . metadata . locale = boardData . locale ;
597597 tree . metadata . id = boardData . id ;
598+ tree . metadata . _obfPagePaths = { [ page . id ] : entryName } ;
598599 if ( boardData . url ) tree . metadata . url = boardData . url ;
599600 if ( boardData . locale ) tree . metadata . languages = [ boardData . locale ] ;
600601 tree . rootId = page . id ;
602+ } else {
603+ tree . metadata . _obfPagePaths [ page . id ] = entryName ;
601604 }
602605 } else {
603606 console . warn ( '[OBF] Skipped entry (not valid OBF JSON):' , entryName ) ;
@@ -784,7 +787,12 @@ class ObfProcessor extends BaseProcessor {
784787 ) ;
785788 await writeTextToPath ( outputPath , JSON . stringify ( obfBoard , null , 2 ) ) ;
786789 } else {
787- const getPageFilename = ( id : string ) : string => ( id . endsWith ( '.obf' ) ? id : `${ id } .obf` ) ;
790+ const getPageFilename = ( id : string ) : string => {
791+ if ( tree . metadata . _obfPagePaths && id in tree . metadata . _obfPagePaths )
792+ return tree . metadata . _obfPagePaths [ id ] as string ;
793+ if ( id . endsWith ( '.obf' ) ) return id ;
794+ return `${ id } .obf` ;
795+ } ;
788796 const files = Object . values ( tree . pages ) . map ( ( page ) => {
789797 const obfBoard = this . createObfBoardFromPage ( page , 'Board' , tree . metadata , embedData ) ;
790798 const obfContent = JSON . stringify ( obfBoard , null , 2 ) ;
0 commit comments