ai-docs-gen 0.1.5__tar.gz → 0.1.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/PKG-INFO +1 -1
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/generator.py +32 -0
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/tokenizer.py +1 -1
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs_gen.egg-info/PKG-INFO +1 -1
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/pyproject.toml +1 -1
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/README.md +0 -0
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/__init__.py +0 -0
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/__main__.py +0 -0
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/assets/mermaid.min.js +0 -0
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/cache.py +0 -0
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/changes.py +0 -0
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/cli.py +0 -0
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/domain.py +0 -0
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/llm.py +0 -0
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/mkdocs.py +0 -0
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/scanner.py +0 -0
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/summary.py +0 -0
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/utils.py +0 -0
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs_gen.egg-info/SOURCES.txt +0 -0
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs_gen.egg-info/dependency_links.txt +0 -0
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs_gen.egg-info/entry_points.txt +0 -0
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs_gen.egg-info/requires.txt +0 -0
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs_gen.egg-info/top_level.txt +0 -0
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/setup.cfg +0 -0
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/tests/test_cache.py +0 -0
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/tests/test_changes.py +0 -0
- {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/tests/test_scanner.py +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import json
|
|
2
2
|
from datetime import datetime
|
|
3
3
|
import os
|
|
4
|
+
import re
|
|
4
5
|
import shutil
|
|
5
6
|
import subprocess
|
|
6
7
|
from pathlib import Path
|
|
@@ -942,6 +943,7 @@ def generate_docs(
|
|
|
942
943
|
if not mkdocs_bin:
|
|
943
944
|
raise RuntimeError("mkdocs is not installed or not on PATH")
|
|
944
945
|
subprocess.check_call([mkdocs_bin, "build", "-f", "mkdocs.yml"], cwd=output_root)
|
|
946
|
+
_postprocess_mermaid_html(output_root / "ai_docs_site")
|
|
945
947
|
print("[ai-docs] mkdocs: done")
|
|
946
948
|
|
|
947
949
|
# Save cache
|
|
@@ -957,3 +959,33 @@ def generate_docs(
|
|
|
957
959
|
print("[ai-docs] errors summary:")
|
|
958
960
|
for item in errors:
|
|
959
961
|
print(f"[ai-docs] error: {item}")
|
|
962
|
+
|
|
963
|
+
|
|
964
|
+
def _postprocess_mermaid_html(site_dir: Path) -> None:
|
|
965
|
+
if not site_dir.exists():
|
|
966
|
+
return
|
|
967
|
+
|
|
968
|
+
mermaid_div_re = re.compile(r'(<div class="mermaid">)(.*?)(</div>)', re.DOTALL)
|
|
969
|
+
bracket_re = re.compile(r"\\[([^\\]]*)\\]")
|
|
970
|
+
|
|
971
|
+
for path in site_dir.rglob("*.html"):
|
|
972
|
+
text = path.read_text(encoding="utf-8")
|
|
973
|
+
if 'class="mermaid"' not in text:
|
|
974
|
+
continue
|
|
975
|
+
|
|
976
|
+
def _fix_mermaid(match: re.Match) -> str:
|
|
977
|
+
head, body, tail = match.groups()
|
|
978
|
+
body = body.replace(">", ">")
|
|
979
|
+
|
|
980
|
+
def _fix_brackets(bmatch: re.Match) -> str:
|
|
981
|
+
inner = bmatch.group(1).replace("(", " ").replace(")", "")
|
|
982
|
+
inner = re.sub(r"[ \\t]+", " ", inner)
|
|
983
|
+
return f"[{inner}]"
|
|
984
|
+
|
|
985
|
+
body = bracket_re.sub(_fix_brackets, body)
|
|
986
|
+
body = re.sub(r"[ \\t]+", " ", body)
|
|
987
|
+
return f"{head}{body}{tail}"
|
|
988
|
+
|
|
989
|
+
updated = mermaid_div_re.sub(_fix_mermaid, text)
|
|
990
|
+
if updated != text:
|
|
991
|
+
path.write_text(updated, encoding="utf-8")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|