Files
builds/greenman-src/build_guides.py
T
Eric WagonerandClaude Fable 5.2 f2bb87caeb Credibility pass over the Green Man generator
Turn audit.py into a run() function and drop audit_run.py, which only
existed to import it quietly. Remove unused parameters, keys, helpers
and imports from draw.py, manifest.py and stl_build.py, and the source
file names in stl_build.FILES that pointed at nothing. Keep the brow
strip's taper and knob positions in geom.py only. Correct comments and
docstrings that disagreed with the code, and the README's claim about
counts.

The page changes only in markup: no stray spaces in class attributes,
and three CSS declarations that did nothing are gone. Guide HTML,
templates and print files are byte-identical apart from that.

Credibility pass over a7c04e5..HEAD; the next one can scope from here.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 19:14:03 -05:00

67 lines
4.9 KiB
Python

"""Build the two guide PDFs (US Letter portrait) from content.py."""
import asyncio, shutil
import content as C, shot, fonts
from paths import OUT, ASSETS
CSS = '''
@page { size: 215.9mm 279.4mm; margin: 13mm 14mm 16mm 14mm; }
* { box-sizing: border-box; }
html { font-family: Inter, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 9.4pt; line-height: 1.45; color: #1c1b19; }
body { margin: 0; }
h1 { font-family: "Inter Display", Inter, sans-serif; font-size: 34pt; line-height: 1.02; letter-spacing: -0.02em; margin: 0 0 4mm; font-weight: 700; }
h2 { font-size: 15pt; line-height: 1.2; margin: 0 0 3mm; padding-top: 3mm; border-top: 1.4pt solid #2f6b2f; font-weight: 700; break-after: avoid; }
h3 { font-size: 12pt; margin: 0; font-weight: 700; }
p { margin: 0 0 2.6mm; } ul, ol { margin: 0 0 2.6mm; padding-left: 5mm; } li { margin-bottom: 1.3mm; }
section { margin: 0 0 7mm; }
code { font-family: "DejaVu Sans Mono", monospace; font-size: 8pt; }
figure { margin: 0; } figcaption { font-size: 7.6pt; color: #6a675f; margin-top: 1mm; line-height: 1.3; }
svg { display: block; width: 100%; height: auto; } img { display: block; max-width: 100%; }
text { font-family: Inter, Helvetica, Arial, sans-serif; }
.cover { display: grid; grid-template-columns: 1fr 78mm; gap: 9mm; align-items: end; margin-bottom: 8mm; }
.kicker { text-transform: uppercase; letter-spacing: 0.12em; font-size: 8pt; font-weight: 700; color: #2f6b2f; margin: 0 0 3mm; }
.lead { font-size: 12pt; line-height: 1.4; color: #33312d; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5mm 6mm; margin: 5mm 0 0; }
.facts dt { font-size: 7.4pt; text-transform: uppercase; letter-spacing: 0.08em; color: #6a675f; } .facts dd { margin: 0; font-weight: 600; }
.cover-photo img { border-radius: 2mm; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8mm; align-items: start; margin-bottom: 3mm; }
.photo img { border-radius: 1.5mm; }
.profile svg { max-height: 96mm; }
table.data { width: 100%; border-collapse: collapse; font-size: 8.5pt; margin: 0 0 3mm; }
table.data th { text-align: left; font-size: 7.4pt; text-transform: uppercase; letter-spacing: 0.06em; color: #6a675f; border-bottom: 0.8pt solid #1c1b19; padding: 1.2mm 2mm 1.2mm 0; }
table.data td { border-bottom: 0.3pt solid #cfccc3; padding: 1.3mm 2mm 1.3mm 0; vertical-align: top; }
table.data tr { break-inside: avoid; }
table.dense { font-size: 7.3pt; } table.dense td, table.dense th { padding-right: 1.4mm; }
.note { border-left: 2.2pt solid #c9a45c; background: #f7f3e8; padding: 2.6mm 3.5mm; font-size: 8.8pt; margin: 2mm 0 3mm; break-inside: avoid; }
.note.warn { border-left-color: #b3261e; background: #fbeeec; }
.keep, .cols, figure, .check, .why { break-inside: avoid; }
.step, .stage { display: grid; grid-template-columns: 88mm 1fr; gap: 6mm; padding: 4mm 0 2mm; border-top: 0.4pt solid #cfccc3; break-inside: avoid; }
.step .wide { grid-column: 1 / -1; max-width: 150mm; margin: 1mm auto 0; }
.stage { grid-template-columns: 66mm 1fr; }
.stage-pics { display: grid; gap: 3mm; }
.step-head { display: flex; align-items: baseline; gap: 2.5mm; flex-wrap: wrap; margin-bottom: 1.6mm; }
.num { display: inline-grid; place-items: center; min-width: 6.4mm; height: 6.4mm; border-radius: 3.2mm; background: #2f6b2f; color: #fff; font-weight: 700; font-size: 9pt; padding: 0 1.5mm; }
.meta { font-size: 7.8pt; color: #6a675f; flex-basis: 100%; }
.chips { margin: 0 0 2mm; } .chip { display: inline-block; border: 0.5pt solid #9a978e; border-radius: 3mm; padding: 0.2mm 2.2mm; font-size: 7.8pt; margin: 0 1.2mm 1.2mm 0; background: #fff; }
.why { font-size: 8.4pt; color: #45423c; margin: 0 0 2mm; } .why ul { margin: 0.6mm 0 0; } .why li { margin-bottom: 0.5mm; }
.check { font-size: 8.6pt; background: #eef4ea; border-radius: 1.2mm; padding: 1.8mm 2.6mm; } .check b { color: #2f6b2f; margin-right: 1.5mm; }
.stl-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 1mm 2mm; margin: 0 0 3mm; } .stl-grid figcaption { text-align: center; font-size: 6.6pt; margin: 0; }
.leafstrip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1.5mm; } .leafstrip figcaption { text-align: center; }
'''
def copy_images():
"""The guides load photos from img/ beside the HTML, so copy the assets there."""
dst = OUT / 'img'
if dst.exists(): shutil.rmtree(dst)
shutil.copytree(ASSETS / 'img', dst)
def build(kind):
body = C.construction() if kind == 'build' else C.painting()
title = 'Green Man mask · build guide' if kind == 'build' else 'Green Man mask · painting guide'
html = f'<!doctype html><html lang="en"><head><meta charset="utf-8"><title>{title}</title><style>{fonts.CSS}{CSS}</style></head><body>{body}</body></html>'
copy_images(); src = str(OUT / f'_{kind}.html'); open(src, 'w').write(html)
out = str(OUT / f'GreenMan_{"build" if kind == "build" else "painting"}_guide.pdf')
asyncio.run(shot.go(src, out, footer=title)); return out
if __name__ == '__main__':
for k in ('build', 'paint'): print(build(k))