diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2026-09-08 17:30:00 -0400 |
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2026-09-09 19:03:54 -0400 |
| commit | 557810df54fb5411c362528b459648611e8267ba (patch) | |
| tree | f93054bbf53b5ae4a84ec341e42d8e076a82b812 /src/sisudoc | |
| parent | output: the abstraction artefacts live with the pod (diff) | |
--ocda-db replaces --show-abstraction-db
ocda (object centric document abstraction)
flag --ocda-db (or --abstraction-db)
replaces --show-abstraction-db
rename results in consequently large diff
Diffstat (limited to 'src/sisudoc')
| -rw-r--r-- | src/sisudoc/ocda/abstraction/db_in.d | 2 | ||||
| -rw-r--r-- | src/sisudoc/outputs/io_out/create_ocda_db.d (renamed from src/sisudoc/outputs/io_out/create_abstraction_db.d) | 2 | ||||
| -rw-r--r-- | src/sisudoc/outputs/io_out/metadata.d | 2 | ||||
| -rw-r--r-- | src/sisudoc/outputs/io_out/source_pod.d | 28 | ||||
| -rw-r--r-- | src/sisudoc/spine.d | 32 |
5 files changed, 43 insertions, 23 deletions
diff --git a/src/sisudoc/ocda/abstraction/db_in.d b/src/sisudoc/ocda/abstraction/db_in.d index f223f6d..0da123d 100644 --- a/src/sisudoc/ocda/abstraction/db_in.d +++ b/src/sisudoc/ocda/abstraction/db_in.d @@ -51,7 +51,7 @@ module sisudoc.ocda.abstraction.db_in; @safe: /+ ↓ read a <doc>.ocda.db back into the document abstraction - the counterpart of sisudoc.outputs.io_out.create_abstraction_db, and the + the counterpart of sisudoc.outputs.io_out.create_ocda, and the sibling of sisudoc.ocda.abstraction.ssp_in: it returns the same value, so a consumer does not have to know which of the two artefacts it was handed. diff --git a/src/sisudoc/outputs/io_out/create_abstraction_db.d b/src/sisudoc/outputs/io_out/create_ocda_db.d index 9b1af4d..a47db7a 100644 --- a/src/sisudoc/outputs/io_out/create_abstraction_db.d +++ b/src/sisudoc/outputs/io_out/create_ocda_db.d @@ -47,7 +47,7 @@ [https://git.sisudoc.org/] +/ -module sisudoc.outputs.io_out.create_abstraction_db; +module sisudoc.outputs.io_out.create_ocda_db; /+ ↓ write document abstraction as per-document sqlite3 database +/ template spineAbstractionDb() { diff --git a/src/sisudoc/outputs/io_out/metadata.d b/src/sisudoc/outputs/io_out/metadata.d index f2aaa53..853fb83 100644 --- a/src/sisudoc/outputs/io_out/metadata.d +++ b/src/sisudoc/outputs/io_out/metadata.d @@ -529,7 +529,7 @@ string theme_light_1 = format(q"┃ writeln("WARNING, source doc_matters.src.filename_base not found: ", doc_matters.src.filename_base, ".zip\n ", fn_pod); } } - if (doc_matters.opt.action.show_abstraction_db) { + if (doc_matters.opt.action.ocda_db) { try { // sha digest and size for the abstraction database, beside the pod string _db_fn = pths_pod.pod_dir_() ~ "/" ~ doc_matters.src.doc_uid_out ~ ".ocda.db"; diff --git a/src/sisudoc/outputs/io_out/source_pod.d b/src/sisudoc/outputs/io_out/source_pod.d index 0ed26db..0b014ca 100644 --- a/src/sisudoc/outputs/io_out/source_pod.d +++ b/src/sisudoc/outputs/io_out/source_pod.d @@ -77,11 +77,15 @@ template spinePod() { regeneration, but only on the first language of a multi-language document, so that subsequent languages' files are not wiped. . - media/abstraction/ is left alone: the .ssp files there are written - by the abstraction stage, which runs before this, and for a - multi-language document they accumulate one language at a time. - That directory clears itself, in the .ssp writer, on the first - language of a run. + media/abstraction/ is left standing: the .ssp files there are + written by the abstraction stage, which runs before this, and for + a multi-language document they accumulate one language at a time. + What is pruned from it instead is any .ssp that does not belong to + a language this document has, which would otherwise linger from an + earlier run and be bundled. That is done here rather than in the + writer because pod actions run serially and the manifest's list of + languages is to hand, where the writer may be one of several + languages running at once. +/ if (doc_matters.src.language == doc_matters.pod.manifest_list_of_languages[0]) { string doc_pod_dir = pths_pod.base_filesystem_(doc_matters.src.filename); @@ -103,6 +107,20 @@ template spinePod() { } } } + if (exists(keep_dir) && keep_dir.isDir) { + string _doc_uid_base + = doc_matters.src.doc_uid_out[0 .. $ - doc_matters.src.lng.length]; + foreach (string _f; dirEntries(keep_dir, "*.ssp", SpanMode.shallow)) { + bool _wanted = false; + foreach (_lang; doc_matters.pod.manifest_list_of_languages) { + if (_f.baseName == (_doc_uid_base ~ _lang ~ ".ssp")) { + _wanted = true; + break; + } + } + if (!_wanted) { _f.remove; } + } + } } { podArchive_directory_tree(doc_matters, pths_pod); diff --git a/src/sisudoc/spine.d b/src/sisudoc/spine.d index 1c68045..568a102 100644 --- a/src/sisudoc/spine.d +++ b/src/sisudoc/spine.d @@ -115,6 +115,7 @@ string program_name = "spine"; } bool[string] opts = [ "abstraction" : false, + "abstraction-db" : false, "allow-downloads" : false, "assertions" : false, "concordance" : false, @@ -156,6 +157,7 @@ string program_name = "spine"; "manifest" : false, "hide-ocn" : false, "no-ocn" : false, + "ocda-db" : false, "ocn-off" : false, "odf" : false, "odt" : false, @@ -168,7 +170,6 @@ string program_name = "spine"; "pod2" : false, "serial" : false, "show-abstraction" : false, - "show-abstraction-db" : false, "show-config" : false, "show-curate" : false, "show-curate-authors" : false, @@ -238,6 +239,7 @@ string program_name = "spine"; auto helpInfo = getopt(args, std.getopt.config.passThrough, "abstraction", "document abstraction", &opts["abstraction"], + "abstraction-db", "document abstraction (write ocda.db sqlite file)", &opts["abstraction-db"], "allow-downloads", "allow downloads (includes cgi.d from github)", &opts["allow-downloads"], "assert", "set optional assertions on", &opts["assertions"], "cgi-bin-root", "path to cgi-bin directory", &settings["cgi-bin-root"], @@ -272,6 +274,7 @@ string program_name = "spine"; "light", "default light theme", &opts["light"], "manifest", "process manifest output", &opts["manifest"], "no-ocn", "object cite numbers", &opts["no-ocn"], + "ocda-db", "document abstraction (write ocda.db sqlite file)", &opts["ocda-db"], "ocn-off", "object cite numbers", &opts["ocn-off"], "odf", "open document format text (--odt)", &opts["odf"], "odt", "open document format text", &opts["odt"], @@ -298,7 +301,6 @@ string program_name = "spine"; "serial", "serial processing", &opts["serial"], "skip-output", "skip output", &opts["skip-output"], "show-abstraction", "show document abstraction (write .ssp file)", &opts["show-abstraction"], - "show-abstraction-db", "show document abstraction (write .db sqlite file)", &opts["show-abstraction-db"], "show-config", "show config", &opts["show-config"], "show-curate", "show curate", &opts["show-curate"], "show-curate-authors", "show curate authors", &opts["show-curate-authors"], @@ -590,11 +592,14 @@ string program_name = "spine"; @trusted bool latex_document_header_sty() { return (opts["latex-init"] || opts["latex-header-sty"] || opts["pdf-init"]) ? true : false; } + @trusted bool odt() { + return (opts["odf"] || opts["odt"]) ? true : false; + } @trusted bool manifest() { return opts["manifest"]; } - @trusted bool odt() { - return (opts["odf"] || opts["odt"]) ? true : false; + @trusted bool ocda_db() { + return (opts["abstraction-db"] || opts["ocda-db"]) ? true : false; } @trusted bool ocn_hidden() { return opts["hide-ocn"]; @@ -614,9 +619,6 @@ string program_name = "spine"; @trusted bool show_abstraction() { return (opts["show-abstraction"] || pod2) ? true : false; } - @trusted bool show_abstraction_db() { - return opts["show-abstraction-db"]; - } @trusted bool show_curate() { return opts["show-curate"]; } @@ -866,7 +868,7 @@ string program_name = "spine"; return ( opts["abstraction"] || show_abstraction - || show_abstraction_db + || ocda_db || concordance || source_or_pod || curate @@ -894,7 +896,7 @@ string program_name = "spine"; || odt || manifest || show_abstraction - || show_abstraction_db + || ocda_db || show_make || show_metadata || show_summary @@ -910,7 +912,7 @@ string program_name = "spine"; return ( opts["abstraction"] || show_abstraction - || show_abstraction_db + || ocda_db || curate || html || epub @@ -926,7 +928,7 @@ string program_name = "spine"; return ( opts["abstraction"] || show_abstraction - || show_abstraction_db + || ocda_db || html || epub || odt @@ -1440,9 +1442,9 @@ string program_name = "spine"; come out are what is written, so the database cannot carry anything the .ssp does not +/ - if (doc.matters.opt.action.show_abstraction_db) { + if (doc.matters.opt.action.ocda_db) { import sisudoc.ocda.abstraction.ssp_in; - import sisudoc.outputs.io_out.create_abstraction_db; + import sisudoc.outputs.io_out.create_ocda_db; mixin spineAbstractionRead; spineAbstractionDb!()(doc, sspRoundTripAbstraction(doc)); } @@ -1555,9 +1557,9 @@ string program_name = "spine"; come out are what is written, so the database cannot carry anything the .ssp does not +/ - if (doc.matters.opt.action.show_abstraction_db) { + if (doc.matters.opt.action.ocda_db) { import sisudoc.ocda.abstraction.ssp_in; - import sisudoc.outputs.io_out.create_abstraction_db; + import sisudoc.outputs.io_out.create_ocda_db; mixin spineAbstractionRead; spineAbstractionDb!()(doc, sspRoundTripAbstraction(doc)); } |
