diff options
Diffstat (limited to 'org')
| -rw-r--r-- | org/in_source_files.org | 19 | ||||
| -rw-r--r-- | org/out_src_abstraction_ocda_peg_ssp.org | 11 | ||||
| -rw-r--r-- | org/out_src_abstraction_sqlite_db.org | 9 | ||||
| -rw-r--r-- | org/spine.org | 10 |
4 files changed, 41 insertions, 8 deletions
diff --git a/org/in_source_files.org b/org/in_source_files.org index 0f50150..0a87ec4 100644 --- a/org/in_source_files.org +++ b/org/in_source_files.org @@ -930,11 +930,16 @@ template spineAbstractionRead() { obj.metainfo.identifier = _tail[_sp + 1 .. $]; } else { obj.metainfo.heading_lev_markup = _levOfMarkedUp(_tail); - obj.metainfo.identifier = obj.metainfo.ocn.to!string; + /+ ↓ omitted means it equals the ocn, and for an object with no ocn + it was empty: "a"~N identifiers are always written + +/ + obj.metainfo.identifier = (obj.metainfo.ocn != 0) + ? obj.metainfo.ocn.to!string : ""; } } else { obj.metainfo.is_a = _rest; - obj.metainfo.identifier = obj.metainfo.ocn.to!string; + obj.metainfo.identifier = (obj.metainfo.ocn != 0) + ? obj.metainfo.ocn.to!string : ""; } obj.metainfo.is_of_section = section; continue; @@ -1059,6 +1064,16 @@ template spineAbstractionRead() { } return doc; } + /+ ↓ the abstraction as it survives a trip through the .ssp text: emitted + as lines by the writer, read straight back. what a consumer built + from this cannot see, the .ssp does not carry, which is what makes a + second artefact built from it unable to drift + +/ + auto sspRoundTripAbstraction(D)(D doc) { + import sisudoc.ocda.abstraction.ssp; + mixin spineAbstractionTxt; + return sspRead(sspDocumentLines(doc)).abstraction; + } SSPdocument sspReadFile(string file_path) { string[] _lines; try { diff --git a/org/out_src_abstraction_ocda_peg_ssp.org b/org/out_src_abstraction_ocda_peg_ssp.org index 3be6ce2..a541513 100644 --- a/org/out_src_abstraction_ocda_peg_ssp.org +++ b/org/out_src_abstraction_ocda_peg_ssp.org @@ -396,7 +396,11 @@ template spineAbstractionTxt() { import std.string; import std.array; mixin sspObjectRecord; - void spineAbstractionTxt(D)(D doc) { + /+ ↓ the whole .ssp for a document, as lines. the file writer below emits + these, and the abstraction db is built by reading them back, so the + database cannot carry anything the .ssp does not + +/ + string[] sspDocumentLines(D)(D doc) { auto doc_abstraction = doc.abstraction; auto doc_matters = doc.matters; string[] output; @@ -538,6 +542,11 @@ template spineAbstractionTxt() { output ~= "}"; output ~= ""; } + return output; + } + void spineAbstractionTxt(D)(D doc) { + auto doc_matters = doc.matters; + string[] output = sspDocumentLines(doc); /+ ↓ write to file +/ /+ path: <output_path>/<language>/abstraction/<doc_uid_out>.ssp +/ string out_root = (doc_matters.output_path.length > 0) diff --git a/org/out_src_abstraction_sqlite_db.org b/org/out_src_abstraction_sqlite_db.org index 3daf045..6159fdd 100644 --- a/org/out_src_abstraction_sqlite_db.org +++ b/org/out_src_abstraction_sqlite_db.org @@ -42,9 +42,12 @@ template spineAbstractionDb() { import std.array; import d2sqlite3; import sisudoc.outputs.io_out.paths_output; - - void spineAbstractionDb(D)(D doc) { - auto doc_abstraction = doc.abstraction; + /+ ↓ the abstraction is passed in rather than taken from doc, because the + caller hands over one that has been through the .ssp: written as text + and read back. so the database is a function of the .ssp and cannot + carry anything the .ssp does not + +/ + void spineAbstractionDb(D,A)(D doc, A doc_abstraction) { auto doc_matters = doc.matters; /+ ↓ determine output path +/ diff --git a/org/spine.org b/org/spine.org index 722f235..84e4d04 100644 --- a/org/spine.org +++ b/org/spine.org @@ -1719,10 +1719,16 @@ if (doc.matters.opt.action.show_abstraction) { #+NAME: spine_each_file_show_abstraction_db #+BEGIN_SRC d -/+ ↓ document abstraction sqlite database +/ +/+ ↓ 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) { + import sisudoc.ocda.abstraction.ssp_in; import sisudoc.outputs.io_out.create_abstraction_db; - spineAbstractionDb!()(doc); + mixin spineAbstractionRead; + spineAbstractionDb!()(doc, sspRoundTripAbstraction(doc)); } #+END_SRC |
