Add the Green Man generator and restyle its page to match the index
greenman-src/ holds the kit source; uv run build.py there rewrites greenman/. deploy skips *-src/. The page now uses the index's ink, bone and gold with the same serif, and no longer loads web fonts. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GrX9qMoNihcWLX3xoJhabw
This commit is contained in:
1 parent
a7c04e5cb7
commit
9c3c361858
59 files changed
+1640
-41
No files matched your search
@@ -0,0 +1,22 @@
|
||||
"""Render an HTML file to PNG (for checking) or PDF (for the kit) with the pre-installed Chromium."""
|
||||
import sys, asyncio
|
||||
from playwright.async_api import async_playwright
|
||||
|
||||
async def go(src, out, width=1260, scale=1, footer=None):
|
||||
async with async_playwright() as p:
|
||||
try: b = await p.chromium.launch()
|
||||
except Exception: b = await p.chromium.launch(channel='chrome') # no Playwright browser installed: use Google Chrome
|
||||
pg = await b.new_page(viewport={'width': width, 'height': 800}, device_scale_factor=scale)
|
||||
await pg.goto('file://' + src); await pg.evaluate('document.fonts.ready'); await pg.wait_for_timeout(300)
|
||||
if out.endswith('.pdf'):
|
||||
kw = dict(display_header_footer=True, header_template='<span></span>', footer_template=
|
||||
'<div style="font-family:Inter,Helvetica,sans-serif;font-size:7.5px;color:#777;width:100%;padding:0 14mm;display:flex;justify-content:space-between"><span>' + footer +
|
||||
'</span><span><span class="pageNumber"></span> / <span class="totalPages"></span></span></div>') if footer else {}
|
||||
await pg.pdf(path=out, prefer_css_page_size=True, print_background=True, **kw)
|
||||
else:
|
||||
await pg.screenshot(path=out, full_page=True)
|
||||
await b.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
src, out = sys.argv[1], sys.argv[2]
|
||||
asyncio.run(go(src, out, width=int(sys.argv[3]) if len(sys.argv) > 3 else 1260))
|
||||
Reference in new issue
Block a user