From db683b9403998ea66cb982d28a3c365eb99ec2e1 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 5 Dec 2016 12:09:04 -0500 Subject: 0.9.4 node info, changes to variables & types --- org/ao_abstract_doc_source.org | 799 ++++++++++++++++++++--------------------- org/ao_defaults.org | 40 ++- org/sdp.org | 2 +- 3 files changed, 416 insertions(+), 425 deletions(-) (limited to 'org') diff --git a/org/ao_abstract_doc_source.org b/org/ao_abstract_doc_source.org index 63daac5..724e44a 100644 --- a/org/ao_abstract_doc_source.org +++ b/org/ao_abstract_doc_source.org @@ -75,12 +75,12 @@ string biblio_entry_str_json; JSONValue[] bib_arr_json; int bib_entry; /+ counters +/ -long cntr, previous_count, previous_length; +int cntr, previous_count, previous_length; int[string] line_occur; int verse_line, heading_ptr; string[] html_segnames=[]; -uint html_segnames_ptr=0; -uint html_segnames_ptr_cntr=0; +int html_segnames_ptr=0; +int html_segnames_ptr_cntr=0; /+ paragraph attributes +/ int[string] indent; bool bullet = true; @@ -104,7 +104,8 @@ string[][string][string] bkidx_hash( return bookindex_extract_hash.bookindex_nugget_hash(bookindex_section, obj_cite_number); } /+ node +/ -string[string][string] _node; +string[string] _node_str; +int[string] _node_int; auto node_construct = NodeStructureMetadata(); #+END_SRC @@ -131,7 +132,8 @@ scope(exit) { #+name: abs_init_rest #+BEGIN_SRC d -auto node_ = node_metadata; +auto node_int_ = node_metadata_int; +auto node_str_ = node_metadata_str; line_occur = [ "heading" : 0, "para" : 0, @@ -189,21 +191,21 @@ string _anchor_tag; string toc_txt_; an_object["glossary_nugget"] = ""; an_object["blurb_nugget"] = ""; -node_["object"]["is"] = "heading"; -node_["object"]["obj_cite_number"] = "0"; -node_["object"]["segment_anchor_tag"] = "toc"; -node_["object"]["parent_obj_cite_number"] = "1"; -node_["object"]["parent_lev_markup_number"] = "0"; +node_str_["is"] = "heading"; +node_str_["ocn"] = "0"; +node_str_["segment_anchor_tag"] = "toc"; +node_str_["attrib"] = ""; +node_str_["marked_up_lev"] = "1"; +node_int_["heading_lev_markup"] = 4; +node_int_["heading_lev_collapsed"] = 2; +node_int_["parent_ocn"] = 1; +node_int_["parent_lev_markup"] = 0; auto toc_head = set_abstract_object.contents_heading( "Table of Contents", // nugget/object - "", // attrib - 0, // obj_cite_number + node_str_, + node_int_, ["toc"], // anchor tag - "1", // lev - 4, // lev_int_markup - 2, // lev_int_collapsed - node_, ); the_table_of_contents_section = [ "seg": [toc_head], @@ -290,7 +292,7 @@ if ((matchFirst(line, rgx.heading_biblio) continue; #+END_SRC -****** TODO within section: glossary :glossary: +****** within section: glossary :glossary: if there is a glossary section you need to: - extract it @@ -325,37 +327,37 @@ 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_["object"]["is"] = "heading"; - node_["object"]["obj_cite_number"] = "0"; - node_["object"]["segment_anchor_tag"] = "glossary"; - node_["object"]["parent_obj_cite_number"] = "1"; - node_["object"]["parent_lev_markup_number"] = "0"; + node_str_["is"] = "heading"; + node_str_["ocn"] = "0"; + node_str_["segment_anchor_tag"] = ""; + node_str_["attrib"] = ""; + node_str_["marked_up_lev"] = "B"; + node_int_["heading_lev_markup"] = 1; + node_int_["heading_lev_collapsed"] = 1; + node_int_["parent_ocn"] = 1; + node_int_["parent_lev_markup"] = 0; the_glossary_section ~= set_abstract_object.contents_heading( "Glossary", // nugget/object - "", // attrib - 0, // obj_cite_number + node_str_, + node_int_, [""], // anchor tag - "B", // lev - 1, // lev_int_markup - 1, // lev_int_collapsed - node_, ); - node_["object"]["is"] = "heading"; - node_["object"]["obj_cite_number"] = "0"; - node_["object"]["segment_anchor_tag"] = "glossary"; - node_["object"]["parent_obj_cite_number"] = "1"; - node_["object"]["parent_lev_markup_number"] = "0"; + node_str_["is"] = "heading"; + node_str_["ocn"] = "0"; + node_str_["segment_anchor_tag"] = "glossary"; + node_str_["attrib"] = ""; + node_str_["marked_up_lev"] = "1"; + node_int_["heading_lev_markup"] = 4; + node_int_["heading_lev_collapsed"] = 2; + node_int_["parent_ocn"] = 1; + node_int_["parent_lev_markup"] = 0; the_glossary_section ~= set_abstract_object.contents_heading( "Glossary", // nugget/object - "", // attrib - 0, // obj_cite_number + node_str_, + node_int_, ["glossary"], // anchor tag - "1", // lev - 4, // lev_int_markup - 2, // lev_int_collapsed - node_, ); // } else if (matchFirst(line, rgx.heading)) { // _heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, type, dochead_meta_aa); // levels? @@ -376,7 +378,7 @@ if there is a glossary section you need to: continue; #+END_SRC -****** TODO within section: blurb :blurb: +****** within section: blurb :blurb: if there is a blurb section you need to: - extract it @@ -411,56 +413,56 @@ 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_["object"]["is"] = "heading"; - node_["object"]["obj_cite_number"] = "0"; - node_["object"]["segment_anchor_tag"] = "blurb"; - node_["object"]["parent_obj_cite_number"] = "1"; - node_["object"]["parent_lev_markup_number"] = "0"; + node_str_["is"] = "heading"; + node_str_["ocn"] = "0"; + node_str_["segment_anchor_tag"] = ""; + node_str_["attrib"] = ""; + node_str_["marked_up_lev"] = "B"; + node_int_["heading_lev_markup"] = 1; + node_int_["heading_lev_collapsed"] = 1; + node_int_["parent_ocn"] = 1; + node_int_["parent_lev_markup"] = 0; the_blurb_section ~= set_abstract_object.contents_heading( "Blurb", // nugget/object - "", // attrib - 0, // obj_cite_number + node_str_, + node_int_, [""], // anchor tag - "B", // lev - 1, // lev_int_markup - 1, // lev_int_collapsed - node_, ); - node_["object"]["is"] = "heading"; - node_["object"]["obj_cite_number"] = "0"; - node_["object"]["segment_anchor_tag"] = "blurb"; - node_["object"]["parent_obj_cite_number"] = "1"; - node_["object"]["parent_lev_markup_number"] = "0"; + node_str_["is"] = "heading"; + node_str_["ocn"] = "0"; + node_str_["segment_anchor_tag"] = "blurb"; + node_str_["attrib"] = ""; + node_str_["marked_up_lev"] = "1"; + node_int_["heading_lev_markup"] = 4; + node_int_["heading_lev_collapsed"] = 2; + node_int_["parent_ocn"] = 1; + node_int_["parent_lev_markup"] = 0; the_blurb_section ~= set_abstract_object.contents_heading( "Blurb", // nugget/object - "", // attrib - 0, // obj_cite_number + node_str_, + node_int_, ["blurb"], // anchor tag - "1", // lev - 4, // lev_int_markup - 2, // lev_int_collapsed - node_, ); } 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_["object"]["is"] = "heading"; - node_["object"]["obj_cite_number"] = "0"; - node_["object"]["segment_anchor_tag"] = "blurb"; - node_["object"]["parent_obj_cite_number"] = "1"; - node_["object"]["parent_lev_markup_number"] = "0"; + node_str_["is"] = "heading"; + node_str_["ocn"] = "0"; + node_str_["segment_anchor_tag"] = "blurb"; + node_str_["attrib"] = ""; + node_str_["marked_up_lev"] = to!string(an_object["lev"]); + node_int_["heading_lev_markup"] = to!int(an_object["lev_markup_number"]); // make int, remove need to conv + node_int_["heading_lev_collapsed"] = to!int(an_object["lev_collapsed_number"]); // make int, remove need to conv + node_int_["parent_ocn"] = 1; + node_int_["parent_lev_markup"] = 0; the_blurb_section ~= set_abstract_object.contents_heading( to!string(line), // an_object["substantive"], - "", // attrib - 0, // obj_cite_number + node_str_, + node_int_, [""], // anchor tag - to!string(an_object["lev"]), - to!int(an_object["lev_markup_number"]), - to!int(an_object["lev_collapsed_number"]), - node_, ); } else { _para_match_(line, an_object, an_object_key, indent, bullet, type, line_occur); @@ -701,7 +703,8 @@ _block_flag_line_empty_( the_document_body_section, bookindex_unordered_hashes, obj_cite_number, - _node, + _node_str, + _node_int, cntr, type, obj_cite_number_poem, @@ -761,19 +764,22 @@ if ((type["heading"] == State.on) html_segnames_ptr = html_segnames_ptr_cntr; html_segnames_ptr_cntr++; } - _node = + auto _node_t = node_construct.node_emitter_heading( - an_object["lev_markup_number"], - an_object["lev_collapsed_number"], - segment_anchor_tag_that_object_belongs_to, - obj_cite_number, - cntr, - heading_ptr, - an_object["is"], - html_segnames_ptr, - ); // heading + an_object["lev"], // string + an_object["lev_markup_number"], // string + an_object["lev_collapsed_number"], // string + segment_anchor_tag_that_object_belongs_to, // string + obj_cite_number, // int + cntr, // int + heading_ptr, // int + an_object["is"], // string + html_segnames_ptr, // int + ); + _node_str = _node_t[0]; + _node_int = _node_t[1]; an_object["attrib"] = - obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node); + obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_str, _node_int); ++heading_ptr; debug(segments) { writeln(an_object["lev_markup_number"]); @@ -782,13 +788,9 @@ if ((type["heading"] == State.on) the_document_body_section ~= set_abstract_object.contents_heading( an_object["substantive"], - an_object["attrib"], - obj_cite_number, + _node_str, + _node_int, anchor_tags, - to!string(an_object["lev"]), - to!int(an_object["lev_markup_number"]), - to!int(an_object["lev_collapsed_number"]), - _node, ); // track previous heading and make assertions debug(objectrelated1) { // check @@ -813,7 +815,7 @@ if ((type["heading"] == State.on) bookindex_unordered_hashes = bkidx_hash(an_object["bookindex_nugget"], obj_cite_number); an_object["is"] = "para"; - _node = + auto _node_t = node_construct.node_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, @@ -822,12 +824,14 @@ if ((type["heading"] == State.on) heading_ptr-1, an_object["is"], ); + _node_str = _node_t[0]; + _node_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); + obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_str, _node_int); the_document_body_section ~= set_abstract_object.contents_para( an_object["is"], @@ -873,16 +877,16 @@ if (the_document_body_section.length > 0) { type["glossary_section"] = State.off; type["blurb_section"] = State.off; } - previous_length = the_document_body_section.length; + previous_length = to!int(the_document_body_section.length); if ( match(the_document_body_section[$-1].object, rgx.inline_notes_delimiter_al_regular_number_note) ) { - previous_count=the_document_body_section.length -1; + previous_count=to!int(the_document_body_section.length -1); note_section.gather_notes_for_endnote_section( the_document_body_section, segment_anchor_tag_that_object_belongs_to, - the_document_body_section.length-1, + to!int(the_document_body_section.length-1), ); } } @@ -937,21 +941,21 @@ debug(endnotes) { #+BEGIN_SRC d if (an_object["glossary_nugget"].length == 0) { writeln("no gloss"); - node_["object"]["is"] = "heading"; - node_["object"]["obj_cite_number"] = "0"; - node_["object"]["segment_anchor_tag"] = "glossary"; - node_["object"]["parent_obj_cite_number"] = "1"; - node_["object"]["parent_lev_markup_number"] = "0"; + node_str_["is"] = "heading"; + node_str_["ocn"] = "0"; + node_str_["segment_anchor_tag"] = ""; + node_str_["attrib"] = ""; + node_str_["marked_up_lev"] = "B"; + node_int_["heading_lev_markup"] = 1; + node_int_["heading_lev_collapsed"] = 1; + node_int_["parent_ocn"] = 1; + node_int_["parent_lev_markup"] = 0; the_glossary_section ~= set_abstract_object.contents_heading( "(skip) there is no Glossary section", // nugget/object - "", // attrib - 0, // obj_cite_number + node_str_, + node_int_, [""], // anchor tag - "B", // lev - 1, // lev_int_markup - 1, // lev_int_collapsed - node_, ); } else { writeln("gloss"); @@ -977,54 +981,54 @@ auto biblio_ordered = #+name: abs_post #+BEGIN_SRC d if (biblio_ordered.length > 0) { - node_["object"]["is"] = "heading"; - node_["object"]["obj_cite_number"] = "0"; - node_["object"]["segment_anchor_tag"] = "bibliography"; - node_["object"]["parent_obj_cite_number"] = "1"; - node_["object"]["parent_lev_markup_number"] = "0"; + node_str_["is"] = "heading"; + node_str_["ocn"] = "0"; + node_str_["segment_anchor_tag"] = ""; + node_str_["attrib"] = ""; + node_str_["marked_up_lev"] = "B"; + node_int_["heading_lev_markup"] = 1; + node_int_["heading_lev_collapsed"] = 1; + node_int_["parent_ocn"] = 1; + node_int_["parent_lev_markup"] = 0; the_bibliography_section ~= set_abstract_object.contents_heading( "Bibliography", // nugget/object - "", // attrib - 0, // obj_cite_number + node_str_, + node_int_, [""], // anchor tag - "B", // lev - 1, // lev_int_markup - 1, // lev_int_collapsed - node_, ); - node_["object"]["is"] = "heading"; - node_["object"]["obj_cite_number"] = "0"; - node_["object"]["segment_anchor_tag"] = "bibliography"; - node_["object"]["parent_obj_cite_number"] = "1"; - node_["object"]["parent_lev_markup_number"] = "0"; + node_str_["is"] = "heading"; + node_str_["ocn"] = "0"; + node_str_["segment_anchor_tag"] = "bibliography"; + node_str_["attrib"] = ""; + node_str_["marked_up_lev"] = "1"; + node_int_["heading_lev_markup"] = 4; + node_int_["heading_lev_collapsed"] = 2; + node_int_["parent_ocn"] = 1; + node_int_["parent_lev_markup"] = 0; the_bibliography_section ~= set_abstract_object.contents_heading( - "Bibliography", // nugget/object - "", // attrib - 0, // obj_cite_number + "Bibliography", + node_str_, + node_int_, ["bibliography"], // anchor tag - "1", // lev - 4, // lev_int_markup - 2, // lev_int_collapsed - node_, ); } else { - node_["object"]["is"] = "heading"; - node_["object"]["obj_cite_number"] = "0"; - node_["object"]["segment_anchor_tag"] = "bibliography"; - node_["object"]["parent_obj_cite_number"] = "1"; - node_["object"]["parent_lev_markup_number"] = "0"; + node_str_["is"] = "heading"; + node_str_["ocn"] = "0"; + node_str_["segment_anchor_tag"] = ""; + node_str_["attrib"] = ""; + node_str_["marked_up_lev"] = "B"; + node_int_["heading_lev_markup"] = 1; + node_int_["heading_lev_collapsed"] = 1; + node_int_["parent_ocn"] = 1; + node_int_["parent_lev_markup"] = 0; the_bibliography_section ~= set_abstract_object.contents_heading( "(skip) there is no Bibliography", // nugget/object - "", // attrib - 0, // obj_cite_number + node_str_, + node_int_, [""], // anchor tag - "B", // lev - 1, // lev_int_markup - 1, // lev_int_collapsed - node_, ); } #+END_SRC @@ -1130,21 +1134,21 @@ debug(bookindex) { // bookindex #+BEGIN_SRC d if (an_object["blurb_nugget"].length == 0) { writeln("no blurb"); - node_["object"]["is"] = "heading"; - node_["object"]["obj_cite_number"] = "0"; - node_["object"]["segment_anchor_tag"] = "blurb"; - node_["object"]["parent_obj_cite_number"] = "1"; - node_["object"]["parent_lev_markup_number"] = "0"; + node_str_["is"] = "heading"; + node_str_["ocn"] = "0"; + node_str_["segment_anchor_tag"] = ""; + node_str_["attrib"] = ""; + node_str_["marked_up_lev"] = "B"; + node_int_["heading_lev_markup"] = 1; + node_int_["heading_lev_collapsed"] = 1; + node_int_["parent_ocn"] = 1; + node_int_["parent_lev_markup"] = 0; the_blurb_section ~= set_abstract_object.contents_heading( "(skip) there is no Blurb section", // nugget/object - "", // attrib - 0, // obj_cite_number + node_str_, + node_int_, [""], // anchor tag - "B", // lev - 1, // lev_int_markup - 1, // lev_int_collapsed - node_, ); } else { writeln("blurb"); @@ -1897,7 +1901,7 @@ void _poem_block_( char[] line, ref string[string] an_object, ref int[string] type, - ref long cntr, + ref int cntr, string[string] obj_cite_number_poem, string[string][string] dochead_make_aa, ) { @@ -1934,7 +1938,7 @@ void _poem_block_( 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); + obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_str, _node_int); the_document_body_section ~= set_abstract_object.contents_block( an_object["is"], @@ -1973,7 +1977,7 @@ void _poem_block_( } processing.remove("verse"); an_object["is"] = "verse"; - _node = node_construct.node_emitter( + auto _node_t = node_construct.node_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, obj_cite_number, @@ -1981,12 +1985,14 @@ void _poem_block_( heading_ptr-1, an_object["is"] ); + _node_str = _node_t[0]; + _node_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); + obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_str, _node_int); the_document_body_section ~= set_abstract_object.contents_block( an_object["is"], @@ -2023,7 +2029,7 @@ void _poem_block_( 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); + obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_str, _node_int); the_document_body_section ~= set_abstract_object.contents_block( an_object["is"], @@ -2061,7 +2067,7 @@ void _poem_block_( } processing.remove("verse"); an_object["is"] = "verse"; - _node = + auto _node_t = node_construct.node_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, @@ -2070,12 +2076,14 @@ void _poem_block_( heading_ptr-1, an_object["is"] ); + _node_str = _node_t[0]; + _node_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); + obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_str, _node_int); the_document_body_section ~= set_abstract_object.contents_block( an_object["is"], @@ -2266,8 +2274,9 @@ void _block_flag_line_empty_( ref ObjComposite[] the_document_body_section, ref string[][string][string] bookindex_unordered_hashes, ref int obj_cite_number, - ref string[string][string] _node, - ref long cntr, + ref string[string] _node_str, + ref int[string] _node_int, + ref int cntr, ref int[string] type, string[string] obj_cite_number_poem, string[string][string] dochead_make_aa, @@ -2290,7 +2299,7 @@ void _block_flag_line_empty_( bookindex_unordered_hashes = bkidx_hash(an_object["bookindex_nugget"], obj_cite_number); an_object["is"] = "code"; - _node = + auto _node_t = node_construct.node_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, @@ -2299,12 +2308,14 @@ void _block_flag_line_empty_( heading_ptr-1, an_object["is"] ); + _node_str = _node_t[0]; + _node_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); + obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_str, _node_int); the_document_body_section ~= set_abstract_object.contents_block_code( an_object["is"], @@ -2323,8 +2334,8 @@ void _block_flag_line_empty_( bookindex_unordered_hashes = bkidx_hash(an_object["bookindex_nugget"], obj_cite_number); an_object["is"] = "verse"; // check also - _node = - node_construct.node_emitter( + auto _node_t = + node_construct.node_emitter( // content_non_header, segment_anchor_tag_that_object_belongs_to, obj_cite_number, @@ -2332,12 +2343,15 @@ void _block_flag_line_empty_( heading_ptr-1, an_object["is"] ); + _node_str = _node_t[0]; + _node_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 + _node_str, + _node_int, ); // bookindex object_reset(an_object); processing.remove("verse"); @@ -2351,7 +2365,7 @@ void _block_flag_line_empty_( bookindex_unordered_hashes = bkidx_hash(an_object["bookindex_nugget"], obj_cite_number); an_object["is"] = "table"; - _node = + auto _node_t = node_construct.node_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, @@ -2360,12 +2374,14 @@ void _block_flag_line_empty_( heading_ptr-1, an_object["is"] ); + _node_str = _node_t[0]; + _node_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); + obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_str, _node_int); the_document_body_section ~= set_abstract_object.contents_block( an_object["is"], @@ -2386,7 +2402,7 @@ void _block_flag_line_empty_( bookindex_unordered_hashes = bkidx_hash(an_object["bookindex_nugget"], obj_cite_number); an_object["is"] = "group"; - _node = + auto _node_t = node_construct.node_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, @@ -2395,12 +2411,14 @@ void _block_flag_line_empty_( heading_ptr-1, an_object["is"] ); + _node_str = _node_t[0]; + _node_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); + obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_str, _node_int); the_document_body_section ~= set_abstract_object.contents_block( an_object["is"], @@ -2420,7 +2438,7 @@ void _block_flag_line_empty_( bookindex_unordered_hashes = bkidx_hash(an_object["bookindex_nugget"], obj_cite_number); an_object["is"] = "block"; - _node = + auto _node_t = node_construct.node_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, @@ -2429,12 +2447,14 @@ void _block_flag_line_empty_( heading_ptr-1, an_object["is"] ); + _node_str = _node_t[0]; + _node_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); + obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_str, _node_int); the_document_body_section ~= set_abstract_object.contents_block( an_object["is"], @@ -2455,8 +2475,8 @@ void _block_flag_line_empty_( bookindex_unordered_hashes = bkidx_hash(an_object["bookindex_nugget"], obj_cite_number); an_object["is"] = "quote"; - _node = - node_construct.node_emitter( + auto _node_t = + node_construct.node_emitter( // content_non_header, segment_anchor_tag_that_object_belongs_to, obj_cite_number, @@ -2464,12 +2484,14 @@ void _block_flag_line_empty_( heading_ptr-1, an_object["is"] ); + _node_str = _node_t[0]; + _node_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); + obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node_str, _node_int); the_document_body_section ~= set_abstract_object.contents_block( an_object["is"], @@ -3418,12 +3440,12 @@ private: ) { if (dochead_make_aa["make"]["num_top"].length > 0) { if (!(match(munge_, rgx.heading_anchor_tag))) { - static __gshared uint heading_num_top_level=9; - static __gshared uint heading_num_depth=2; - static __gshared uint heading_num_0 = 0; - static __gshared uint heading_num_1 = 0; - static __gshared uint heading_num_2 = 0; - static __gshared uint heading_num_3 = 0; + static __gshared int heading_num_top_level=9; + static __gshared int heading_num_depth=2; + static __gshared int heading_num_0 = 0; + static __gshared int heading_num_1 = 0; + static __gshared int heading_num_2 = 0; + static __gshared int heading_num_3 = 0; static __gshared string heading_number_auto_composite = ""; if (heading_num_top_level==9) { if (dochead_make_aa["make"]["num_depth"].length > 0) { @@ -3550,7 +3572,7 @@ private: "$1~" ~ "s" ~ m.captures[1] ~ " "); } } else if (lev_ == "1") { // (if not successful) manufacture a unique anchor tag for lev=="1" - static __gshared uint heading_num_lev1 = 0; + static __gshared int heading_num_lev1 = 0; heading_num_lev1 ++; munge_=replaceFirst(munge_, rgx.heading_marker_missing_tag, "$1~" ~ "x" ~ to!string(heading_num_lev1) ~ " "); @@ -3633,14 +3655,16 @@ struct ObjAttributes { string obj_attributes( string obj_is_, string obj_raw, - string[string][string] _node + string[string] _node_str, + int[string] _node_int ) in { } body { scope(exit) { destroy(obj_is_); destroy(obj_raw); - destroy(_node); + destroy(_node_str); + destroy(_node_int); } _obj_attrib.remove("json"); _obj_attrib["json"] ="{"; @@ -3680,7 +3704,7 @@ struct ObjAttributes { break; } _obj_attrib["json"] ~=" }"; - _obj_attrib["json"]=_set_additional_values_parse_as_json(_obj_attrib["json"], obj_is_, _node); + _obj_attrib["json"]=_set_additional_values_parse_as_json(_obj_attrib["json"], obj_is_, _node_str, _node_int); // check debug(structattrib) { if (oa_j["is"].str() == "heading") { writeln(_obj_attrib["json"]); @@ -3889,23 +3913,24 @@ struct ObjAttributes { string _set_additional_values_parse_as_json( string _obj_attrib, string obj_is_, - string[string][string] _node + string[string] _node_str, + int[string] _node_int ) { // JSONValue oa_j = parseJSON(_obj_attrib); assert( (oa_j.type == JSON_TYPE.OBJECT) ); if (obj_is_ == "heading") { - oa_j.object["obj_cite_number"] = _node["object"]["obj_cite_number"]; - oa_j.object["lev_markup_number"] = _node["heading"]["lev_markup_number"]; - oa_j.object["lev_collapsed_number"] = _node["heading"]["lev_collapsed_number"]; + oa_j.object["obj_cite_number"] = _node_str["ocn"]; + oa_j.object["lev_markup_number"] = _node_int["heading_lev_markup"]; + oa_j.object["lev_collapsed_number"] = _node_int["heading_lev_collapsed"]; oa_j.object["heading_ptr"] = - _node["object"]["heading_ptr"]; // check + _node_int["ptr_heading"]; oa_j.object["doc_object_ptr"] = - _node["object"]["doc_object_ptr"]; // check + _node_int["ptr_doc_object"]; } - oa_j.object["parent_obj_cite_number"] = _node["object"]["parent_obj_cite_number"]; - oa_j.object["parent_lev_markup_number"] = _node["object"]["parent_lev_markup_number"]; + oa_j.object["parent_obj_cite_number"] = _node_int["parent_ocn"]; + oa_j.object["parent_lev_markup_number"] = _node_int["parent_lev_markup"]; _obj_attrib = oa_j.toString(); return _obj_attrib; } @@ -4093,74 +4118,59 @@ struct BookIndexReportSection { auto mainkeys = bookindex_unordered_hashes.byKey.array.sort().release; ObjComposite[][string] bookindex_section; - auto node_ = node_metadata; + auto node_int_ = node_metadata_int; + auto node_str_ = node_metadata_str; if ((mainkeys.length > 0) && (opt_action_bool["backmatter"] && opt_action_bool["section_bookindex"])) { string bi_tmp_seg, bi_tmp_scroll; - attrib=""; - lev="B"; - lev_int_markup=1; - lev_int_collapsed=1; - node_["object"]["is"] = "heading"; - node_["object"]["obj_cite_number"] = "0"; - node_["object"]["segment_anchor_tag"] = "bookindex"; - node_["object"]["parent_obj_cite_number"] = "1"; - node_["object"]["parent_lev_markup_number"] = "0"; + node_str_["is"] = "heading"; + node_str_["ocn"] = "0"; + node_str_["segment_anchor_tag"] = ""; + node_str_["attrib"] = ""; + node_str_["marked_up_lev"] = "B"; + node_int_["heading_lev_markup"] = 1; + node_int_["heading_lev_collapsed"] = 1; + node_int_["parent_ocn"] = 1; + node_int_["parent_lev_markup"] = 0; bookindex_section["scroll"] ~= set_abstract_object.contents_heading( "Book Index", - attrib, - obj_cite_number, + node_str_, + node_int_, [], - to!string(lev), - lev_int_markup, - lev_int_collapsed, - node_, ); bookindex_section["seg"] ~= set_abstract_object.contents_heading( "Book Index", - attrib, - obj_cite_number, + node_str_, + node_int_, [], - to!string(lev), - lev_int_markup, - lev_int_collapsed, - node_, ); ++obj_cite_number; ++mkn; // 1~ Index - attrib=""; - lev="1"; - lev_int_markup=4; - lev_int_collapsed=2; - node_["object"]["is"] = "heading"; - node_["object"]["obj_cite_number"] = "0"; - node_["object"]["segment_anchor_tag"] = "bookindex"; - node_["object"]["parent_obj_cite_number"] = "1"; - node_["object"]["parent_lev_markup_number"] = "0"; + node_str_["is"] = "heading"; + node_str_["ocn"] = "0"; + node_str_["segment_anchor_tag"] = "bookindex"; + node_str_["attrib"] = ""; + node_str_["marked_up_lev"] = "1"; + node_int_["heading_lev_markup"] = 4; + node_int_["heading_lev_collapsed"] = 2; + node_int_["parent_ocn"] = 1; + node_int_["parent_lev_markup"] = 0; bookindex_section["scroll"] ~= set_abstract_object.contents_heading( "Index", - attrib, - obj_cite_number, + node_str_, + node_int_, ["book_index"], - to!string(lev), - lev_int_markup, - lev_int_collapsed, - node_, ); bookindex_section["seg"] ~= set_abstract_object.contents_heading( "Index", - attrib, - obj_cite_number, + node_str_, + node_int_, ["book_index"], - to!string(lev), - lev_int_markup, - lev_int_collapsed, - node_, ); ++obj_cite_number; ++mkn; @@ -4223,32 +4233,28 @@ struct BookIndexReportSection { ++mkn; } } else { // no book index, (figure out what to do here) - node_["object"]["is"] = "heading"; - node_["object"]["obj_cite_number"] = "0"; - node_["object"]["segment_anchor_tag"] = "bookindex"; - node_["object"]["parent_obj_cite_number"] = "1"; - node_["object"]["parent_lev_markup_number"] = "0"; + node_str_["is"] = "heading"; + node_str_["ocn"] = "0"; + node_str_["segment_anchor_tag"] = ""; + node_str_["attrib"] = ""; + node_str_["marked_up_lev"] = "B"; + node_int_["heading_lev_markup"] = 1; + node_int_["heading_lev_collapsed"] = 1; + node_int_["parent_ocn"] = 1; + node_int_["parent_lev_markup"] = 0; bookindex_section["scroll"] ~= set_abstract_object.contents_heading( "(skip) there is no Book Index", - "", // attrib, - 0, + node_str_, + node_int_, [""], - "B", - 1, - 1, - node_, ); bookindex_section["seg"] ~= set_abstract_object.contents_heading( "(skip) there is no Book Index", - "", // attrib, - 0, + node_str_, + node_int_, [""], - "B", - 1, - 1, - node_, ); } auto t = tuple(bookindex_section, obj_cite_number); @@ -4269,7 +4275,7 @@ struct BookIndexReportSection { #+BEGIN_SRC d struct NotesSection { string[string] object_notes; - long previous_count; + int previous_count; int mkn; auto rgx = Rgx(); #+END_SRC @@ -4281,7 +4287,7 @@ struct NotesSection { private auto gather_notes_for_endnote_section( ObjComposite[] contents_am, string segment_anchor_tag_that_object_belongs_to, - ulong cntr, + int cntr, ) in { // endnotes/ footnotes for @@ -4373,102 +4379,83 @@ struct NotesSection { string lev, lev_markup_number, lev_collapsed_number; string attrib; int[string] indent; - auto node_ = node_metadata; + auto node_int_ = node_metadata_int; + auto node_str_ = node_metadata_str; if ((endnotes_["seg"].length > 0) && (opt_action_bool["backmatter"] && opt_action_bool["section_endnotes"])) { - attrib=""; - lev="B"; - lev_markup_number="1"; - lev_collapsed_number="1"; - node_["object"]["is"] = "heading"; - node_["object"]["obj_cite_number"] = "0"; - node_["object"]["segment_anchor_tag"] = "endnotes"; - node_["object"]["parent_obj_cite_number"] = "1"; - node_["object"]["parent_lev_markup_number"] = "0"; + node_str_["is"] = "heading"; + node_str_["ocn"] = "0"; + node_str_["segment_anchor_tag"] = ""; + node_str_["attrib"] = ""; + node_str_["marked_up_lev"] = "B"; + node_int_["heading_lev_markup"] = 1; + node_int_["heading_lev_collapsed"] = 1; + node_int_["parent_ocn"] = 1; + node_int_["parent_lev_markup"] = 0; the_endnotes_section["seg"] ~= set_abstract_object.contents_heading( "Endnotes", - attrib, - obj_cite_number, + node_str_, + node_int_, [], - to!string(lev), - to!int(lev_markup_number), - to!int(lev_collapsed_number), - node_, ); the_endnotes_section["scroll"] ~= set_abstract_object.contents_heading( "Endnotes", - attrib, - obj_cite_number, + node_str_, + node_int_, [], - to!string(lev), - to!int(lev_markup_number), - to!int(lev_collapsed_number), - node_, ); ++obj_cite_number; ++mkn; - attrib=""; - lev="1"; - lev_markup_number="4"; - lev_collapsed_number="2"; - node_["object"]["is"] = "heading"; - node_["object"]["obj_cite_number"] = "0"; - node_["object"]["segment_anchor_tag"] = "endnotes"; - node_["object"]["parent_obj_cite_number"] = "1"; - node_["object"]["parent_lev_markup_number"] = "0"; + node_str_["is"] = "heading"; + node_str_["ocn"] = "0"; + node_str_["segment_anchor_tag"] = "endnotes"; + node_str_["attrib"] = ""; + node_str_["marked_up_lev"] = "1"; + node_int_["heading_lev_markup"] = 4; + node_int_["heading_lev_collapsed"] = 2; + node_int_["parent_ocn"] = 1; + node_int_["parent_lev_markup"] = 0; the_endnotes_section["seg"] ~= set_abstract_object.contents_heading( "Endnotes", - attrib, - obj_cite_number, + node_str_, + node_int_, ["endnotes"], - to!string(lev), - to!int(lev_markup_number), - to!int(lev_collapsed_number), - node_, ); the_endnotes_section["scroll"] ~= set_abstract_object.contents_heading( "Endnotes", - attrib, - obj_cite_number, + node_str_, + node_int_, ["endnotes"], - to!string(lev), - to!int(lev_markup_number), - to!int(lev_collapsed_number), - node_, ); ++obj_cite_number; ++mkn; } else { - node_["object"]["is"] = "heading"; - node_["object"]["obj_cite_number"] = "0"; - node_["object"]["segment_anchor_tag"] = "endnotes"; - node_["object"]["parent_obj_cite_number"] = "1"; - node_["object"]["parent_lev_markup_number"] = "0"; + node_str_["is"] = "heading"; + node_str_["ocn"] = "0"; + node_str_["segment_anchor_tag"] = ""; + node_str_["attrib"] = ""; + node_str_["marked_up_lev"] = "B"; + node_int_["heading_lev_markup"] = 1; + node_int_["heading_lev_collapsed"] = 1; + node_int_["parent_ocn"] = 1; + node_int_["parent_lev_markup"] = 0; the_endnotes_section["seg"] ~= set_abstract_object.contents_heading( "(skip) there are no Endnotes", - "", // attrib, - 0, + node_str_, + node_int_, [""], - "B", - 1, - 1, - node_, ); the_endnotes_section["scroll"] ~= set_abstract_object.contents_heading( "(skip) there are no Endnotes", - "", // attrib, - 0, + node_str_, + node_int_, [""], - "B", - 1, - 1, - node_, ); } if (opt_action_bool["backmatter"] && opt_action_bool["section_endnotes"]) { @@ -4621,18 +4608,17 @@ struct NodeStructureMetadata { int lv, lv0, lv1, lv2, lv3, lv4, lv5, lv6, lv7; int obj_cite_number; int[string] p_; // p_ parent_ - string[string][string] _node; #+END_SRC **** TODO node metadata emitter #+name: ao_emitters_metadata #+BEGIN_SRC d - string[string][string] node_emitter( + auto node_emitter( string lev_markup_number, string segment_anchor_tag, int obj_cite_number_, - long cntr_, + int cntr_, int ptr_, string is_ ) @@ -4658,23 +4644,22 @@ struct NodeStructureMetadata { p_["lev_markup_number"] = DocStructMarkupHeading.h_text_1; p_["obj_cite_number"] = lv4; } - auto _node = [ - "object" : [ - "is" : is_, - "heading_ptr" : to!string(ptr_), - "doc_object_ptr" : to!string(cntr_), - "obj_cite_number" : to!string(obj_cite_number_), - "segment_anchor_tag" : to!string(segment_anchor_tag), - "parent_obj_cite_number" : to!string(p_["obj_cite_number"]), - "parent_lev_markup_number" : to!string(p_["lev_markup_number"]), - ], - "heading" : [ - "html_segnames_ptr" : "", - "lev_markup_number" : "", - "lev_collapsed_number" : "", - // "ancestors" : "", - // "open_headings_to_close" : "", - ] + string[string] _node_str = [ + "is" : is_, + "ocn" : to!string(obj_cite_number_), + "marked_up_lev" : "", + "segment_anchor_tag" : to!string(segment_anchor_tag), + "attrib" : "", + ]; + int[string] _node_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"], ]; debug(node) { if (match(lev_markup_number, rgx.levels_numbered_headings)) { @@ -4683,10 +4668,14 @@ struct NodeStructureMetadata { writeln("- ", to!string(_node)); } } - assert(to!int(_node["object"]["parent_lev_markup_number"]) >= 4); - assert(to!int(_node["object"]["parent_lev_markup_number"]) <= 7); - assert(to!int(_node["object"]["parent_obj_cite_number"]) >= 0); // hmm, perhaps - return _node; + assert(_node_int["parent_lev_markup"] >= 4); // + assert(_node_int["parent_lev_markup"] <= 7); // + assert(_node_int["parent_ocn"] >= 0); // hmm, perhaps // + auto t = tuple( + _node_str, + _node_int, + ); + return t; } invariant() { } @@ -4696,15 +4685,16 @@ struct NodeStructureMetadata { #+name: ao_emitters_metadata #+BEGIN_SRC d - string[string][string] node_emitter_heading( + auto node_emitter_heading( + string lev, string lev_markup_number, string lev_collapsed_number, string segment_anchor_tag, int obj_cite_number_, - long cntr_, + int cntr_, int ptr_, string is_, - uint html_segnames_ptr, + int html_segnames_ptr, ) in { auto rgx = Rgx(); @@ -4803,23 +4793,22 @@ struct NodeStructureMetadata { default: break; } - auto _node = [ - "object" : [ - "is" : is_, - "heading_ptr" : to!string(ptr_), - "doc_object_ptr" : to!string(cntr_), - "obj_cite_number" : to!string(obj_cite_number_), - "segment_anchor_tag" : to!string(segment_anchor_tag), - "parent_obj_cite_number" : to!string(p_["obj_cite_number"]), - "parent_lev_markup_number" : to!string(p_["lev_markup_number"]), - ], - "heading" : [ - "html_segnames_ptr" : ((lev_markup_number == "4") ? (to!string(html_segnames_ptr)) : ""), - "lev_markup_number" : to!string(lev_markup_number), - "lev_collapsed_number" : to!string(lev_collapsed_number), - // "ancestors" : to!string(ancestors), - // "open_headings_to_close" : to!string(open_headings_to_close), - ] + string[string] _node_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_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"], ]; debug(node) { if (match(lev_markup_number, rgx.levels_numbered_headings)) { @@ -4831,37 +4820,44 @@ struct NodeStructureMetadata { writeln("* ", to!string(_node)); } } - assert(to!int(_node["object"]["parent_lev_markup_number"]) <= 7); - assert(to!int(_node["object"]["parent_obj_cite_number"]) >= 0); + assert(_node_int["parent_lev_markup"] <= 7); + assert(_node_int["parent_ocn"] >= 0); if (match(lev_markup_number, rgx.levels_numbered_headings)) { - assert(to!int(_node["heading"]["lev_markup_number"]) <= 7); - assert(to!int(_node["object"]["obj_cite_number"]) >= 0); - if (to!int(_node["object"]["parent_lev_markup_number"]) > 0) { - assert(to!int(_node["object"]["parent_lev_markup_number"]) < to!int(_node["heading"]["lev_markup_number"])); - if (to!int(_node["object"]["obj_cite_number"]) != 0) { - assert(to!int(_node["object"]["parent_obj_cite_number"]) < to!int(_node["object"]["obj_cite_number"])); + assert(_node_int["heading_lev_markup"] <= 7); // issues + assert(to!int(_node_str["ocn"]) >= 0); + if (_node_int["parent_lev_markup"] > 0) { + assert(_node_int["parent_lev_markup"] < _node_int["heading_lev_markup"]); + if (to!int(_node_str["ocn"]) != 0) { + assert(_node_int["parent_ocn"] < to!int(_node_str["ocn"])); } } - if (to!int(_node["heading"]["lev_markup_number"]) == 0) { - assert(to!int(_node["object"]["parent_lev_markup_number"]) == DocStructMarkupHeading.h_sect_A); - } else if (to!int(_node["heading"]["lev_markup_number"]) == DocStructMarkupHeading.h_sect_B) { - assert(to!int(_node["object"]["parent_lev_markup_number"]) == DocStructMarkupHeading.h_sect_A); - } else if (to!int(_node["heading"]["lev_markup_number"]) == DocStructMarkupHeading.h_sect_C) { - assert(to!int(_node["object"]["parent_lev_markup_number"]) == DocStructMarkupHeading.h_sect_B); - } else if (to!int(_node["heading"]["lev_markup_number"]) == DocStructMarkupHeading.h_sect_D) { - assert(to!int(_node["object"]["parent_lev_markup_number"]) == DocStructMarkupHeading.h_sect_C); - } else if (to!int(_node["heading"]["lev_markup_number"]) == DocStructMarkupHeading.h_text_1) { - assert(to!int(_node["object"]["parent_lev_markup_number"]) <= DocStructMarkupHeading.h_sect_D); - } else if (to!int(_node["heading"]["lev_markup_number"]) == DocStructMarkupHeading.h_text_2) { - assert(to!int(_node["object"]["parent_lev_markup_number"]) == DocStructMarkupHeading.h_text_1); - } else if (to!int(_node["heading"]["lev_markup_number"]) == DocStructMarkupHeading.h_text_3) { - assert(to!int(_node["object"]["parent_lev_markup_number"]) == DocStructMarkupHeading.h_text_2); - } else if (to!int(_node["heading"]["lev_markup_number"]) == DocStructMarkupHeading.h_text_4) { - assert(to!int(_node["object"]["parent_lev_markup_number"]) == DocStructMarkupHeading.h_text_3); - } else if (to!int(_node["heading"]["lev_markup_number"]) == DocStructMarkupHeading.h_text_5) { + if (_node_int["heading_lev_markup"] == 0) { + assert(_node_int["parent_lev_markup"] == DocStructMarkupHeading.h_sect_A); + } else if (_node_int["heading_lev_markup"] == DocStructMarkupHeading.h_sect_B) { + assert(_node_int["parent_lev_markup"] == DocStructMarkupHeading.h_sect_A); + } else if (_node_int["heading_lev_markup"] == DocStructMarkupHeading.h_sect_C) { + assert(_node_int["parent_lev_markup"] == DocStructMarkupHeading.h_sect_B); + } else if (_node_int["heading_lev_markup"] == DocStructMarkupHeading.h_sect_D) { + assert(_node_int["parent_lev_markup"] == DocStructMarkupHeading.h_sect_C); + } else if (_node_int["heading_lev_markup"] == DocStructMarkupHeading.h_text_1) { + assert(_node_int["parent_lev_markup"] <= DocStructMarkupHeading.h_sect_D); + } else if (_node_int["heading_lev_markup"] == DocStructMarkupHeading.h_text_2) { + assert(_node_int["parent_lev_markup"] == DocStructMarkupHeading.h_text_1); + } else if (_node_int["heading_lev_markup"] == DocStructMarkupHeading.h_text_3) { + assert(_node_int["parent_lev_markup"] == DocStructMarkupHeading.h_text_2); + } else if (_node_int["heading_lev_markup"] == DocStructMarkupHeading.h_text_4) { + assert(_node_int["parent_lev_markup"] == DocStructMarkupHeading.h_text_3); + } else if (_node_int["heading_lev_markup"] == DocStructMarkupHeading.h_text_5) { + // // writeln(to!int(_node_int["parent_lev_markup"])); + // // assert(to!int(_node_int["parent_lev_markup"]) >= 4); + // // assert(to!int(_node_int["parent_lev_markup"]) <= 7); } } - return _node; + auto t = tuple( + _node_str, + _node_int, + ); + return t; } invariant() { } @@ -5205,25 +5201,21 @@ auto contents_comment(in string object) { #+name: ao_object_setter_heading #+BEGIN_SRC d auto contents_heading( - in string object, - in string attrib, - in int obj_cite_number, - in string[] tags, - in string lev, - in int lev_int_markup, - in int lev_int_collapsed, - in string[string][string] _node, + in string object, + in string[string] _node_str, + in int[string] _node_int, + in string[] tags, ) { ObjComposite object_set; object_set.use = "content"; object_set.of = "para"; object_set.is_a = "heading"; object_set.object = object; - object_set.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + object_set.obj_cite_number = _node_str["ocn"]; object_set.anchor_tags ~= tags; - object_set.heading_attrib.lev = lev; - object_set.heading_attrib.lev_int_markup = lev_int_markup; - object_set.heading_attrib.lev_int_collapsed = lev_int_collapsed; + object_set.heading_attrib.lev = _node_str["marked_up_lev"]; + object_set.heading_attrib.lev_int_markup = _node_int["heading_lev_markup"]; + object_set.heading_attrib.lev_int_collapsed = _node_int["heading_lev_collapsed"]; return object_set; } #+END_SRC @@ -5249,7 +5241,6 @@ auto contents_para( 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; - // object_set.node_structure.node = _node; return object_set; } #+END_SRC @@ -5320,7 +5311,6 @@ auto contents_block( object_set.is_a = type; object_set.object = object; object_set.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); - // object_set.node_structure.node = _node; return object_set; } #+END_SRC @@ -5342,7 +5332,6 @@ auto contents_block_code( 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.node_structure.node = _node; return object_set; } #+END_SRC @@ -5352,10 +5341,11 @@ auto contents_block_code( #+name: ao_object_setter_block_obj_cite_number_string #+BEGIN_SRC d auto contents_block_obj_cite_number_string( - in string type, - in string object, - in string obj_cite_number, - in string[string][string] _node + in string type, + 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"; @@ -5363,7 +5353,6 @@ auto contents_block_obj_cite_number_string( object_set.is_a = type; object_set.object = object; object_set.obj_cite_number = obj_cite_number; - object_set.node_structure.node = _node; return object_set; } #+END_SRC diff --git a/org/ao_defaults.org b/org/ao_defaults.org index 4f9777c..39cfff8 100644 --- a/org/ao_defaults.org +++ b/org/ao_defaults.org @@ -392,26 +392,28 @@ template SiSUrgxInitFlags() { #+name: ao_defaults_templates #+BEGIN_SRC d template SiSUnode() { - string[string][string] node_metadata() { - auto node_ = [ - "object" : [ - "is" : "", - "heading_ptr" : "", - "doc_object_ptr" : "", - "obj_cite_number" : "", - "segment_anchor_tag" : "", - "parent_obj_cite_number" : "", - "parent_lev_markup_number" : "", - ], - "heading" : [ - "html_segnames_ptr" : "", - "lev_markup_number" : "", - "lev_collapsed_number" : "", - // "ancestors" : "", - // "open_headings_to_close" : "", - ], + string[string] node_metadata_str() { + auto _node = [ + "is" : "", + "ocn" : "", + "marked_up_lev" : "", + "segment_anchor_tag" : "", + "attrib" : "", + ]; + return _node; + } + int[string] node_metadata_int() { + auto _node = [ + "ocn" : 0, // decide whether to use or keep? + "ptr_doc_object" : 0, + "ptr_html_segnames" : 0, + "ptr_heading" : 0, + "heading_lev_markup" : 9, + "heading_lev_collapsed" : 9, + "parent_ocn" : 0, + "parent_lev_markup" : 9, ]; - return node_; + return _node; } } #+END_SRC diff --git a/org/sdp.org b/org/sdp.org index 6a2c0b7..fad6f12 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -24,7 +24,7 @@ struct Version { int minor; int patch; } -enum ver = Version(0, 9, 3); +enum ver = Version(0, 9, 4); #+END_SRC * sdp.d sisu document parser :sdp.d: -- cgit v1.2.3