diff options
Diffstat (limited to 'org/out_src_abstraction_ocda_peg_ssp.org')
| -rw-r--r-- | org/out_src_abstraction_ocda_peg_ssp.org | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/org/out_src_abstraction_ocda_peg_ssp.org b/org/out_src_abstraction_ocda_peg_ssp.org index a541513..0edad7d 100644 --- a/org/out_src_abstraction_ocda_peg_ssp.org +++ b/org/out_src_abstraction_ocda_peg_ssp.org @@ -84,6 +84,7 @@ template sspObjectRecord() { import std.stdio; import std.string; import std.array; + import sisudoc.ocda.io_in.paths_source; mixin sspEscape; string[] sspObjectRecord(O)(O obj, string section, bool _vox = false) { string[] output; @@ -395,6 +396,7 @@ template spineAbstractionTxt() { import std.stdio; import std.string; import std.array; + import sisudoc.ocda.io_in.paths_source; mixin sspObjectRecord; /+ ↓ 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 @@ -544,19 +546,34 @@ template spineAbstractionTxt() { } return output; } - void spineAbstractionTxt(D)(D doc) { + @trusted 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) - ? doc_matters.output_path : ""; - string base_pth = (out_root - .chainPath(doc_matters.src.language, "abstraction") - .asNormalizedPath).array; + /+ ↓ write to file, into the pod's own tree: + pod/<doc>/media/abstraction/<doc_uid_out>.ssp + . + where it sits beside pod/<doc>/media/image/, which is what a .ssp + needs to be a document source: the file describes its images by + name, size, pixels and digest, and they have to be findable. Written + here once; --pod2 then digests and zips it where it stands rather + than copying it in from an output directory of its own. + +/ + auto pths_pod = spinePathsPods!()(doc_matters); + string base_pth + = pths_pod.abstraction_root(doc_matters.src.filename).filesystem_open_zpod.to!string; try { if (!exists(base_pth)) { base_pth.mkdirRecurse; + } else if (doc_matters.src.language + == doc_matters.pod.manifest_list_of_languages[0] + ) { + /+ ↓ this directory is the one part of the pod written before the pod + is built, so the pod builder leaves it alone. It therefore clears + itself here, on the first language of a run, or a .ssp for a + language the document no longer has would linger and be bundled +/ + foreach (string _f; dirEntries(base_pth, "*.ssp", SpanMode.shallow)) { + _f.remove; + } } } catch (Exception ex) { } |
