#!/usr/bin/env python3 """Generate a portable offline index; no model, network or PNG collection.""" from pathlib import Path import argparse import json ROOT = Path(__file__).resolve().parents[1] TEMPLATE = r'''
v0.2.1 CTAN candidate. Font-backed forms from GlyphWiki, not an OCR result. Source IDs and component hits are not scholarly identifications. Check each form against your document.
LaTeX: \ebag{s030-067}
Keep this file under doc/ and the font at ../fonts/OpenGlyphEbag.otf. After TEXMF installation, use your local OTF path. Licenses: third-party notices. Each source link below is an optional external link.
''' def main(): p = argparse.ArgumentParser(description=__doc__) p.add_argument('-o', '--output', type=Path, default=ROOT.parent/'doc/openglyph-index.html') args = p.parse_args() manifest = json.loads((ROOT/'data/ebag-manifest.json').read_text()) rows = [[r['id'], r['codepoint'], ' '.join(r['components'])] for r in manifest['glyphs']] args.output.parent.mkdir(parents=True, exist_ok=True) args.output.write_text(TEMPLATE.replace('__GLYPH_DATA__', json.dumps(rows, ensure_ascii=True, separators=(',', ':'))), encoding='utf-8') print(json.dumps({'entries': len(rows), 'file': str(args.output)})) if __name__ == '__main__': main()