#!/usr/bin/env python3 import html from pathlib import Path import tomli EMAIL = ''.join(['&#x{:02x};'.format(ord(c)) for c in 'mailto:martin@push-f.com']) out_dir = Path('build') out_dir.mkdir(exist_ok=True) html_f = open(out_dir / 'index.html', 'w') nginx_f = open(out_dir / 'nginx_rules', 'w') html_f.write(''' spec.pub

spec.pub

Redirects to specification publications.

Maintained by Martin Fischer. Suggestions for new redirects are welcome.

Note that the redirects are lowercase (the links on this page are capitalized for readability). ''' % EMAIL) redirects = {} def link(key, css_class=''): return '{}'.format( html.escape(key.lower()), f' class={css_class}' if css_class else '', html.escape(key)) with open('specs.toml', 'rb') as f: data = tomli.load(f) html_f.write('
') for section, redirects in data.items(): html_f.write(f'

{section}

') html_f.write('') html_f.write(''' ''') html_f.close() nginx_f.close()