@@ -103,20 +103,20 @@ async function organizeByStars(dishesFolder, starsystemFolder) {
103
103
104
104
await processFolder ( dishesFolderAbs ) ;
105
105
106
- const starRatings = Array . from ( new Set ( Object . values ( dishes ) ) ) . sort ( ( a , b ) => b - a ) ;
106
+ const starRatings = Array . from ( new Set ( Object . values ( dishes ) ) ) . sort ( ( a , b ) => a - b ) ;
107
107
const navigationLinks = [ ] ;
108
108
109
109
for ( const stars of starRatings ) {
110
110
const starsFile = path . join ( starsystemFolderAbs , `${ stars } Star.md` ) ;
111
- const content = [ `# Dishes with ${ stars } Stars ` , '' ] ;
111
+ const content = [ `# ${ stars } 星难度菜品 ` , '' ] ;
112
112
for ( const [ filepath , starCount ] of Object . entries ( dishes ) ) {
113
113
if ( starCount === stars ) {
114
114
const relativePath = path . relative ( starsystemFolderAbs , filepath ) . replace ( / \\ / g, '/' ) ;
115
115
content . push ( `* [${ path . basename ( filepath , '.md' ) } ](./${ relativePath } )` ) ;
116
116
}
117
117
}
118
118
await writeFile ( starsFile , content . join ( '\n' ) , 'utf-8' ) ;
119
- navigationLinks . push ( `- [${ stars } Star Dishes ](${ path . relative ( path . dirname ( README_PATH ) , starsFile ) . replace ( / \\ / g, '/' ) } )` ) ;
119
+ navigationLinks . push ( `- [${ stars } 星难度 ](${ path . relative ( path . dirname ( README_PATH ) , starsFile ) . replace ( / \\ / g, '/' ) } )` ) ;
120
120
}
121
121
122
122
return navigationLinks ;
@@ -180,15 +180,16 @@ async function main() {
180
180
181
181
const navigationLinks = await organizeByStars ( dishesFolder , starsystemFolder ) ;
182
182
// Debug logging to ensure navigationLinks is defined and contains data
183
- console . log ( "Navigation Links: " , navigationLinks ) ;
184
- const navigationSection = `\n## Navigation \n\n${ navigationLinks . join ( '\n' ) } ` ;
183
+ console . log ( "难度索引 " , navigationLinks ) ;
184
+ const navigationSection = `\n### 按难度索引 \n\n${ navigationLinks . join ( '\n' ) } ` ;
185
185
186
186
await writeFile (
187
187
README_PATH ,
188
188
README_TEMPLATE
189
189
. replace ( '{{before}}' , README_BEFORE . trim ( ) )
190
+ . replace ( '{{index_stars}}' , navigationSection . trim ( ) )
190
191
. replace ( '{{main}}' , README_MAIN . trim ( ) )
191
- . replace ( '{{after}}' , README_AFTER . trim ( ) ) + navigationSection ,
192
+ . replace ( '{{after}}' , README_AFTER . trim ( ) ) ,
192
193
) ;
193
194
194
195
await writeFile (
0 commit comments