add the gallery shortcode and the seam it needed
A feature now learns which bundle is rendering: render.Bundle puts an Origin —
the bundle's directory plus the rooted fs.FS — on the parse context, and
render.OriginFrom reads it back. Available while parsing, not while rendering,
which decides where a feature does its filesystem work: goldmark hands the
context to a block parser and not to a node renderer, so gallery gathers its
filenames at parse time and carries them on the node.
Reads stay inside the site root because Origin passes the fs.FS rather than a
path to join (ADR-0031).
Fragment{Args, Items} lands with it (ADR-0037), so figure's template now reads
.Args.src. Authored arguments and engine-gathered items stay in separate fields:
a src argument beside a src the engine found would otherwise silently pick one.
A gallery is pictures beside the bundle, in filename order, skipping
subdirectories and anything a browser cannot show. Filename order is what makes
the sparse numeric-prefix convention work without numbers in URLs (ADR-0016).
New latent row: the reference theme's images carry no width/height and a
gallery's carry no alt, which is below the output floor conventions.md states.
Nothing can supply either yet — dimensions need the image read, and a filename is
not alt text. Queue 13 computes dimensions and brings structured items with it.
This commit is contained in:
@@ -1,8 +1,18 @@
|
||||
{{define "figure" -}}
|
||||
<figure>
|
||||
<img src="{{.src}}" alt="{{.alt}}">
|
||||
{{- if .caption}}
|
||||
<figcaption>{{.caption}}</figcaption>
|
||||
<img src="{{.Args.src}}" alt="{{.Args.alt}}">
|
||||
{{- if .Args.caption}}
|
||||
<figcaption>{{.Args.caption}}</figcaption>
|
||||
{{- end}}
|
||||
</figure>
|
||||
{{- end}}
|
||||
|
||||
{{define "gallery" -}}
|
||||
{{if .Items -}}
|
||||
<div class="gallery">
|
||||
{{- range .Items}}
|
||||
<figure><img src="{{.}}" alt=""></figure>
|
||||
{{- end}}
|
||||
</div>
|
||||
{{- end}}
|
||||
{{- end}}
|
||||
|
||||
Reference in New Issue
Block a user