aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/ocda_get.org
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2026-09-11 13:57:47 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2026-09-12 12:14:39 -0400
commitf41bf1cc525c70cced764a5e4df70d499d82f9c9 (patch)
tree5825a95d525fcaa332bd378c1493bbd4a14613a0 /org/ocda_get.org
parentocda: one constructor for doc_matters (diff)
spine: process a document from .ocda.db or .ssp
Process a document from its .ocda.db or .ssp abstraction. A .ssp or a .ocda.db given as an argument is now a document like any other: read rather than parsed, and handed to the output writers as the same doc they already take. The 35 document sample collection built from its .ssp files is byte identical to the same collection built from markup: 1457 files, no differences. Three things had to be rebuilt rather than read, all of them a value parsed rather than a structure derived: - classify_topic_register_arr and its expanded twin. The split is not a plain one, so the rule moved to sisudoc.ocda.meta.topic_register and both the yaml reader and this one call it. - creator_author_arr, which is creator.author split on the ", " it was joined with. - title_sub, a copy of title_subtitle made where the header is read, and what epub3 puts in dc:title id="subtitle". Fixed ordering bug found by the acceptance test. A heading's own anchor can be a bare number taken from its text and this can collide with the ocn of an unrelated object. Whole output comparison found that before the fix there was one wrong link in one epub's table of contents. From a .ocda.db, 1446 of 1457 files are identical. The 11 that are not are the images: a database carries its own image blobs and nothing yet extracts them, so the five sisu_markup images are not copied and the epub that embeds them differs. That is the next step and is not a defect in this one. --source and --pod2 are refused with a warning rather than half done, no artefact carrying the markup. (assisted by Claude-Code)
Diffstat (limited to 'org/ocda_get.org')
-rw-r--r--org/ocda_get.org43
1 files changed, 27 insertions, 16 deletions
diff --git a/org/ocda_get.org b/org/ocda_get.org
index 64fff57..40effc5 100644
--- a/org/ocda_get.org
+++ b/org/ocda_get.org
@@ -165,22 +165,6 @@ template spineDocHasFromAbstraction() {
_tag_assoc[obj.tags.segment_anchor_tag_epub]["seg_lv1to4"]
= obj.tags.segment_anchor_tag_epub;
}
- /+ ↓ the body's objects are what a citation or a cross reference
- points at, so each one's identifier maps to the segment it is
- in. seg_lv4 is only set where it is not already, since an
- anchor of the same name set above names a segment rather than
- sits in one
- +/
- if (_section == "body" && obj.metainfo.identifier.length > 0) {
- if (!((obj.metainfo.identifier in _tag_assoc)
- && ("seg_lv4" in _tag_assoc[obj.metainfo.identifier]))
- ) {
- _tag_assoc[obj.metainfo.identifier]["seg_lv4"]
- = obj.tags.html_segment_anchor_tag_is;
- }
- _tag_assoc[obj.metainfo.identifier]["seg_lv1to4"]
- = obj.tags.epub_segment_anchor_tag_is;
- }
/+ ↓ a heading's own anchor tags, and the anchors declared inline in
an object's text, both point at the segment the object is in +/
/+ ↓ a heading above level 4 opens no html segment of its own, so a
@@ -237,6 +221,33 @@ template spineDocHasFromAbstraction() {
foreach (_section; tail_sections) {
if (_has_section(_abst, _section)) { _out.segnames_lv4 ~= _section; }
}
+ /+ ↓ the body's objects, in a pass of their own after every anchor above
+ has been recorded, because the parser does it in that order and the
+ order is what decides two of these entries.
+ .
+ each body object's identifier maps to the segment it is in. seg_lv4
+ is set only where it is not already, an anchor of the same name
+ having said it *names* a segment rather than sits in one; seg_lv1to4
+ is set always. A heading's own anchor can be a bare number taken
+ from its text ("2. Shorter Terms" gives the anchor "2"), which then
+ collides with the ocn of an unrelated object, and this is the order
+ that resolves the collision the way the parser resolves it: in
+ free_culture, ocn 2 keeps seg_lv4 "them" from the anchor and takes
+ seg_lv1to4 "_part_1" from itself.
+ +/
+ if (_has_section(_abst, "body")) {
+ foreach (obj; _abst["body"]) {
+ if (obj.metainfo.identifier.length == 0) { continue; }
+ if (!((obj.metainfo.identifier in _tag_assoc)
+ && ("seg_lv4" in _tag_assoc[obj.metainfo.identifier]))
+ ) {
+ _tag_assoc[obj.metainfo.identifier]["seg_lv4"]
+ = obj.tags.html_segment_anchor_tag_is;
+ }
+ _tag_assoc[obj.metainfo.identifier]["seg_lv1to4"]
+ = obj.tags.epub_segment_anchor_tag_is;
+ }
+ }
_out.imagelist = _images.sort.uniq.array;
_out.tag_associations = _tag_assoc;
_out.section_keys_sequenced = sectionKeysSequenced(_abst, _opt_action);