File tree Expand file tree Collapse file tree 1 file changed +17
-8
lines changed Expand file tree Collapse file tree 1 file changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -78,14 +78,23 @@ function generateLinks(filepath) {
7878 const issueUrl = `https://github.com/angular/angular-ja/issues/new?template=translation-checkout.md&title=${ encodeURIComponent ( 'translate: ' + title ) } ` ;
7979
8080 // .mdファイルのみプレビューURL生成
81- let previewUrl = null ;
82- if ( filepath . endsWith ( '.md' ) ) {
83- const previewPath = filepath
84- . replace ( 'src/content/' , '' )
85- . replace ( / \/ R E A D M E \. m d $ / , '' ) // READMEの場合はディレクトリのみ
86- . replace ( / \. m d $ / , '' ) ;
87- previewUrl = `https://angular.jp/${ previewPath } ` ;
88- }
81+ const previewUrl = filepath . endsWith ( '.md' )
82+ ? ( ( ) => {
83+ const basePath = filepath
84+ . replace ( 'src/content/' , '' )
85+ . replace ( / \/ R E A D M E \. m d $ / , '' ) // READMEの場合はディレクトリのみ
86+ . replace ( / \. m d $ / , '' ) ;
87+
88+ // チュートリアルの特殊なパス変換
89+ const previewPath = basePath . startsWith ( 'tutorials/' )
90+ ? basePath
91+ . replace ( / \/ i n t r o $ / , '' ) // intro ディレクトリを削除
92+ . replace ( / \/ s t e p s \/ / , '/' ) // steps/ を削除
93+ : basePath ;
94+
95+ return `https://angular.jp/${ previewPath } ` ;
96+ } ) ( )
97+ : null ;
8998
9099 return { githubUrl, previewUrl, issueUrl } ;
91100}
You can’t perform that action at this time.
0 commit comments