diff options
Diffstat (limited to 'src/sisudoc/ocda')
| -rw-r--r-- | src/sisudoc/ocda/abstraction/ssp.d | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/src/sisudoc/ocda/abstraction/ssp.d b/src/sisudoc/ocda/abstraction/ssp.d index 3e80956..2501add 100644 --- a/src/sisudoc/ocda/abstraction/ssp.d +++ b/src/sisudoc/ocda/abstraction/ssp.d @@ -102,6 +102,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; @@ -413,6 +414,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 @@ -562,19 +564,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) { } |
