diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2026-09-07 10:44:19 -0400 |
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2026-09-09 17:24:26 -0400 |
| commit | 0bf89ffb9bee8f31715f7492097ce63536869add (patch) | |
| tree | 355ffa9c89ca9fe738596fff6f1b0de7aaa8cf61 /src/sisudoc | |
| parent | test: cross-check .ssp & ocda db (diff) | |
.ssp: three additional fields the writers read
With these the .ssp carries every field the output writers read.
The two that were missing were both read by the sqlite search
writer, and one of them is needed by anything that wants to know
where an object sits in a segmented output:
- .segment_html_is / .segment_epub_is
(tags.html_segment_anchor_tag_is, epub_segment_anchor_tag_is),
the segment an object *belongs to*, as against .segment
(in_segment_html), which is the segment a heading *opens* and is
set on headings only: 32 of 36 headings and 0 of 109 paragraphs
in the autonomous contract. Without them a reader cannot tell
which segment a paragraph is in.
- .identifier for non-heading objects, the "a"~N series given to
objects whose number is suppressed. A heading already carried it
on its declaration line; every other object now carries it as a
property, on the same condition, that it differs from the ocn.
The same two segment fields are added to the abstraction db
(segment_html_is, segment_epub_is) and to the cross-check test, so the
two serialisations stay level.
.ssp reference regenerated
output run (--text --latex --epub --html --curate) byte identical
to before the change, as it must be since no output writer reads
either artefact.
(assisted by Claude-Code)
Diffstat (limited to 'src/sisudoc')
| -rw-r--r-- | src/sisudoc/ocda/abstraction/ssp.d | 32 | ||||
| -rw-r--r-- | src/sisudoc/outputs/io_out/create_abstraction_db.d | 6 |
2 files changed, 36 insertions, 2 deletions
diff --git a/src/sisudoc/ocda/abstraction/ssp.d b/src/sisudoc/ocda/abstraction/ssp.d index 5e9347f..1ec2d41 100644 --- a/src/sisudoc/ocda/abstraction/ssp.d +++ b/src/sisudoc/ocda/abstraction/ssp.d @@ -195,7 +195,10 @@ template spineAbstractionTxt() { output ~= "@" ~ section ~ " {"; output ~= ""; foreach (obj; section_objs) { - /+ ↓ object declaration line +/ + /+ ↓ object declaration line. a heading carries its identifier here, + on the declaration line, where it is not the ocn; every other + object carries it as .identifier below, on the same condition + +/ string obj_decl = "[" ~ obj.metainfo.ocn.to!string ~ "] "; if (obj.metainfo.is_a == "heading") { string lev = obj.metainfo.marked_up_level; @@ -209,6 +212,11 @@ template spineAbstractionTxt() { } output ~= obj_decl; /+ ↓ properties (only non-default values) +/ + if (obj.metainfo.is_a != "heading" + && obj.metainfo.identifier.length > 0 + && obj.metainfo.identifier != obj.metainfo.ocn.to!string) { + output ~= ".identifier: " ~ obj.metainfo.identifier; + } if (obj.metainfo.is_of_part.length > 0) { output ~= ".part: " ~ obj.metainfo.is_of_part; } @@ -315,6 +323,9 @@ template spineAbstractionTxt() { if (obj.metainfo.object_number_off) { output ~= ".ocn_off: true"; } + // if (obj.metainfo.o_n_type != 0) { + // output ~= ".o_n_type: " ~ obj.metainfo.o_n_type.to!string; + // } if (obj.metainfo.is_of_type.length > 0) { output ~= ".is_of_type: " ~ obj.metainfo.is_of_type; } @@ -399,10 +410,16 @@ template spineAbstractionTxt() { } if (obj.table.heading) { output ~= ".table_header: true"; - } + } + // if (obj.table.walls) { + // output ~= ".table_walls: true"; + // } } /+ ↓ code block properties +/ if (obj.metainfo.is_a == "code") { + // if (obj.code_block.syntax.length > 0) { + // output ~= ".code_syntax: " ~ obj.code_block.syntax; + // } if (obj.code_block.linenumbers) { output ~= ".code_linenumbers: true"; } @@ -435,6 +452,17 @@ template spineAbstractionTxt() { if (obj.tags.segment_anchor_tag_epub.length > 0) { output ~= ".segment_epub: " ~ obj.tags.segment_anchor_tag_epub; } + /+ ↓ the segment an object belongs to, as opposed to the segment a + heading opens. .segment (in_segment_html) is set on headings + only, so without these two a reader cannot tell which segment a + paragraph is in; the sqlite search writer reads the html one + +/ + if (obj.tags.html_segment_anchor_tag_is.length > 0) { + output ~= ".segment_html_is: " ~ obj.tags.html_segment_anchor_tag_is; + } + if (obj.tags.epub_segment_anchor_tag_is.length > 0) { + output ~= ".segment_epub_is: " ~ obj.tags.epub_segment_anchor_tag_is; + } /+ ↓ heading ancestors text +/ { bool has_hat = false; diff --git a/src/sisudoc/outputs/io_out/create_abstraction_db.d b/src/sisudoc/outputs/io_out/create_abstraction_db.d index 539dd55..3a6a85e 100644 --- a/src/sisudoc/outputs/io_out/create_abstraction_db.d +++ b/src/sisudoc/outputs/io_out/create_abstraction_db.d @@ -157,6 +157,8 @@ template spineAbstractionDb() { segment_prev TEXT, segment_next TEXT, segment_epub TEXT, + segment_html_is TEXT, + segment_epub_is TEXT, anchor TEXT, heading_lev_anchor TEXT, heading_ancestors_text TEXT @@ -335,6 +337,7 @@ template spineAbstractionDb() { ~ "indent_base, indent_hang, bullet, lang," ~ "has_links, has_notes_reg, has_notes_star, has_images, has_images_no_dim," ~ "segment, segment_prev, segment_next, segment_epub," + ~ "segment_html_is, segment_epub_is," ~ "anchor, heading_lev_anchor, heading_ancestors_text," ~ "table_cols, table_widths, table_aligns, table_header," ~ "code_linenumbers, text" @@ -349,6 +352,7 @@ template spineAbstractionDb() { ~ ":indent_base, :indent_hang, :bullet, :lang," ~ ":has_links, :has_notes_reg, :has_notes_star, :has_images, :has_images_no_dim," ~ ":segment, :segment_prev, :segment_next, :segment_epub," + ~ ":segment_html_is, :segment_epub_is," ~ ":anchor, :heading_lev_anchor, :heading_ancestors_text," ~ ":table_cols, :table_widths, :table_aligns, :table_header," ~ ":code_linenumbers, :text" @@ -490,6 +494,8 @@ template spineAbstractionDb() { bindStr(":segment_prev", obj.tags.segname_prev); bindStr(":segment_next", obj.tags.segname_next); bindStr(":segment_epub", obj.tags.segment_anchor_tag_epub); + bindStr(":segment_html_is", obj.tags.html_segment_anchor_tag_is); + bindStr(":segment_epub_is", obj.tags.epub_segment_anchor_tag_is); bindStr(":anchor", obj.tags.anchor_tag_html); bindStr(":heading_lev_anchor", obj.tags.heading_lev_anchor_tag); bindJsonStrs(":heading_ancestors_text", obj.tags.heading_ancestors_text); |
