(related_scripts_map, use_details=True, center=False)
| 113 | |
| 114 | # 生成分组后的HTML |
| 115 | def generate_grouped_html(related_scripts_map, use_details=True, center=False): |
| 116 | html_output = "" |
| 117 | center_o = '' |
| 118 | center_c = '' |
| 119 | # 居中显示 |
| 120 | if center: |
| 121 | center_o = '<div align="center">' |
| 122 | center_c = '</div>' |
| 123 | for index, (related_id, scripts) in enumerate(related_scripts_map.items()): |
| 124 | # 分组下的内容收缩 |
| 125 | if use_details: |
| 126 | html_output += f'{center_o}<details><summary>{related_id}</summary>' |
| 127 | else: |
| 128 | html_output += ( |
| 129 | f'<div align="center"><h1>{related_id} ({len(scripts)})</h1></div>' |
| 130 | ) |
| 131 | html_output += generate_html_table(scripts) |
| 132 | html_output += ( |
| 133 | '<div align="right"><a href="#-脚本列表">返回目录</a></div>\n' |
| 134 | '<img height=6px width="100%" ' |
| 135 | 'src="{separator}">\n' |
| 136 | ) |
| 137 | if use_details: |
| 138 | print(center_c) |
| 139 | html_output += f"{center_c}</details>" |
| 140 | html_output = format_str(html_output) |
| 141 | return html_output |
| 142 | |
| 143 | |
| 144 | def main(): |
no test coverage detected