diff options
Diffstat (limited to 'src/sdp')
-rw-r--r-- | src/sdp/ao_abstract_doc_source.d | 762 | ||||
-rw-r--r-- | src/sdp/ao_defaults.d | 40 | ||||
-rw-r--r-- | src/sdp/ao_object_setter.d | 33 |
3 files changed, 413 insertions, 422 deletions
diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d index c2cf32b..5431b3d 100644 --- a/src/sdp/ao_abstract_doc_source.d +++ b/src/sdp/ao_abstract_doc_source.d @@ -48,12 +48,12 @@ template SiSUdocAbstraction() { 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; @@ -77,7 +77,8 @@ template SiSUdocAbstraction() { 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(); /+ ↓ abstract marked up document +/ auto abstract_doc_source( @@ -100,7 +101,8 @@ template SiSUdocAbstraction() { destroy(processing); destroy(biblio_arr_json); } - auto node_ = node_metadata; + auto node_int_ = node_metadata_int; + auto node_str_ = node_metadata_str; line_occur = [ "heading" : 0, "para" : 0, @@ -158,21 +160,21 @@ template SiSUdocAbstraction() { 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], @@ -261,37 +263,37 @@ template SiSUdocAbstraction() { 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? @@ -334,56 +336,56 @@ template SiSUdocAbstraction() { 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); @@ -538,7 +540,8 @@ template SiSUdocAbstraction() { the_document_body_section, bookindex_unordered_hashes, obj_cite_number, - _node, + _node_str, + _node_int, cntr, type, obj_cite_number_poem, @@ -587,19 +590,22 @@ template SiSUdocAbstraction() { 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"]); @@ -608,13 +614,9 @@ template SiSUdocAbstraction() { 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 @@ -633,7 +635,7 @@ template SiSUdocAbstraction() { 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, @@ -642,12 +644,14 @@ template SiSUdocAbstraction() { 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"], @@ -688,16 +692,16 @@ template SiSUdocAbstraction() { 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), ); } } @@ -734,21 +738,21 @@ template SiSUdocAbstraction() { } 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"); @@ -764,54 +768,54 @@ template SiSUdocAbstraction() { auto biblio_ordered = biblio._bibliography_(biblio_unsorted_incomplete, bib_arr_json); 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_, ); } string out_; @@ -863,21 +867,21 @@ template SiSUdocAbstraction() { } 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"); @@ -1472,7 +1476,7 @@ template SiSUdocAbstraction() { 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, ) { @@ -1509,7 +1513,7 @@ template SiSUdocAbstraction() { 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"], @@ -1548,7 +1552,7 @@ template SiSUdocAbstraction() { } 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, @@ -1556,12 +1560,14 @@ template SiSUdocAbstraction() { 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"], @@ -1598,7 +1604,7 @@ template SiSUdocAbstraction() { 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"], @@ -1636,7 +1642,7 @@ template SiSUdocAbstraction() { } 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, @@ -1645,12 +1651,14 @@ template SiSUdocAbstraction() { 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"], @@ -1811,8 +1819,9 @@ template SiSUdocAbstraction() { 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, @@ -1835,7 +1844,7 @@ template SiSUdocAbstraction() { 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, @@ -1844,12 +1853,14 @@ template SiSUdocAbstraction() { 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"], @@ -1868,8 +1879,8 @@ template SiSUdocAbstraction() { 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, @@ -1877,12 +1888,15 @@ template SiSUdocAbstraction() { 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"); @@ -1896,7 +1910,7 @@ template SiSUdocAbstraction() { 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, @@ -1905,12 +1919,14 @@ template SiSUdocAbstraction() { 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"], @@ -1931,7 +1947,7 @@ template SiSUdocAbstraction() { 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, @@ -1940,12 +1956,14 @@ template SiSUdocAbstraction() { 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"], @@ -1965,7 +1983,7 @@ template SiSUdocAbstraction() { 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, @@ -1974,12 +1992,14 @@ template SiSUdocAbstraction() { 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"], @@ -2000,8 +2020,8 @@ template SiSUdocAbstraction() { 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, @@ -2009,12 +2029,14 @@ template SiSUdocAbstraction() { 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"], @@ -2889,12 +2911,12 @@ template SiSUdocAbstraction() { ) { 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) { @@ -3010,7 +3032,7 @@ template SiSUdocAbstraction() { "$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) ~ " "); @@ -3068,14 +3090,16 @@ template SiSUdocAbstraction() { 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"] ="{"; @@ -3115,7 +3139,7 @@ template SiSUdocAbstraction() { 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"]); @@ -3251,23 +3275,24 @@ template SiSUdocAbstraction() { 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; } @@ -3417,74 +3442,59 @@ template SiSUdocAbstraction() { 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; @@ -3547,32 +3557,28 @@ template SiSUdocAbstraction() { ++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); @@ -3581,13 +3587,13 @@ template SiSUdocAbstraction() { } struct NotesSection { string[string] object_notes; - long previous_count; + int previous_count; int mkn; auto rgx = Rgx(); 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 @@ -3667,102 +3673,83 @@ template SiSUdocAbstraction() { 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"]) { @@ -3865,12 +3852,11 @@ template SiSUdocAbstraction() { int lv, lv0, lv1, lv2, lv3, lv4, lv5, lv6, lv7; int obj_cite_number; int[string] p_; // p_ parent_ - string[string][string] _node; - 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_ ) @@ -3896,23 +3882,22 @@ template SiSUdocAbstraction() { 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)) { @@ -3921,22 +3906,27 @@ template SiSUdocAbstraction() { 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() { } - 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(); @@ -4035,23 +4025,22 @@ template SiSUdocAbstraction() { 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)) { @@ -4063,37 +4052,44 @@ template SiSUdocAbstraction() { 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() { } diff --git a/src/sdp/ao_defaults.d b/src/sdp/ao_defaults.d index 4408cc8..4883540 100644 --- a/src/sdp/ao_defaults.d +++ b/src/sdp/ao_defaults.d @@ -351,26 +351,28 @@ template SiSUrgxInitFlags() { } } 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; } } template SiSUbiblio() { diff --git a/src/sdp/ao_object_setter.d b/src/sdp/ao_object_setter.d index c293eb0..8ec51fd 100644 --- a/src/sdp/ao_object_setter.d +++ b/src/sdp/ao_object_setter.d @@ -71,25 +71,21 @@ template ObjectSetter() { return object_set; } 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; } auto contents_para( @@ -109,7 +105,6 @@ template ObjectSetter() { 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; } auto contents_toc( @@ -162,7 +157,6 @@ template ObjectSetter() { 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; } auto contents_block_code( @@ -178,14 +172,14 @@ template ObjectSetter() { 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; } 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"; @@ -193,7 +187,6 @@ template ObjectSetter() { 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; } } |