diff options
| -rw-r--r-- | flake.nix | 2 | ||||
| -rw-r--r-- | org/config_nix.org | 2 | ||||
| -rw-r--r-- | org/out_src_pod.org | 41 | ||||
| -rw-r--r-- | src/sisudoc/outputs/io_out/source_pod.d | 41 |
4 files changed, 86 insertions, 0 deletions
@@ -289,6 +289,8 @@ texliveFull # NOT texlive.combined.scheme-full: deprecated, file # what a file is coreutils # sha256sum and numfmt guaranteed, for checking a digests.txt line by hand + po4a + gettext ]; }; }); diff --git a/org/config_nix.org b/org/config_nix.org index 6fb82ad..f2bc085 100644 --- a/org/config_nix.org +++ b/org/config_nix.org @@ -312,6 +312,8 @@ texliveFull # NOT texlive.combined.scheme-full: deprecated, file # what a file is coreutils # sha256sum and numfmt guaranteed, for checking a digests.txt line by hand + po4a + gettext ]; }; }); diff --git a/org/out_src_pod.org b/org/out_src_pod.org index 7efc52a..8668078 100644 --- a/org/out_src_pod.org +++ b/org/out_src_pod.org @@ -127,6 +127,7 @@ import std.zip; import std.conv : to; import sisudoc.ocda.meta.rgx_files; import sisudoc.outputs.io_out; +import sisudoc.ocda.io_in.carried_names; import sisudoc.outputs.io_out.zip_pod; import sisudoc.outputs.io_out.xmls; #+END_SRC @@ -290,6 +291,46 @@ auto pod_zipMakeReady(M,P,S)(M doc_matters, P pths_pod, S _st) { writeln("WARNING (io) src out NOT found (document make): ", fn_src_in); } } + } { /+ ↓ bundle tools/po4a, the translation working set + . + A directory walk, where every other thing the pod writer carries + is named. A catalogue set is whatever the translator has, and + naming .pot and .po files would mean the writer knowing the + document's languages a second time, from a second place, to say + what it already reads from the manifest. + . + Done once, on the last language, as the markup blocks are. + . + Every name is checked before it is carried, by the rule the pod + reader applies to an archive it is handed. The writer is reading a + directory someone else may have filled. + +/ + if (doc_matters.src.is_pod + && doc_matters.src.language == doc_matters.pod.manifest_list_of_languages[$-1] + ) { + mixin spineCarriedNames; + enum string _po4a_root = "tools/po4a"; + string _tools_in = doc_matters.pod.manifest_path ~ "/" ~ _po4a_root; + if (exists(_tools_in) && _tools_in.isDir) { + foreach (string _f; dirEntries(_tools_in, SpanMode.depth)) { + if (!(_f.isFile)) { continue; } + string _rel = _po4a_root ~ "/" ~ _f[(_tools_in.length + 1) .. $]; + string _bad = validateCarriedPath(_rel); + if (_bad.length > 0) { + writeln("WARNING not carried into the pod: ", _bad); + continue; + } + if (doc_matters.opt.action.source_or_pod) { + string _out_fs = pths_pod.pod_root(doc_matters.src.filename) + .filesystem_open_zpod.to!string ~ "/" ~ _rel; + string _parent = _out_fs.dirName; + if (!exists(_parent)) { _parent.mkdirRecurse; } + _f.copy(_out_fs); + zip = podArchive("file_path_bin", _f, "pod/" ~ _rel, zip); + } + } + } + } } { // pod manifest auto fn_src_in = doc_matters.src.file_with_absolute_path.to!string; auto fn_src_out_pod_zip_base diff --git a/src/sisudoc/outputs/io_out/source_pod.d b/src/sisudoc/outputs/io_out/source_pod.d index bfbad70..4730bf2 100644 --- a/src/sisudoc/outputs/io_out/source_pod.d +++ b/src/sisudoc/outputs/io_out/source_pod.d @@ -58,6 +58,7 @@ template spinePod() { import std.conv : to; import sisudoc.ocda.meta.rgx_files; import sisudoc.outputs.io_out; + import sisudoc.ocda.io_in.carried_names; import sisudoc.outputs.io_out.zip_pod; import sisudoc.outputs.io_out.xmls; void spinePod(T)(T doc_matters) { @@ -321,6 +322,46 @@ template spinePod() { writeln("WARNING (io) src out NOT found (document make): ", fn_src_in); } } + } { /+ ↓ bundle tools/po4a, the translation working set + . + A directory walk, where every other thing the pod writer carries + is named. A catalogue set is whatever the translator has, and + naming .pot and .po files would mean the writer knowing the + document's languages a second time, from a second place, to say + what it already reads from the manifest. + . + Done once, on the last language, as the markup blocks are. + . + Every name is checked before it is carried, by the rule the pod + reader applies to an archive it is handed. The writer is reading a + directory someone else may have filled. + +/ + if (doc_matters.src.is_pod + && doc_matters.src.language == doc_matters.pod.manifest_list_of_languages[$-1] + ) { + mixin spineCarriedNames; + enum string _po4a_root = "tools/po4a"; + string _tools_in = doc_matters.pod.manifest_path ~ "/" ~ _po4a_root; + if (exists(_tools_in) && _tools_in.isDir) { + foreach (string _f; dirEntries(_tools_in, SpanMode.depth)) { + if (!(_f.isFile)) { continue; } + string _rel = _po4a_root ~ "/" ~ _f[(_tools_in.length + 1) .. $]; + string _bad = validateCarriedPath(_rel); + if (_bad.length > 0) { + writeln("WARNING not carried into the pod: ", _bad); + continue; + } + if (doc_matters.opt.action.source_or_pod) { + string _out_fs = pths_pod.pod_root(doc_matters.src.filename) + .filesystem_open_zpod.to!string ~ "/" ~ _rel; + string _parent = _out_fs.dirName; + if (!exists(_parent)) { _parent.mkdirRecurse; } + _f.copy(_out_fs); + zip = podArchive("file_path_bin", _f, "pod/" ~ _rel, zip); + } + } + } + } } { // pod manifest auto fn_src_in = doc_matters.src.file_with_absolute_path.to!string; auto fn_src_out_pod_zip_base |
