(md_files, path, lang='zh-CN')
| 22 | |
| 23 | |
| 24 | def build_html(md_files, path, lang='zh-CN'): |
| 25 | template_path = "utils/templates/SELECTOR.html" |
| 26 | with open(template_path, 'r', encoding='utf-8') as file: |
| 27 | html_template = file.read() |
| 28 | base_url = f"https://github.com/{get_repo_name()}/blob/main/" |
| 29 | links = [] |
| 30 | for file in md_files: |
| 31 | match = re.match(r'README_([a-zA-Z\-]+)\.md', file) |
| 32 | lang_code = match.group(1) if match else lang |
| 33 | title = find_locale(lang_code) |
| 34 | links.append(f'<a href="{base_url}{path}/{file}">{title}</a>') |
| 35 | # 格式化的换行符 |
| 36 | links_html = " |\n ".join(links) |
| 37 | html = html_template.replace('{{links}}', links_html) |
| 38 | return html |
| 39 | |
| 40 | |
| 41 | def main(): |
no test coverage detected