diff options
author | Ralph Amissah <ralph@amissah.com> | 2018-06-25 12:50:54 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:15 -0400 |
commit | c9c1b3501569d83f9c1e9f7ca153230cd117b8a9 (patch) | |
tree | b4d15bcdfe5c2881b6e17d33eceb2c70cb910664 /org | |
parent | doc object metainfo consolidation (diff) |
obj.metainfo node type info, ancestors
Diffstat (limited to 'org')
-rw-r--r-- | org/meta_abstraction.org | 589 | ||||
-rw-r--r-- | org/meta_debugs.org | 4 | ||||
-rw-r--r-- | org/output_sqlite.org | 4 | ||||
-rw-r--r-- | org/output_xmls.org | 4 |
4 files changed, 434 insertions, 167 deletions
diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index 0153020..feaf5ea 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -85,6 +85,7 @@ template SiSUdocAbstraction() { } /+ ← closed: loop markup document/text line by line +/ /+ ↓ post loop markup document/text +/ <<abs_post>> + <<abs_post_doc_reloop_processing>> <<abs_return_tuple>> /+ post loop markup document/text ↑ +/ } /+ ← closed: abstract doc source +/ @@ -232,14 +233,14 @@ struct OCNset { OCNset obj_cite_digits; int obj_cite_digit_, obj_cite_digit_off, obj_cite_digit_bkidx, obj_cite_digit_type; auto object_citation_number = OCNemitter(); -int[] dom_markedup = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; -int[] dom_markedup_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; -int[] dom_collapsed = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; -int[] dom_collapsed_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; +int[] dom_structure_markedup_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; +int[] dom_structure_markedup_tags_status_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; +int[] dom_structure_collapsed_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; +int[] dom_structure_collapsed_tags_status_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; enum DomTags { none, open, close, close_and_open, open_still, } #+END_SRC -**** initialize heading ancestors +**** method heading ancestors #+name: abs_top_init_struct #+BEGIN_SRC d @@ -298,7 +299,7 @@ pure auto obj_heading_ancestors(O)( } #+END_SRC -**** initialize dom markup tags +**** method dom markup tags #+name: abs_top_init_struct #+BEGIN_SRC d @@ -343,12 +344,12 @@ pure auto obj_dom_structure_set_markup_tags(O)( debug(dom_magic_numbers) { writeln("marked up: ", lev, ": ", dom); } - obj.metainfo.dom_markedup = dom.dup; + obj.metainfo.dom_structure_markedup_tags_status = dom.dup; return obj; } #+END_SRC -**** initialize dom collapsed tags +**** method dom collapsed tags #+name: abs_top_init_struct #+BEGIN_SRC d @@ -393,12 +394,12 @@ pure auto obj_dom_set_collapsed_tags(O)( debug(dom_magic_numbers) { writeln("collapsed: ", lev, ": ", dom); } - obj.metainfo.dom_collapsed = dom.dup; + obj.metainfo.dom_structure_collapsed_tags_status = dom.dup; return obj; } #+END_SRC -**** initialize ocn emit +**** method ocn emit #+name: abs_top_init_struct #+BEGIN_SRC d @@ -500,27 +501,27 @@ auto heading_match_rgx = [ ]; string _anchor_tag; string toc_txt_; -an_object["glossary_nugget"] = ""; -an_object["blurb_nugget"] = ""; -comp_obj_heading_ = comp_obj_heading_.init; -comp_obj_heading_.metainfo.is_of_part = "frontmatter"; -comp_obj_heading_.metainfo.is_of_section = "toc"; -comp_obj_heading_.metainfo.is_of_type = "para"; -comp_obj_heading_.metainfo.is_a = "heading"; -comp_obj_heading_.text = "Table of Contents"; -comp_obj_heading_.metainfo.ocn = 0; -comp_obj_heading_.metainfo.object_number_off = ""; -comp_obj_heading_.metainfo.object_number_type = 0; -comp_obj_heading_.tags.segment_anchor_tag = "toc"; -comp_obj_heading_.metainfo.heading_lev_markup = 4; -comp_obj_heading_.metainfo.heading_lev_collapsed = 1; -comp_obj_heading_.metainfo.parent_ocn = 1; -comp_obj_heading_.metainfo.parent_lev_markup = 0; -comp_obj_heading_.ptr.html_segnames = html_segnames_ptr; -comp_obj_heading_.tags.anchor_tags = ["toc"]; -comp_obj_heading_.metainfo.dom_markedup = [ 1, 1, 0, 0, 1, 0, 0, 0]; -comp_obj_heading_.metainfo.dom_collapsed = [ 1, 1, 1, 0, 0, 0, 0, 0]; -auto toc_head = comp_obj_heading_; +an_object["glossary_nugget"] = ""; +an_object["blurb_nugget"] = ""; +comp_obj_heading_ = comp_obj_heading_.init; +comp_obj_heading_.metainfo.is_of_part = "frontmatter"; +comp_obj_heading_.metainfo.is_of_section = "toc"; +comp_obj_heading_.metainfo.is_of_type = "para"; +comp_obj_heading_.metainfo.is_a = "heading"; +comp_obj_heading_.text = "Table of Contents"; +comp_obj_heading_.metainfo.ocn = 0; +comp_obj_heading_.metainfo.object_number_off = ""; +comp_obj_heading_.metainfo.object_number_type = 0; +comp_obj_heading_.tags.segment_anchor_tag = "toc"; +comp_obj_heading_.metainfo.heading_lev_markup = 4; +comp_obj_heading_.metainfo.heading_lev_collapsed = 1; +comp_obj_heading_.metainfo.parent_ocn = 1; +comp_obj_heading_.metainfo.parent_lev_markup = 0; +comp_obj_heading_.ptr.html_segnames = html_segnames_ptr; +comp_obj_heading_.tags.anchor_tags = ["toc"]; +comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = [ 1, 1, 0, 0, 1, 0, 0, 0]; +comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = [ 1, 1, 1, 0, 0, 0, 0, 0]; +auto toc_head = comp_obj_heading_; html_segnames_ptr_cntr++; the_table_of_contents_section = [ "seg": [toc_head], @@ -691,8 +692,8 @@ if there is a glossary section you need to: comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; comp_obj_heading_.metainfo.parent_lev_markup = 0; - comp_obj_heading_.metainfo.dom_markedup = [ 1, 1, 0, 0, 0, 0, 0, 0]; - comp_obj_heading_.metainfo.dom_collapsed = [ 1, 1, 0, 0, 0, 0, 0, 0]; + comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = [ 1, 1, 0, 0, 0, 0, 0, 0]; + comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = [ 1, 1, 0, 0, 0, 0, 0, 0]; the_glossary_section ~= comp_obj_heading_; comp_obj_heading_ = comp_obj_heading_.init; comp_obj_heading_.metainfo.is_of_part = "backmatter"; @@ -708,8 +709,8 @@ if there is a glossary section you need to: comp_obj_heading_.metainfo.heading_lev_collapsed = 2; comp_obj_heading_.metainfo.parent_ocn = 1; comp_obj_heading_.metainfo.parent_lev_markup = 0; - comp_obj_heading_.metainfo.dom_markedup = [ 1, 1, 0, 0, 1, 0, 0, 0]; - comp_obj_heading_.metainfo.dom_collapsed = [ 1, 1, 1, 0, 0, 0, 0, 0]; + comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = [ 1, 1, 0, 0, 1, 0, 0, 0]; + comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = [ 1, 1, 1, 0, 0, 0, 0, 0]; comp_obj_heading_.tags.anchor_tags = ["glossary"]; the_glossary_section ~= comp_obj_heading_; } else { @@ -796,41 +797,41 @@ if there is a blurb section you need to: line_occur["para"] = State.off; an_object_key="blurb_nugget"; if (line.matchFirst(rgx.heading_blurb)) { - comp_obj_heading_ = comp_obj_heading_.init; - comp_obj_heading_.metainfo.is_of_part = "backmatter"; - comp_obj_heading_.metainfo.is_of_section = "blurb"; - comp_obj_heading_.metainfo.is_of_type = "para"; - comp_obj_heading_.metainfo.is_a = "heading"; - comp_obj_heading_.text = "Blurb"; - comp_obj_heading_.metainfo.ocn = 0; - comp_obj_heading_.metainfo.object_number_off = ""; - comp_obj_heading_.metainfo.object_number_type = 0; - comp_obj_heading_.tags.segment_anchor_tag = "_part_blurb"; - comp_obj_heading_.metainfo.heading_lev_markup = 1; - comp_obj_heading_.metainfo.heading_lev_collapsed = 1; - comp_obj_heading_.metainfo.parent_ocn = 1; - comp_obj_heading_.metainfo.parent_lev_markup = 0; - comp_obj_heading_.metainfo.dom_markedup = [ 1, 1, 0, 0, 0, 0, 0, 0]; - comp_obj_heading_.metainfo.dom_collapsed = [ 1, 1, 0, 0, 0, 0, 0, 0]; - the_blurb_section ~= comp_obj_heading_; - comp_obj_heading_ = comp_obj_heading_.init; - comp_obj_heading_.metainfo.is_of_part = "backmatter"; - comp_obj_heading_.metainfo.is_of_section = "blurb"; - comp_obj_heading_.metainfo.is_of_type = "para"; - comp_obj_heading_.metainfo.is_a = "heading"; - comp_obj_heading_.text = "Blurb"; - comp_obj_heading_.metainfo.ocn = 0; - comp_obj_heading_.metainfo.object_number_off = ""; - comp_obj_heading_.metainfo.object_number_type = 0; - comp_obj_heading_.tags.segment_anchor_tag = "blurb"; - comp_obj_heading_.metainfo.heading_lev_markup = 4; - comp_obj_heading_.metainfo.heading_lev_collapsed = 2; - comp_obj_heading_.metainfo.parent_ocn = 1; - comp_obj_heading_.metainfo.parent_lev_markup = 0; - comp_obj_heading_.tags.anchor_tags = ["blurb"]; - comp_obj_heading_.metainfo.dom_markedup = [ 1, 1, 0, 0, 1, 0, 0, 0]; - comp_obj_heading_.metainfo.dom_collapsed = [ 1, 1, 1, 0, 0, 0, 0, 0]; - the_blurb_section ~= comp_obj_heading_; + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.metainfo.is_of_part = "backmatter"; + comp_obj_heading_.metainfo.is_of_section = "blurb"; + comp_obj_heading_.metainfo.is_of_type = "para"; + comp_obj_heading_.metainfo.is_a = "heading"; + comp_obj_heading_.text = "Blurb"; + comp_obj_heading_.metainfo.ocn = 0; + comp_obj_heading_.metainfo.object_number_off = ""; + comp_obj_heading_.metainfo.object_number_type = 0; + comp_obj_heading_.tags.segment_anchor_tag = "_part_blurb"; + comp_obj_heading_.metainfo.heading_lev_markup = 1; + comp_obj_heading_.metainfo.heading_lev_collapsed = 1; + comp_obj_heading_.metainfo.parent_ocn = 1; + comp_obj_heading_.metainfo.parent_lev_markup = 0; + comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = [ 1, 1, 0, 0, 0, 0, 0, 0]; + comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = [ 1, 1, 0, 0, 0, 0, 0, 0]; + the_blurb_section ~= comp_obj_heading_; + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.metainfo.is_of_part = "backmatter"; + comp_obj_heading_.metainfo.is_of_section = "blurb"; + comp_obj_heading_.metainfo.is_of_type = "para"; + comp_obj_heading_.metainfo.is_a = "heading"; + comp_obj_heading_.text = "Blurb"; + comp_obj_heading_.metainfo.ocn = 0; + comp_obj_heading_.metainfo.object_number_off = ""; + comp_obj_heading_.metainfo.object_number_type = 0; + comp_obj_heading_.tags.segment_anchor_tag = "blurb"; + comp_obj_heading_.metainfo.heading_lev_markup = 4; + comp_obj_heading_.metainfo.heading_lev_collapsed = 2; + comp_obj_heading_.metainfo.parent_ocn = 1; + comp_obj_heading_.metainfo.parent_lev_markup = 0; + comp_obj_heading_.tags.anchor_tags = ["blurb"]; + comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = [ 1, 1, 0, 0, 1, 0, 0, 0]; + comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = [ 1, 1, 1, 0, 0, 0, 0, 0]; + the_blurb_section ~= comp_obj_heading_; } else if (line.matchFirst(rgx.heading) && (opt_action.backmatter && opt_action.section_blurb)) { comp_obj_heading_ = comp_obj_heading_.init; @@ -847,7 +848,7 @@ if there is a blurb section you need to: comp_obj_heading_.metainfo.heading_lev_collapsed = an_object["lev_collapsed_number"].to!int; // make int, remove need to conv comp_obj_heading_.metainfo.parent_ocn = 1; comp_obj_heading_.metainfo.parent_lev_markup = 0; - the_blurb_section ~= comp_obj_heading_; + the_blurb_section ~= comp_obj_heading_; } else { _para_match_(line, an_object, an_object_key, indent, bullet, obj_type_status, line_occur); comp_obj_para = comp_obj_para.init; @@ -1772,6 +1773,219 @@ NOTE there are issues attempting to do this on first pass as: - could optimise a bit by - skipping this loop unless the html seg or epub output is selected +***** Methods +****** get ancestors markup + +#+name: abs_post +#+BEGIN_SRC d +int[] _get_ancestors_markup(O)(O obj, ref int[] _ancestors_markup) { + if (obj.metainfo.is_a == "heading") { + debug(dom) { + writeln(obj.text); + } + if (obj.metainfo.heading_lev_markup == 1) { + _ancestors_markup = [ + _ancestors_markup[0], + 0,0,0,0,0,0,0 + ]; + } + if (obj.metainfo.heading_lev_markup == 2) { + _ancestors_markup = [ + _ancestors_markup[0], + _ancestors_markup[1], + 0,0,0,0,0,0 + ]; + } + if (obj.metainfo.heading_lev_markup == 3) { + _ancestors_markup = [ + _ancestors_markup[0], + _ancestors_markup[1], + _ancestors_markup[2], + 0,0,0,0,0 + ]; + } + if (obj.metainfo.heading_lev_markup == 4) { + _ancestors_markup = [ + _ancestors_markup[0], + _ancestors_markup[1], + _ancestors_markup[2], + _ancestors_markup[3], + 0,0,0,0 + ]; + } + if (obj.metainfo.heading_lev_markup == 5) { + _ancestors_markup = [ + _ancestors_markup[0], + _ancestors_markup[1], + _ancestors_markup[2], + _ancestors_markup[3], + _ancestors_markup[4], + 0,0,0 + ]; + } + if (obj.metainfo.heading_lev_markup == 6) { + _ancestors_markup = [ + _ancestors_markup[0], + _ancestors_markup[1], + _ancestors_markup[2], + _ancestors_markup[3], + _ancestors_markup[4], + _ancestors_markup[5], + 0,0 + ]; + } + if (obj.metainfo.heading_lev_markup == 7) { + _ancestors_markup = [ + _ancestors_markup[0], + _ancestors_markup[1], + _ancestors_markup[2], + _ancestors_markup[3], + _ancestors_markup[4], + _ancestors_markup[5], + _ancestors_markup[6], + 0 + ]; + } + if (obj.metainfo.heading_lev_markup == 8) { + _ancestors_markup = [ + _ancestors_markup[0], + _ancestors_markup[1], + _ancestors_markup[2], + _ancestors_markup[3], + _ancestors_markup[4], + _ancestors_markup[5], + _ancestors_markup[6], + _ancestors_markup[7] + ]; + } + _ancestors_markup[obj.metainfo.heading_lev_markup] = obj.metainfo.ocn; + } + debug(ancestor_markup) { + writeln("marked up: ", _ancestors_markup); + } + return _ancestors_markup; +} +#+END_SRC + +****** get ancestors collapsed + +#+name: abs_post +#+BEGIN_SRC d +int[] _get_ancestors_collapsed(O)(O obj, ref int[] _ancestors_collapsed) { + if (obj.metainfo.is_a == "heading") { + if (obj.metainfo.heading_lev_collapsed == 1) { + _ancestors_collapsed = [ + _ancestors_collapsed[0], + 0,0,0,0,0,0,0 + ]; + } + if (obj.metainfo.heading_lev_collapsed == 2) { + _ancestors_collapsed = [ + _ancestors_collapsed[0], + _ancestors_collapsed[1], + 0,0,0,0,0,0 + ]; + } + if (obj.metainfo.heading_lev_collapsed == 3) { + _ancestors_collapsed = [ + _ancestors_collapsed[0], + _ancestors_collapsed[1], + _ancestors_collapsed[2], + 0,0,0,0,0 + ]; + } + if (obj.metainfo.heading_lev_collapsed == 4) { + _ancestors_collapsed = [ + _ancestors_collapsed[0], + _ancestors_collapsed[1], + _ancestors_collapsed[2], + _ancestors_collapsed[3], + 0,0,0,0 + ]; + } + if (obj.metainfo.heading_lev_collapsed == 5) { + _ancestors_collapsed = [ + _ancestors_collapsed[0], + _ancestors_collapsed[1], + _ancestors_collapsed[2], + _ancestors_collapsed[3], + _ancestors_collapsed[4], + 0,0,0 + ]; + } + if (obj.metainfo.heading_lev_collapsed == 6) { + _ancestors_collapsed = [ + _ancestors_collapsed[0], + _ancestors_collapsed[1], + _ancestors_collapsed[2], + _ancestors_collapsed[3], + _ancestors_collapsed[4], + _ancestors_collapsed[5], + 0,0 + ]; + } + if (obj.metainfo.heading_lev_collapsed == 7) { + _ancestors_collapsed = [ + _ancestors_collapsed[0], + _ancestors_collapsed[1], + _ancestors_collapsed[2], + _ancestors_collapsed[3], + _ancestors_collapsed[4], + _ancestors_collapsed[5], + _ancestors_collapsed[6], + 0 + ]; + } + if (obj.metainfo.heading_lev_collapsed == 8) { + _ancestors_collapsed = [ + _ancestors_collapsed[0], + _ancestors_collapsed[1], + _ancestors_collapsed[2], + _ancestors_collapsed[3], + _ancestors_collapsed[4], + _ancestors_collapsed[5], + _ancestors_collapsed[6], + _ancestors_collapsed[7] + ]; + } + _ancestors_collapsed[obj.metainfo.heading_lev_collapsed] = obj.metainfo.ocn; + } + debug(ancestor_collapsed) { + writeln("collapsed: ", _ancestors_collapsed); + } + return _ancestors_collapsed; +} +#+END_SRC + +***** ↻ Loop section: document body [bd] + +- substantive object numbers already exist +- number un-numbered non-substantive text + +#+name: abs_post +#+BEGIN_SRC d +/+ multiple 1~ levels, loop through document body +/ +if (the_document_body_section.length > 1) { + int[] _ancestors_markup = [0,0,0,0,0,0,0,0]; + int[][] _ancestors_markup_; + _ancestors_markup = [1,0,0,0,0,0,0,0]; + _ancestors_markup_ ~= _ancestors_markup; + int[] _ancestors_collapsed = [0,0,0,0,0,0,0,0]; + int[][] _ancestors_collapsed_; + _ancestors_collapsed = [1,0,0,0,0,0,0,0]; + _ancestors_collapsed_ ~= _ancestors_collapsed; + foreach (ref obj; the_document_body_section) { + if (obj.metainfo.is_a == "heading") { + obj.metainfo.markedup_ancestors = _get_ancestors_markup(obj, _ancestors_markup); + } + } + debug(ancestors) { + writeln("ancestors markup o_n: ", obj.metainfo.markedup_ancestors); + writeln("ancestors collapsed o_n: ", obj.metainfo.markedup_ancestors); + } +} +#+END_SRC + ***** ↻ Loop section: endnotes #+name: abs_post @@ -1879,8 +2093,9 @@ Build here: - DOM structure - ancestors & decendants - ancestors could be determined earlier, but convenient to have here - - descendants could be in the form of: headings contained under current - heading, and/or; the range of objects under the current heading + - descendants could be in the form of: + - headings contained under current heading, and/or; + - the range of objects under the current heading - numbering - already given - substantive object numbers @@ -1984,8 +2199,8 @@ foreach (ref obj; the_document_head_section) { || (opt_action.sqlite_discrete) || (opt_action.sqlite_update) || (opt_action.postgresql)) { - obj = obj_dom_structure_set_markup_tags(obj, dom_markedup, obj.metainfo.heading_lev_markup); - obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.metainfo.heading_lev_collapsed); + obj = obj_dom_structure_set_markup_tags(obj, dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); + obj = obj_dom_set_collapsed_tags(obj, dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); } obj = obj_heading_ancestors(obj, lv_ancestors_txt); } @@ -1998,8 +2213,8 @@ foreach (ref obj; the_document_head_section) { #+BEGIN_SRC d if (the_table_of_contents_section["scroll"].length > 1) { /+ scroll +/ - dom_markedup_buffer = dom_markedup.dup; - dom_collapsed_buffer = dom_collapsed.dup; + dom_structure_markedup_tags_status_buffer = dom_structure_markedup_tags_status.dup; + dom_structure_collapsed_tags_status_buffer = dom_structure_collapsed_tags_status.dup; foreach (ref obj; the_table_of_contents_section["scroll"]) { if (obj.metainfo.is_a == "heading") { if (obj.metainfo.heading_lev_markup <= 4) { @@ -2018,15 +2233,15 @@ if (the_table_of_contents_section["scroll"].length > 1) { || (opt_action.sqlite_discrete) || (opt_action.sqlite_update) || (opt_action.postgresql)) { - obj = obj_dom_structure_set_markup_tags(obj, dom_markedup, obj.metainfo.heading_lev_markup); - obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.metainfo.heading_lev_collapsed); + obj = obj_dom_structure_set_markup_tags(obj, dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); + obj = obj_dom_set_collapsed_tags(obj, dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); } obj = obj_heading_ancestors(obj, lv_ancestors_txt); } } /+ seg +/ - dom_markedup = dom_markedup_buffer.dup; - dom_collapsed = dom_collapsed_buffer.dup; + dom_structure_markedup_tags_status = dom_structure_markedup_tags_status_buffer.dup; + dom_structure_collapsed_tags_status = dom_structure_collapsed_tags_status_buffer.dup; foreach (ref obj; the_table_of_contents_section["seg"]) { if (obj.metainfo.is_a == "heading") { debug(dom) { @@ -2044,8 +2259,8 @@ if (the_table_of_contents_section["scroll"].length > 1) { || (opt_action.html_scroll) || (opt_action.html_seg) || (opt_action.epub)) { - obj = obj_dom_structure_set_markup_tags(obj, dom_markedup, obj.metainfo.heading_lev_markup); - obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.metainfo.heading_lev_collapsed); + obj = obj_dom_structure_set_markup_tags(obj, dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); + obj = obj_dom_set_collapsed_tags(obj, dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); } obj = obj_heading_ancestors(obj, lv_ancestors_txt); } @@ -2084,8 +2299,8 @@ if (the_document_body_section.length > 1) { || (opt_action.sqlite_discrete) || (opt_action.sqlite_update) || (opt_action.postgresql)) { - obj = obj_dom_structure_set_markup_tags(obj, dom_markedup, obj.metainfo.heading_lev_markup); - obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.metainfo.heading_lev_collapsed); + obj = obj_dom_structure_set_markup_tags(obj, dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); + obj = obj_dom_set_collapsed_tags(obj, dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); } obj = obj_heading_ancestors(obj, lv_ancestors_txt); } else if (obj.metainfo.is_a == "para") { @@ -2105,10 +2320,10 @@ auto images=uniq(_images.sort()); #+BEGIN_SRC d /+ optional only one 1~ level +/ if (the_endnotes_section.length > 1) { - dom_markedup_buffer = dom_markedup.dup; - dom_collapsed_buffer = dom_collapsed.dup; - dom_markedup = dom_markedup_buffer.dup; - dom_collapsed = dom_collapsed_buffer.dup; + dom_structure_markedup_tags_status_buffer = dom_structure_markedup_tags_status.dup; + dom_structure_collapsed_tags_status_buffer = dom_structure_collapsed_tags_status.dup; + dom_structure_markedup_tags_status = dom_structure_markedup_tags_status_buffer.dup; + dom_structure_collapsed_tags_status = dom_structure_collapsed_tags_status_buffer.dup; foreach (ref obj; the_endnotes_section) { if (obj.metainfo.is_a == "heading") { debug(dom) { @@ -2135,8 +2350,8 @@ if (the_endnotes_section.length > 1) { || (opt_action.sqlite_discrete) || (opt_action.sqlite_update) || (opt_action.postgresql)) { - obj = obj_dom_structure_set_markup_tags(obj, dom_markedup, obj.metainfo.heading_lev_markup); - obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.metainfo.heading_lev_collapsed); + obj = obj_dom_structure_set_markup_tags(obj, dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); + obj = obj_dom_set_collapsed_tags(obj, dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); } obj = obj_heading_ancestors(obj, lv_ancestors_txt); } @@ -2178,8 +2393,8 @@ if (the_glossary_section.length > 1) { || (opt_action.sqlite_discrete) || (opt_action.sqlite_update) || (opt_action.postgresql)) { - obj = obj_dom_structure_set_markup_tags(obj, dom_markedup, obj.metainfo.heading_lev_markup); - obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.metainfo.heading_lev_collapsed); + obj = obj_dom_structure_set_markup_tags(obj, dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); + obj = obj_dom_set_collapsed_tags(obj, dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); } obj = obj_heading_ancestors(obj, lv_ancestors_txt); } else if (obj.metainfo.is_a == "glossary") { @@ -2224,8 +2439,8 @@ if (the_bibliography_section.length > 1) { || (opt_action.sqlite_discrete) || (opt_action.sqlite_update) || (opt_action.postgresql)) { - obj = obj_dom_structure_set_markup_tags(obj, dom_markedup, obj.metainfo.heading_lev_markup); - obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.metainfo.heading_lev_collapsed); + obj = obj_dom_structure_set_markup_tags(obj, dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); + obj = obj_dom_set_collapsed_tags(obj, dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); } obj = obj_heading_ancestors(obj, lv_ancestors_txt); } else if (obj.metainfo.is_a == "bibliography") { @@ -2248,8 +2463,8 @@ int ocn_bkidx_ = 0; int ocn_bidx_; if (the_bookindex_section["scroll"].length > 1) { /+ scroll +/ - dom_markedup_buffer = dom_markedup.dup; - dom_collapsed_buffer = dom_collapsed.dup; + dom_structure_markedup_tags_status_buffer = dom_structure_markedup_tags_status.dup; + dom_structure_collapsed_tags_status_buffer = dom_structure_collapsed_tags_status.dup; foreach (ref obj; the_bookindex_section["scroll"]) { if (obj.metainfo.is_a == "heading") { debug(dom) { @@ -2275,20 +2490,20 @@ if (the_bookindex_section["scroll"].length > 1) { || (opt_action.sqlite_discrete) || (opt_action.sqlite_update) || (opt_action.postgresql)) { - obj = obj_dom_structure_set_markup_tags(obj, dom_markedup, obj.metainfo.heading_lev_markup); - obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.metainfo.heading_lev_collapsed); + obj = obj_dom_structure_set_markup_tags(obj, dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); + obj = obj_dom_set_collapsed_tags(obj, dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); } obj = obj_heading_ancestors(obj, lv_ancestors_txt); } else if (obj.metainfo.is_a == "bookindex") { - obj_cite_digits = ocn_emit(OCNstatus.bkidx); + obj_cite_digits = ocn_emit(OCNstatus.bkidx); obj.metainfo.ocn = obj_cite_digits.digit; obj.metainfo.o_n_book_index = obj_cite_digits.bkidx; obj.metainfo.object_number_type = OCNtype.bkidx; } } /+ seg +/ - dom_markedup = dom_markedup_buffer.dup; - dom_collapsed = dom_collapsed_buffer.dup; + dom_structure_markedup_tags_status = dom_structure_markedup_tags_status_buffer.dup; + dom_structure_collapsed_tags_status = dom_structure_collapsed_tags_status_buffer.dup; foreach (ref obj; the_bookindex_section["seg"]) { if (obj.metainfo.is_a == "heading") { debug(dom) { @@ -2314,12 +2529,12 @@ if (the_bookindex_section["scroll"].length > 1) { || (opt_action.sqlite_discrete) || (opt_action.sqlite_update) || (opt_action.postgresql)) { - obj = obj_dom_structure_set_markup_tags(obj, dom_markedup, obj.metainfo.heading_lev_markup); - obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.metainfo.heading_lev_collapsed); + obj = obj_dom_structure_set_markup_tags(obj, dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); + obj = obj_dom_set_collapsed_tags(obj, dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); } obj = obj_heading_ancestors(obj, lv_ancestors_txt); } else if (obj.metainfo.is_a == "bookindex") { - ocn_bidx_ = ++ocn_bkidx_; + ocn_bidx_ = ++ocn_bkidx_; obj.metainfo.o_n_book_index = ocn_bidx_; // FIX need to distinguish from regular ocn obj.metainfo.object_number_type = OCNtype.bkidx; } @@ -2363,8 +2578,8 @@ if (the_blurb_section.length > 1) { || (opt_action.sqlite_discrete) || (opt_action.sqlite_update) || (opt_action.postgresql)) { - obj = obj_dom_structure_set_markup_tags(obj, dom_markedup, obj.metainfo.heading_lev_markup); - obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.metainfo.heading_lev_collapsed); + obj = obj_dom_structure_set_markup_tags(obj, dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); + obj = obj_dom_set_collapsed_tags(obj, dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); } obj = obj_heading_ancestors(obj, lv_ancestors_txt); } else if (obj.metainfo.is_a == "blurb") { @@ -2383,8 +2598,8 @@ if (the_blurb_section.length > 1) { /+ TODO - note create/insert heading object sole purpose eof close all open tags sort out: - - obj.metainfo.dom_markedup = dom_markedup; - - obj.metainfo.dom_collapsed = dom_collapsed; + - obj.metainfo.dom_structure_markedup_tags_status = dom_structure_markedup_tags_status; + - obj.metainfo.dom_structure_collapsed_tags_status = dom_structure_collapsed_tags_status; +/ comp_obj_heading_ = comp_obj_heading_.init; comp_obj_heading_.metainfo.is_of_part = "empty"; @@ -2399,10 +2614,10 @@ comp_obj_heading_.metainfo.heading_lev_markup = 9; comp_obj_heading_.metainfo.heading_lev_collapsed = 9; comp_obj_heading_.metainfo.parent_ocn = 0; comp_obj_heading_.metainfo.parent_lev_markup = 0; -comp_obj_heading_.metainfo.dom_markedup = dom_markedup.dup; -comp_obj_heading_.metainfo.dom_collapsed = dom_collapsed.dup; -comp_obj_heading_ = obj_dom_structure_set_markup_tags(comp_obj_heading_, dom_markedup, 0); -comp_obj_heading_ = obj_dom_set_collapsed_tags(comp_obj_heading_, dom_collapsed, 0); +comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = dom_structure_markedup_tags_status.dup; +comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = dom_structure_collapsed_tags_status.dup; +comp_obj_heading_ = obj_dom_structure_set_markup_tags(comp_obj_heading_, dom_structure_markedup_tags_status, 0); +comp_obj_heading_ = obj_dom_set_collapsed_tags(comp_obj_heading_, dom_structure_collapsed_tags_status, 0); comp_obj_heading_ = obj_heading_ancestors(comp_obj_heading_, lv_ancestors_txt); // the_dom_tail_section ~= comp_obj_heading_; // remove tail for now, decide on later #+END_SRC @@ -2497,16 +2712,68 @@ destroy(the_blurb_section); destroy(html_segnames); destroy(bookindex_unordered_hashes); destroy(an_object); -obj_cite_digits = ocn_emit(OCNstatus.reset); -biblio_arr_json = []; -obj_cite_digit_ = 0; -html_segnames_ptr = 0; -html_segnames_ptr_cntr = 0; -content_non_header = "8"; -dom_markedup = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; -dom_markedup_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; -dom_collapsed = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; -dom_collapsed_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; +obj_cite_digits = ocn_emit(OCNstatus.reset); +biblio_arr_json = []; +obj_cite_digit_ = 0; +html_segnames_ptr = 0; +html_segnames_ptr_cntr = 0; +content_non_header = "8"; +dom_structure_markedup_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; +dom_structure_markedup_tags_status_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; +dom_structure_collapsed_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; +dom_structure_collapsed_tags_status_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; +#+END_SRC + +*** [#A] ↻ _reloop_ :reloop: + +- this would work, but no need for extra loop, remove + +#+name: abs_post_doc_reloop_processing +#+BEGIN_SRC d +debug(abstraction) { + foreach (part; sequenced_document_keys.scroll) { + foreach (ref obj; document_the[part]) { + debug(node_misc) { + if (obj.metainfo.is_a == "heading") { + writeln("heading ancestors text?: ", obj.tags.heading_ancestors_text); + } + } + debug(node_headings) { + if (obj.metainfo.is_a == "heading") { + writeln("---"); + writeln(obj.text); + writeln(" node: ", obj.metainfo.node); + writeln(" ocn: ", obj.metainfo.ocn); + writeln(" markedup heading lev: ", obj.metainfo.heading_lev_markup); + writeln(" collapsed heading lev ", obj.metainfo.heading_lev_collapsed); + writeln(" parent ocn: ", obj.metainfo.parent_ocn); + writeln(" parent lev: ", obj.metainfo.parent_lev_markup); + writeln(" markedup ancestors o_n: ", obj.metainfo.markedup_ancestors); + writeln(" dom markedup: ", obj.metainfo.dom_structure_markedup_tags_status); + writeln(" collapsed ancestors o_n: ", obj.metainfo.collapsed_ancestors); + writeln(" dom collapsed: ", obj.metainfo.dom_structure_collapsed_tags_status); + } + } + debug(node_all) { + writeln("---"); + if (obj.metainfo.is_a == "heading") { + writeln(obj.text); + } + writeln("node: ", obj.metainfo.node); + writeln("ocn: ", obj.metainfo.ocn); + writeln("markedup heading lev: ", obj.metainfo.heading_lev_markup); + writeln("collapsed heading lev ", obj.metainfo.heading_lev_collapsed); + writeln("markedup ancestors o_n: ", obj.metainfo.markedup_ancestors); + writeln("collapsed ancestors o_n: ", obj.metainfo.collapsed_ancestors); + writeln("dom markedup: ", obj.metainfo.dom_structure_markedup_tags_status); + writeln("dom collapsed: ", obj.metainfo.dom_structure_collapsed_tags_status); + writeln("parent ocn: ", obj.metainfo.parent_ocn); + writeln("parent lev: ", obj.metainfo.parent_lev_markup); + writeln("Node: ", obj.metainfo.ocn); + } + } + } +} #+END_SRC *** [#A] _return document tuple_ :return:tuple: @@ -6808,7 +7075,7 @@ struct NodeStructureMetadata { comp_obj_location.tags.segment_anchor_tag = segment_anchor_tag.to!string; comp_obj_location.metainfo.parent_ocn = p_["object_number"]; comp_obj_location.metainfo.parent_lev_markup = p_["lev_markup_number"]; - debug(node) { + debug(_node) { if (lev_markup_number.match(rgx.levels_numbered_headings)) { writeln("x ", _node.to!string); } else { @@ -6979,7 +7246,7 @@ struct NodeStructureMetadata { _comp_obj_heading_.has.inline_notes_reg = flag_notes_reg; _comp_obj_heading_.has.inline_notes_star = flag_notes_star; _comp_obj_heading_.has.inline_links = flag_links; - debug(node) { + debug(_node) { if (lev_markup_number.match(rgx.levels_numbered_headings)) { writeln("* ", _node.to!string); } @@ -7402,50 +7669,50 @@ struct DocObj_MetaInfo_ { // metainfo } return _out; } - int[] dom_markedup = [ 0, 0, 0, 0, 0, 0, 0, 0,]; - int[] dom_collapsed = [ 0, 0, 0, 0, 0, 0, 0, 0,]; - int[] heading_ancestors = [ 0, 0, 0, 0, 0, 0, 0, 0,]; - int parent_lev_markup = 0; - int parent_ocn = 0; - int[] ancestors = []; + int[] markedup_ancestors = [ 0, 0, 0, 0, 0, 0, 0, 0,]; + int[] collapsed_ancestors = [ 0, 0, 0, 0, 0, 0, 0, 0,]; + int[] dom_structure_markedup_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0,]; + int[] dom_structure_collapsed_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0,]; + int parent_lev_markup = 0; + int parent_ocn = 0; } -struct DocObj_TxtAttrib_ { // attrib - int indent_base = 0; - int indent_hang = 0; - bool bullet = false; - string language = ""; // not implemented, consider +struct DocObj_TxtAttrib_ { // attrib + int indent_base = 0; + int indent_hang = 0; + bool bullet = false; + string language = ""; // not implemented, consider } -struct DocObj_Has_ { // has - bool inline_links = false; - bool inline_notes_reg = false; - bool inline_notes_star = false; - bool contains_image_without_dimensions = false; +struct DocObj_Has_ { // has + bool inline_links = false; + bool inline_notes_reg = false; + bool inline_notes_star = false; + bool contains_image_without_dimensions = false; } -struct DocObj_Table_ { // table - int number_of_columns = 0; - double[] column_widths = []; - string[] column_aligns = []; - bool heading = false; - bool walls = false; // not implemented +struct DocObj_Table_ { // table + int number_of_columns = 0; + double[] column_widths = []; + string[] column_aligns = []; + bool heading = false; + bool walls = false; // not implemented } -struct DocObj_CodeBlock_ { // code_block - string syntax = ""; +struct DocObj_CodeBlock_ { // code_block + string syntax = ""; } -struct DocObj_Pointer_ { // ptr - int doc_object = 0; - int html_segnames = 0; - int heading = 0; +struct DocObj_Pointer_ { // ptr + int doc_object = 0; + int html_segnames = 0; + int heading = 0; } -struct DocObj_Tags_ { // tags - string[] heading_ancestors_text = [ "", "", "", "", "", "", "", "", ]; - string segment_anchor_tag = ""; - string segname_prev = ""; - string segname_next = ""; - string[] lev4_subtoc = []; - string[] anchor_tags = []; +struct DocObj_Tags_ { // tags + string[] heading_ancestors_text = [ "", "", "", "", "", "", "", "", ]; // TODO redundant? see markedup and collapsed ancestors DONE + string segment_anchor_tag = ""; + string segname_prev = ""; + string segname_next = ""; + string[] lev4_subtoc = []; + string[] anchor_tags = []; } struct ObjGenericComposite { - string text = ""; + string text = ""; DocObj_MetaInfo_ metainfo; DocObj_TxtAttrib_ attrib; DocObj_Tags_ tags; diff --git a/org/meta_debugs.org b/org/meta_debugs.org index b89b4ea..e34a95c 100644 --- a/org/meta_debugs.org +++ b/org/meta_debugs.org @@ -310,7 +310,7 @@ debug(toc_nav_dom) { foreach (obj; contents[sect]) { if (obj.metainfo.is_a == "heading") { foreach_reverse (k; 0 .. 7) { - switch (obj.dom_markedup[k]) { + switch (obj.dom_structure_markedup_tags_status[k]) { case DomTags.close : writeln(markup.indent_by_spaces_provided(k), "</", k, ">"); break; @@ -337,7 +337,7 @@ debug(toc_nav_dom) { foreach (obj; contents[sect]) { if (obj.metainfo.is_a == "heading") { foreach_reverse (k; 0 .. 7) { - switch (obj.dom_collapsed[k]) { + switch (obj.dom_structure_collapsed_tags_status[k]) { case DomTags.close : writeln(markup.indent_by_spaces_provided(k), "</", k, ">"); break; diff --git a/org/output_sqlite.org b/org/output_sqlite.org index 45f8303..58e612e 100644 --- a/org/output_sqlite.org +++ b/org/output_sqlite.org @@ -1063,9 +1063,9 @@ foreach (part; doc_matters.xml.keys_seq.sql) { if ((doc_matters.opt.action.verbose)) { writeln( "markup: ", obj.metainfo.heading_lev_markup, - "> ", obj.metainfo.dom_markedup, + "> ", obj.metainfo.dom_structure_markedup_tags_status, "; collapsed: ", obj.metainfo.heading_lev_collapsed, - "> ", obj.metainfo.dom_collapsed, + "> ", obj.metainfo.dom_structure_collapsed_tags_status, "; ocn: ", obj.metainfo.ocn, " node: ", obj.metainfo.node, "; parent: ", obj.metainfo.parent_lev_markup, diff --git a/org/output_xmls.org b/org/output_xmls.org index 3742975..27c3f2f 100644 --- a/org/output_xmls.org +++ b/org/output_xmls.org @@ -2058,7 +2058,7 @@ string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { string _txt = obj.text.replaceAll(rgx.inline_notes_al_gen, "").strip; foreach_reverse (n; 0 .. 7) { string k = n.to!string; - switch (obj.metainfo.dom_collapsed[n]) { + switch (obj.metainfo.dom_structure_collapsed_tags_status[n]) { case DomTags.close : toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "</li>" ~ "\n"; toc ~= markup.indent_by_spaces_provided(n, " ") ~ "</ol>" ~ "\n"; @@ -2164,7 +2164,7 @@ string epub2_oebps_toc_ncx(D,I)(D doc_abstraction, I doc_matters) { string _txt = obj.text.replaceAll(rgx.inline_notes_al_gen, "").strip; string hashtag =(obj.metainfo.heading_lev_markup <= 4) ? "" : ("#" ~ obj.metainfo.ocn.to!string); foreach_reverse (k; 0 .. 7) { - switch (obj.metainfo.dom_markedup[k]) { + switch (obj.metainfo.dom_structure_markedup_tags_status[k]) { case DomTags.close : toc ~= "\n </navPoint>"; break; |