Files
feresaria/scripts/build-site.py
T
Samuel Onoja eb84104940 Publish topic guides to the wiki and document tabbed windows
Publish the guides from this repository to the GitHub Wiki. Organize them into Usage, Configuration and Development, with 15 separate configuration topics and redirects for the former website guide URLs.

Add a tabbed-windows guide covering grouping, switching tabs and taking windows out. Document the scrolling indicator's defaults and limits, and link the guide from the README, shortcuts and IPC pages. Update from main, including the latest tabbed-layout changes.

Separate Activities setup, configuration and publishing documentation. Review the guide prose with the unslop skill, keeping existing examples and heading links. The wiki workflow uses GitHub's built-in token to publish documentation changes on main.

Validation:

- 20 documentation tests pass, including README links and Activities/tab-indicator field coverage.
- The publisher builds 46 wiki pages; the site build and Python syntax checks pass.
- All 115 code examples from main are preserved.
- The Python suite passes: 90 tests passed and 31 opt-in integration tests skipped, with the system GI module available.
2026-10-13 00:32:23 +01:00

58 lines
2.1 KiB
Python

#!/usr/bin/env python3
"""Build the Ferese homepage and redirect former handbook URLs to the wiki."""
from html import escape
import importlib.util
import json
from pathlib import Path
import shutil
ROOT = Path(__file__).resolve().parent.parent
OUTPUT = ROOT / 'build/site'
spec = importlib.util.spec_from_file_location('wiki', ROOT / 'scripts/build-wiki.py')
wiki = importlib.util.module_from_spec(spec)
spec.loader.exec_module(wiki)
def redirect_page(destination):
return f'''<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Ferese documentation</title>
<link rel="canonical" href="{escape(destination, quote=True)}">
<meta http-equiv="refresh" content="0;url={escape(destination, quote=True)}">
<script>location.replace({json.dumps(destination)} + location.hash);</script>
</head>
<body><p>This guide is on the <a href="{escape(destination, quote=True)}">Ferese wiki</a>.</p></body>
</html>
'''
def main():
if OUTPUT.exists():
shutil.rmtree(OUTPUT)
OUTPUT.mkdir(parents=True)
for name in ('index.html', 'home.css', 'styles.css'):
shutil.copy2(ROOT / 'site' / name, OUTPUT / name)
(OUTPUT / 'assets').mkdir(exist_ok=True)
shutil.copytree(ROOT / 'site/assets', OUTPUT / 'assets', dirs_exist_ok=True)
shutil.copytree(ROOT / 'docs/images', OUTPUT / 'assets', dirs_exist_ok=True)
shutil.copytree(ROOT / 'assets/branding', OUTPUT / 'assets/branding')
(OUTPUT / '.nojekyll').touch()
handbook = OUTPUT / 'docs'
handbook.mkdir()
(handbook / 'index.html').write_text(redirect_page(wiki.WIKI))
for source in wiki.guide_sources():
if not source.is_relative_to(ROOT / 'docs') or source.stem == 'README':
continue
destination = wiki.WIKI + '/' + wiki.page_name(source)
output = handbook / source.relative_to(ROOT / 'docs').with_suffix('.html')
output.parent.mkdir(parents=True, exist_ok=True)
output.write_text(redirect_page(destination))
print(f'Built homepage and documentation redirects at {OUTPUT}')
if __name__ == '__main__':
main()