Build HTML content for repo info section. Args: metadata: Metadata dictionary Returns: HTML string for info content
(self, metadata: Optional[Dict[str, Any]])
| 171 | "{{HTML_LANG}}": language_tag(language), |
| 172 | "{{PAGE_TITLES_JSON}}": page_titles_json, |
| 173 | "{{DOC_PATHS_JSON}}": doc_paths_json, |
| 174 | "{{REPO_LINK}}": repo_link, |
| 175 | "{{SHOW_INFO}}": show_info, |
| 176 | "{{INFO_CONTENT}}": info_content, |
| 177 | "{{CONFIG_JSON}}": config_json, |
| 178 | "{{MODULE_TREE_JSON}}": module_tree_json, |
| 179 | "{{METADATA_JSON}}": metadata_json, |
| 180 | "{{DOCS_BASE_PATH}}": docs_base_path, |
| 181 | } |
| 182 | |
| 183 | for placeholder, value in replacements.items(): |
| 184 | html_content = html_content.replace(placeholder, value) |
| 185 | |
| 186 | # Write output |
| 187 | output_path = Path(output_path) |
| 188 | output_path.parent.mkdir(parents=True, exist_ok=True) |
| 189 | safe_write(output_path, html_content) |
| 190 | |
| 191 | # Keep the branded viewer self-contained when it is published elsewhere. |
| 192 | icon_path = self.template_dir / "codewiki-icon.png" |
| 193 | icon_output_path = output_path.parent / "codewiki-icon.png" |
| 194 | if icon_path.exists() and icon_path.resolve() != icon_output_path.resolve(): |
| 195 | shutil.copyfile(icon_path, icon_output_path) |
| 196 | |
| 197 | def _build_info_content(self, metadata: Optional[Dict[str, Any]]) -> str: |
| 198 | """ |
| 199 | Build HTML content for repo info section. |
| 200 | |
| 201 | Args: |
| 202 | metadata: Metadata dictionary |
| 203 | |
| 204 | Returns: |
| 205 | HTML string for info content |
| 206 | """ |
| 207 | if not metadata or not metadata.get("generation_info"): |
| 208 | return "" |
| 209 | |
| 210 | info = metadata.get("generation_info", {}) |
| 211 | stats = metadata.get("statistics", {}) |
| 212 | |
| 213 | html_parts = [] |
| 214 | |
| 215 | if info.get("main_model"): |
| 216 | html_parts.append( |
| 217 | f'<div class="info-row"><strong>Model:</strong> {self._escape_html(info["main_model"])}</div>' |
| 218 | ) |
| 219 | |
| 220 | if info.get("timestamp"): |
no test coverage detected