Generate HTML documentation viewer. Args: output_path: Output file path (index.html) title: Documentation title module_tree: Module tree structure (auto-loaded from docs_dir if not provided) repository_url: GitHub repository U
(
self,
output_path: Path,
title: str,
module_tree: Optional[Dict[str, Any]] = None,
repository_url: Optional[str] = None,
github_pages_url: Optional[str] = None,
config: Optional[Dict[str, Any]] = None,
docs_dir: Optional[Path] = None,
metadata: Optional[Dict[str, Any]] = None
)
| 81 | return None |
| 82 | |
| 83 | def generate( |
| 84 | self, |
| 85 | output_path: Path, |
| 86 | title: str, |
| 87 | module_tree: Optional[Dict[str, Any]] = None, |
| 88 | repository_url: Optional[str] = None, |
| 89 | github_pages_url: Optional[str] = None, |
| 90 | config: Optional[Dict[str, Any]] = None, |
| 91 | docs_dir: Optional[Path] = None, |
| 92 | metadata: Optional[Dict[str, Any]] = None |
| 93 | ): |
| 94 | """ |
| 95 | Generate HTML documentation viewer. |
| 96 | |
| 97 | Args: |
| 98 | output_path: Output file path (index.html) |
| 99 | title: Documentation title |
| 100 | module_tree: Module tree structure (auto-loaded from docs_dir if not provided) |
| 101 | repository_url: GitHub repository URL |
| 102 | github_pages_url: Expected GitHub Pages URL |
| 103 | config: Additional configuration |
| 104 | docs_dir: Documentation directory (for auto-loading module_tree and metadata) |
| 105 | metadata: Metadata dictionary (auto-loaded from docs_dir if not provided) |
| 106 | """ |
| 107 | # Auto-load module_tree and metadata from docs_dir if not provided |
| 108 | if docs_dir: |
| 109 | if module_tree is None: |
| 110 | module_tree = self.load_module_tree(docs_dir) |
| 111 | if metadata is None: |
| 112 | metadata = self.load_metadata(docs_dir) |
| 113 | |
| 114 | # Default values |
| 115 | if module_tree is None: |
| 116 | module_tree = {} |
| 117 | if config is None: |
| 118 | config = {} |
| 119 | |
| 120 | # Load template |
| 121 | template_path = self.template_dir / "viewer_template.html" |
| 122 | if not template_path.exists(): |
| 123 | raise FileSystemError(f"Template not found: {template_path}") |
| 124 | |
| 125 | template_content = safe_read(template_path) |
| 126 | |
| 127 | # Build info content HTML |
| 128 | info_content = self._build_info_content(metadata) |
| 129 | show_info = "block" if info_content else "none" |
| 130 | |
| 131 | # Build repository link |
| 132 | repo_link = "" |
| 133 | if repository_url: |
| 134 | repo_link = f'<a href="{repository_url}" class="repo-link" target="_blank">🔗 View Repository</a>' |
| 135 | |
| 136 | # Determine docs base path |
| 137 | # For GitHub Pages: relative path to docs folder |
| 138 | # For local: relative path to docs folder |
| 139 | docs_base_path = "" |
| 140 | if docs_dir and output_path.parent != docs_dir: |
no test coverage detected