Build HTML content for repo info section. Args: metadata: Metadata dictionary Returns: HTML string for info content
(self, metadata: Optional[Dict[str, Any]])
| 171 | safe_write(output_path, html_content) |
| 172 | |
| 173 | def _build_info_content(self, metadata: Optional[Dict[str, Any]]) -> str: |
| 174 | """ |
| 175 | Build HTML content for repo info section. |
| 176 | |
| 177 | Args: |
| 178 | metadata: Metadata dictionary |
| 179 | |
| 180 | Returns: |
| 181 | HTML string for info content |
| 182 | """ |
| 183 | if not metadata or not metadata.get('generation_info'): |
| 184 | return "" |
| 185 | |
| 186 | info = metadata.get('generation_info', {}) |
| 187 | stats = metadata.get('statistics', {}) |
| 188 | |
| 189 | html_parts = [] |
| 190 | |
| 191 | if info.get('main_model'): |
| 192 | html_parts.append(f'<div class="info-row"><strong>Model:</strong> {self._escape_html(info["main_model"])}</div>') |
| 193 | |
| 194 | if info.get('timestamp'): |
| 195 | try: |
| 196 | from datetime import datetime |
| 197 | timestamp = info['timestamp'] |
| 198 | # Parse ISO format timestamp |
| 199 | if isinstance(timestamp, str): |
| 200 | dt = datetime.fromisoformat(timestamp.replace('Z', '+00:00')) |
| 201 | formatted_date = dt.strftime('%Y-%m-%d') |
| 202 | html_parts.append(f'<div class="info-row"><strong>Generated:</strong> {formatted_date}</div>') |
| 203 | except Exception: |
| 204 | pass |
| 205 | |
| 206 | if info.get('commit_id'): |
| 207 | commit_short = info['commit_id'][:8] |
| 208 | html_parts.append(f'<div class="info-row"><strong>Commit:</strong> {commit_short}</div>') |
| 209 | |
| 210 | if stats.get('total_components'): |
| 211 | components_str = f"{stats['total_components']:,}" |
| 212 | html_parts.append(f'<div class="info-row"><strong>Components:</strong> {components_str}</div>') |
| 213 | |
| 214 | if stats.get('max_depth'): |
| 215 | html_parts.append(f'<div class="info-row"><strong>Max Depth:</strong> {stats["max_depth"]}</div>') |
| 216 | |
| 217 | return '\n '.join(html_parts) |
| 218 | |
| 219 | def _escape_html(self, text: str) -> str: |
| 220 | """ |
no test coverage detected