From 762439ade3de42d2043fafc0005b255c6c58ba49 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 11 Dec 2016 11:17:06 -0500 Subject: 0.10.0 generic object (ObjGenericComposite), removed "object_set" --- org/ao_abstract_doc_source.org | 1851 +++++++++++++++------------------------- 1 file changed, 702 insertions(+), 1149 deletions(-) (limited to 'org/ao_abstract_doc_source.org') diff --git a/org/ao_abstract_doc_source.org b/org/ao_abstract_doc_source.org index 4292328..c11193c 100644 --- a/org/ao_abstract_doc_source.org +++ b/org/ao_abstract_doc_source.org @@ -13,7 +13,7 @@ #+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) [[./sdp.org][sdp]] [[./][org/]] -* 0. Code Outline / Structure (tangles) :tangle:io:file: +* 0. Code Skeleton / Outline / Structure (tangles) :tangle:io:file: ** 1. ao abstract doc source: :ao_abstract_doc_source.d: #+BEGIN_SRC d :tangle ../src/sdp/ao_abstract_doc_source.d @@ -139,17 +139,6 @@ template SiSUdocAbstraction() { template ObjectSetter() { /+ structs +/ <> - /+ structs setter +/ - struct ObjectAbstractSet { - import std.conv : to; - <> - <> - <> - <> - <> - <> - <> - } } #+END_SRC @@ -183,13 +172,12 @@ mixin InternalMarkup; #+BEGIN_SRC d /+ initialize +/ auto rgx = Rgx(); -ObjComposite[][string] the_table_of_contents_section; -ObjComposite[] the_document_head_section, the_document_body_section, the_bibliography_section, the_glossary_section, the_blurb_section; +ObjGenericComposite[][string] the_table_of_contents_section; +ObjGenericComposite[] the_document_head_section, the_document_body_section, the_bibliography_section, the_glossary_section, the_blurb_section; string[string] an_object, processing; string an_object_key; string[] anchor_tags; string segment_anchor_tag_that_object_belongs_to; -auto set_abstract_object = ObjectAbstractSet(); auto note_section = NotesSection(); /+ enum +/ enum State { off, on } @@ -238,13 +226,12 @@ string[][string][string] bookindex_unordered_hashes; auto bookindex_extract_hash = BookIndexNuggetHash(); string[][string][string] bkidx_hash( string bookindex_section, - int obj_cite_number + int obj_cite_number ) { return bookindex_extract_hash.bookindex_nugget_hash(bookindex_section, obj_cite_number); } /+ node +/ -string[string] _node_heading_str; -int[string] _node_heading_int; +ObjGenericComposite comp_obj_heading, comp_obj_location, comp_obj_block, comp_obj_code, comp_obj_poem_ocn, comp_obj_comment; auto node_construct = NodeStructureMetadata(); #+END_SRC @@ -271,10 +258,9 @@ scope(exit) { #+name: abs_init_rest #+BEGIN_SRC d -auto node_heading_int_ = node_metadata_heading_int; -auto node_heading_str_ = node_metadata_heading_str; auto node_para_int_ = node_metadata_para_int; auto node_para_str_ = node_metadata_para_str; +ObjGenericComposite comp_obj_heading_, comp_obj_para, comp_obj_toc; line_occur = [ "heading" : 0, "para" : 0, @@ -332,22 +318,20 @@ string _anchor_tag; string toc_txt_; an_object["glossary_nugget"] = ""; an_object["blurb_nugget"] = ""; -node_heading_str_["is"] = "heading"; -node_heading_str_["ocn"] = "0"; -node_heading_str_["segment_anchor_tag"] = "toc"; -node_heading_str_["attrib"] = ""; -node_heading_str_["marked_up_lev"] = "1"; -node_heading_int_["heading_lev_markup"] = 4; -node_heading_int_["heading_lev_collapsed"] = 2; -node_heading_int_["parent_ocn"] = 1; -node_heading_int_["parent_lev_markup"] = 0; -auto toc_head = - set_abstract_object.contents_heading( - "Table of Contents", // nugget/object - node_heading_str_, - node_heading_int_, - ["toc"], // anchor tag - ); +comp_obj_heading_ = comp_obj_heading_.init; +comp_obj_heading_.use = "content"; +comp_obj_heading_.of = "para"; +comp_obj_heading_.is_a = "heading"; +comp_obj_heading_.text = "Table of Contents"; +comp_obj_heading_.ocn = 0; +comp_obj_heading_.segment_anchor_tag = "toc"; +comp_obj_heading_.marked_up_level = "1"; +comp_obj_heading_.heading_lev_markup = 4; +comp_obj_heading_.heading_lev_collapsed = 2; +comp_obj_heading_.parent_ocn = 1; +comp_obj_heading_.parent_lev_markup = 0; +comp_obj_heading_.anchor_tags = ["toc"]; +auto toc_head = comp_obj_heading_; the_table_of_contents_section = [ "seg": [toc_head], "scroll": [toc_head], @@ -468,54 +452,47 @@ if there is a glossary section you need to: line_occur["para"] = State.off; an_object_key="glossary_nugget"; // if (matchFirst(line, rgx.heading_glossary)) { - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = ""; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "B"; - node_heading_int_["heading_lev_markup"] = 1; - node_heading_int_["heading_lev_collapsed"] = 1; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_glossary_section ~= - set_abstract_object.contents_heading( - "Glossary", // nugget/object - node_heading_str_, - node_heading_int_, - [""], // anchor tag - ); - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = "glossary"; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "1"; - node_heading_int_["heading_lev_markup"] = 4; - node_heading_int_["heading_lev_collapsed"] = 2; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_glossary_section ~= - set_abstract_object.contents_heading( - "Glossary", // nugget/object - node_heading_str_, - node_heading_int_, - ["glossary"], // anchor tag - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "Glossary"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.marked_up_level = "B"; + comp_obj_heading_.heading_lev_markup = 1; + comp_obj_heading_.heading_lev_collapsed = 1; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + the_glossary_section ~= comp_obj_heading_; + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "Glossary"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.segment_anchor_tag = "glossary"; + comp_obj_heading_.marked_up_level = "1"; + comp_obj_heading_.heading_lev_markup = 4; + comp_obj_heading_.heading_lev_collapsed = 2; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + comp_obj_heading_.anchor_tags = ["glossary"]; + the_glossary_section ~= comp_obj_heading_; // } else if (matchFirst(line, rgx.heading)) { // _heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, type, dochead_meta_aa); // levels? } else { _para_match_(line, an_object, an_object_key, indent, bullet, type, line_occur); - node_para_str_["is"] = "para"; - node_para_str_["attrib"] = ""; - node_para_int_["ocn"] = 0; - node_para_int_["indent_hang"] = indent["hang_position"]; - node_para_int_["indent_base"] = indent["base_position"]; - node_para_int_["bullet"] = (bullet) ? 1 : 0; - the_glossary_section ~= - set_abstract_object.contents_para( - to!string(line), // an_object["substantive"], - node_para_str_, - node_para_int_, - ); + comp_obj_para = comp_obj_para.init; + comp_obj_para.use = "content"; + comp_obj_para.of = "para"; + comp_obj_para.is_a = "para"; + comp_obj_para.text = to!string(line).strip; + comp_obj_para.ocn = 0; + comp_obj_para.obj_cite_number = "0"; + comp_obj_para.indent_hang = indent["hang_position"]; + comp_obj_para.indent_base = indent["base_position"]; + comp_obj_para.bullet = bullet; + the_glossary_section ~= comp_obj_para; } type["ocn_status"] = TriState.off; } @@ -557,71 +534,60 @@ if there is a blurb section you need to: line_occur["para"] = State.off; an_object_key="blurb_nugget"; if (matchFirst(line, rgx.heading_blurb)) { - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = ""; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "B"; - node_heading_int_["heading_lev_markup"] = 1; - node_heading_int_["heading_lev_collapsed"] = 1; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_blurb_section ~= - set_abstract_object.contents_heading( - "Blurb", // nugget/object - node_heading_str_, - node_heading_int_, - [""], // anchor tag - ); - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = "blurb"; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "1"; - node_heading_int_["heading_lev_markup"] = 4; - node_heading_int_["heading_lev_collapsed"] = 2; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_blurb_section ~= - set_abstract_object.contents_heading( - "Blurb", // nugget/object - node_heading_str_, - node_heading_int_, - ["blurb"], // anchor tag - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "Blurb"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.marked_up_level = "B"; + comp_obj_heading_.heading_lev_markup = 1; + comp_obj_heading_.heading_lev_collapsed = 1; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + the_blurb_section ~= comp_obj_heading_; + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "Blurb"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.segment_anchor_tag = "blurb"; + comp_obj_heading_.marked_up_level = "1"; + comp_obj_heading_.heading_lev_markup = 4; + comp_obj_heading_.heading_lev_collapsed = 2; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + comp_obj_heading_.anchor_tags = ["blurb"]; + the_blurb_section ~= comp_obj_heading_; } else if ((matchFirst(line, rgx.heading)) && (opt_action_bool["backmatter"] && opt_action_bool["section_blurb"])) { - _heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, type, dochead_meta_aa); // levels? - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = "blurb"; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = to!string(an_object["lev"]); - node_heading_int_["heading_lev_markup"] = to!int(an_object["lev_markup_number"]); // make int, remove need to conv - node_heading_int_["heading_lev_collapsed"] = to!int(an_object["lev_collapsed_number"]); // make int, remove need to conv - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_blurb_section ~= - set_abstract_object.contents_heading( - to!string(line), // an_object["substantive"], - node_heading_str_, - node_heading_int_, - [""], // anchor tag - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = to!string(line); + comp_obj_heading_.ocn = 0; + comp_obj_heading_.segment_anchor_tag = "blurb"; + comp_obj_heading_.marked_up_level = to!string(an_object["lev"]); + comp_obj_heading_.heading_lev_markup = to!int(an_object["lev_markup_number"]); // make int, remove need to conv + comp_obj_heading_.heading_lev_collapsed = to!int(an_object["lev_collapsed_number"]); // make int, remove need to conv + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + the_blurb_section ~= comp_obj_heading_; } else { _para_match_(line, an_object, an_object_key, indent, bullet, type, line_occur); - node_para_str_["is"] = "para"; - node_para_str_["attrib"] = ""; - node_para_int_["ocn"] = obj_cite_number; - node_para_int_["indent_hang"] = indent["hang_position"]; - node_para_int_["indent_base"] = indent["base_position"]; - node_para_int_["bullet"] = (bullet) ? 1 : 0; - the_blurb_section ~= - set_abstract_object.contents_para( - to!string(line), // an_object["substantive"], - node_para_str_, - node_para_int_, - ); + comp_obj_para = comp_obj_para.init; + comp_obj_para.use = "content"; + comp_obj_para.of = "para"; + comp_obj_para.is_a = "para"; + comp_obj_para.text = to!string(line).strip; + comp_obj_para.ocn = obj_cite_number; + comp_obj_para.obj_cite_number = to!string(obj_cite_number); + comp_obj_para.indent_hang = indent["hang_position"]; + comp_obj_para.indent_base = indent["base_position"]; + comp_obj_para.bullet = bullet; + the_blurb_section ~= comp_obj_para; } type["ocn_status"] = TriState.off; } @@ -766,8 +732,12 @@ if ((matchFirst(line, rgx.book_index)) writeln(line); } an_object[an_object_key] ~= line ~= "\n"; - the_document_body_section ~= - set_abstract_object.contents_comment(strip(an_object[an_object_key])); + comp_obj_comment = comp_obj_comment.init; + comp_obj_comment.use = "comment"; + comp_obj_comment.of = "comment"; + comp_obj_comment.is_a = "comment"; + comp_obj_comment.text = an_object[an_object_key].strip; + the_document_body_section ~= comp_obj_comment; _common_reset_(line_occur, an_object, type); processing.remove("verse"); ++cntr; @@ -850,13 +820,12 @@ _block_flag_line_empty_( the_document_body_section, bookindex_unordered_hashes, obj_cite_number, - _node_heading_str, - _node_heading_int, + comp_obj_heading, cntr, type, obj_cite_number_poem, dochead_make_aa -); // watch +); #+END_SRC ****** line empty [+1] @@ -911,8 +880,9 @@ if ((type["heading"] == State.on) html_segnames_ptr = html_segnames_ptr_cntr; html_segnames_ptr_cntr++; } - auto _node_t = + auto comp_obj_heading = node_construct.node_emitter_heading( + an_object["substantive"], // string an_object["lev"], // string an_object["lev_markup_number"], // string an_object["lev_collapsed_number"], // string @@ -923,22 +893,12 @@ if ((type["heading"] == State.on) an_object["is"], // string html_segnames_ptr, // int ); - _node_heading_str = _node_t[0]; - _node_heading_int = _node_t[1]; - an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_heading_str, _node_heading_int); ++heading_ptr; debug(segments) { writeln(an_object["lev_markup_number"]); writeln(segment_anchor_tag_that_object_belongs_to); } - the_document_body_section ~= - set_abstract_object.contents_heading( - an_object["substantive"], - _node_heading_str, - _node_heading_int, - anchor_tags, - ); + the_document_body_section ~= comp_obj_heading; // track previous heading and make assertions debug(objectrelated1) { // check writeln(line); @@ -962,8 +922,8 @@ if ((type["heading"] == State.on) bookindex_unordered_hashes = bkidx_hash(an_object["bookindex_nugget"], obj_cite_number); an_object["is"] = "para"; - auto _node_t = - node_construct.node_emitter( + auto comp_obj_heading = + node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, obj_cite_number, @@ -971,26 +931,22 @@ if ((type["heading"] == State.on) heading_ptr-1, an_object["is"], ); - _node_heading_str = _node_t[0]; - _node_heading_int = _node_t[1]; auto substantive_object_and_anchor_tags_tuple = obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); // ... an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; - an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_heading_str, _node_heading_int); - node_para_str_["is"] = an_object["is"]; - node_para_str_["attrib"] = an_object["attrib"]; - node_para_int_["ocn"] = obj_cite_number; - node_para_int_["indent_hang"] = indent["hang_position"]; - node_para_int_["indent_base"] = indent["base_position"]; - node_para_int_["bullet"] = (bullet) ? 1 : 0; - the_document_body_section ~= - set_abstract_object.contents_para( - an_object["substantive"], - node_para_str_, - node_para_int_, - ); + comp_obj_para = comp_obj_para.init; + comp_obj_para.use = "content"; + comp_obj_para.of = "para"; + comp_obj_para.is_a = "para"; + comp_obj_para.text = to!string(an_object["substantive"]).strip; + comp_obj_para.ocn = obj_cite_number; + comp_obj_para.obj_cite_number = to!string(obj_cite_number); + comp_obj_para.indent_hang = indent["hang_position"]; + comp_obj_para.indent_base = indent["base_position"]; + comp_obj_para.bullet = bullet; + comp_obj_para.anchor_tags = anchor_tags; + the_document_body_section ~= comp_obj_para; _common_reset_(line_occur, an_object, type); indent=[ "hang_position" : 0, @@ -1022,14 +978,14 @@ if (the_document_body_section.length > 0) { && (the_document_body_section.length > previous_length) ) { if ((the_document_body_section[$-1].is_a == "heading") - && (the_document_body_section[$-1].heading_attrib.lev_int_markup < 5)) { + && (the_document_body_section[$-1].heading_lev_markup < 5)) { type["biblio_section"] = State.off; type["glossary_section"] = State.off; type["blurb_section"] = State.off; } previous_length = to!int(the_document_body_section.length); if ( - match(the_document_body_section[$-1].object, + match(the_document_body_section[$-1].text, rgx.inline_notes_delimiter_al_regular_number_note) ) { previous_count=to!int(the_document_body_section.length -1); @@ -1091,28 +1047,24 @@ debug(endnotes) { #+BEGIN_SRC d if (an_object["glossary_nugget"].length == 0) { writeln("no gloss"); - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = ""; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "B"; - node_heading_int_["heading_lev_markup"] = 1; - node_heading_int_["heading_lev_collapsed"] = 1; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_glossary_section ~= - set_abstract_object.contents_heading( - "(skip) there is no Glossary section", // nugget/object - node_heading_str_, - node_heading_int_, - [""], // anchor tag - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "(skip) there is no Glossary section"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.marked_up_level = "B"; + comp_obj_heading_.heading_lev_markup = 1; + comp_obj_heading_.heading_lev_collapsed = 1; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + the_glossary_section ~= comp_obj_heading_; } else { writeln("gloss"); } debug(glossary) { foreach (gloss; the_glossary_section) { - writeln(gloss.object); + writeln(gloss.text); } } #+END_SRC @@ -1131,55 +1083,46 @@ auto biblio_ordered = #+name: abs_post #+BEGIN_SRC d if (biblio_ordered.length > 0) { - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = ""; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "B"; - node_heading_int_["heading_lev_markup"] = 1; - node_heading_int_["heading_lev_collapsed"] = 1; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_bibliography_section ~= - set_abstract_object.contents_heading( - "Bibliography", // nugget/object - node_heading_str_, - node_heading_int_, - [""], // anchor tag - ); - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = "bibliography"; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "1"; - node_heading_int_["heading_lev_markup"] = 4; - node_heading_int_["heading_lev_collapsed"] = 2; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_bibliography_section ~= - set_abstract_object.contents_heading( - "Bibliography", - node_heading_str_, - node_heading_int_, - ["bibliography"], // anchor tag - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "Bibliography"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.marked_up_level = "B"; + comp_obj_heading_.heading_lev_markup = 1; + comp_obj_heading_.heading_lev_collapsed = 1; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + the_bibliography_section ~= comp_obj_heading_; + // --- + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "Bibliography"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.segment_anchor_tag = "bibliography"; + comp_obj_heading_.marked_up_level = "1"; + comp_obj_heading_.heading_lev_markup = 4; + comp_obj_heading_.heading_lev_collapsed = 2; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + comp_obj_heading_.anchor_tags = ["bibliography"]; + the_bibliography_section ~= comp_obj_heading_; } else { - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = ""; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "B"; - node_heading_int_["heading_lev_markup"] = 1; - node_heading_int_["heading_lev_collapsed"] = 1; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_bibliography_section ~= - set_abstract_object.contents_heading( - "(skip) there is no Bibliography", // nugget/object - node_heading_str_, - node_heading_int_, - [""], // anchor tag - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "(skip) there is no Bibliography"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.marked_up_level = "B"; + comp_obj_heading_.heading_lev_markup = 1; + comp_obj_heading_.heading_lev_collapsed = 1; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + the_bibliography_section ~= comp_obj_heading_; } #+END_SRC @@ -1203,18 +1146,18 @@ foreach (entry; biblio_ordered) { ((entry["place"].str.empty) ? "" : ", " ~ entry["place"].str), ((entry["url"].str.empty) ? "" : ", [" ~ entry["url"].str ~ "]"), ); - node_para_str_["is"] = "bibliography"; - node_para_str_["attrib"] = ""; - node_para_int_["ocn"] = 0; - node_para_int_["indent_hang"] = 0; - node_para_int_["indent_base"] = 1; - node_para_int_["bullet"] = 0; - the_bibliography_section ~= - set_abstract_object.contents_para( - out_, // nugget/object - node_para_str_, - node_para_int_, - ); + comp_obj_para = comp_obj_para.init; + comp_obj_para.use = "content"; + comp_obj_para.of = "para"; + comp_obj_para.is_a = "bibliography"; + comp_obj_para.text = to!string(out_).strip; + comp_obj_para.ocn = 0; + comp_obj_para.obj_cite_number = "0"; + comp_obj_para.indent_hang = 0; + comp_obj_para.indent_base = 1; + comp_obj_para.bullet = bullet; + comp_obj_para.anchor_tags = anchor_tags; + the_bibliography_section ~= comp_obj_para; } #+END_SRC @@ -1222,7 +1165,7 @@ foreach (entry; biblio_ordered) { #+BEGIN_SRC d debug(bibliosection) { foreach (o; the_bibliography_section) { - writeln(o.object); + writeln(o.text); } } #+END_SRC @@ -1287,28 +1230,25 @@ debug(bookindex) { // bookindex #+BEGIN_SRC d if (an_object["blurb_nugget"].length == 0) { writeln("no blurb"); - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = ""; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "B"; - node_heading_int_["heading_lev_markup"] = 1; - node_heading_int_["heading_lev_collapsed"] = 1; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_blurb_section ~= - set_abstract_object.contents_heading( - "(skip) there is no Blurb section", // nugget/object - node_heading_str_, - node_heading_int_, - [""], // anchor tag - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "(skip) there is no Blurb section"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.segment_anchor_tag = "bibliography"; + comp_obj_heading_.marked_up_level = "1"; + comp_obj_heading_.heading_lev_markup = 4; + comp_obj_heading_.heading_lev_collapsed = 2; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + the_blurb_section ~= comp_obj_heading_; } else { writeln("blurb"); } debug(blurb) { foreach (blurb; the_blurb_section) { - writeln(blurb.object); + writeln(blurb.text); } } #+END_SRC @@ -1322,6 +1262,15 @@ indent=[ "hang_position" : 1, "base_position" : 1, ]; +comp_obj_toc = comp_obj_toc.init; +comp_obj_toc.use = "content"; +comp_obj_toc.of = "para"; +comp_obj_toc.is_a = "toc"; +comp_obj_toc.ocn = 0; +comp_obj_toc.obj_cite_number = "0"; +comp_obj_toc.indent_hang = indent["hang_position"]; +comp_obj_toc.indent_base = indent["base_position"]; +comp_obj_toc.bullet = false; if (the_endnotes_section["seg"].length > 1) { toc_txt_ = format( "{ %s }../%s.fn_suffix", @@ -1329,15 +1278,8 @@ if (the_endnotes_section["seg"].length > 1) { "endnotes", // segment_anchor_tag_that_object_belongs_to ); toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["seg"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["seg"] ~= comp_obj_toc; } if (the_endnotes_section["scroll"].length > 1) { toc_txt_ = format( @@ -1346,15 +1288,8 @@ if (the_endnotes_section["scroll"].length > 1) { "endnotes", // _anchor_tag ); toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["scroll"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["scroll"] ~= comp_obj_toc; } if (the_glossary_section.length > 1) { toc_txt_ = format( @@ -1363,30 +1298,16 @@ if (the_glossary_section.length > 1) { "glossary", // segment_anchor_tag_that_object_belongs_to ); toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["seg"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["seg"] ~= comp_obj_toc; toc_txt_ = format( "{ %s }#%s", "Glossary", "glossary", // _anchor_tag ); toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["scroll"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["scroll"] ~= comp_obj_toc; } if (the_bibliography_section.length > 1){ toc_txt_ = format( @@ -1395,30 +1316,17 @@ if (the_bibliography_section.length > 1){ "bibliography", // segment_anchor_tag_that_object_belongs_to ); toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["seg"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["seg"] ~= comp_obj_toc; + toc_txt_ = format( "{ %s }#%s", "Bibliography", "bibliography", // _anchor_tag ); toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["scroll"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["scroll"] ~= comp_obj_toc; } if (the_bookindex_section["seg"].length > 1) { toc_txt_ = format( @@ -1427,15 +1335,8 @@ if (the_bookindex_section["seg"].length > 1) { "bookindex", // segment_anchor_tag_that_object_belongs_to ); toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["seg"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["seg"] ~= comp_obj_toc; } if (the_bookindex_section["scroll"].length > 1) { toc_txt_ = format( @@ -1444,15 +1345,8 @@ if (the_bookindex_section["scroll"].length > 1) { "bookindex", // _anchor_tag ); toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["scroll"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["scroll"] ~= comp_obj_toc; } if (the_blurb_section.length > 1) { toc_txt_ = format( @@ -1461,30 +1355,16 @@ if (the_blurb_section.length > 1) { "blurb", // segment_anchor_tag_that_object_belongs_to ); toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["seg"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["seg"] ~= comp_obj_toc; toc_txt_ = format( "{ %s }#%s", "Blurb", "blurb", // _anchor_tag ); toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["scroll"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["scroll"] ~= comp_obj_toc; } debug(toc) { writefln( @@ -1493,7 +1373,7 @@ debug(toc) { the_table_of_contents_section["seg"].length ); foreach (toc_linked_heading; the_table_of_contents_section["seg"]) { - writeln(mkup.indent_by_spaces_provided(toc_linked_heading.para_attrib.indent_start), toc_linked_heading.object); + writeln(mkup.indent_by_spaces_provided(toc_linked_heading.indent_hang), toc_linked_heading.text); } } #+END_SRC @@ -1508,7 +1388,9 @@ auto document_the = [ "head": the_document_head_section, "toc_seg": the_table_of_contents_section["seg"], "toc_scroll": the_table_of_contents_section["scroll"], + /+ substantive/body: +/ "body": the_document_body_section, + /+ backmatter: +/ "endnotes_seg": the_endnotes_section["seg"], "endnotes_scroll": the_endnotes_section["scroll"], "glossary": the_glossary_section, @@ -1561,14 +1443,14 @@ auto object_reset(ref string[string] an_object) { #+name: abs_functions_header_set_common #+BEGIN_SRC d auto _common_reset_( - ref int[string] line_occur, + ref int[string] line_occur, ref string[string] an_object, - ref int[string] type + ref int[string] type ) { line_occur["heading"] = State.off; - line_occur["para"]= State.off; - type["heading"] = State.off; - type["para"] = State.off; + line_occur["para"] = State.off; + type["heading"] = State.off; + type["para"] = State.off; object_reset(an_object); } #+END_SRC @@ -1578,7 +1460,7 @@ auto _common_reset_( #+name: abs_functions_ocn_status #+BEGIN_SRC d void _check_ocn_status_( - char[] line, + char[] line, ref int[string] type ) { if ((!line.empty) && (type["ocn_status_multi_obj"] == TriState.off)) { @@ -1630,9 +1512,9 @@ void _check_ocn_status_( #+name: abs_functions_block #+BEGIN_SRC d void _start_block_( - char[] line, + char[] line, ref int[string] type, - string[string] obj_cite_number_poem + string[string] obj_cite_number_poem ) { #+END_SRC @@ -1799,9 +1681,9 @@ void _start_block_( #+name: abs_functions_block_code #+BEGIN_SRC d void _code_block_( - char[] line, + char[] line, ref string[string] an_object, - ref int[string] type + ref int[string] type ) { if (type["curly_code"] == TriState.on) { if (matchFirst(line, rgx.block_curly_code_close)) { @@ -2051,11 +1933,11 @@ why extra object stuff only in poem/verse? #+name: abs_functions_block_poem #+BEGIN_SRC d void _poem_block_( - char[] line, - ref string[string] an_object, - ref int[string] type, - ref int cntr, - string[string] obj_cite_number_poem, + char[] line, + ref string[string] an_object, + ref int[string] type, + ref int cntr, + string[string] obj_cite_number_poem, string[string][string] dochead_make_aa, ) { if (type["curly_poem"] == TriState.on) { @@ -2090,15 +1972,14 @@ void _poem_block_( obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; - an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_heading_str, _node_heading_int); - the_document_body_section ~= - set_abstract_object.contents_block( - an_object["is"], - an_object["substantive"], - an_object["attrib"], - obj_cite_number - ); + comp_obj_block = comp_obj_block.init; + comp_obj_block.use = "content"; + comp_obj_block.of = "block"; + comp_obj_block.is_a = an_object["is"]; + comp_obj_block.ocn = obj_cite_number; + comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_block.text = an_object["substantive"]; + the_document_body_section ~= comp_obj_block; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -2130,7 +2011,7 @@ void _poem_block_( } processing.remove("verse"); an_object["is"] = "verse"; - auto _node_t = node_construct.node_emitter( + auto comp_obj_location = node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, obj_cite_number, @@ -2138,21 +2019,18 @@ void _poem_block_( heading_ptr-1, an_object["is"] ); - _node_heading_str = _node_t[0]; - _node_heading_int = _node_t[1]; auto substantive_object_and_anchor_tags_tuple = obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; - an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_heading_str, _node_heading_int); - the_document_body_section ~= - set_abstract_object.contents_block( - an_object["is"], - an_object["substantive"], - an_object["attrib"], - obj_cite_number - ); + comp_obj_block = comp_obj_block.init; + comp_obj_block.use = "content"; + comp_obj_block.of = "block"; + comp_obj_block.is_a = an_object["is"]; + comp_obj_block.ocn = obj_cite_number; + comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_block.text = an_object["substantive"]; + the_document_body_section ~= comp_obj_block; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -2181,15 +2059,14 @@ void _poem_block_( obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; - an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_heading_str, _node_heading_int); - the_document_body_section ~= - set_abstract_object.contents_block( - an_object["is"], - an_object["substantive"], - an_object["attrib"], - obj_cite_number - ); + comp_obj_block = comp_obj_block.init; + comp_obj_block.use = "content"; + comp_obj_block.of = "block"; + comp_obj_block.is_a = an_object["is"]; + comp_obj_block.ocn = obj_cite_number; + comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_block.text = an_object["substantive"]; + the_document_body_section ~= comp_obj_block; obj_cite_number_poem["end"] = to!string(obj_cite_number); object_reset(an_object); processing.remove("verse"); @@ -2220,8 +2097,8 @@ void _poem_block_( } processing.remove("verse"); an_object["is"] = "verse"; - auto _node_t = - node_construct.node_emitter( + auto comp_obj_location = + node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, obj_cite_number, @@ -2229,21 +2106,18 @@ void _poem_block_( heading_ptr-1, an_object["is"] ); - _node_heading_str = _node_t[0]; - _node_heading_int = _node_t[1]; auto substantive_object_and_anchor_tags_tuple = obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; - an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_heading_str, _node_heading_int); - the_document_body_section ~= - set_abstract_object.contents_block( - an_object["is"], - an_object["substantive"], - an_object["attrib"], - obj_cite_number - ); + comp_obj_block = comp_obj_block.init; + comp_obj_block.use = "content"; + comp_obj_block.of = "block"; + comp_obj_block.is_a = an_object["is"]; + comp_obj_block.ocn = obj_cite_number; + comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_block.text = an_object["substantive"]; + the_document_body_section ~= comp_obj_block; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -2258,9 +2132,9 @@ void _poem_block_( #+name: abs_functions_block_group #+BEGIN_SRC d void _group_block_( - char[] line, + char[] line, ref string[string] an_object, - ref int[string] type + ref int[string] type ) { if (type["curly_group"] == State.on) { if (matchFirst(line, rgx.block_curly_group_close)) { @@ -2299,9 +2173,9 @@ void _group_block_( #+name: abs_functions_block_block #+BEGIN_SRC d void _block_block_( - char[] line, + char[] line, ref string[string] an_object, - ref int[string] type + ref int[string] type ) { if (type["curly_block"] == TriState.on) { if (matchFirst(line, rgx.block_curly_block_close)) { @@ -2340,9 +2214,9 @@ void _block_block_( #+name: abs_functions_block_quote #+BEGIN_SRC d void _quote_block_( - char[] line, + char[] line, ref string[string] an_object, - ref int[string] type + ref int[string] type ) { if (type["curly_quote"] == TriState.on) { if (matchFirst(line, rgx.block_curly_quote_close)) { @@ -2381,9 +2255,9 @@ void _quote_block_( #+name: abs_functions_block_table #+BEGIN_SRC d void _table_block_( - char[] line, + char[] line, ref string[string] an_object, - ref int[string] type + ref int[string] type ) { if (type["curly_table"] == TriState.on) { if (matchFirst(line, rgx.block_curly_table_close)) { @@ -2422,17 +2296,16 @@ void _table_block_( #+name: abs_functions_block_line_status_empty #+BEGIN_SRC d void _block_flag_line_empty_( - char[] line, - ref string[string] an_object, - ref ObjComposite[] the_document_body_section, + char[] line, + ref string[string] an_object, + ref ObjGenericComposite[] the_document_body_section, ref string[][string][string] bookindex_unordered_hashes, - ref int obj_cite_number, - ref string[string] _node_heading_str, - ref int[string] _node_heading_int, - ref int cntr, - ref int[string] type, - string[string] obj_cite_number_poem, - string[string][string] dochead_make_aa, + ref int obj_cite_number, + ref ObjGenericComposite _comp_obj_heading, + ref int cntr, + ref int[string] type, + string[string] obj_cite_number_poem, + string[string][string] dochead_make_aa, ) { // line.empty, post contents, empty variables --------------- assert( @@ -2452,8 +2325,8 @@ void _block_flag_line_empty_( bookindex_unordered_hashes = bkidx_hash(an_object["bookindex_nugget"], obj_cite_number); an_object["is"] = "code"; - auto _node_t = - node_construct.node_emitter( + auto comp_obj_location = + node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, obj_cite_number, @@ -2461,21 +2334,18 @@ void _block_flag_line_empty_( heading_ptr-1, an_object["is"] ); - _node_heading_str = _node_t[0]; - _node_heading_int = _node_t[1]; auto substantive_object_and_anchor_tags_tuple = obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; - an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_heading_str, _node_heading_int); - the_document_body_section ~= - set_abstract_object.contents_block_code( - an_object["is"], - an_object["substantive"], - an_object["attrib"], - obj_cite_number - ); + comp_obj_code = comp_obj_code.init; + comp_obj_code.use = "content"; + comp_obj_code.of = "block"; + comp_obj_code.is_a = an_object["is"]; + comp_obj_code.ocn = obj_cite_number; + comp_obj_code.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_code.text = an_object["substantive"]; + the_document_body_section ~= comp_obj_code; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -2487,8 +2357,8 @@ void _block_flag_line_empty_( bookindex_unordered_hashes = bkidx_hash(an_object["bookindex_nugget"], obj_cite_number); an_object["is"] = "verse"; // check also - auto _node_t = - node_construct.node_emitter( // + auto comp_obj_location = + node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, obj_cite_number, @@ -2496,16 +2366,14 @@ void _block_flag_line_empty_( heading_ptr-1, an_object["is"] ); - _node_heading_str = _node_t[0]; - _node_heading_int = _node_t[1]; - the_document_body_section ~= - set_abstract_object.contents_block_obj_cite_number_string( - "poem", - "", - (obj_cite_number_poem["start"], obj_cite_number_poem["end"]), - _node_heading_str, - _node_heading_int, - ); // bookindex + comp_obj_poem_ocn = comp_obj_poem_ocn.init; + comp_obj_poem_ocn.use = "content"; + comp_obj_poem_ocn.of = "block"; + comp_obj_poem_ocn.is_a = "poem"; + comp_obj_poem_ocn.ocn = obj_cite_number; + comp_obj_poem_ocn.obj_cite_number = (obj_cite_number_poem["start"], obj_cite_number_poem["end"]); // not sure about this + comp_obj_poem_ocn.text = ""; // an_object["substantive"]; + the_document_body_section ~= comp_obj_poem_ocn; object_reset(an_object); processing.remove("verse"); type["blocks"] = TriState.off; @@ -2518,8 +2386,8 @@ void _block_flag_line_empty_( bookindex_unordered_hashes = bkidx_hash(an_object["bookindex_nugget"], obj_cite_number); an_object["is"] = "table"; - auto _node_t = - node_construct.node_emitter( + auto comp_obj_location = + node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, obj_cite_number, @@ -2527,21 +2395,18 @@ void _block_flag_line_empty_( heading_ptr-1, an_object["is"] ); - _node_heading_str = _node_t[0]; - _node_heading_int = _node_t[1]; auto substantive_object_and_anchor_tags_tuple = obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; - an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_heading_str, _node_heading_int); - the_document_body_section ~= - set_abstract_object.contents_block( - an_object["is"], - an_object["substantive"], - an_object["attrib"], - obj_cite_number - ); + comp_obj_block = comp_obj_block.init; + comp_obj_block.use = "content"; + comp_obj_block.of = "block"; + comp_obj_block.is_a = an_object["is"]; + comp_obj_block.ocn = obj_cite_number; + comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_block.text = an_object["substantive"]; + the_document_body_section ~= comp_obj_block; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -2555,8 +2420,8 @@ void _block_flag_line_empty_( bookindex_unordered_hashes = bkidx_hash(an_object["bookindex_nugget"], obj_cite_number); an_object["is"] = "group"; - auto _node_t = - node_construct.node_emitter( + auto comp_obj_location = + node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, obj_cite_number, @@ -2564,21 +2429,18 @@ void _block_flag_line_empty_( heading_ptr-1, an_object["is"] ); - _node_heading_str = _node_t[0]; - _node_heading_int = _node_t[1]; auto substantive_object_and_anchor_tags_tuple = obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; - an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_heading_str, _node_heading_int); - the_document_body_section ~= - set_abstract_object.contents_block( - an_object["is"], - an_object["substantive"], - an_object["attrib"], - obj_cite_number - ); + comp_obj_block = comp_obj_block.init; + comp_obj_block.use = "content"; + comp_obj_block.of = "block"; + comp_obj_block.is_a = an_object["is"]; + comp_obj_block.ocn = obj_cite_number; + comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_block.text = an_object["substantive"]; + the_document_body_section ~= comp_obj_block; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -2591,8 +2453,8 @@ void _block_flag_line_empty_( bookindex_unordered_hashes = bkidx_hash(an_object["bookindex_nugget"], obj_cite_number); an_object["is"] = "block"; - auto _node_t = - node_construct.node_emitter( + auto comp_obj_location = + node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, obj_cite_number, @@ -2600,21 +2462,18 @@ void _block_flag_line_empty_( heading_ptr-1, an_object["is"] ); - _node_heading_str = _node_t[0]; - _node_heading_int = _node_t[1]; auto substantive_object_and_anchor_tags_tuple = obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; - an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_heading_str, _node_heading_int); - the_document_body_section ~= - set_abstract_object.contents_block( - an_object["is"], - an_object["substantive"], - an_object["attrib"], - obj_cite_number - ); + comp_obj_block = comp_obj_block.init; + comp_obj_block.use = "content"; + comp_obj_block.of = "block"; + comp_obj_block.is_a = an_object["is"]; + comp_obj_block.ocn = obj_cite_number; + comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_block.text = an_object["substantive"]; + the_document_body_section ~= comp_obj_block; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -2628,8 +2487,8 @@ void _block_flag_line_empty_( bookindex_unordered_hashes = bkidx_hash(an_object["bookindex_nugget"], obj_cite_number); an_object["is"] = "quote"; - auto _node_t = - node_construct.node_emitter( // + auto comp_obj_location = + node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, obj_cite_number, @@ -2637,21 +2496,18 @@ void _block_flag_line_empty_( heading_ptr-1, an_object["is"] ); - _node_heading_str = _node_t[0]; - _node_heading_int = _node_t[1]; auto substantive_object_and_anchor_tags_tuple = obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; - an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_heading_str, _node_heading_int); - the_document_body_section ~= - set_abstract_object.contents_block( - an_object["is"], - an_object["substantive"], - an_object["attrib"], - obj_cite_number - ); + comp_obj_block = comp_obj_block.init; + comp_obj_block.use = "content"; + comp_obj_block.of = "block"; + comp_obj_block.is_a = an_object["is"]; + comp_obj_block.ocn = obj_cite_number; + comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_block.text = an_object["substantive"]; + the_document_body_section ~= comp_obj_block; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -2722,11 +2578,11 @@ auto _book_index_( #+name: abs_functions_heading #+BEGIN_SRC d auto _heading_found_( - char[] line, - string dochead_make_identify_unmarked_headings, - ref string[string] heading_match_str, + char[] line, + string dochead_make_identify_unmarked_headings, + ref string[string] heading_match_str, ref Regex!(char)[string] heading_match_rgx, - ref int[string] type + ref int[string] type ) { if ((dochead_make_identify_unmarked_headings.length > 2) && (type["make_headings"] == State.off)) { @@ -2812,10 +2668,10 @@ auto _heading_found_( #+name: abs_functions_heading #+BEGIN_SRC d auto _heading_make_set_( - ref char[] line, - ref int[string] line_occur, + ref char[] line, + ref int[string] line_occur, ref Regex!(char)[string] heading_match_rgx, - ref int[string] type + ref int[string] type ) { if ((type["make_headings"] == State.on) && ((line_occur["para"] == State.off) @@ -2874,13 +2730,13 @@ auto _heading_make_set_( #+name: abs_functions_heading #+BEGIN_SRC d auto _heading_matched_( - char[] line, - ref int[string] line_occur, - ref string[string] an_object, - ref string an_object_key, - ref int[string] lv, - ref int[string] collapsed_lev, - ref int[string] type, + char[] line, + ref int[string] line_occur, + ref string[string] an_object, + ref string an_object_key, + ref int[string] lv, + ref int[string] collapsed_lev, + ref int[string] type, ref string[string][string] dochead_meta_aa ) { if (auto m = match(line, rgx.heading)) { @@ -3023,13 +2879,13 @@ auto _heading_matched_( #+name: abs_functions_para #+BEGIN_SRC d auto _para_match_( - char[] line, + char[] line, ref string[string] an_object, - ref string an_object_key, - ref int[string] indent, - ref bool bullet, - ref int[string] type, - ref int[string] line_occur, + ref string an_object_key, + ref int[string] indent, + ref bool bullet, + ref int[string] type, + ref int[string] line_occur, ) { if (line_occur["para"] == State.off) { /+ para matches +/ @@ -3346,8 +3202,8 @@ struct ObjInlineMarkup { #+name: ao_emitters_obj_inline_markup_and_anchor_tags #+BEGIN_SRC d auto obj_inline_markup_and_anchor_tags( - string[string] obj_, - string obj_key_, + string[string] obj_, + string obj_key_, string[string][string] dochead_make_aa ) in { } @@ -3429,27 +3285,21 @@ struct ObjInlineMarkup { return heading_toc_; }; auto table_of_contents_gather_headings( - string[string] obj_, - string[string][string] dochead_make_aa, - string segment_anchor_tag_that_object_belongs_to, - string _anchor_tag, - ObjComposite[][string] the_table_of_contents_section, + string[string] obj_, + string[string][string] dochead_make_aa, + string segment_anchor_tag_that_object_belongs_to, + string _anchor_tag, + ObjGenericComposite[][string] the_table_of_contents_section, ) in { } body { + ObjGenericComposite comp_obj_toc; char[] heading_toc_ = to!(char[])(obj_["body_nugget"].dup.strip); heading_toc_ = _clean_heading_toc_(heading_toc_); auto attrib=""; string toc_txt_; int[string] indent; - auto set_abstract_object = ObjectAbstractSet(); if (to!int(obj_["lev_markup_number"]) > 0) { - toc_txt_ = format( - "{ %s }#%s", - heading_toc_, - _anchor_tag, - ); - toc_txt_= munge.url_links(toc_txt_); indent=[ "hang_position" : to!int(obj_["lev_markup_number"]), "base_position" : to!int(obj_["lev_markup_number"]), @@ -3460,30 +3310,41 @@ struct ObjInlineMarkup { _anchor_tag, ); toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["scroll"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc = comp_obj_toc.init; + comp_obj_toc.use = "content"; + comp_obj_toc.of = "para"; + comp_obj_toc.is_a = "toc"; + comp_obj_toc.ocn = 0; + comp_obj_toc.obj_cite_number = "0"; + comp_obj_toc.indent_hang = indent["hang_position"]; + comp_obj_toc.indent_base = indent["base_position"]; + comp_obj_toc.bullet = false; + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["scroll"] ~= comp_obj_toc; } else { indent=[ "hang_position" : 0, "base_position" : 0, ]; - the_table_of_contents_section["scroll"] ~= - set_abstract_object.contents_toc( - "toc", - "Table of Contents", - "", // attrib - 0, - indent, - false - ); + comp_obj_toc = comp_obj_toc.init; + comp_obj_toc.use = "content"; + comp_obj_toc.of = "para"; + comp_obj_toc.is_a = "toc"; + comp_obj_toc.ocn = 0; + comp_obj_toc.obj_cite_number = "0"; + comp_obj_toc.indent_hang = indent["hang_position"]; + comp_obj_toc.indent_base = indent["base_position"]; + comp_obj_toc.bullet = false; + comp_obj_toc.text = "Table of Contents"; + the_table_of_contents_section["scroll"] ~= comp_obj_toc; } + comp_obj_toc = comp_obj_toc.init; + comp_obj_toc.use = "content"; + comp_obj_toc.of = "para"; + comp_obj_toc.is_a = "toc"; + comp_obj_toc.ocn = 0; + comp_obj_toc.obj_cite_number = "0"; + comp_obj_toc.bullet = false; switch (to!int(obj_["lev_markup_number"])) { case 0: indent=[ @@ -3492,15 +3353,10 @@ struct ObjInlineMarkup { ]; toc_txt_ = "{ Table of Contents }../toc.fn_suffix"; toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["seg"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.indent_hang = indent["hang_position"]; + comp_obj_toc.indent_base = indent["base_position"]; + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["seg"] ~= comp_obj_toc; break; case 1: .. case 3: indent=[ @@ -3512,15 +3368,10 @@ struct ObjInlineMarkup { heading_toc_, ); toc_txt_= munge.url_links(toc_txt_); - the_table_of_contents_section["seg"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.indent_hang = indent["hang_position"]; + comp_obj_toc.indent_base = indent["base_position"]; + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["seg"] ~= comp_obj_toc; break; case 4: toc_txt_ = format( @@ -3533,15 +3384,10 @@ struct ObjInlineMarkup { "hang_position" : to!int(obj_["lev_markup_number"]), "base_position" : to!int(obj_["lev_markup_number"]), ]; - the_table_of_contents_section["seg"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.indent_hang = indent["hang_position"]; + comp_obj_toc.indent_base = indent["base_position"]; + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["seg"] ~= comp_obj_toc; break; case 5: .. case 7: toc_txt_ = format( @@ -3555,15 +3401,10 @@ struct ObjInlineMarkup { "hang_position" : to!int(obj_["lev_markup_number"]), "base_position" : to!int(obj_["lev_markup_number"]), ]; - the_table_of_contents_section["seg"] ~= - set_abstract_object.contents_toc( - "toc", - toc_txt_, - "", // attrib - 0, - indent, - false - ); + comp_obj_toc.indent_hang = indent["hang_position"]; + comp_obj_toc.indent_base = indent["base_position"]; + comp_obj_toc.text = to!string(toc_txt_).strip; + the_table_of_contents_section["seg"] ~= comp_obj_toc; break; default: break; @@ -3586,10 +3427,9 @@ private: #+name: ao_emitters_obj_inline_markup_heading_numbering_segment_anchor_tags #+BEGIN_SRC d static string _configured_auto_heading_numbering_and_segment_anchor_tags( - string munge_, - string[string] obj_, - string[string][string] - dochead_make_aa + string munge_, + string[string] obj_, + string[string][string] dochead_make_aa ) { if (dochead_make_aa["make"]["num_top"].length > 0) { if (!(match(munge_, rgx.heading_anchor_tag))) { @@ -3806,20 +3646,17 @@ struct ObjAttributes { #+name: ao_emitters_obj_attributes_public #+BEGIN_SRC d string obj_attributes( - string obj_is_, - string obj_raw, - string[string] _node_heading_str, - int[string] _node_heading_int + string obj_is_, + string obj_raw, + ObjGenericComposite _comp_obj_heading, ) in { } body { scope(exit) { destroy(obj_is_); destroy(obj_raw); - destroy(_node_heading_str); - destroy(_node_heading_int); + destroy(_comp_obj_heading); } - _obj_attrib.remove("json"); _obj_attrib["json"] ="{"; switch (obj_is_) { case "heading": @@ -3857,7 +3694,7 @@ struct ObjAttributes { break; } _obj_attrib["json"] ~=" }"; - _obj_attrib["json"]=_set_additional_values_parse_as_json(_obj_attrib["json"], obj_is_, _node_heading_str, _node_heading_int); // check + _obj_attrib["json"]=_set_additional_values_parse_as_json(_obj_attrib["json"], obj_is_, _comp_obj_heading); // check debug(structattrib) { if (oa_j["is"].str() == "heading") { writeln(_obj_attrib["json"]); @@ -3892,24 +3729,24 @@ struct ObjAttributes { auto rgx = Rgx(); if (matchFirst(obj_txt_in, rgx.para_bullet)) { _obj_attributes =" \"bullet\": \"true\"," - ~ " \"indent_start\": 0," - ~ " \"indent_rest\": 0,"; + ~ " \"indent_hang\": 0," + ~ " \"indent_base\": 0,"; } else if (auto m = matchFirst(obj_txt_in, rgx.para_bullet_indent)) { _obj_attributes =" \"bullet\": \"true\"," - ~ " \"indent_start\": " ~ to!string(m.captures[1]) ~ "," - ~ " \"indent_rest\": " ~ to!string(m.captures[1]) ~ ","; + ~ " \"indent_hang\": " ~ to!string(m.captures[1]) ~ "," + ~ " \"indent_base\": " ~ to!string(m.captures[1]) ~ ","; } else if (auto m = matchFirst(obj_txt_in, rgx.para_indent_hang)) { _obj_attributes =" \"bullet\": \"false\"," - ~ " \"indent_start\": " ~ to!string(m.captures[1]) ~ "," - ~ " \"indent_rest\": " ~ to!string(m.captures[2]) ~ ","; + ~ " \"indent_hang\": " ~ to!string(m.captures[1]) ~ "," + ~ " \"indent_base\": " ~ to!string(m.captures[2]) ~ ","; } else if (auto m = matchFirst(obj_txt_in, rgx.para_indent)) { _obj_attributes =" \"bullet\": \"false\"," - ~ " \"indent_start\": " ~ to!string(m.captures[1]) ~ "," - ~ " \"indent_rest\": " ~ to!string(m.captures[1]) ~ ","; + ~ " \"indent_hang\": " ~ to!string(m.captures[1]) ~ "," + ~ " \"indent_base\": " ~ to!string(m.captures[1]) ~ ","; } else { _obj_attributes =" \"bullet\": \"false\"," - ~ " \"indent_start\": 0," - ~ " \"indent_rest\": 0,"; + ~ " \"indent_hang\": 0," + ~ " \"indent_base\": 0,"; } return _obj_attributes; } @@ -4064,26 +3901,25 @@ struct ObjAttributes { #+name: ao_emitters_obj_attributes_private_json #+BEGIN_SRC d string _set_additional_values_parse_as_json( - string _obj_attrib, - string obj_is_, - string[string] _node_heading_str, - int[string] _node_heading_int + string _obj_attrib, + string obj_is_, + ObjGenericComposite _comp_obj_heading, ) { // JSONValue oa_j = parseJSON(_obj_attrib); assert( (oa_j.type == JSON_TYPE.OBJECT) ); if (obj_is_ == "heading") { - oa_j.object["obj_cite_number"] = _node_heading_str["ocn"]; - oa_j.object["lev_markup_number"] = _node_heading_int["heading_lev_markup"]; - oa_j.object["lev_collapsed_number"] = _node_heading_int["heading_lev_collapsed"]; + oa_j.object["obj_cite_number"] = _comp_obj_heading.ocn; + oa_j.object["lev_markup_number"] = _comp_obj_heading.heading_lev_markup; + oa_j.object["lev_collapsed_number"] = _comp_obj_heading.heading_lev_collapsed; oa_j.object["heading_ptr"] = - _node_heading_int["ptr_heading"]; + _comp_obj_heading.ptr_heading; oa_j.object["doc_object_ptr"] = - _node_heading_int["ptr_doc_object"]; + _comp_obj_heading.ptr_doc_object; } - oa_j.object["parent_obj_cite_number"] = _node_heading_int["parent_ocn"]; // - oa_j.object["parent_lev_markup_number"] = _node_heading_int["parent_lev_markup"]; // + oa_j.object["parent_obj_cite_number"] = _comp_obj_heading.parent_ocn; + oa_j.object["parent_lev_markup_number"] = _comp_obj_heading.parent_lev_markup; _obj_attrib = oa_j.toString(); return _obj_attrib; } @@ -4110,7 +3946,7 @@ struct BookIndexNuggetHash { string[] bi_main_terms_split_arr; string[][string][string] bookindex_nugget_hash( string bookindex_section, - int obj_cite_number + int obj_cite_number ) in { debug(bookindexraw) { @@ -4264,68 +4100,48 @@ struct BookIndexReportSection { mixin SiSUnode; string type_is; string lev; - int lev_int_markup, lev_int_collapsed; + int heading_lev_markup, heading_lev_collapsed; string attrib; int[string] indent; - auto set_abstract_object = ObjectAbstractSet(); auto mainkeys = bookindex_unordered_hashes.byKey.array.sort().release; - ObjComposite[][string] bookindex_section; - auto node_heading_int_ = node_metadata_heading_int; - auto node_heading_str_ = node_metadata_heading_str; + ObjGenericComposite[][string] bookindex_section; + ObjGenericComposite comp_obj_heading_, comp_obj_para; auto node_para_int_ = node_metadata_para_int; auto node_para_str_ = node_metadata_para_str; if ((mainkeys.length > 0) && (opt_action_bool["backmatter"] && opt_action_bool["section_bookindex"])) { string bi_tmp_seg, bi_tmp_scroll; - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = ""; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "B"; - node_heading_int_["heading_lev_markup"] = 1; - node_heading_int_["heading_lev_collapsed"] = 1; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - bookindex_section["scroll"] ~= - set_abstract_object.contents_heading( - "Book Index", - node_heading_str_, - node_heading_int_, - [], - ); - bookindex_section["seg"] ~= - set_abstract_object.contents_heading( - "Book Index", - node_heading_str_, - node_heading_int_, - [], - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "Book Index"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.marked_up_level = "B"; + comp_obj_heading_.heading_lev_markup = 1; + comp_obj_heading_.heading_lev_collapsed = 1; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + bookindex_section["scroll"] ~= comp_obj_heading_; + bookindex_section["seg"] ~= comp_obj_heading_; ++obj_cite_number; ++mkn; - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = "bookindex"; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "1"; - node_heading_int_["heading_lev_markup"] = 4; - node_heading_int_["heading_lev_collapsed"] = 2; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - bookindex_section["scroll"] ~= - set_abstract_object.contents_heading( - "Index", - node_heading_str_, - node_heading_int_, - ["bookindex"], - ); - bookindex_section["seg"] ~= - set_abstract_object.contents_heading( - "Index", - node_heading_str_, - node_heading_int_, - ["bookindex"], - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "Index"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.segment_anchor_tag = "bookindex"; + comp_obj_heading_.marked_up_level = "1"; + comp_obj_heading_.heading_lev_markup = 4; + comp_obj_heading_.heading_lev_collapsed = 2; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + comp_obj_heading_.anchor_tags = ["bookindex"]; + bookindex_section["scroll"] ~= comp_obj_heading_; + bookindex_section["seg"] ~= comp_obj_heading_; ++obj_cite_number; ++mkn; foreach (mainkey; mainkeys) { @@ -4359,52 +4175,33 @@ struct BookIndexReportSection { } bi_tmp_scroll = replaceFirst(bi_tmp_scroll, rgx.trailing_linebreak, ""); bi_tmp_seg = replaceFirst(bi_tmp_seg, rgx.trailing_linebreak, ""); - indent=[ "hang_position" : 0, "base_position" : 1, ]; - node_para_str_["is"] = "para"; - node_para_str_["attrib"] = ""; - node_para_int_["ocn"] = obj_cite_number; - node_para_int_["indent_hang"] = 0; - node_para_int_["indent_base"] = 1; - node_para_int_["bullet"] = 0; - bookindex_section["scroll"] ~= - set_abstract_object.contents_para( - bi_tmp_scroll, - node_para_str_, - node_para_int_, - ); - bookindex_section["seg"] ~= - set_abstract_object.contents_para( - bi_tmp_seg, - node_para_str_, - node_para_int_, - ); + comp_obj_para = comp_obj_para.init; + comp_obj_para.use = "content"; + comp_obj_para.of = "para"; + comp_obj_para.is_a = "para"; + comp_obj_para.text = to!string(bi_tmp_scroll).strip; + comp_obj_para.ocn = obj_cite_number; + comp_obj_para.obj_cite_number = to!string(obj_cite_number); + comp_obj_para.indent_hang = 0; + comp_obj_para.indent_base = 1; + comp_obj_para.bullet = false; + bookindex_section["scroll"] ~= comp_obj_para; + comp_obj_para.text = to!string(bi_tmp_seg).strip; + bookindex_section["seg"] ~= comp_obj_para; ++obj_cite_number; ++mkn; } } else { // no book index, (figure out what to do here) - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = ""; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "B"; - node_heading_int_["heading_lev_markup"] = 1; - node_heading_int_["heading_lev_collapsed"] = 1; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - bookindex_section["scroll"] ~= - set_abstract_object.contents_heading( - "(skip) there is no Book Index", - node_heading_str_, - node_heading_int_, - [""], - ); - bookindex_section["seg"] ~= - set_abstract_object.contents_heading( - "(skip) there is no Book Index", - node_heading_str_, - node_heading_int_, - [""], - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.text = "(skip) there is no Book Index"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.marked_up_level = "B"; + comp_obj_heading_.heading_lev_markup = 1; + comp_obj_heading_.heading_lev_collapsed = 1; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + bookindex_section["scroll"] ~= comp_obj_heading_; + bookindex_section["seg"] ~= comp_obj_heading_; } auto t = tuple(bookindex_section, obj_cite_number); return t; @@ -4434,9 +4231,9 @@ struct NotesSection { #+name: ao_emitters_endnotes #+BEGIN_SRC d private auto gather_notes_for_endnote_section( - ObjComposite[] contents_am, - string segment_anchor_tag_that_object_belongs_to, - int cntr, + ObjGenericComposite[] contents_am, + string segment_anchor_tag_that_object_belongs_to, + int cntr, ) in { // endnotes/ footnotes for @@ -4448,7 +4245,7 @@ struct NotesSection { assert(cntr >= previous_count); previous_count=cntr; assert( - match(contents_am[cntr].object, + match(contents_am[cntr].text, rgx.inline_notes_delimiter_al_regular_number_note) ); } @@ -4457,7 +4254,7 @@ struct NotesSection { foreach( m; matchAll( - contents_am[cntr].object, + contents_am[cntr].text, rgx.inline_notes_delimiter_al_regular_number_note ) ) { @@ -4521,102 +4318,88 @@ struct NotesSection { } body { mixin SiSUnode; - auto set_abstract_object = ObjectAbstractSet(); - ObjComposite[][string] the_endnotes_section; + ObjGenericComposite[][string] the_endnotes_section; auto endnotes_ = gathered_notes(); string type_is; string lev, lev_markup_number, lev_collapsed_number; string attrib; int[string] indent; - auto node_heading_int_ = node_metadata_heading_int; - auto node_heading_str_ = node_metadata_heading_str; + ObjGenericComposite comp_obj_heading_; if ((endnotes_["seg"].length > 0) && (opt_action_bool["backmatter"] && opt_action_bool["section_endnotes"])) { - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = ""; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "B"; - node_heading_int_["heading_lev_markup"] = 1; - node_heading_int_["heading_lev_collapsed"] = 1; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_endnotes_section["seg"] ~= - set_abstract_object.contents_heading( - "Endnotes", - node_heading_str_, - node_heading_int_, - [], - ); - the_endnotes_section["scroll"] ~= - set_abstract_object.contents_heading( - "Endnotes", - node_heading_str_, - node_heading_int_, - [], - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "Endnotes"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.marked_up_level = "B"; + comp_obj_heading_.heading_lev_markup = 1; + comp_obj_heading_.heading_lev_collapsed = 1; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + the_endnotes_section["seg"] ~= comp_obj_heading_; + the_endnotes_section["scroll"] ~= comp_obj_heading_; ++obj_cite_number; ++mkn; - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = "endnotes"; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "1"; - node_heading_int_["heading_lev_markup"] = 4; - node_heading_int_["heading_lev_collapsed"] = 2; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_endnotes_section["seg"] ~= - set_abstract_object.contents_heading( - "Endnotes", - node_heading_str_, - node_heading_int_, - ["endnotes"], - ); - the_endnotes_section["scroll"] ~= - set_abstract_object.contents_heading( - "Endnotes", - node_heading_str_, - node_heading_int_, - ["endnotes"], - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "Endnotes"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.segment_anchor_tag = "endnotes"; + comp_obj_heading_.marked_up_level = "1"; + comp_obj_heading_.heading_lev_markup = 4; + comp_obj_heading_.heading_lev_collapsed = 2; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + comp_obj_heading_.anchor_tags = ["endnotes"]; + the_endnotes_section["seg"] ~= comp_obj_heading_; + the_endnotes_section["scroll"] ~= comp_obj_heading_; ++obj_cite_number; ++mkn; } else { - node_heading_str_["is"] = "heading"; - node_heading_str_["ocn"] = "0"; - node_heading_str_["segment_anchor_tag"] = ""; - node_heading_str_["attrib"] = ""; - node_heading_str_["marked_up_lev"] = "B"; - node_heading_int_["heading_lev_markup"] = 1; - node_heading_int_["heading_lev_collapsed"] = 1; - node_heading_int_["parent_ocn"] = 1; - node_heading_int_["parent_lev_markup"] = 0; - the_endnotes_section["seg"] ~= - set_abstract_object.contents_heading( - "(skip) there are no Endnotes", - node_heading_str_, - node_heading_int_, - [""], - ); - the_endnotes_section["scroll"] ~= - set_abstract_object.contents_heading( - "(skip) there are no Endnotes", - node_heading_str_, - node_heading_int_, - [""], - ); + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.use = "content"; + comp_obj_heading_.of = "para"; + comp_obj_heading_.is_a = "heading"; + comp_obj_heading_.text = "(skip) there are no Endnotes"; + comp_obj_heading_.ocn = 0; + comp_obj_heading_.marked_up_level = "B"; + comp_obj_heading_.heading_lev_markup = 1; + comp_obj_heading_.heading_lev_collapsed = 1; + comp_obj_heading_.parent_ocn = 1; + comp_obj_heading_.parent_lev_markup = 0; + the_endnotes_section["seg"] ~= comp_obj_heading_; + the_endnotes_section["scroll"] ~= comp_obj_heading_; } if (opt_action_bool["backmatter"] && opt_action_bool["section_endnotes"]) { + ObjGenericComposite comp_obj_endnote_; + comp_obj_endnote_ = comp_obj_endnote_.init; + comp_obj_endnote_.use = "content"; + comp_obj_endnote_.of = "para"; + comp_obj_endnote_.is_a = "endnote"; + comp_obj_endnote_.ocn = 0; + comp_obj_endnote_.obj_cite_number = "0"; + comp_obj_endnote_.indent_hang = 0; + comp_obj_endnote_.indent_base = 0; + comp_obj_endnote_.bullet = false; foreach (i, endnote; endnotes_["seg"]) { - attrib=""; - the_endnotes_section["seg"] ~= - set_abstract_object.contents_endnote(endnote, endnotes_["anchor"][i]); + auto m = (matchFirst(endnote, rgx.note_ref)); + string notenumber = to!string(m.captures[1]); + string anchor_tag = "note_" ~ notenumber; + comp_obj_endnote_.anchor_tags ~= [ endnotes_["anchor"][i] ]; // fix + comp_obj_endnote_.text = endnote.strip; + the_endnotes_section["seg"] ~= comp_obj_endnote_; } foreach (i, endnote; endnotes_["scroll"]) { - attrib=""; - the_endnotes_section["scroll"] ~= - set_abstract_object.contents_endnote(endnote, endnotes_["anchor"][i]); + auto m = (matchFirst(endnote, rgx.note_ref)); + string notenumber = to!string(m.captures[1]); + string anchor_tag = "note_" ~ notenumber; + comp_obj_endnote_.anchor_tags ~= [ endnotes_["anchor"][i] ]; // fix + comp_obj_endnote_.text = endnote.strip; + the_endnotes_section["scroll"] ~= comp_obj_endnote_; } } auto t = tuple(the_endnotes_section, obj_cite_number); @@ -4644,8 +4427,8 @@ struct Bibliography { #+name: ao_emitters_bibliography #+BEGIN_SRC d public JSONValue[] _bibliography_( - ref string[] biblio_unsorted_incomplete, - ref JSONValue[] bib_arr_json + ref string[] biblio_unsorted_incomplete, + ref JSONValue[] bib_arr_json ) in { } body { @@ -4675,7 +4458,7 @@ struct Bibliography { #+name: ao_emitters_bibliography #+BEGIN_SRC d final private JSONValue[] _biblio_unsorted_complete_( - string[] biblio_unordered, + string[] biblio_unordered, ref JSONValue[] bib_arr_json ) { foreach (bibent; biblio_unordered) { @@ -4763,11 +4546,11 @@ struct NodeStructureMetadata { #+name: ao_emitters_metadata #+BEGIN_SRC d - auto node_emitter( + ObjGenericComposite node_location_emitter( string lev_markup_number, string segment_anchor_tag, int obj_cite_number_, - int cntr_, + int cntr_, int ptr_, string is_ ) @@ -4793,23 +4576,13 @@ struct NodeStructureMetadata { p_["lev_markup_number"] = DocStructMarkupHeading.h_text_1; p_["obj_cite_number"] = lv4; } - string[string] _node_heading_str = [ - "is" : is_, - "ocn" : to!string(obj_cite_number_), - "marked_up_lev" : "", - "segment_anchor_tag" : to!string(segment_anchor_tag), - "attrib" : "", - ]; - int[string] _node_heading_int = [ - "ocn" : obj_cite_number_, - "ptr_doc_object" : 0, - "ptr_html_segnames" : 0, - "ptr_heading" : 0, - "heading_lev_markup" : 0, - "heading_lev_collapsed" : 0, - "parent_ocn" : p_["obj_cite_number"], - "parent_lev_markup" : p_["lev_markup_number"], - ]; + ObjGenericComposite comp_obj_location; + comp_obj_location = comp_obj_location.init; + comp_obj_location.is_a = is_; + comp_obj_location.ocn = obj_cite_number_; + comp_obj_location.segment_anchor_tag = to!string(segment_anchor_tag); + comp_obj_location.parent_ocn = p_["obj_cite_number"]; + comp_obj_location.parent_lev_markup = p_["lev_markup_number"]; debug(node) { if (match(lev_markup_number, rgx.levels_numbered_headings)) { writeln("x ", to!string(_node)); @@ -4817,14 +4590,10 @@ struct NodeStructureMetadata { writeln("- ", to!string(_node)); } } - assert(_node_heading_int["parent_lev_markup"] >= 4); // - assert(_node_heading_int["parent_lev_markup"] <= 7); // - assert(_node_heading_int["parent_ocn"] >= 0); // hmm, perhaps // - auto t = tuple( - _node_heading_str, - _node_heading_int, - ); - return t; + assert(comp_obj_location.parent_lev_markup >= 4); + assert(comp_obj_location.parent_lev_markup <= 7); + assert(comp_obj_location.parent_ocn >= 0); + return comp_obj_location; } invariant() { } @@ -4834,7 +4603,8 @@ struct NodeStructureMetadata { #+name: ao_emitters_metadata #+BEGIN_SRC d - auto node_emitter_heading( + ObjGenericComposite node_emitter_heading( + string _text, string lev, string lev_markup_number, string lev_collapsed_number, @@ -4843,7 +4613,7 @@ struct NodeStructureMetadata { int cntr_, int ptr_, string is_, - int html_segnames_ptr, + int html_segnames_ptr, ) in { auto rgx = Rgx(); @@ -4942,23 +4712,23 @@ struct NodeStructureMetadata { default: break; } - string[string] _node_heading_str = [ - "is" : is_, - "ocn" : to!string(obj_cite_number_), - "marked_up_lev" : lev, - "segment_anchor_tag" : to!string(segment_anchor_tag), - "attrib" : "", - ]; - int[string] _node_heading_int = [ - "ocn" : obj_cite_number_, - "ptr_doc_object" : cntr_, - "ptr_html_segnames" : ((lev_markup_number == "4") ? html_segnames_ptr : 0), - "ptr_heading" : ptr_, - "heading_lev_markup" : (!(lev_markup_number.empty) ? to!int(lev_markup_number) : 0), // switch to use int if possible - "heading_lev_collapsed" : (!(lev_collapsed_number.empty) ? to!int(lev_collapsed_number) : 0), // switch to use int if possible - "parent_ocn" : p_["obj_cite_number"], - "parent_lev_markup" : p_["lev_markup_number"], - ]; + ObjGenericComposite _comp_obj_heading_; + _comp_obj_heading_ = _comp_obj_heading_.init; + _comp_obj_heading_.use = "content"; + _comp_obj_heading_.of = "para"; + _comp_obj_heading_.is_a = "heading"; + _comp_obj_heading_.text = to!string(_text).strip; + _comp_obj_heading_.ocn = obj_cite_number_; + _comp_obj_heading_.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + _comp_obj_heading_.segment_anchor_tag = to!string(segment_anchor_tag); + _comp_obj_heading_.marked_up_level = lev; + _comp_obj_heading_.heading_lev_markup = (!(lev_markup_number.empty) ? to!int(lev_markup_number) : 0); + _comp_obj_heading_.heading_lev_collapsed = (!(lev_collapsed_number.empty) ? to!int(lev_collapsed_number) : 0); + _comp_obj_heading_.parent_ocn = p_["obj_cite_number"]; + _comp_obj_heading_.parent_lev_markup = p_["lev_markup_number"]; + _comp_obj_heading_.ptr_doc_object = cntr_; + _comp_obj_heading_.ptr_html_segnames = ((lev_markup_number == "4") ? html_segnames_ptr : 0); + _comp_obj_heading_.ptr_heading = ptr_; debug(node) { if (match(lev_markup_number, rgx.levels_numbered_headings)) { writeln("* ", to!string(_node)); @@ -4969,44 +4739,37 @@ struct NodeStructureMetadata { writeln("* ", to!string(_node)); } } - assert(_node_heading_int["parent_lev_markup"] <= 7); - assert(_node_heading_int["parent_ocn"] >= 0); + assert(_comp_obj_heading_.parent_lev_markup <= 7); + assert(_comp_obj_heading_.parent_ocn >= 0); if (match(lev_markup_number, rgx.levels_numbered_headings)) { - assert(_node_heading_int["heading_lev_markup"] <= 7); // issues - assert(to!int(_node_heading_str["ocn"]) >= 0); - if (_node_heading_int["parent_lev_markup"] > 0) { - assert(_node_heading_int["parent_lev_markup"] < _node_heading_int["heading_lev_markup"]); - if (to!int(_node_heading_str["ocn"]) != 0) { - assert(_node_heading_int["parent_ocn"] < to!int(_node_heading_str["ocn"])); + assert(_comp_obj_heading_.heading_lev_markup <= 7); + assert(_comp_obj_heading_.ocn >= 0); + if (_comp_obj_heading_.parent_lev_markup > 0) { + assert(_comp_obj_heading_.parent_lev_markup < _comp_obj_heading_.heading_lev_markup); + if (_comp_obj_heading_.ocn != 0) { + assert(_comp_obj_heading_.parent_ocn < _comp_obj_heading_.ocn); } } - if (_node_heading_int["heading_lev_markup"] == 0) { - assert(_node_heading_int["parent_lev_markup"] == DocStructMarkupHeading.h_sect_A); - } else if (_node_heading_int["heading_lev_markup"] == DocStructMarkupHeading.h_sect_B) { - assert(_node_heading_int["parent_lev_markup"] == DocStructMarkupHeading.h_sect_A); - } else if (_node_heading_int["heading_lev_markup"] == DocStructMarkupHeading.h_sect_C) { - assert(_node_heading_int["parent_lev_markup"] == DocStructMarkupHeading.h_sect_B); - } else if (_node_heading_int["heading_lev_markup"] == DocStructMarkupHeading.h_sect_D) { - assert(_node_heading_int["parent_lev_markup"] == DocStructMarkupHeading.h_sect_C); - } else if (_node_heading_int["heading_lev_markup"] == DocStructMarkupHeading.h_text_1) { - assert(_node_heading_int["parent_lev_markup"] <= DocStructMarkupHeading.h_sect_D); - } else if (_node_heading_int["heading_lev_markup"] == DocStructMarkupHeading.h_text_2) { - assert(_node_heading_int["parent_lev_markup"] == DocStructMarkupHeading.h_text_1); - } else if (_node_heading_int["heading_lev_markup"] == DocStructMarkupHeading.h_text_3) { - assert(_node_heading_int["parent_lev_markup"] == DocStructMarkupHeading.h_text_2); - } else if (_node_heading_int["heading_lev_markup"] == DocStructMarkupHeading.h_text_4) { - assert(_node_heading_int["parent_lev_markup"] == DocStructMarkupHeading.h_text_3); - } else if (_node_heading_int["heading_lev_markup"] == DocStructMarkupHeading.h_text_5) { - // // writeln(to!int(_node_heading_int["parent_lev_markup"])); - // // assert(to!int(_node_heading_int["parent_lev_markup"]) >= 4); - // // assert(to!int(_node_heading_int["parent_lev_markup"]) <= 7); + if (_comp_obj_heading_.heading_lev_markup == 0) { + assert(_comp_obj_heading_.parent_lev_markup == DocStructMarkupHeading.h_sect_A); + } else if (_comp_obj_heading_.heading_lev_markup == DocStructMarkupHeading.h_sect_B) { + assert(_comp_obj_heading_.parent_lev_markup == DocStructMarkupHeading.h_sect_A); + } else if (_comp_obj_heading_.heading_lev_markup == DocStructMarkupHeading.h_sect_C) { + assert(_comp_obj_heading_.parent_lev_markup == DocStructMarkupHeading.h_sect_B); + } else if (_comp_obj_heading_.heading_lev_markup == DocStructMarkupHeading.h_sect_D) { + assert(_comp_obj_heading_.parent_lev_markup == DocStructMarkupHeading.h_sect_C); + } else if (_comp_obj_heading_.heading_lev_markup == DocStructMarkupHeading.h_text_1) { + assert(_comp_obj_heading_.parent_lev_markup <= DocStructMarkupHeading.h_sect_D); + } else if (_comp_obj_heading_.heading_lev_markup == DocStructMarkupHeading.h_text_2) { + assert(_comp_obj_heading_.parent_lev_markup == DocStructMarkupHeading.h_text_1); + } else if (_comp_obj_heading_.heading_lev_markup == DocStructMarkupHeading.h_text_3) { + assert(_comp_obj_heading_.parent_lev_markup == DocStructMarkupHeading.h_text_2); + } else if (_comp_obj_heading_.heading_lev_markup == DocStructMarkupHeading.h_text_4) { + assert(_comp_obj_heading_.parent_lev_markup == DocStructMarkupHeading.h_text_3); + } else if (_comp_obj_heading_.heading_lev_markup == DocStructMarkupHeading.h_text_5) { } } - auto t = tuple( - _node_heading_str, - _node_heading_int, - ); - return t; + return _comp_obj_heading_; } invariant() { } @@ -5026,7 +4789,7 @@ struct NodeStructureMetadata { #+BEGIN_SRC d auto assertions_doc_structure( string[string] an_object, - int[string] lv + int[string] lv ) { if (lv["h3"] > State.off) { assert(lv["h0"] > State.off); @@ -5240,66 +5003,12 @@ set abstracted objects for downstream processing #+BEGIN_SRC d struct HeadingAttrib { string lev = "9"; - int lev_int_markup = 9; - int lev_int_collapsed = 9; - int[] closes_lev_collapsed = []; // TODO track - int[] closes_lev_markup = []; // TODO track - int array_ptr = 0; -// heading segments, 1~ lev4: - int heading_array_ptr_segments = 0; // TODO -} -#+END_SRC - -*** paragraph attribute - -#+name: ao_structs_init -#+BEGIN_SRC d -struct ParaAttrib { - int indent_start = 0; - int indent_rest = 0; - bool bullet = false; -} -#+END_SRC - -*** block attribute - -#+name: ao_structs_init -#+BEGIN_SRC d -struct BlockAttrib { - string syntax = ""; -} -#+END_SRC - -*** comment attribute - -#+name: ao_structs_init -#+BEGIN_SRC d -struct Comment { - // no .attrib and no .obj_cite_number -} -#+END_SRC - -*** TODO node - -#+name: ao_structs_init -#+BEGIN_SRC d -struct Node { - int ocn = 0; - string seg_anchor_tag = ""; -// parent - int parent_lev_int_markup = 0; - int parent_ocn = 0; - int[] ancestors = []; // TODO track -// heading: - int heading_lev_int_markup = 0; - int heading_lev_int_collapsed = 0; - int[] heading_closes_lev_collapsed = []; // TODO track - int[] heading_closes_lev_markup = []; // TODO track - int heading_array_ptr = 0; -// heading segments, 1~ lev4: - int heading_array_ptr_segments = 0; // TODO -// node info json string: - string[string][string] node; + int heading_lev_markup = 9; + int heading_lev_collapsed = 9; + int[] closes_lev_collapsed = []; + int[] closes_lev_markup = []; + int array_ptr = 0; + int heading_array_ptr_segments = 0; } #+END_SRC @@ -5307,202 +5016,46 @@ struct Node { #+name: ao_structs_init #+BEGIN_SRC d -struct ObjComposite { - string use = ""; - string of = ""; - string is_a = ""; - string object = ""; - string obj_cite_number = ""; // not used for calculations? output only? else int - string[] anchor_tags = []; - HeadingAttrib heading_attrib; - ParaAttrib para_attrib; - BlockAttrib block_attrib; - Node node_structure; +struct ObjGenericComposite { + // size_t id; + string use = ""; + string of = ""; + string is_a = ""; + string text = ""; + string obj_cite_number = ""; + string[] anchor_tags = []; + string marked_up_level = "9"; + int[] closes_lev_collapsed = []; + int[] closes_lev_markup = []; + int indent_base = 0; + int indent_hang = 0; + bool bullet = false; + string syntax = ""; + int ocn = 0; + string segment_anchor_tag = ""; + int parent_lev_markup = 0; + int parent_ocn = 0; + int[] ancestors = []; + int heading_lev_markup = 9; + int heading_lev_collapsed = 9; + int[] heading_closes_lev_collapsed = []; + int[] heading_closes_lev_markup = []; + int heading_array_ptr = 0; + int ptr_doc_object = 0; + int ptr_html_segnames = 0; + int ptr_heading = 0; + int array_ptr = 0; + int heading_array_ptr_segments = 0; + string[string][string] node; } #+END_SRC -*** object composite array +*** The Objects: generic composite object array #+name: ao_structs_init #+BEGIN_SRC d -struct ObjCompositeArr { - ObjComposite[] oca; -} -#+END_SRC - -** object setter :set: -*** comment :comment: - -#+name: ao_object_setter_comment -#+BEGIN_SRC d -auto contents_comment(in string object) { - ObjComposite object_set; - object_set.use = "comment"; - object_set.of = "comment"; - object_set.is_a = "comment"; - object_set.object = object; - return object_set; -} -#+END_SRC - -*** heading :heading: - -#+name: ao_object_setter_heading -#+BEGIN_SRC d -auto contents_heading( - in string object, - in string[string] _node_heading_str, - in int[string] _node_heading_int, - in string[] tags, -) { - ObjComposite object_set; - object_set.use = "content"; - object_set.of = "para"; - object_set.is_a = "heading"; - object_set.object = object.strip; - object_set.obj_cite_number = _node_heading_str["ocn"]; - object_set.anchor_tags ~= tags; - object_set.heading_attrib.lev = _node_heading_str["marked_up_lev"]; - object_set.heading_attrib.lev_int_markup = _node_heading_int["heading_lev_markup"]; - object_set.heading_attrib.lev_int_collapsed = _node_heading_int["heading_lev_collapsed"]; - return object_set; -} -#+END_SRC - -*** para :para: - -#+name: ao_object_setter_para -#+BEGIN_SRC d -auto contents_para( - in string object, - in string[string] _node_para_str, - in int[string] _node_para_int, -) { - ObjComposite object_set; - object_set.use = "content"; - object_set.of = "para"; - object_set.is_a = "para"; - object_set.object = object.strip; - object_set.obj_cite_number = (_node_para_int["ocn"]==0) ? "" : to!string(_node_para_int["ocn"]); - object_set.anchor_tags = []; - object_set.para_attrib.indent_start = _node_para_int["indent_hang"]; - object_set.para_attrib.indent_rest = _node_para_int["indent_base"]; - object_set.para_attrib.bullet = (_node_para_int["bullet"] == 1) ? true : false; - return object_set; -} -#+END_SRC - -*** toc :para: - -#+name: ao_object_setter_para -#+BEGIN_SRC d -auto contents_toc( - in string is_a, - in string object, - in string attrib, - in int obj_cite_number, - in int[string] indent, - in bool bullet, -) { - ObjComposite object_set; - object_set.use = "content"; - object_set.of = "para"; - object_set.is_a = "toc"; - object_set.object = object.strip; - object_set.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); - object_set.para_attrib.indent_start = to!int(indent["hang_position"]); - object_set.para_attrib.indent_rest = to!int(indent["base_position"]); - object_set.para_attrib.bullet = false; // bullet; - return object_set; -} -#+END_SRC - -*** para_endnote :para: - -#+name: ao_object_setter_endnote -#+BEGIN_SRC d -auto contents_endnote( - in string object, - in string tag, -) { - auto m = (matchFirst(object, rgx.note_ref)); - string notenumber = to!string(m.captures[1]); - string anchor_tag = "note_" ~ notenumber; - ObjComposite object_set; - object_set.use = "content"; - object_set.of = "para"; - object_set.is_a = "endnote"; - object_set.object = object.strip; - object_set.obj_cite_number = ""; - object_set.anchor_tags ~= [ tag ]; - object_set.para_attrib.indent_start = 0; - object_set.para_attrib.indent_rest = 0; - object_set.para_attrib.bullet = false; - return object_set; -} -#+END_SRC - -*** block :block: - -#+name: ao_object_setter_block -#+BEGIN_SRC d -auto contents_block( - in string type_is, - in string object, - in string attrib, - in int obj_cite_number, -) { - ObjComposite object_set; - object_set.use = "content"; - object_set.of = "block"; - object_set.is_a = type_is; - object_set.object = object; - object_set.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); - object_set.anchor_tags = []; - return object_set; -} -#+END_SRC - -*** block code :block:code: - -#+name: ao_object_setter_block_code -#+BEGIN_SRC d -auto contents_block_code( - in string type_is, - in string object, - in string attrib_language_syntax, - in int obj_cite_number, -) { - ObjComposite object_set; - object_set.use = "content"; - object_set.of = "block"; - object_set.is_a = type_is; - object_set.block_attrib.syntax = attrib_language_syntax; - object_set.object = object; - object_set.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); - object_set.anchor_tags = []; - return object_set; -} -#+END_SRC - -*** block obj_cite_number string :block: - -#+name: ao_object_setter_block_obj_cite_number_string -#+BEGIN_SRC d -auto contents_block_obj_cite_number_string( - in string type_is, - in string object, - in string obj_cite_number, - in string[string] _node_str, - in int[string] _node_int, -) { - ObjComposite object_set; - object_set.use = "content"; - object_set.of = "block"; - object_set.is_a = type_is; - object_set.object = object; - object_set.obj_cite_number = obj_cite_number; - return object_set; +struct TheObjects { + ObjGenericComposite[] oca; } #+END_SRC -- cgit v1.2.3