mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-05-30 21:37:39 -04:00
feat(docs): use workflow for version docs generation
This commit is contained in:
parent
887a50a54e
commit
8765f9b7c5
97 changed files with 53 additions and 6826 deletions
7
.github/scripts/sync-wiki.py
vendored
7
.github/scripts/sync-wiki.py
vendored
|
|
@ -5,7 +5,6 @@ from pathlib import Path
|
|||
|
||||
DOCS_DIR = Path("docs")
|
||||
WIKI_DIR = Path("wiki-temp")
|
||||
LATEST_DIR = DOCS_DIR / "(git)"
|
||||
|
||||
FRONTMATTER_RE = re.compile(r"\A---\s*\n.*?^---\s*\n", re.DOTALL | re.MULTILINE)
|
||||
DOCS_LINK_RE = re.compile(r"\[([^\]]+)\]\(/docs/(?:[^/)]+/)*([^/)#]+)(#[^)]+)?\)")
|
||||
|
|
@ -21,10 +20,10 @@ def collect_all_files() -> list[tuple[Path, str]]:
|
|||
return [directory / f"{p}.md" for p in data.get("pages", []) if (directory / f"{p}.md").exists()]
|
||||
return sorted(directory.glob("*.md"))
|
||||
|
||||
for src in from_dir(LATEST_DIR):
|
||||
for src in from_dir(DOCS_DIR):
|
||||
files.append((src, "Home" if src.stem == "index" else src.stem))
|
||||
|
||||
for subdir in sorted(LATEST_DIR.iterdir()):
|
||||
for subdir in sorted(DOCS_DIR.iterdir()):
|
||||
if subdir.is_dir():
|
||||
for src in from_dir(subdir):
|
||||
files.append((src, src.stem))
|
||||
|
|
@ -45,7 +44,7 @@ def main() -> None:
|
|||
lines: list[str] = []
|
||||
current_section = None
|
||||
for src, dest_name in files:
|
||||
section = "General" if src.parent == LATEST_DIR else src.parent.name.replace("-", " ").title()
|
||||
section = "General" if src.parent == DOCS_DIR else src.parent.name.replace("-", " ").title()
|
||||
if section != current_section:
|
||||
if current_section is not None:
|
||||
lines.append("")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue