diff options
Diffstat (limited to 'org/spine.org')
| -rw-r--r-- | org/spine.org | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/org/spine.org b/org/spine.org index fce7ca6..494b918 100644 --- a/org/spine.org +++ b/org/spine.org @@ -236,6 +236,14 @@ string program_name = "spine"; foreach (ref _dlr; _url_downloads) { cleanupDownload(_dlr); } + /+ ↓ and any pod written out of a database for this run +/ + foreach (_root; _pod_materialisations) { + try { + if (_root.exists) { _root.rmdirRecurse; } + } catch (Exception ex) { + stderr.writeln("WARNING: could not remove ", _root, ": ", ex.msg); + } + } /+ ↓ --strict and a document whose languages diverged: fatal to the run. At the end rather than where the check runs, so that the outputs of the run are complete and can be looked at. The warning has already @@ -1446,6 +1454,51 @@ foreach (arg; args[1..$]) { _resolved_args ~= arg; } } +/+ ↓ a database asked for as a source: write the pod back out of it and carry on + with the pod. + . + --source and --pod2 need the original markup file, included in a 2.0 + database. The pod is written to a directory of this run's making and takes + the place of the argument, so everything after this point is handling a + pod, and the document is built by the same code over the same bytes as the + original. That is what makes "identical output" a consequence. + . + Before the config discovery below, because that walks the argument looking + for a .dr/ above it, and the argument it should walk is the pod rather than + the database. + . + A database without original markup still refuses, as it has to: no artefact + written by an older spine carries any. ++/ +string[] _pod_materialisations; +if (_opt_action.source_or_pod) { + import sisudoc.ocda.abstraction.pod_from_db; + import std.process : thisProcessID; + mixin spinePodFromDb; + string[] _args_after; + foreach (arg; _resolved_args) { + if (!(arg.endsWith(".ocda.db") || arg.endsWith(".db")) + || arg.match(rgx.flag_action) + ) { + _args_after ~= arg; + continue; + } + string _root = (tempDir.chainPath("spine-pod-" + ~ arg.baseName ~ "-" ~ thisProcessID.to!string).array).to!string; + auto _mat = podFromDb!()(arg, _root, _opt_action); + if (_mat.ok) { + _pod_materialisations ~= _root; + _args_after ~= _mat.pod_dir; + if (_opt_action.vox_gt_1) { + writeln("pod from database: ", arg.baseName, " -> ", _mat.pod_dir); + } + } else { + stderr.writeln("WARNING: --source and --pod2 need the markup, and ", + arg.baseName, " ", _mat.note, "; skipped"); + } + } + _resolved_args = _args_after; +} ConfComposite _siteConfig; if ( _opt_action.require_processing_files |
