aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/ocda_get.org
diff options
context:
space:
mode:
Diffstat (limited to 'org/ocda_get.org')
-rw-r--r--org/ocda_get.org40
1 files changed, 18 insertions, 22 deletions
diff --git a/org/ocda_get.org b/org/ocda_get.org
index 7ea9260..64fff57 100644
--- a/org/ocda_get.org
+++ b/org/ocda_get.org
@@ -143,20 +143,6 @@ template spineDocHasFromAbstraction() {
_out.quotes = _count(_doc_has_block, "quotes");
string[] _images;
string[string][string] _tag_assoc;
- /+ ↓ keys waiting for the level 4 segment that will hold them.
-
- a heading above level 4 opens no html segment, so a cross reference
- to it has to land on the next level 4 heading, which has not been
- seen yet when the heading is read. The parser does this the same
- way, back-filling a pending tag when the level 4 heading arrives
- (metadoc_from_src.d, "tag_assoc[lv0_to_lv3_html_tag]"), and the
- order of the objects is what both are reading it from.
- +/
- string[] _awaiting_lv4;
- void _backfill(string _seg) {
- foreach (_k; _awaiting_lv4) { _tag_assoc[_k]["seg_lv4"] = _seg; }
- _awaiting_lv4 = [];
- }
/+ ↓ segnames["html"] is seeded with the toc, which is a segment of its
own before any level 4 heading opens one +/
_out.segnames_lv4 ~= "toc";
@@ -206,6 +192,7 @@ template spineDocHasFromAbstraction() {
+/
if (obj.tags.heading_lev_anchor_tag.length > 0
&& obj.tags.in_segment_html.length > 0
+ && obj.metainfo.heading_lev_markup >= 4
) {
_tag_assoc[obj.tags.heading_lev_anchor_tag]["seg_lv4"]
= obj.tags.in_segment_html;
@@ -225,14 +212,23 @@ template spineDocHasFromAbstraction() {
if (obj.metainfo.heading_lev_markup <= 4) {
_out.segnames_lv_0_to_4 ~= obj.tags.segment_anchor_tag_epub;
}
- if (obj.metainfo.heading_lev_markup == 4) {
- if (_section == "body") { _out.segnames_lv4 ~= obj.tags.anchor_tag_html; }
- /+ ↓ this is the segment the headings above it were waiting for +/
- _backfill(obj.tags.in_segment_html);
- } else if (obj.metainfo.heading_lev_markup < 4) {
- foreach (_k; [obj.metainfo.identifier, obj.tags.heading_lev_anchor_tag,
- obj.tags.anchor_tag_html]) {
- if (_k.length > 0) { _awaiting_lv4 ~= _k; }
+ if (_section == "body" && obj.metainfo.heading_lev_markup == 4) {
+ _out.segnames_lv4 ~= obj.tags.anchor_tag_html;
+ }
+ /+ ↓ a heading above level 4 opens no html segment of its own, so
+ a cross reference to it lands on the level 4 segment that
+ follows. That is .segment_lv4_is, resolved in ocda where the
+ finished sections are to hand and carried by the artefact, so
+ there is nothing to work out here
+ +/
+ if (obj.tags.segment_lv4_is.length > 0) {
+ /+ ↓ seg_lv4 only, and not through heading_lev_anchor_tag: that
+ names the level 4 heading itself, whose own entry says it
+ opens that segment rather than merely sits in it. epub
+ segments go down to level 1, so seg_lv1to4 is untouched
+ +/
+ foreach (_k; [obj.metainfo.identifier, obj.tags.anchor_tag_html]) {
+ if (_k.length > 0) { _tag_assoc[_k]["seg_lv4"] = obj.tags.segment_lv4_is; }
}
}
}