diff options
Diffstat (limited to 'org/ocda.org')
| -rw-r--r-- | org/ocda.org | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/org/ocda.org b/org/ocda.org index f58e955..db24139 100644 --- a/org/ocda.org +++ b/org/ocda.org @@ -1356,6 +1356,37 @@ if (the_document_blurb_section.length > 1) { // writeln("blurb"); the_document_bookindex_section = get_ancestors.the_document_bookindex_section; the_document_blurb_section = get_ancestors.the_document_blurb_section; } +/+ ↓ the html segment a cross reference to a heading lands on. + a heading above level 4 opens no html segment, so a link to it goes + to the level 4 heading that follows it. The build loop cannot know + that yet and back-fills tag_assoc when the level 4 heading arrives + (see lv0to3_tags); this is the same answer, kept on the object, so + that it travels with the abstraction instead of living only in a map + the parser holds. Walking backwards, the last level 4 seen is the + next one for everything above it. ++/ +{ + string _next_lv4; + foreach_reverse (ref obj; the_document_body_section) { + if (obj.metainfo.is_a != "heading") { continue; } + if (obj.metainfo.heading_lev_markup == 4) { + _next_lv4 = obj.tags.anchor_tag_html; + } else if (obj.metainfo.heading_lev_markup < 4) { + obj.tags.segment_lv4_is = _next_lv4; + } + } + /+ ↓ the head section's title sits above the body and resolves to the + body's first level 4 heading, which is what _next_lv4 now holds + +/ + foreach_reverse (ref obj; the_document_head_section) { + if (obj.metainfo.is_a != "heading") { continue; } + if (obj.metainfo.heading_lev_markup == 4) { + _next_lv4 = obj.tags.anchor_tag_html; + } else if (obj.metainfo.heading_lev_markup < 4) { + obj.tags.segment_lv4_is = _next_lv4; + } + } +} // get descendants if (the_document_body_section.length > 1) { auto pairs = after_doc_get_descendants( |
