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>
115 lines
10 KiB
Python
115 lines
10 KiB
Python
"""Web page version of both guides, plus downloads, as it is published on the builds site.
|
|
Photos, PDFs and the zips sit beside the page in img/ and dl/."""
|
|
import re
|
|
import content as C
|
|
from paths import OUT
|
|
|
|
SITE_NAME = "Kestrel's Builds"
|
|
URL = 'https://builds.kestrelsnest.social/greenman/'
|
|
DESCRIPTION = 'A half-mask of oak leaves, acorns and bark, built to be worn with glasses. Templates, print files, a build guide and a painting guide, free to download.'
|
|
OG_DESCRIPTION = 'A half-mask of oak leaves, acorns and bark, built to be worn with glasses. Everything you need to make your own.'
|
|
OG_ALT = 'A Green Man half-mask worn with glasses: a crown of painted oak leaves above a bark brow ridge, with acorns at the temples and a leaf over the nose.'
|
|
|
|
CSS = '''
|
|
/* Same ink, bone and gold as the builds index and Kestrel's Hall, and the same serif. Drawings stay on light paper with sans labels.
|
|
layout: one reading column of guide text; each step is a drawing beside its instructions, stacking on phones */
|
|
:root { --bg:#14181a; --surface:#1c2124; --fg:#e6dfcf; --muted:#a9a494; --line:#2c3236; --accent:#d2a94a; --accent-fg:#14181a; --bark:#d2a94a;
|
|
--note:#211f18; --warn:#2e1b19; --warn-fg:#f0988c; --ok:#1a231d; --paper:#ebe6d9; --paper-fg:#33382f;
|
|
--display:"Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif; --body:"Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif;
|
|
--sans:"Helvetica Neue",Helvetica,Arial,sans-serif; --mono:ui-monospace,"SF Mono",Menlo,monospace; }
|
|
html { background: var(--bg); color-scheme: dark; }
|
|
* { box-sizing: border-box; }
|
|
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 17px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
|
|
.wrap { max-width: 1060px; margin: 0 auto; padding-block: 28px 80px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
|
|
h1, h2, h3 { font-family: var(--display); font-weight: 400; text-wrap: balance; line-height: 1.12; margin: 0; }
|
|
h1 { font-size: clamp(2.3rem, 6vw, 3.6rem); letter-spacing: 0.01em; }
|
|
h2 { font-size: 1.6rem; padding-top: 18px; border-top: 1px solid var(--accent); margin-bottom: 12px; }
|
|
h3 { font-size: 1.3rem; font-weight: 500; }
|
|
p { margin: 0 0 12px; max-width: 68ch; } ul, ol { margin: 0 0 12px; padding-left: 1.3em; max-width: 68ch; } li { margin-bottom: 6px; }
|
|
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; } b, strong { font-weight: 600; } code { font-family: var(--mono); font-size: 0.86em; }
|
|
section { margin: 0 0 40px; min-width: 0; }
|
|
figure { margin: 0; min-width: 0; } figcaption { font-size: 0.8rem; color: var(--muted); margin-top: 6px; line-height: 1.35; }
|
|
img { border-radius: 6px; display: block; height: auto; max-width: 100%; }
|
|
.fig svg, .leafstrip svg { display: block; width: 100%; height: auto; background: var(--paper); border-radius: 6px; }
|
|
.fig svg text, .leafstrip svg text { font-family: var(--sans); }
|
|
nav.top { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 28px; }
|
|
nav.top a { text-decoration: none; border: 1px solid var(--line); background: var(--surface); color: var(--fg); padding: 7px 14px; border-radius: 999px; font-size: 0.92rem; }
|
|
nav.top a:hover, nav.top a:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; text-decoration: none; }
|
|
.cover { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 320px); gap: 32px; align-items: end; margin-bottom: 40px; }
|
|
.kicker { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.78rem; color: var(--accent); margin: 0 0 10px; }
|
|
.lead { font-size: 1.2rem; line-height: 1.5; color: var(--muted); margin-top: 14px; }
|
|
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; margin: 20px 0 0; }
|
|
.facts dt { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); } .facts dd { margin: 0; font-weight: 600; }
|
|
.guide-start { margin-top: 72px; }
|
|
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; align-items: start; margin-bottom: 14px; }
|
|
.tw { overflow-x: auto; margin: 0 0 14px; }
|
|
table.data { width: 100%; border-collapse: collapse; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
|
|
table.data th { text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); border-bottom: 1.5px solid var(--fg); padding: 6px 12px 6px 0; white-space: nowrap; }
|
|
table.data td { border-bottom: 1px solid var(--line); padding: 7px 12px 7px 0; vertical-align: top; }
|
|
table.dense { font-size: 0.8rem; min-width: 760px; }
|
|
.note { border-left: 3px solid var(--bark); background: var(--note); padding: 12px 16px; font-size: 0.93rem; margin: 10px 0 14px; border-radius: 0 6px 6px 0; }
|
|
.note.warn { border-left-color: var(--warn-fg); background: var(--warn); } .note.warn b { color: var(--warn-fg); }
|
|
.step, .stage { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 28px; padding: 22px 0 10px; border-top: 1px solid var(--line); }
|
|
.step .wide { grid-column: 1 / -1; max-width: 640px; }
|
|
.stage-pics { display: grid; gap: 14px; align-content: start; }
|
|
.step-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
|
|
.num { display: inline-grid; place-items: center; min-width: 28px; height: 28px; border-radius: 14px; background: var(--accent); color: var(--accent-fg); font-weight: 700; font-size: 0.85rem; padding: 0 6px; font-family: var(--sans); }
|
|
.meta { font-size: 0.82rem; color: var(--muted); flex-basis: 100%; }
|
|
.chips { margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 6px; } .chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 1px 10px; font-size: 0.8rem; }
|
|
.why { font-size: 0.88rem; color: var(--muted); margin: 0 0 10px; } .why ul { margin: 4px 0 0; }
|
|
.check { font-size: 0.9rem; background: var(--ok); border-radius: 6px; padding: 9px 12px; max-width: 68ch; } .check b { color: var(--accent); margin-right: 6px; }
|
|
.stl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; margin: 0 0 14px; }
|
|
.stl-grid figure { background: var(--paper); border-radius: 6px; padding: 4px 4px 8px; } .stl-grid figcaption { text-align: center; color: var(--paper-fg); margin: 0; font-size: 0.72rem; }
|
|
.leafstrip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; } .leafstrip figcaption { text-align: center; }
|
|
.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 10px; }
|
|
.dl .dlbtn { text-decoration: none; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; display: grid; gap: 4px; }
|
|
.dl .dlbtn:hover, .dl .dlbtn:focus-visible { border-color: var(--accent); outline: none; text-decoration: none; } .dl .dlbtn:hover b, .dl .dlbtn:focus-visible b { color: var(--accent); }
|
|
.dl .dlbtn b { font-family: var(--display); font-size: 1.2rem; font-weight: 500; } .dl .dlbtn span { font-size: 0.82rem; color: var(--muted); }
|
|
.home { margin: 0 0 24px; font-size: 0.95rem; } .home a { text-decoration: none; } .home a:hover, .home a:focus-visible { text-decoration: underline; }
|
|
.home.foot { margin: 48px 0 0; padding-top: 18px; border-top: 1px solid var(--line); }
|
|
@media (max-width: 760px) { .cover, .cols, .step, .stage { grid-template-columns: minmax(0, 1fr); } .cover-photo { max-width: 360px; } }
|
|
'''
|
|
|
|
def wrap_tables(h): return h.replace('<table', '<div class="tw"><table').replace('</table>', '</table></div>')
|
|
|
|
def build(out=str(OUT / 'index.html')):
|
|
body = C.construction(); paint_html = C.painting().replace('<header class="cover">', '<header class="cover guide-start" id="painting">').replace('<h1>Green Man mask</h1>', '<h1>Painting the mask</h1>')
|
|
dls = [('GreenMan_mask_kit.zip', 'Whole kit', 'Templates, both guides, and the 8 print files in one zip'), ('GreenMan_templates.pdf', 'Templates', '4 pages, 1:1, US Letter or A4'),
|
|
('GreenMan_build_guide.pdf', 'Build guide', 'Printable, for the workbench'), ('GreenMan_painting_guide.pdf', 'Painting guide', 'Printable'), ('GreenMan_print_files.zip', 'Print files', '8 STL files, no supports needed')]
|
|
downloads = ('<section id="downloads"><h2>Downloads</h2><div class="dl">' + ''.join(f'<a class="dlbtn" href="dl/{f}" download><b>{t}</b><span>{d}</span></a>' for f, t, d in dls) + '</div></section>')
|
|
nav = '<nav class="top" aria-label="Sections"><a href="#downloads">Downloads</a><a href="#build">Build guide</a><a href="#step-strip">Assembly steps</a><a href="#painting">Painting guide</a></nav>'
|
|
i = body.index('</header>') + len('</header>')
|
|
body = body[:i] + nav + downloads + '<div id="build"></div>' + body[i:]
|
|
home = '<p class="home"><a href="../">\u2190 Kestrel\u2019s Builds</a></p>'
|
|
foot = '<p class="home foot"><a href="../">\u2190 All builds at Kestrel\u2019s Builds</a></p>'
|
|
head = f'''<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Green Man Mask Kit</title>
|
|
<link rel="icon" href="../favicon.svg">
|
|
<meta name="description" content="{DESCRIPTION}">
|
|
<link rel="canonical" href="{URL}">
|
|
<meta property="og:type" content="article">
|
|
<meta property="og:site_name" content="{SITE_NAME}">
|
|
<meta property="og:title" content="Green Man mask">
|
|
<meta property="og:description" content="{OG_DESCRIPTION}">
|
|
<meta property="og:url" content="{URL}">
|
|
<meta property="og:image" content="{URL}og-image.jpg">
|
|
<meta property="og:image:width" content="1200">
|
|
<meta property="og:image:height" content="630">
|
|
<meta property="og:image:alt" content="{OG_ALT}">
|
|
<meta name="twitter:card" content="summary_large_image">
|
|
<meta name="theme-color" content="#14181a">
|
|
<style>{CSS}</style>
|
|
</head>
|
|
<body>
|
|
'''
|
|
page = f'{head}<div class="wrap">{home}{wrap_tables(body)}{wrap_tables(paint_html)}{foot}</div>\n\n</body>\n</html>\n'
|
|
page = re.sub(r'<img src="img/([^"]+)" alt="([^"]*)">', r'<img src="img/\1" alt="\2" loading="lazy">', page)
|
|
open(out, 'w', encoding='utf-8').write(page); return out
|
|
|
|
if __name__ == '__main__':
|
|
print(build())
|