From 41f8d3025f041aaab98fcc3511cb6ec2198f76a7 Mon Sep 17 00:00:00 2001 From: Ahmed Date: Sun, 14 Jun 2026 01:49:48 +0300 Subject: init: vibed --- web/scripts/gen_tool.py | 1388 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1388 insertions(+) create mode 100644 web/scripts/gen_tool.py (limited to 'web/scripts/gen_tool.py') diff --git a/web/scripts/gen_tool.py b/web/scripts/gen_tool.py new file mode 100644 index 0000000..232a7eb --- /dev/null +++ b/web/scripts/gen_tool.py @@ -0,0 +1,1388 @@ +#!/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() -- cgit v1.2.3