aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sisudoc/outputs/io_out/hub.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2026-09-21 10:29:15 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2026-09-22 14:14:40 -0400
commitb65fb777715cd02e52286ea11422c6c5e828291c (patch)
treee23abedb96c766c729d4d985c50d496271688448 /src/sisudoc/outputs/io_out/hub.d
parentpod: carry tools/po4a, the translation working set (diff)
pod: generate the po4a configuration, --po4a-cfg
A document's po4a configuration is derived rather than kept. Spine already knows both halves without looking: the manifest says which languages, and the markup says which files, through the << lines the parser follows. Derived, it cannot disagree with the document, where a hand-kept file eventually does: a language added to the manifest and forgotten in the Makefile is a translation nobody updates. It prints, rather than writing. Spine does not write into a source tree, and the file belongs beside the catalogues in the pod it describes: spine --po4a-cfg <pod> > <pod>/tools/po4a/po4a.cfg Three things the Makefile it replaces knew, which had to be found by running po4a rather than by reading: --keep 0 is the difference between regenerating a document and destroying it. po4a will not write a translated file below a completeness threshold, and that threshold defaults to 80%. A partly translated document is the normal state of one being worked on, and sisu covers it: an untranslated string falls back to the source text. Measured at the default, 181 of live-manual's 189 translated files would be discarded, and nine languages would collapse to eight surviving files, reading as the document reverting to its source language rather than as a failure. index.html.in is not markup and no << line names it, so a configuration built from the manifest and the insert list alone drops it, and with it index.html.in.pot and its nine .po files at the next regeneration. It is found by asking whether the source language has one. neverwrap is not set, and the measurement is recorded beside the code: setting it turns 889 of 1126 strings fuzzy in four languages, and po4a does not use a fuzzy translation, so Catalan's coverage would fall from about 46% to about 12%. Tidy formatting is not worth that. The run-complete banner is suppressed for this action. The configuration goes to stdout and the banner would otherwise be part of the file, which is what the round trips already avoid by leaving early; this one prints from inside output processing and cannot. (assisted by Claude-Code)
Diffstat (limited to 'src/sisudoc/outputs/io_out/hub.d')
-rw-r--r--src/sisudoc/outputs/io_out/hub.d15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/sisudoc/outputs/io_out/hub.d b/src/sisudoc/outputs/io_out/hub.d
index 0973097..254eaa5 100644
--- a/src/sisudoc/outputs/io_out/hub.d
+++ b/src/sisudoc/outputs/io_out/hub.d
@@ -62,6 +62,21 @@ template outputHub() {
@system void outputHub(D)(D doc) {
mixin Msg;
auto msg = Msg!()(doc.matters);
+ /+ ↓ the po4a configuration, printed rather than written.
+ Spine does not write into a source tree, and this belongs beside the
+ catalogues in the pod it describes, so it goes to stdout for the
+ caller to put where they want it:
+ spine --po4a-cfg <pod> > <pod>/tools/po4a/po4a.cfg
+ Once per document, not once per language: it is generated from the
+ source language's files and names every other language itself.
+ +/
+ if (doc.matters.opt.action.po4a_cfg
+ && doc.matters.src.language == doc.matters.pod.manifest_list_of_languages[0]
+ ) {
+ import sisudoc.outputs.io_out.po4a_cfg;
+ mixin spinePo4aConfig;
+ write(po4aConfig(doc.matters));
+ }
enum outTask { source_or_pod, sqlite, sqlite_multi, latex, odt, epub, html_scroll, html_seg, html_stuff, text, skel }
void Scheduled(D)(int sched, D doc) {
auto msg = Msg!()(doc.matters);