annotate doc/design.md @ 0:71dd8d58a8e5 default tip

cleaned up re-init from net_wobblyhead_www project tooling
author ark
date 2026-10-22 14:59 +0200
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
1 # Design notes
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
2
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
3 ## Requirements
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
4
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
5 The generator was written for a personal site. It is mostly a gallery of
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
6 projects, with posts and links to other sites. Pages have tags, and the tags
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
7 are the navigation. Links to the site get shared, so pages need link preview
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
8 metadata. There are no comments and no other dynamic parts. The site is
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
9 updated about once a week at most.
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
10
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
11 The toolchain avoids Node.js and npm. Python with python-markdown and Pillow
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
12 is the whole dependency list. The build runs on the author's machine, and only
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
13 the finished output goes to the server.
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
14
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
15 The images are mostly JPEG photos from a phone, plus screenshots. They
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
16 document things; fidelity is not a goal. They do need the right orientation,
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
17 no location data in the published copies, and screenshots have to stay
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
18 legible.
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
19
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
20 Because the site changes rarely, few moving parts matter more than build
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
21 speed. Whoever comes back to it after months has to be able to read the whole
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
22 generator.
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
23
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
24 ## Decisions
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
25
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
26 ### Clean builds
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
27
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
28 The normal workflow is a clean build, followed by replacing the whole
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
29 published site with an archive of the output. Incremental builds are a
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
30 convenience during writing. They only compare the dates of sources and
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
31 outputs, and they never remove files. See [build.md](build.md).
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
32
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
33 ### Header blocks
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
34
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
35 A page starts with `key: value` lines, folded like mail headers. This is not
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
36 YAML: there is no quoting, no nesting and no fence. Every value is a string.
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
37 The site configuration uses the same format.
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
38
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
39 Unknown header keys are passed to the templates and produce a warning. The
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
40 warning catches typos. It does not restrict what keys a site may use: a key
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
41 stops warning once it is listed in the configuration.
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
42
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
43 ### Mirrored paths
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
44
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
45 The output tree mirrors the source tree. The generator creates no directories
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
46 of its own and gives `index.md` no special role. Navigation and directory
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
47 indexes are written by hand, or kept up to date with `update_index.py`.
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
48
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
49 ### Errors and warnings
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
50
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
51 An error stops the build. It is used only where no correct output is possible,
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
52 such as a page without a title. Everything else produces output and a
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
53 warning: broken links, unknown sizes, unknown keys. A build with warnings
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
54 still exits successfully.
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
55
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
56 ### Markdown
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
57
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
58 python-markdown with the `extra` bundle and `sane_lists`. `smarty` is off,
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
59 so quotes and dashes stay as written.
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
60
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
61 ### Images
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
62
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
63 Image sizes are requested in the file name of the reference, such as
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
64 `photo.800.jpg`, so the Markdown stays standard. The original is the name
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
65 without that part.
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
66
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
67 The format of an image is decided by its content, not by its extension. A
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
68 generated image keeps the format of its original. There is no format
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
69 conversion.
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
70
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
71 Phone photos may be stored sideways, with the rotation recorded only in the
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
72 Exif (Exchangeable Image File Format) data. Generated images have the rotation
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
73 applied to their pixels and contain no Exif data, so location and camera
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
74 details are not published. They keep the colour profile of the original,
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
75 because phone cameras record in a wider colour space than sRGB. Images are
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
76 never scaled up.
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
77
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
78 Files referenced verbatim, including the originals behind linked thumbnails,
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
79 are copied unchanged with all their metadata.
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
80
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
81 ### Link previews
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
82
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
83 Services that show a preview card for a shared link read tags in the page
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
84 head. There is no standard all of them follow. Most read the Open Graph tags,
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
85 X wants its own `twitter:card` tag, and search engines read the description
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
86 meta tag. Each one crops, sizes and caches the image in its own way. The
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
87 generator aims at a common set of tags that most of them understand.
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
88
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
89 The generator supplies the values; the templates write the tags. Preview
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
90 images are cut to 1200x630, the size Facebook and LinkedIn ask for.
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
91
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
92 Consumers fetch a page on their own, so the canonical address and the image
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
93 address are absolute. They are built from the production address in the
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
94 configuration. `make_dist.sh` replaces it in a copy of the output when an
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
95 archive is meant for another address, such as a test server.
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
96
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
97 ### Templates
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
98
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
99 Templates are plain HTML with value markers and two kinds of block: a
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
100 condition and a loop. Blocks of the same kind cannot be nested. Values are
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
101 HTML-escaped unless a filter says otherwise.
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
102
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
103 ### Accepted limitations
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
104
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
105 - A file name with dots can be read as a size request. A reference to
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
106 `my.photo.png` with no such file present is taken as a request for size
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
107 `photo` of `my.png`.
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
108 - Building a subset of the site into a clean directory produces link
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
109 warnings for everything outside the subset, and incomplete tag index pages.
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
110 - Files from `static/`, `tpl/` and `src/` are copied into one tree. Nothing
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
111 detects one of them overwriting another.
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
112 - A changed template or configuration does not cause a rebuild. A clean
71dd8d58a8e5 cleaned up re-init from net_wobblyhead_www project tooling
ark
parents:
diff changeset
113 build does.