#!/usr/bin/env python3 """Generate UGI_TOOL_v0.html from ugi_registry_v0.json.""" import json import os import sys import html def load_registry(path): with open(path, "r") as f: return json.load(f) def generate_html(reg): reg_json = json.dumps(reg, ensure_ascii=False) return f""" UGI Tool v{reg['spec']['version']} — Encoder / Decoder / Converter

UGI Tool v{reg['spec']['version']}

{html.escape(reg['spec']['description'])}


Encode your UGI


URI output:

Block output:


  

Decode a UGI string

Convert between formats

Converted output:


  

Quick Reference

""" def main(): if len(sys.argv) != 3: print(f"Usage: {sys.argv[0]} ", file=sys.stderr) sys.exit(1) registry_path, output_path = sys.argv[1], sys.argv[2] reg = load_registry(registry_path) html_content = generate_html(reg) os.makedirs(os.path.dirname(os.path.abspath(output_path)), exist_ok=True) with open(output_path, "w") as f: f.write(html_content) print(f"Generated {output_path}") if __name__ == "__main__": main()