split the theme's fragments into a directory, keeping the file form

One file held every fragment, and it gained one per feature all session: figure,
gallery, icon, three admonitions, details, aside, contents. A theme author
overriding one had to copy the file or redefine into it, and a diff of the theme
became a diff of everything.

Both forms are supported, because a small theme is happier with one file and the
contract should not force a directory on it. Parse order is embedded file,
embedded directory, site file, site directory, and the last definition wins — so
the directory overrides the file within one source and a site overrides the
binary either way. Verified with a site root using both at once: its
shortcodes.html supplied `icon`, its shortcodes/note.html supplied `note`, the
embedded directory supplied the rest, and with the same name in both the
directory won.

The embedded theme ships the directory only, seven files, so nothing is defined
twice.

parseSet takes globs now and lost a branch doing it. Its old guard — a literal
embedded name must exist — had to go, since shortcodes.html is deliberately
absent; the replacement is stronger, failing at startup when a set matches
nothing anywhere, which also catches a renamed base.html.
This commit is contained in:
Claude Opus 5
2026-08-01 23:39:12 +06:00
committed by bdeshi
parent 4f706f1c35
commit 1b898fdfc3
15 changed files with 143 additions and 110 deletions
@@ -0,0 +1,6 @@
{{/* An expandable section, and tabs, from one template. `<details>` needs no script; siblings sharing a
`group` become mutually exclusive through the native `name` attribute, which is what tabs are. A
browser too old for grouping simply opens them independently — the content is never hidden. */}}
{{define "details"}}<details{{with .Args.group}} name="{{.}}"{{end}}{{if .Args.open}} open{{end}}>
<summary>{{with .Args.summary}}{{.}}{{else}}{{with $.Args.title}}{{.}}{{else}}{{t $.Lang "details"}}{{end}}{{end}}</summary>
{{.Body}}</details>{{end}}