Skip to content

Commit fbd94ed

Browse files
committed
更新首页显示标题
1 parent 4b937a0 commit fbd94ed

File tree

2 files changed

+8
-673
lines changed

2 files changed

+8
-673
lines changed

Assets/Scripts/create_solutions_list.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,6 @@ def gen_solutions_list(solotions_path, solotions_output_path):
142142
# 将 readme_head、list 合并到,自动生成 README.md 并保存到 readme_path 中
143143
def merge_readme_file(solotions_output_path, readme_head_path, readme_catalogue_list_path, content_index_path, readme_path, solutions_count):
144144

145-
146-
147-
148145
# 生成项目 README.md 文件
149146
readme_file = open(readme_path,'w')
150147

@@ -161,9 +158,13 @@ def merge_readme_file(solotions_output_path, readme_head_path, readme_catalogue_
161158
readme_file.write(readme_catelogue_list_line)
162159
readme_catelogue_list_file.close()
163160

164-
# 将题解写入 readme 文件
161+
# 将题解标题写入 readme 文件
165162
catalogue_list_file = open(solotions_output_path)
166-
readme_file.writelines(catalogue_list_file.readlines())
163+
catalogue_list_lines = catalogue_list_file.readlines()
164+
if len(catalogue_list_lines) > 0:
165+
catalogue_list_title = '[' + catalogue_list_lines[0] + '](./Contents/00.Introduction/04.Solutions-List.md)'
166+
catalogue_list_title = catalogue_list_title.replace('# LeetCode 题解', '## 10. LeetCode 题解')
167+
readme_file.writelines(catalogue_list_title)
167168
catalogue_list_file.close()
168169

169170
readme_file.close()

0 commit comments

Comments
 (0)