From 4e6774904ce811b074d8b3694b04dc5c1e8219e4 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 11 Sep 2026 12:32:13 -0400 Subject: ocda: heading cross reference linking The segment a cross reference to a heading lands on, gixed upstream in ocda, where the field is created, rather than inferred by the loader. A heading above level 4 opens no html segment of its own, so a link to it has to land on the level 4 heading that follows. The build loop cannot know that when it reads the heading, and says so in a comment of its own: "for html segname need following lv4 not yet known". It back-fills tag_assoc when the level 4 heading arrives (lv0to3_tags), and the answer then lives only in that map. tags.segment_lv4_is now holds it, resolved in a pass over the finished head and body sections: walking backwards, the last level 4 heading seen is the next one for everything above it, which is the same answer the back-fill gives. Emitted in the .ssp only where it differs from .segment_html_is, which is every heading at level 4 or below, so it is sparse: 317 lines over the 35 document reference set, none removed. Carried in the database as a column of its own, and read back by both readers. docHasFromAbstraction reads it instead of working it out. With that, and on top of the two defect fixes, a document loaded from an artefact and one parsed from markup agree: key sets identical, all 35 documents values 3 entries differ of some 30,000, all of them _the_title, where the abstraction supplies an epub segment the parser leaves unset link targets all 1,651 agree, against 89 differing before any of this work and 1 after the defect fixes alone Format stays v1.1. That version is new in this same run of work and nothing outside spine has read it, so this belongs in it rather than in a bump of its own. (assisted by Claude-Code) --- test/reference/abstraction/live-manual.en.ssp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test/reference/abstraction/live-manual.en.ssp') diff --git a/test/reference/abstraction/live-manual.en.ssp b/test/reference/abstraction/live-manual.en.ssp index 631f01f..7e656a2 100644 --- a/test/reference/abstraction/live-manual.en.ssp +++ b/test/reference/abstraction/live-manual.en.ssp @@ -58,6 +58,7 @@ .segment_epub: _the_title .segment_html_is: _the_title .segment_epub_is: _the_title +.segment_lv4_is: about-manual .heading_ancestors_text: Live Systems Manual||||||| | Live Systems Manual @@ -1579,6 +1580,7 @@ .segment_epub: _part_1 .segment_html_is: _part_1 .segment_epub_is: _part_1 +.segment_lv4_is: about-manual .heading_ancestors_text: Live Systems Manual|About|||||| | About @@ -1598,6 +1600,7 @@ .segment_epub: _part_2 .segment_html_is: _part_2 .segment_epub_is: _part_2 +.segment_lv4_is: about-manual .heading_ancestors_text: Live Systems Manual|About this manual|||||| | About this manual @@ -2547,6 +2550,7 @@ .segment_epub: _part_3 .segment_html_is: _part_3 .segment_epub_is: _part_3 +.segment_lv4_is: about-project .heading_ancestors_text: Live Systems Manual|About the ${project}|||||| | About the ${project} @@ -3056,6 +3060,7 @@ .segment_epub: _part_4 .segment_html_is: _part_4 .segment_epub_is: _part_4 +.segment_lv4_is: installation .heading_ancestors_text: Live Systems Manual|User|||||| | User @@ -3076,6 +3081,7 @@ .segment_epub: _part_5 .segment_html_is: _part_5 .segment_epub_is: _part_5 +.segment_lv4_is: installation .heading_ancestors_text: Live Systems Manual|Installation|||||| | Installation @@ -3793,6 +3799,7 @@ .segment_epub: _part_6 .segment_html_is: _part_6 .segment_epub_is: _part_6 +.segment_lv4_is: the-basics .heading_ancestors_text: Live Systems Manual|The basics|||||| | The basics @@ -5743,6 +5750,7 @@ .segment_epub: _part_7 .segment_html_is: _part_7 .segment_epub_is: _part_7 +.segment_lv4_is: overview-of-tools .heading_ancestors_text: Live Systems Manual|Overview of tools|||||| | Overview of tools @@ -6228,6 +6236,7 @@ .segment_epub: _part_8 .segment_html_is: _part_8 .segment_epub_is: _part_8 +.segment_lv4_is: managing-a-configuration .heading_ancestors_text: Live Systems Manual|Managing a configuration|||||| | Managing a configuration @@ -6607,6 +6616,7 @@ .segment_epub: _part_9 .segment_html_is: _part_9 .segment_epub_is: _part_9 +.segment_lv4_is: customization-overview .heading_ancestors_text: Live Systems Manual|Customizing contents|||||| | Customizing contents @@ -6816,6 +6826,7 @@ .segment_epub: _part_10 .segment_html_is: _part_10 .segment_epub_is: _part_10 +.segment_lv4_is: customizing-package-installation .heading_ancestors_text: Live Systems Manual|Customizing package installation|||||| | Customizing package installation @@ -8671,6 +8682,7 @@ .segment_epub: _part_11 .segment_html_is: _part_11 .segment_epub_is: _part_11 +.segment_lv4_is: customizing-contents .heading_ancestors_text: Live Systems Manual|Customizing contents|||||| | Customizing contents @@ -9135,6 +9147,7 @@ .segment_epub: _part_12 .segment_html_is: _part_12 .segment_epub_is: _part_12 +.segment_lv4_is: customizing-run-time-behaviours .heading_ancestors_text: Live Systems Manual|Customizing run time behaviours|||||| | Customizing run time behaviours @@ -10291,6 +10304,7 @@ .segment_epub: _part_13 .segment_html_is: _part_13 .segment_epub_is: _part_13 +.segment_lv4_is: customizing-binary .heading_ancestors_text: Live Systems Manual|Customizing the binary image|||||| | Customizing the binary image @@ -10512,6 +10526,7 @@ .segment_epub: _part_14 .segment_html_is: _part_14 .segment_epub_is: _part_14 +.segment_lv4_is: customizing-installer .heading_ancestors_text: Live Systems Manual|Customizing Debian Installer|||||| | Customizing Debian Installer @@ -10810,6 +10825,7 @@ .segment_epub: _part_15 .segment_html_is: _part_15 .segment_epub_is: _part_15 +.segment_lv4_is: contributing-to-project .heading_ancestors_text: Live Systems Manual|Project|||||| | Project @@ -10829,6 +10845,7 @@ .segment_epub: _part_16 .segment_html_is: _part_16 .segment_epub_is: _part_16 +.segment_lv4_is: contributing-to-project .heading_ancestors_text: Live Systems Manual|Contributing to the project|||||| | Contributing to the project @@ -11217,6 +11234,7 @@ .segment_epub: _part_17 .segment_html_is: _part_17 .segment_epub_is: _part_17 +.segment_lv4_is: bugs .heading_ancestors_text: Live Systems Manual|Reporting bugs|||||| | Reporting bugs @@ -12049,6 +12067,7 @@ .segment_epub: _part_18 .segment_html_is: _part_18 .segment_epub_is: _part_18 +.segment_lv4_is: coding-style .heading_ancestors_text: Live Systems Manual|Coding Style|||||| | Coding Style @@ -12697,6 +12716,7 @@ .segment_epub: _part_19 .segment_html_is: _part_19 .segment_epub_is: _part_19 +.segment_lv4_is: procedures .heading_ancestors_text: Live Systems Manual|Procedures|||||| | Procedures @@ -13037,6 +13057,7 @@ .segment_epub: _part_20 .segment_html_is: _part_20 .segment_epub_is: _part_20 +.segment_lv4_is: git-repositories .heading_ancestors_text: Live Systems Manual|Git repositories|||||| | Git repositories @@ -13293,6 +13314,7 @@ .segment_epub: _part_21 .segment_html_is: _part_21 .segment_epub_is: _part_21 +.segment_lv4_is: examples .heading_ancestors_text: Live Systems Manual|Examples|||||| | Examples @@ -13312,6 +13334,7 @@ .segment_epub: _part_22 .segment_html_is: _part_22 .segment_epub_is: _part_22 +.segment_lv4_is: examples .heading_ancestors_text: Live Systems Manual|Examples|||||| | Examples @@ -14536,6 +14559,7 @@ .segment_epub: _part_23 .segment_html_is: _part_23 .segment_epub_is: _part_23 +.segment_lv4_is: style-guide .heading_ancestors_text: Live Systems Manual|Appendix|||||| | Appendix @@ -14555,6 +14579,7 @@ .segment_epub: _part_24 .segment_html_is: _part_24 .segment_epub_is: _part_24 +.segment_lv4_is: style-guide .heading_ancestors_text: Live Systems Manual|Style guide|||||| | Style guide -- cgit v1.2.3