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 /org | |
| 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 'org')
| -rw-r--r-- | org/in_source_files.org | 2 | ||||
| -rw-r--r-- | org/out_metadata.org | 2 | ||||
| -rw-r--r-- | org/out_src_abstraction_sqlite_db.org | 4 | ||||
| -rw-r--r-- | org/out_src_pod.org | 28 | ||||
| -rw-r--r-- | org/spine.org | 32 | ||||
| -rw-r--r-- | org/tests_for_document_abstraction_shell_scripts.org | 13 |
6 files changed, 54 insertions, 27 deletions
diff --git a/org/in_source_files.org b/org/in_source_files.org index dc6571e..2f12196 100644 --- a/org/in_source_files.org +++ b/org/in_source_files.org @@ -1098,7 +1098,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/org/out_metadata.org b/org/out_metadata.org index 71bfe9f..19bc02e 100644 --- a/org/out_metadata.org +++ b/org/out_metadata.org @@ -195,7 +195,7 @@ if (doc_matters.opt.action.html_link_markup_source) { 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/org/out_src_abstraction_sqlite_db.org b/org/out_src_abstraction_sqlite_db.org index 9144fdd..6befb4f 100644 --- a/org/out_src_abstraction_sqlite_db.org +++ b/org/out_src_abstraction_sqlite_db.org @@ -25,11 +25,11 @@ rename source_abstraction_peg_txt.d -#+HEADER: :tangle "../src/sisudoc/outputs/io_out/create_abstraction_db.d" +#+HEADER: :tangle "../src/sisudoc/outputs/io_out/create_ocda_db.d" #+HEADER: :noweb yes #+BEGIN_SRC d <<doc_header_including_copyright_and_license>> -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/org/out_src_pod.org b/org/out_src_pod.org index b987151..94094ae 100644 --- a/org/out_src_pod.org +++ b/org/out_src_pod.org @@ -37,11 +37,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); @@ -63,6 +67,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/org/spine.org b/org/spine.org index 2d969e1..51926d5 100644 --- a/org/spine.org +++ b/org/spine.org @@ -289,6 +289,7 @@ scope(failure) { #+BEGIN_SRC d bool[string] opts = [ "abstraction" : false, + "abstraction-db" : false, "allow-downloads" : false, "assertions" : false, "concordance" : false, @@ -330,6 +331,7 @@ bool[string] opts = [ "manifest" : false, "hide-ocn" : false, "no-ocn" : false, + "ocda-db" : false, "ocn-off" : false, "odf" : false, "odt" : false, @@ -342,7 +344,6 @@ bool[string] opts = [ "pod2" : false, "serial" : false, "show-abstraction" : false, - "show-abstraction-db" : false, "show-config" : false, "show-curate" : false, "show-curate-authors" : false, @@ -426,6 +427,7 @@ string[string] settings = [ 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"], @@ -460,6 +462,7 @@ auto helpInfo = getopt(args, "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"], @@ -486,7 +489,6 @@ auto helpInfo = getopt(args, "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"], @@ -791,11 +793,14 @@ struct OptActions { @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"]; @@ -815,9 +820,6 @@ struct OptActions { @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"]; } @@ -1067,7 +1069,7 @@ struct OptActions { return ( opts["abstraction"] || show_abstraction - || show_abstraction_db + || ocda_db || concordance || source_or_pod || curate @@ -1095,7 +1097,7 @@ struct OptActions { || odt || manifest || show_abstraction - || show_abstraction_db + || ocda_db || show_make || show_metadata || show_summary @@ -1111,7 +1113,7 @@ struct OptActions { return ( opts["abstraction"] || show_abstraction - || show_abstraction_db + || ocda_db || curate || html || epub @@ -1127,7 +1129,7 @@ struct OptActions { return ( opts["abstraction"] || show_abstraction - || show_abstraction_db + || ocda_db || html || epub || odt @@ -1668,7 +1670,7 @@ if ((doc.matters.opt.action.debug_do) <<spine_each_file_do_debugs_checkdoc_2>> <<spine_each_file_do_debugs_checkdoc_3>> <<spine_each_file_show_abstraction_peg>> -<<spine_each_file_show_abstraction_db>> +<<spine_each_file_ocda_db>> <<spine_each_file_do_debugs_checkdoc_4>> <<spine_each_file_do_debugs_checkdoc_5>> #+END_SRC @@ -1735,16 +1737,16 @@ if (doc.matters.opt.action.show_abstraction) { ***** show abstraction (sqlite db) --show-abstraction-db -#+NAME: spine_each_file_show_abstraction_db +#+NAME: spine_each_file_ocda_db #+BEGIN_SRC d /+ ↓ document abstraction sqlite database, built from the .ssp: the lines are emitted and read straight back, and the objects that 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)); } diff --git a/org/tests_for_document_abstraction_shell_scripts.org b/org/tests_for_document_abstraction_shell_scripts.org index 4266e8c..1c93eed 100644 --- a/org/tests_for_document_abstraction_shell_scripts.org +++ b/org/tests_for_document_abstraction_shell_scripts.org @@ -87,19 +87,26 @@ test-abstraction-db-roundtrip.sh" PASSED=0 FAILED=0 RESULTS="" +LOG="${TMPDIR:-/tmp}/spine-run-tests.$$" for t in $TESTS; do printf '%s\n' "── $t" - if sh "$SCRIPT_DIR/$t" $SPINE_BIN 2>&1 | sed 's/^/ /'; then + # the status has to be the test's, not the last command of a pipeline: + # "cmd | sed" reports sed's status, which is always 0, and a harness that + # cannot fail is worse than no harness + if sh "$SCRIPT_DIR/$t" $SPINE_BIN > "$LOG" 2>&1; then + sed 's/^/ /' "$LOG" PASSED=$((PASSED + 1)) RESULTS="$RESULTS ok $t" else + sed 's/^/ /' "$LOG" FAILED=$((FAILED + 1)) RESULTS="$RESULTS FAIL $t" fi done +rm -f "$LOG" echo "" echo "summary:$RESULTS" @@ -372,7 +379,7 @@ echo "samples: $SAMPLES_DIR" echo "Generating .ssp and .ocda.db ..." rm -rf "$OUT_DIR" mkdir -p "$OUT_DIR" -$SPINE_BIN --show-abstraction --show-abstraction-db --skip-output \ +$SPINE_BIN --show-abstraction --ocda-db --skip-output \ --output="$OUT_DIR" "$SAMPLES_DIR"/* 2>&1 | tail -1 FAILURES=0 @@ -692,7 +699,7 @@ mkdir -p "$OUT_DIR" echo "spine binary: $SPINE_BIN" echo "samples: $SAMPLES_DIR" echo "Generating .ssp and .ocda.db ..." -$SPINE_BIN --show-abstraction --show-abstraction-db --skip-output \ +$SPINE_BIN --show-abstraction --ocda-db --skip-output \ --output="$OUT_DIR" "$SAMPLES_DIR"/* 2>&1 | tail -1 COUNT=0 |
