diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2026-04-22 13:44:39 -0400 |
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2026-04-22 20:42:31 -0400 |
| commit | 49fd1ba683dd36e3826cf0d48e950c26d5235c1c (patch) | |
| tree | 3098726fea4d2724fffe3d79f2326af52385f648 /src/sisudoc/spine.d | |
| parent | 0.19.0 (diff) | |
.ssp document abstraction as PEG parsable text
--show-abstraction flag to write .ssp document abstraction files
- Add a new output mode that serializes the in-memory document
abstraction (produced by spineAbstraction) to a human-readable,
line-oriented text format (.ssp). This captures the full object
model after parsing and abstraction but before output generation.
- The .ssp format uses unambiguous line prefixes:
@section { } - section boundaries (head/toc/body/endnotes/...)
[N] type - object declaration with OCN
.name: value - object properties (only non-defaults)
| content - text content lines
% comment - comments
- New files:
src/sisudoc/io_out/create_abstraction_txt.d
Serializer module following the same template pattern as
metadoc_show_summary.d. Walks doc.abstraction() section by
section, writing metadata preamble (@meta, @make, @doc_has)
then each object with its properties and text content.
Output goes to {output_path}/{lang}/abstraction/{doc}.ssp
- Changes to spine.d:
- Add "show-abstraction" to opts initialization, getopt, and
OptActions struct
- Add show_abstraction to abstraction(), require_processing_files(),
and meta_processing_general() so the flag triggers full document
processing
- Insert call at both spineAbstraction sites (parallel and serial
branches), gated by show_abstraction flag, following the same
pattern as show_config/show_summary/show_make
- Tested against all 35 sample documents (including multilingual
live-manual in 9 languages) - zero failures. Works standalone
(--show-abstraction) or combined with other output flags
(--show-abstraction --html --text). No effect on existing code
paths when the flag is not used.
Co-Authored-By: Anthropic Claude Opus 4.6 (1M context)
Diffstat (limited to 'src/sisudoc/spine.d')
| -rwxr-xr-x | src/sisudoc/spine.d | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/sisudoc/spine.d b/src/sisudoc/spine.d index fcde22e..ceb9d6c 100755 --- a/src/sisudoc/spine.d +++ b/src/sisudoc/spine.d @@ -166,6 +166,7 @@ string program_name = "spine"; "pdf-init" : false, "pod" : false, "serial" : false, + "show-abstraction" : false, "show-config" : false, "show-curate" : false, "show-curate-authors" : false, @@ -287,6 +288,7 @@ string program_name = "spine"; "section-toc", "table of contents (default)", &opts["section_toc"], "serial", "serial processing", &opts["serial"], "skip-output", "skip output", &opts["skip-output"], + "show-abstraction", "show document abstraction (write .ssp file)", &opts["show-abstraction"], "show-config", "show config", &opts["show-config"], "show-curate", "show curate", &opts["show-curate"], "show-curate-authors", "show curate authors", &opts["show-curate-authors"], @@ -498,6 +500,9 @@ string program_name = "spine"; @trusted bool show_config() { return opts["show-config"]; } + @trusted bool show_abstraction() { + return opts["show-abstraction"]; + } @trusted bool show_curate() { return opts["show-curate"]; } @@ -746,6 +751,7 @@ string program_name = "spine"; @trusted bool abstraction() { return ( opts["abstraction"] + || show_abstraction || concordance || source_or_pod || curate @@ -772,6 +778,7 @@ string program_name = "spine"; || latex || odt || manifest + || show_abstraction || show_make || show_metadata || show_summary @@ -786,6 +793,7 @@ string program_name = "spine"; @trusted bool meta_processing_general() { return ( opts["abstraction"] + || show_abstraction || curate || html || epub @@ -1303,6 +1311,11 @@ string program_name = "spine"; import sisudoc.meta.metadoc_show_config; spineShowConfig!()(doc.matters); } + /+ ↓ document abstraction text representation +/ + if (doc.matters.opt.action.show_abstraction) { + import sisudoc.io_out.create_abstraction_txt; + spineAbstractionTxt!()(doc); + } if (doc.matters.opt.action.curate) { auto _hvst = spineMetaDocCurate!()(doc.matters, hvst); if ( @@ -1402,6 +1415,11 @@ string program_name = "spine"; import sisudoc.meta.metadoc_show_config; spineShowConfig!()(doc.matters); } + /+ ↓ document abstraction text representation +/ + if (doc.matters.opt.action.show_abstraction) { + import sisudoc.io_out.create_abstraction_txt; + spineAbstractionTxt!()(doc); + } if (doc.matters.opt.action.curate) { auto _hvst = spineMetaDocCurate!()(doc.matters, hvst); if ( |
