You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
afm pins the renderer's CSS-class contract in crates/afm-markdown-test-support/src/lib.rs as the AFM_CLASSES
constant, maintained by hand. The file documents why (lib.rs:62-86): aozora-render embeds the aozora-* class names as string literals
inside writer.write_str(...) — there is no pub const to import — so
each new upstream class has to be appended here (and to the two mdbook
themes) when tests/css_class_contract.rs fails after an aozora-* pin
bump.
The same file (lib.rs:82-86) sketches the intended fix as a future ADR:
A dedicated automation pass (build.rs that fetches the sibling source
tree, regex-extracts class="aozora-…" literals, and emits an AFM_CLASSES const into OUT_DIR) is sketched as a future ADR — it
would eliminate the manual append step at the cost of a network /
filesystem dependency in the test build.
What to do
Eliminate the manual-append step. Two paths, in preference order:
Preferred — consume an upstream constant. If aozora-render
exposes its emitted class names as a pub const (tracked in feat(render): expose emitted CSS class names as a public constant aozora#91), AFM_CLASSES becomes a direct re-export with no
scraping and no build.rs. This is the cheap, robust outcome and makes
this issue mostly a follow-the-upstream task.
Fallback — local automation. If upstream does not expose it, write
the build.rs sketched above (fetch sibling source via cargo
metadata, regex-extract class="aozora-…", emit into OUT_DIR), and
record the network/filesystem-dependency trade-off in an ADR.
Either way, also keep crates/afm-book/theme/afm-{horizontal,vertical}.css
in sync — consider deriving/checking the themes' class coverage from the
same source of truth.
Background
afm pins the renderer's CSS-class contract in
crates/afm-markdown-test-support/src/lib.rsas theAFM_CLASSESconstant, maintained by hand. The file documents why (lib.rs:62-86):
aozora-renderembeds theaozora-*class names as string literalsinside
writer.write_str(...)— there is nopub constto import — soeach new upstream class has to be appended here (and to the two mdbook
themes) when
tests/css_class_contract.rsfails after anaozora-*pinbump.
The same file (lib.rs:82-86) sketches the intended fix as a future ADR:
What to do
Eliminate the manual-append step. Two paths, in preference order:
aozora-renderexposes its emitted class names as a
pub const(tracked infeat(render): expose emitted CSS class names as a public constant aozora#91),
AFM_CLASSESbecomes a direct re-export with noscraping and no build.rs. This is the cheap, robust outcome and makes
this issue mostly a follow-the-upstream task.
the
build.rssketched above (fetch sibling source via cargometadata, regex-extract
class="aozora-…", emit intoOUT_DIR), andrecord the network/filesystem-dependency trade-off in an ADR.
Either way, also keep
crates/afm-book/theme/afm-{horizontal,vertical}.cssin sync — consider deriving/checking the themes' class coverage from the
same source of truth.
References
crates/afm-markdown-test-support/src/lib.rs:62-86(manual mirror +future-ADR sketch)
crates/afm-markdown/tests/css_class_contract.rs(the drift gate)(
feat(render): expose emitted CSS class names as a public constant)