Reorganize wiki into cross-cultural-ai/ and solidarity-economies/ sections with shared orgs and tags
This commit is contained in:
1 parent
c283cf5955
commit
f00c781008
40 files changed
+681
-166
No files matched your search
@@ -1,10 +1,15 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Regenerate tag index pages from YAML frontmatter in wiki markdown files.
|
||||
|
||||
Scans all .md files in the wiki (excluding tags/ and .git/), parses YAML
|
||||
Scans all .md files in the wiki (excluding tags/, scripts/, and .git/), parses YAML
|
||||
frontmatter, and regenerates tag index pages in tags/ plus a master
|
||||
tags/README.md index.
|
||||
|
||||
The wiki is organized into two top-level sections:
|
||||
- cross-cultural-ai/ (research on cross-cultural AI perspectives)
|
||||
- solidarity-economies/ (research on cooperative/public AI ownership)
|
||||
Plus a shared organizations/ directory and tags/ + scripts/ infrastructure.
|
||||
|
||||
Usage:
|
||||
python3 scripts/generate_tag_index.py
|
||||
"""
|
||||
@@ -17,6 +22,9 @@ from collections import defaultdict
|
||||
# Tag dimensions in display order
|
||||
DIMENSIONS = ["type", "function", "region", "maturity", "ownership"]
|
||||
|
||||
# Directories to exclude from scanning
|
||||
EXCLUDED_DIRS = {".git", "tags", "scripts"}
|
||||
|
||||
|
||||
def parse_frontmatter(content):
|
||||
"""Parse YAML frontmatter from markdown content. Returns (frontmatter_dict, body)."""
|
||||
@@ -107,12 +115,16 @@ def extract_title_and_description(content):
|
||||
|
||||
|
||||
def scan_wiki(wiki_root):
|
||||
"""Scan all .md files in the wiki, returning list of (relpath, frontmatter, title, description)."""
|
||||
"""Scan all .md files in the wiki, returning list of (relpath, frontmatter, title, description).
|
||||
|
||||
Scans the two top-level sections (cross-cultural-ai/, solidarity-economies/)
|
||||
and the shared organizations/ directory. Excludes tags/, scripts/, and .git/.
|
||||
"""
|
||||
pages = []
|
||||
for root, dirs, files in os.walk(wiki_root):
|
||||
# Skip .git and tags directories
|
||||
if ".git" in root or os.path.join("tags") in os.path.relpath(root, wiki_root):
|
||||
continue
|
||||
# Skip excluded directories (prune in-place for os.walk)
|
||||
dirs[:] = [d for d in dirs if d not in EXCLUDED_DIRS]
|
||||
|
||||
for fname in sorted(files):
|
||||
if not fname.endswith(".md"):
|
||||
continue
|
||||
|
||||
Reference in new issue
Block a user