sa6anw.se/clean_language_blocks.py

20 lines
674 B
Python

# Skapa .pages i docs/ och docs/en/ baserat på nav i mkdocs.yml
def extract_nav_from_mkdocs_yml(path):
with open(path, "r", encoding="utf-8") as f:
data = yaml.safe_load(f)
return {
"title": data.get("site_name", "SA6ANW"),
"nav": data.get("nav", [])
}
# Hämta navigation från mkdocs.yml
pages = extract_nav_from_mkdocs_yml(MKDOCS_YML)
# Skriv till svenska .pages
with open(os.path.join(SOURCE_DIR, ".pages"), "w", encoding="utf-8") as f:
yaml.dump(pages, f, allow_unicode=True)
# Skriv till engelska .pages
with open(os.path.join(ENGLISH_DIR, ".pages"), "w", encoding="utf-8") as f:
yaml.dump(pages, f, allow_unicode=True)