From cf5e80c5c5355dfb40f8abd1350fb4d3869316a6 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 6 Jul 2018 11:27:23 -0400 Subject: parent ocn --- org/meta_abstraction.org | 52 +++++++++++++++++++++++++++-------------- src/sdp/meta/metadoc_from_src.d | 52 +++++++++++++++++++++++++++-------------- 2 files changed, 68 insertions(+), 36 deletions(-) diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index 6b6ad9f..00b87a3 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -1978,6 +1978,7 @@ if (the_document_body_section.length > 1) { if (obj.metainfo.is_a == "heading") { obj.metainfo.markedup_ancestors = _get_ancestors_markup(obj, _ancestors_markup); obj.metainfo.collapsed_ancestors = _get_ancestors_collapsed(obj, _ancestors_collapsed); + obj.metainfo.parent_ocn = obj.metainfo.markedup_ancestors[obj.metainfo.parent_lev_markup]; } } debug(ancestors) { @@ -1994,9 +1995,12 @@ if (the_document_body_section.length > 1) { if (the_endnotes_section.length > 1) { html_segnames ~= "endnotes"; html_segnames_ptr = html_segnames_ptr_cntr; - foreach (ref section; the_endnotes_section) { - if (section.metainfo.heading_lev_markup == 4) { - section.ptr.html_segnames = html_segnames_ptr; + foreach (ref obj; the_endnotes_section) { + if (obj.metainfo.is_a == "heading") { + obj.metainfo.parent_ocn = obj.metainfo.markedup_ancestors[obj.metainfo.parent_lev_markup]; + } + if (obj.metainfo.heading_lev_markup == 4) { + obj.ptr.html_segnames = html_segnames_ptr; break; } } @@ -2011,9 +2015,12 @@ if (the_endnotes_section.length > 1) { if (the_glossary_section.length > 1) { html_segnames ~= "glossary"; html_segnames_ptr = html_segnames_ptr_cntr; - foreach (ref section; the_glossary_section) { - if (section.metainfo.heading_lev_markup == 4) { - section.ptr.html_segnames = html_segnames_ptr; + foreach (ref obj; the_glossary_section) { + if (obj.metainfo.is_a == "heading") { + obj.metainfo.parent_ocn = obj.metainfo.markedup_ancestors[obj.metainfo.parent_lev_markup]; + } + if (obj.metainfo.heading_lev_markup == 4) { + obj.ptr.html_segnames = html_segnames_ptr; break; } } @@ -2028,9 +2035,12 @@ if (the_glossary_section.length > 1) { if (the_bibliography_section.length > 1) { html_segnames ~= "bibliography"; html_segnames_ptr = html_segnames_ptr_cntr; - foreach (ref section; the_bibliography_section) { - if (section.metainfo.heading_lev_markup == 4) { - section.ptr.html_segnames = html_segnames_ptr; + foreach (ref obj; the_bibliography_section) { + if (obj.metainfo.is_a == "heading") { + obj.metainfo.parent_ocn = obj.metainfo.markedup_ancestors[obj.metainfo.parent_lev_markup]; + } + if (obj.metainfo.heading_lev_markup == 4) { + obj.ptr.html_segnames = html_segnames_ptr; break; } } @@ -2045,15 +2055,18 @@ if (the_bibliography_section.length > 1) { if (the_bookindex_section["scroll"].length > 1) { html_segnames ~= "bookindex"; html_segnames_ptr = html_segnames_ptr_cntr; - foreach (ref section; the_bookindex_section["scroll"]) { - if (section.metainfo.heading_lev_markup == 4) { - section.ptr.html_segnames = html_segnames_ptr; + foreach (ref obj; the_bookindex_section["scroll"]) { + if (obj.metainfo.is_a == "heading") { + obj.metainfo.parent_ocn = obj.metainfo.markedup_ancestors[obj.metainfo.parent_lev_markup]; + } + if (obj.metainfo.heading_lev_markup == 4) { + obj.ptr.html_segnames = html_segnames_ptr; break; } } - foreach (ref section; the_bookindex_section["seg"]) { - if (section.metainfo.heading_lev_markup == 4) { - section.ptr.html_segnames = html_segnames_ptr; + foreach (ref obj; the_bookindex_section["seg"]) { + if (obj.metainfo.heading_lev_markup == 4) { + obj.ptr.html_segnames = html_segnames_ptr; break; } } @@ -2068,9 +2081,12 @@ if (the_bookindex_section["scroll"].length > 1) { if (the_blurb_section.length > 1) { html_segnames ~= "blurb"; html_segnames_ptr = html_segnames_ptr_cntr; - foreach (ref section; the_blurb_section) { - if (section.metainfo.heading_lev_markup == 4) { - section.ptr.html_segnames = html_segnames_ptr; + foreach (ref obj; the_blurb_section) { + if (obj.metainfo.is_a == "heading") { + obj.metainfo.parent_ocn = obj.metainfo.markedup_ancestors[obj.metainfo.parent_lev_markup]; + } + if (obj.metainfo.heading_lev_markup == 4) { + obj.ptr.html_segnames = html_segnames_ptr; break; } } diff --git a/src/sdp/meta/metadoc_from_src.d b/src/sdp/meta/metadoc_from_src.d index f202b7c..050089e 100644 --- a/src/sdp/meta/metadoc_from_src.d +++ b/src/sdp/meta/metadoc_from_src.d @@ -1510,6 +1510,7 @@ template SiSUdocAbstraction() { if (obj.metainfo.is_a == "heading") { obj.metainfo.markedup_ancestors = _get_ancestors_markup(obj, _ancestors_markup); obj.metainfo.collapsed_ancestors = _get_ancestors_collapsed(obj, _ancestors_collapsed); + obj.metainfo.parent_ocn = obj.metainfo.markedup_ancestors[obj.metainfo.parent_lev_markup]; } } debug(ancestors) { @@ -1520,9 +1521,12 @@ template SiSUdocAbstraction() { if (the_endnotes_section.length > 1) { html_segnames ~= "endnotes"; html_segnames_ptr = html_segnames_ptr_cntr; - foreach (ref section; the_endnotes_section) { - if (section.metainfo.heading_lev_markup == 4) { - section.ptr.html_segnames = html_segnames_ptr; + foreach (ref obj; the_endnotes_section) { + if (obj.metainfo.is_a == "heading") { + obj.metainfo.parent_ocn = obj.metainfo.markedup_ancestors[obj.metainfo.parent_lev_markup]; + } + if (obj.metainfo.heading_lev_markup == 4) { + obj.ptr.html_segnames = html_segnames_ptr; break; } } @@ -1531,9 +1535,12 @@ template SiSUdocAbstraction() { if (the_glossary_section.length > 1) { html_segnames ~= "glossary"; html_segnames_ptr = html_segnames_ptr_cntr; - foreach (ref section; the_glossary_section) { - if (section.metainfo.heading_lev_markup == 4) { - section.ptr.html_segnames = html_segnames_ptr; + foreach (ref obj; the_glossary_section) { + if (obj.metainfo.is_a == "heading") { + obj.metainfo.parent_ocn = obj.metainfo.markedup_ancestors[obj.metainfo.parent_lev_markup]; + } + if (obj.metainfo.heading_lev_markup == 4) { + obj.ptr.html_segnames = html_segnames_ptr; break; } } @@ -1542,9 +1549,12 @@ template SiSUdocAbstraction() { if (the_bibliography_section.length > 1) { html_segnames ~= "bibliography"; html_segnames_ptr = html_segnames_ptr_cntr; - foreach (ref section; the_bibliography_section) { - if (section.metainfo.heading_lev_markup == 4) { - section.ptr.html_segnames = html_segnames_ptr; + foreach (ref obj; the_bibliography_section) { + if (obj.metainfo.is_a == "heading") { + obj.metainfo.parent_ocn = obj.metainfo.markedup_ancestors[obj.metainfo.parent_lev_markup]; + } + if (obj.metainfo.heading_lev_markup == 4) { + obj.ptr.html_segnames = html_segnames_ptr; break; } } @@ -1553,15 +1563,18 @@ template SiSUdocAbstraction() { if (the_bookindex_section["scroll"].length > 1) { html_segnames ~= "bookindex"; html_segnames_ptr = html_segnames_ptr_cntr; - foreach (ref section; the_bookindex_section["scroll"]) { - if (section.metainfo.heading_lev_markup == 4) { - section.ptr.html_segnames = html_segnames_ptr; + foreach (ref obj; the_bookindex_section["scroll"]) { + if (obj.metainfo.is_a == "heading") { + obj.metainfo.parent_ocn = obj.metainfo.markedup_ancestors[obj.metainfo.parent_lev_markup]; + } + if (obj.metainfo.heading_lev_markup == 4) { + obj.ptr.html_segnames = html_segnames_ptr; break; } } - foreach (ref section; the_bookindex_section["seg"]) { - if (section.metainfo.heading_lev_markup == 4) { - section.ptr.html_segnames = html_segnames_ptr; + foreach (ref obj; the_bookindex_section["seg"]) { + if (obj.metainfo.heading_lev_markup == 4) { + obj.ptr.html_segnames = html_segnames_ptr; break; } } @@ -1570,9 +1583,12 @@ template SiSUdocAbstraction() { if (the_blurb_section.length > 1) { html_segnames ~= "blurb"; html_segnames_ptr = html_segnames_ptr_cntr; - foreach (ref section; the_blurb_section) { - if (section.metainfo.heading_lev_markup == 4) { - section.ptr.html_segnames = html_segnames_ptr; + foreach (ref obj; the_blurb_section) { + if (obj.metainfo.is_a == "heading") { + obj.metainfo.parent_ocn = obj.metainfo.markedup_ancestors[obj.metainfo.parent_lev_markup]; + } + if (obj.metainfo.heading_lev_markup == 4) { + obj.ptr.html_segnames = html_segnames_ptr; break; } } -- cgit v1.2.3