docs(ci): Front-Matter + CI-Docs + YT-Sync vorbereitet (MP-7)

This commit is contained in:
2025-10-22 11:11:10 +02:00
parent 79c9d4a71a
commit 1bdd5c38aa
13 changed files with 310 additions and 2 deletions
+33
View File
@@ -0,0 +1,33 @@
import os, re, yaml, json
from glob import glob
try:
import jsonschema
except ImportError:
# GitHub Actions step will install this before running; provide friendlier message if missing
raise SystemExit("[FM] jsonschema package not installed. Please run: pip install jsonschema pyyaml")
SCHEMA_PATH = 'docs/.frontmatter.schema.json'
FM_REGEX = re.compile(r'^---\n(.*?)\n---', re.S)
with open(SCHEMA_PATH, encoding='utf-8') as f:
schema = json.load(f)
errors = 0
for path in glob('docs/**/*.md', recursive=True):
# Skip generated or non-content files if any (none by default)
with open(path, 'r', encoding='utf-8') as fh:
content = fh.read()
m = FM_REGEX.search(content)
if not m:
print(f"[FM] fehlt: {path}")
errors = 1
continue
try:
fm = yaml.safe_load(m.group(1)) or {}
jsonschema.validate(fm, schema)
except Exception as e:
print(f"[FM] invalid in {path}: {e}")
errors = 1
exit(errors)