diff options
author | Ralph Amissah <ralph@amissah.com> | 2016-12-02 14:44:39 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:13 -0400 |
commit | 313ddb0ac605838eaca89054ff80a0402a8c6313 (patch) | |
tree | 960459bef8876b5e859fa15435a15ee673212a67 /src/sdp/ao_abstract_doc_source.d | |
parent | 0.9.2 backmatter: control processing, possible to omit sections (diff) |
0.9.3 start work on node pointers, a way to go
Diffstat (limited to 'src/sdp/ao_abstract_doc_source.d')
-rw-r--r-- | src/sdp/ao_abstract_doc_source.d | 338 |
1 files changed, 173 insertions, 165 deletions
diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d index cc39ea1..7dbc573 100644 --- a/src/sdp/ao_abstract_doc_source.d +++ b/src/sdp/ao_abstract_doc_source.d @@ -22,7 +22,7 @@ template SiSUdocAbstraction() { string[string] an_object, processing; string an_object_key; string[] anchor_tags; - string segment_object_belongs_to; + string segment_anchor_tag_that_object_belongs_to; auto set_abstract_object = ObjectAbstractSet(); auto note_section = NotesSection(); /+ enum +/ @@ -48,9 +48,12 @@ template SiSUdocAbstraction() { JSONValue[] bib_arr_json; int bib_entry; /+ counters +/ - long counter, previous_count, previous_length; + long cntr, previous_count, previous_length; int[string] line_occur; - int verse_line, heading_pointer; + int verse_line, heading_ptr; + string[] html_segnames=[]; + uint html_segnames_ptr=0; + uint html_segnames_ptr_cntr=0; /+ paragraph attributes +/ int[string] indent; bool bullet = true; @@ -122,7 +125,7 @@ template SiSUdocAbstraction() { "h5" : State.off, "h6" : State.off, "h7" : State.off, - "lev_collapsed_number" : 0, + "lev_int_collapsed" : 0, ]; int[string] collapsed_lev = [ "h0" : State.off, @@ -165,8 +168,8 @@ template SiSUdocAbstraction() { 0, // obj_cite_number ["toc"], // anchor tag "1", // lev - 4, // lev_markup_number - 2, // lev_collapsed_number + 4, // lev_int_markup + 2, // lev_int_collapsed ); the_table_of_contents_section = [ "seg": [toc_head], @@ -262,8 +265,8 @@ template SiSUdocAbstraction() { 0, // obj_cite_number [""], // anchor tag "B", // lev - 1, // lev_markup_number - 1, // lev_collapsed_number + 1, // lev_int_markup + 1, // lev_int_collapsed ); the_glossary_section ~= set_abstract_object.contents_heading( @@ -272,8 +275,8 @@ template SiSUdocAbstraction() { 0, // obj_cite_number ["glossary"], // anchor tag "1", // lev - 4, // lev_markup_number - 2, // lev_collapsed_number + 4, // lev_int_markup + 2, // lev_int_collapsed ); // } else if (matchFirst(line, rgx.heading)) { // _heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, type, dochead_meta_aa); // levels? @@ -323,8 +326,8 @@ template SiSUdocAbstraction() { 0, // obj_cite_number [""], // anchor tag "B", // lev - 1, // lev_markup_number - 1, // lev_collapsed_number + 1, // lev_int_markup + 1, // lev_int_collapsed ); the_blurb_section ~= set_abstract_object.contents_heading( @@ -333,8 +336,8 @@ template SiSUdocAbstraction() { 0, // obj_cite_number ["blurb"], // anchor tag "1", // lev - 4, // lev_markup_number - 2, // lev_collapsed_number + 4, // lev_int_markup + 2, // lev_int_collapsed ); } else if ((matchFirst(line, rgx.heading)) && (opt_action_bool["backmatter"] && opt_action_bool["section_blurb"])) { @@ -366,7 +369,7 @@ template SiSUdocAbstraction() { continue; } else if (type["poem"] == TriState.on) { /+ within block object: poem +/ - _poem_block_(line, an_object, type, counter, obj_cite_number_poem, dochead_make_aa); + _poem_block_(line, an_object, type, cntr, obj_cite_number_poem, dochead_make_aa); continue; /+ within block object: group +/ } else if (type["group"] == TriState.on) { @@ -444,7 +447,7 @@ template SiSUdocAbstraction() { set_abstract_object.contents_comment(strip(an_object[an_object_key])); _common_reset_(line_occur, an_object, type); processing.remove("verse"); - ++counter; + ++cntr; } else if (((line_occur["para"] == State.off) && (line_occur["heading"] == State.off)) && ((type["para"] == State.off) @@ -503,7 +506,7 @@ template SiSUdocAbstraction() { bookindex_unordered_hashes, obj_cite_number, _node, - counter, + cntr, type, obj_cite_number_poem, dochead_make_aa @@ -534,34 +537,40 @@ template SiSUdocAbstraction() { an_object["substantive"] = substantive_object_and_anchor_tags_tuple[0]; anchor_tags = substantive_object_and_anchor_tags_tuple[1]; if (to!int(an_object["lev_markup_number"]) == 4) { - segment_object_belongs_to = anchor_tags[0]; + segment_anchor_tag_that_object_belongs_to = anchor_tags[0]; } else if (to!int(an_object["lev_markup_number"]) < 4) { - segment_object_belongs_to = ""; + segment_anchor_tag_that_object_belongs_to = ""; } _anchor_tag=to!string(obj_cite_number); the_table_of_contents_section = obj_im.table_of_contents_gather_headings( an_object, dochead_make_aa, - segment_object_belongs_to, + segment_anchor_tag_that_object_belongs_to, _anchor_tag, the_table_of_contents_section, ); + if (an_object["lev_markup_number"] == "4") { + html_segnames ~= segment_anchor_tag_that_object_belongs_to; + html_segnames_ptr = html_segnames_ptr_cntr; + html_segnames_ptr_cntr++; + } _node = node_construct.node_emitter_heading( an_object["lev_markup_number"], an_object["lev_collapsed_number"], - segment_object_belongs_to, + segment_anchor_tag_that_object_belongs_to, obj_cite_number, - counter, - heading_pointer, - an_object["is"] + cntr, + heading_ptr, + an_object["is"], + html_segnames_ptr, ); // heading an_object["attrib"] = obj_att.obj_attributes(an_object["is"], an_object[an_object_key], _node); - ++heading_pointer; + ++heading_ptr; debug(segments) { writeln(an_object["lev_markup_number"]); - writeln(segment_object_belongs_to); + writeln(segment_anchor_tag_that_object_belongs_to); } the_document_body_section ~= set_abstract_object.contents_heading( @@ -581,7 +590,7 @@ template SiSUdocAbstraction() { an_object.remove("lev"); an_object.remove("lev_markup_number"); processing.remove("verse"); - ++counter; + ++cntr; } else if ((type["para"] == State.on) && (line_occur["para"] > State.off)) { /+ paragraph object (current line empty) +/ obj_cite_number = obj_cite_number_emit(type["obj_cite_number_status"]); @@ -593,11 +602,11 @@ template SiSUdocAbstraction() { _node = node_construct.node_emitter( content_non_header, - segment_object_belongs_to, + segment_anchor_tag_that_object_belongs_to, obj_cite_number, - counter, - heading_pointer-1, - an_object["is"] + cntr, + heading_ptr-1, + an_object["is"], ); auto substantive_object_and_anchor_tags_tuple = obj_im.obj_inline_markup_and_anchor_tags(an_object, an_object_key, dochead_make_aa); // ... @@ -621,7 +630,7 @@ template SiSUdocAbstraction() { ]; bullet = false; processing.remove("verse"); - ++counter; + ++cntr; } else { assert( line == null, @@ -640,7 +649,7 @@ template SiSUdocAbstraction() { && (the_document_body_section.length > previous_length) ) { if ((the_document_body_section[$-1].is_a == "heading") - && (the_document_body_section[$-1].heading_attrib.lev_markup_number < 5)) { + && (the_document_body_section[$-1].heading_attrib.lev_int_markup < 5)) { type["biblio_section"] = State.off; type["glossary_section"] = State.off; type["blurb_section"] = State.off; @@ -653,8 +662,8 @@ template SiSUdocAbstraction() { previous_count=the_document_body_section.length -1; note_section.gather_notes_for_endnote_section( the_document_body_section, - segment_object_belongs_to, - the_document_body_section.length-1 + segment_anchor_tag_that_object_belongs_to, + the_document_body_section.length-1, ); } } @@ -698,8 +707,8 @@ template SiSUdocAbstraction() { 0, // obj_cite_number [""], // anchor tag "B", // lev - 1, // lev_markup_number - 1, // lev_collapsed_number + 1, // lev_int_markup + 1, // lev_int_collapsed ); } else { writeln("gloss"); @@ -722,8 +731,8 @@ template SiSUdocAbstraction() { 0, // obj_cite_number [""], // anchor tag "B", // lev - 1, // lev_markup_number - 1, // lev_collapsed_number + 1, // lev_int_markup + 1, // lev_int_collapsed ); the_bibliography_section ~= set_abstract_object.contents_heading( @@ -732,8 +741,8 @@ template SiSUdocAbstraction() { 0, // obj_cite_number ["bibliography"], // anchor tag "1", // lev - 4, // lev_markup_number - 2, // lev_collapsed_number + 4, // lev_int_markup + 2, // lev_int_collapsed ); } else { the_bibliography_section ~= @@ -743,8 +752,8 @@ template SiSUdocAbstraction() { 0, // obj_cite_number [""], // anchor tag "B", // lev - 1, // lev_markup_number - 1, // lev_collapsed_number + 1, // lev_int_markup + 1, // lev_int_collapsed ); } string out_; @@ -783,7 +792,7 @@ template SiSUdocAbstraction() { bi.bookindex_build_section( bookindex_unordered_hashes, obj_cite_number, - segment_object_belongs_to, + segment_anchor_tag_that_object_belongs_to, opt_action_bool, ); static assert(!isTypeTuple!(bi_tuple)); @@ -803,8 +812,8 @@ template SiSUdocAbstraction() { 0, // obj_cite_number [""], // anchor tag "B", // lev - 1, // lev_markup_number - 1, // lev_collapsed_number + 1, // lev_int_markup + 1, // lev_int_collapsed ); } else { writeln("blurb"); @@ -823,7 +832,7 @@ template SiSUdocAbstraction() { toc_txt_ = format( "{ %s }../%s.fn_suffix", "Endnotes", - "endnotes", // segment_object_belongs_to + "endnotes", // segment_anchor_tag_that_object_belongs_to ); toc_txt_= munge.url_links(toc_txt_); the_table_of_contents_section["seg"] ~= @@ -857,7 +866,7 @@ template SiSUdocAbstraction() { toc_txt_ = format( "{ %s }../%s.fn_suffixs", "Glossary", - "glossary", // segment_object_belongs_to + "glossary", // segment_anchor_tag_that_object_belongs_to ); toc_txt_= munge.url_links(toc_txt_); the_table_of_contents_section["seg"] ~= @@ -889,7 +898,7 @@ template SiSUdocAbstraction() { toc_txt_ = format( "{ %s }../%s.fn_suffix", "Bibliography", - "bibliography", // segment_object_belongs_to + "bibliography", // segment_anchor_tag_that_object_belongs_to ); toc_txt_= munge.url_links(toc_txt_); the_table_of_contents_section["seg"] ~= @@ -921,7 +930,7 @@ template SiSUdocAbstraction() { toc_txt_ = format( "{ %s }../%s.fn_suffix", "Book Index", - "bookindex", // segment_object_belongs_to + "bookindex", // segment_anchor_tag_that_object_belongs_to ); toc_txt_= munge.url_links(toc_txt_); the_table_of_contents_section["seg"] ~= @@ -955,7 +964,7 @@ template SiSUdocAbstraction() { toc_txt_ = format( "{ %s }../%s.fn_suffix", "Blurb", - "blurb", // segment_object_belongs_to + "blurb", // segment_anchor_tag_that_object_belongs_to ); toc_txt_= munge.url_links(toc_txt_); the_table_of_contents_section["seg"] ~= @@ -1010,8 +1019,7 @@ template SiSUdocAbstraction() { ]; auto t = tuple( document_the, - bookindex_unordered_hashes, - biblio_ordered + html_segnames, ); return t; /+ post loop markup document/text ↑ +/ @@ -1400,7 +1408,7 @@ template SiSUdocAbstraction() { char[] line, ref string[string] an_object, ref int[string] type, - ref long counter, + ref long cntr, string[string] obj_cite_number_poem, string[string][string] dochead_make_aa, ) { @@ -1447,7 +1455,7 @@ template SiSUdocAbstraction() { ); object_reset(an_object); processing.remove("verse"); - ++counter; + ++cntr; } obj_cite_number_poem["end"] = to!string(obj_cite_number); @@ -1478,10 +1486,10 @@ template SiSUdocAbstraction() { an_object["is"] = "verse"; _node = node_construct.node_emitter( content_non_header, - segment_object_belongs_to, + segment_anchor_tag_that_object_belongs_to, obj_cite_number, - counter, - heading_pointer-1, + cntr, + heading_ptr-1, an_object["is"] ); auto substantive_object_and_anchor_tags_tuple = @@ -1499,7 +1507,7 @@ template SiSUdocAbstraction() { ); object_reset(an_object); processing.remove("verse"); - ++counter; + ++cntr; } } } else if (type["tic_poem"] == TriState.on) { @@ -1537,7 +1545,7 @@ template SiSUdocAbstraction() { obj_cite_number_poem["end"] = to!string(obj_cite_number); object_reset(an_object); processing.remove("verse"); - ++counter; + ++cntr; } type["blocks"] = TriState.closing; type["poem"] = TriState.closing; @@ -1567,10 +1575,10 @@ template SiSUdocAbstraction() { _node = node_construct.node_emitter( content_non_header, - segment_object_belongs_to, + segment_anchor_tag_that_object_belongs_to, obj_cite_number, - counter, - heading_pointer-1, + cntr, + heading_ptr-1, an_object["is"] ); auto substantive_object_and_anchor_tags_tuple = @@ -1588,7 +1596,7 @@ template SiSUdocAbstraction() { ); object_reset(an_object); processing.remove("verse"); - ++counter; + ++cntr; } } } @@ -1740,7 +1748,7 @@ template SiSUdocAbstraction() { ref string[][string][string] bookindex_unordered_hashes, ref int obj_cite_number, ref string _node, - ref long counter, + ref long cntr, ref int[string] type, string[string] obj_cite_number_poem, string[string][string] dochead_make_aa, @@ -1766,10 +1774,10 @@ template SiSUdocAbstraction() { _node = node_construct.node_emitter( content_non_header, - segment_object_belongs_to, + segment_anchor_tag_that_object_belongs_to, obj_cite_number, - counter, - heading_pointer-1, + cntr, + heading_ptr-1, an_object["is"] ); auto substantive_object_and_anchor_tags_tuple = @@ -1787,7 +1795,7 @@ template SiSUdocAbstraction() { ); object_reset(an_object); processing.remove("verse"); - ++counter; + ++cntr; type["blocks"] = TriState.off; type["code"] = TriState.off; } else if (type["poem"] == TriState.closing) { @@ -1799,10 +1807,10 @@ template SiSUdocAbstraction() { _node = node_construct.node_emitter( content_non_header, - segment_object_belongs_to, + segment_anchor_tag_that_object_belongs_to, obj_cite_number, - counter, - heading_pointer-1, + cntr, + heading_ptr-1, an_object["is"] ); the_document_body_section ~= @@ -1827,10 +1835,10 @@ template SiSUdocAbstraction() { _node = node_construct.node_emitter( content_non_header, - segment_object_belongs_to, + segment_anchor_tag_that_object_belongs_to, obj_cite_number, - counter, - heading_pointer-1, + cntr, + heading_ptr-1, an_object["is"] ); auto substantive_object_and_anchor_tags_tuple = @@ -1848,7 +1856,7 @@ template SiSUdocAbstraction() { ); object_reset(an_object); processing.remove("verse"); - ++counter; + ++cntr; type["blocks"] = TriState.off; type["table"] = TriState.off; } else if (type["group"] == TriState.closing) { @@ -1862,10 +1870,10 @@ template SiSUdocAbstraction() { _node = node_construct.node_emitter( content_non_header, - segment_object_belongs_to, + segment_anchor_tag_that_object_belongs_to, obj_cite_number, - counter, - heading_pointer-1, + cntr, + heading_ptr-1, an_object["is"] ); auto substantive_object_and_anchor_tags_tuple = @@ -1883,7 +1891,7 @@ template SiSUdocAbstraction() { ); object_reset(an_object); processing.remove("verse"); - ++counter; + ++cntr; type["blocks"] = TriState.off; type["group"] = TriState.off; } else if (type["block"] == TriState.closing) { @@ -1896,10 +1904,10 @@ template SiSUdocAbstraction() { _node = node_construct.node_emitter( content_non_header, - segment_object_belongs_to, + segment_anchor_tag_that_object_belongs_to, obj_cite_number, - counter, - heading_pointer-1, + cntr, + heading_ptr-1, an_object["is"] ); auto substantive_object_and_anchor_tags_tuple = @@ -1917,7 +1925,7 @@ template SiSUdocAbstraction() { ); object_reset(an_object); processing.remove("verse"); - ++counter; + ++cntr; type["blocks"] = TriState.off; type["block"] = TriState.off; } else if (type["quote"] == TriState.closing) { @@ -1931,10 +1939,10 @@ template SiSUdocAbstraction() { _node = node_construct.node_emitter( content_non_header, - segment_object_belongs_to, + segment_anchor_tag_that_object_belongs_to, obj_cite_number, - counter, - heading_pointer-1, + cntr, + heading_ptr-1, an_object["is"] ); auto substantive_object_and_anchor_tags_tuple = @@ -1952,7 +1960,7 @@ template SiSUdocAbstraction() { ); object_reset(an_object); processing.remove("verse"); - ++counter; + ++cntr; type["blocks"] = TriState.off; type["quote"] = TriState.off; } @@ -2667,7 +2675,7 @@ template SiSUdocAbstraction() { auto table_of_contents_gather_headings( string[string] obj_, string[string][string] dochead_make_aa, - string segment_object_belongs_to, + string segment_anchor_tag_that_object_belongs_to, string _anchor_tag, ObjComposite[][string] the_table_of_contents_section, ) @@ -2762,7 +2770,7 @@ template SiSUdocAbstraction() { toc_txt_ = format( "{ %s }../%s.fn_suffix", heading_toc_, - segment_object_belongs_to, + segment_anchor_tag_that_object_belongs_to, ); toc_txt_= munge.url_links(toc_txt_); indent=[ @@ -2783,7 +2791,7 @@ template SiSUdocAbstraction() { toc_txt_ = format( "{ %s }../%s.fn_suffix#%s", heading_toc_, - segment_object_belongs_to, + segment_anchor_tag_that_object_belongs_to, _anchor_tag, ); toc_txt_= munge.url_links(toc_txt_); @@ -3178,10 +3186,10 @@ template SiSUdocAbstraction() { oa_j.object["obj_cite_number"] = node_j["obj_cite_number"]; oa_j.object["lev_markup_number"] = node_j["lev_markup_number"]; oa_j.object["lev_collapsed_number"] = node_j["lev_collapsed_number"]; - oa_j.object["heading_pointer"] = - node_j["heading_pointer"]; // check - oa_j.object["doc_object_pointer"] = - node_j["doc_object_pointer"]; // check + oa_j.object["heading_ptr"] = + node_j["heading_ptr"]; // check + oa_j.object["doc_object_ptr"] = + node_j["doc_object_ptr"]; // check } oa_j.object["parent_obj_cite_number"] = node_j["parent_obj_cite_number"]; oa_j.object["parent_lev_markup_number"] = node_j["parent_lev_markup_number"]; @@ -3318,12 +3326,12 @@ template SiSUdocAbstraction() { auto bookindex_build_section( string[][string][string] bookindex_unordered_hashes, int obj_cite_number, - string segment_object_belongs_to, + string segment_anchor_tag_that_object_belongs_to, bool[string] opt_action_bool, ) { string type; string lev; - int lev_markup_number, lev_collapsed_number; + int lev_int_markup, lev_int_collapsed; string attrib; int[string] indent; auto set_abstract_object = ObjectAbstractSet(); @@ -3335,8 +3343,8 @@ template SiSUdocAbstraction() { string bi_tmp_seg, bi_tmp_scroll; attrib=""; lev="B"; - lev_markup_number=1; - lev_collapsed_number=1; + lev_int_markup=1; + lev_int_collapsed=1; bookindex_section["scroll"] ~= set_abstract_object.contents_heading( "Book Index", @@ -3344,8 +3352,8 @@ template SiSUdocAbstraction() { obj_cite_number, [], to!string(lev), - lev_markup_number, - lev_collapsed_number + lev_int_markup, + lev_int_collapsed ); bookindex_section["seg"] ~= set_abstract_object.contents_heading( @@ -3354,16 +3362,16 @@ template SiSUdocAbstraction() { obj_cite_number, [], to!string(lev), - lev_markup_number, - lev_collapsed_number + lev_int_markup, + lev_int_collapsed ); ++obj_cite_number; ++mkn; // 1~ Index attrib=""; lev="1"; - lev_markup_number=4; - lev_collapsed_number=2; + lev_int_markup=4; + lev_int_collapsed=2; bookindex_section["scroll"] ~= set_abstract_object.contents_heading( "Index", @@ -3371,8 +3379,8 @@ template SiSUdocAbstraction() { obj_cite_number, ["book_index"], to!string(lev), - lev_markup_number, - lev_collapsed_number + lev_int_markup, + lev_int_collapsed ); bookindex_section["seg"] ~= set_abstract_object.contents_heading( @@ -3381,8 +3389,8 @@ template SiSUdocAbstraction() { obj_cite_number, ["book_index"], to!string(lev), - lev_markup_number, - lev_collapsed_number + lev_int_markup, + lev_int_collapsed ); ++obj_cite_number; ++mkn; @@ -3392,9 +3400,9 @@ template SiSUdocAbstraction() { foreach (ref_; bookindex_unordered_hashes[mainkey]["_a"]) { auto go = replaceAll(ref_, rgx.book_index_go, "$1"); bi_tmp_scroll ~= munge.url_links(" {" ~ ref_ ~ "}#" ~ go ~ ", "); - bi_tmp_seg ~= (segment_object_belongs_to.empty) + bi_tmp_seg ~= (segment_anchor_tag_that_object_belongs_to.empty) ? munge.url_links(" {" ~ ref_ ~ "}#" ~ go ~ ", ") - : munge.url_links(" {" ~ ref_ ~ "}../" ~ segment_object_belongs_to ~ ".fn_suffix#" ~ go ~ ", "); + : munge.url_links(" {" ~ ref_ ~ "}../" ~ segment_anchor_tag_that_object_belongs_to ~ ".fn_suffix#" ~ go ~ ", "); } bi_tmp_scroll ~= " \\\\\n "; bi_tmp_seg ~= " \\\\\n "; @@ -3407,9 +3415,9 @@ template SiSUdocAbstraction() { foreach (ref_; bookindex_unordered_hashes[mainkey][subkey]) { auto go = replaceAll(ref_, rgx.book_index_go, "$1"); bi_tmp_scroll ~= munge.url_links(" {" ~ ref_ ~ "}#" ~ go ~ ", "); - bi_tmp_seg ~= (segment_object_belongs_to.empty) + bi_tmp_seg ~= (segment_anchor_tag_that_object_belongs_to.empty) ? munge.url_links(" {" ~ ref_ ~ "}#" ~ go ~ ", ") - : munge.url_links(" {" ~ ref_ ~ "}../" ~ segment_object_belongs_to ~ ".fn_suffix#" ~ go ~ ", "); + : munge.url_links(" {" ~ ref_ ~ "}../" ~ segment_anchor_tag_that_object_belongs_to ~ ".fn_suffix#" ~ go ~ ", "); } bi_tmp_scroll ~= " \\\\\n "; bi_tmp_seg ~= " \\\\\n "; @@ -3477,20 +3485,20 @@ template SiSUdocAbstraction() { auto rgx = Rgx(); private auto gather_notes_for_endnote_section( ObjComposite[] contents_am, - string segment_object_belongs_to, - ulong counter, + string segment_anchor_tag_that_object_belongs_to, + ulong cntr, ) in { // endnotes/ footnotes for // doc objects other than paragraphs & headings // various forms of grouped text - assert((contents_am[counter].is_a == "para") - || (contents_am[counter].is_a == "heading") - || (contents_am[counter].is_a == "group")); - assert(counter >= previous_count); - previous_count=counter; + assert((contents_am[cntr].is_a == "para") + || (contents_am[cntr].is_a == "heading") + || (contents_am[cntr].is_a == "group")); + assert(cntr >= previous_count); + previous_count=cntr; assert( - match(contents_am[counter].object, + match(contents_am[cntr].object, rgx.inline_notes_delimiter_al_regular_number_note) ); } @@ -3499,24 +3507,24 @@ template SiSUdocAbstraction() { foreach( m; matchAll( - contents_am[counter].object, + contents_am[cntr].object, rgx.inline_notes_delimiter_al_regular_number_note ) ) { debug(endnotes_build) { writeln( - "{^{", m.captures[1], ".}^}../", segment_object_belongs_to, ".fn_suffix#noteref_\n ", m.captures[1], " ", + "{^{", m.captures[1], ".}^}../", segment_anchor_tag_that_object_belongs_to, ".fn_suffix#noteref_\n ", m.captures[1], " ", m.captures[2]); // sometimes need segment name (segmented html & epub) } // TODO NEXT you need anchor for segments at this point -> object_notes["anchor"] ~= "#note_" ~ m.captures[1] ~ "』"; - object_notes["seg"] ~= (segment_object_belongs_to.empty) + object_notes["seg"] ~= (segment_anchor_tag_that_object_belongs_to.empty) ? (munge.url_links( "{^{" ~ m.captures[1] ~ ".}^}#noteref_" ~ m.captures[1]) ~ " " ~ m.captures[2] ~ "』" ) : (munge.url_links( - "{^{" ~ m.captures[1] ~ ".}^}../" ~ segment_object_belongs_to ~ ".fn_suffix#noteref_" ~ + "{^{" ~ m.captures[1] ~ ".}^}../" ~ segment_anchor_tag_that_object_belongs_to ~ ".fn_suffix#noteref_" ~ m.captures[1]) ~ " " ~ m.captures[2] ~ "』" ); object_notes["scroll"] ~= @@ -3666,11 +3674,11 @@ template SiSUdocAbstraction() { writeln("json: ", bib_arr_json.length); writeln("unsorted: ", biblio_unsorted.length); writeln("sorted: ", biblio_sorted__.length); - int counter; + int cntr; int[7] x; - while (counter < x.length) { - writeln(counter, ": ", biblio_sorted__[counter]["fulltitle"]); - counter++; + while (cntr < x.length) { + writeln(cntr, ": ", biblio_sorted__[cntr]["fulltitle"]); + cntr++; } } return biblio_sorted__; @@ -3737,9 +3745,9 @@ template SiSUdocAbstraction() { string node_emitter( string lev_markup_number, string segment_anchor_tag, - int obj_cite_number_, - long counter_, - int pointer_, + int obj_cite_number_, + long cntr_, + int ptr_, string is_ ) in { @@ -3765,20 +3773,20 @@ template SiSUdocAbstraction() { p_["obj_cite_number"] = lv4; } _node=("{ " ~ - "\"is\": \"" ~ is_ ~ "\"" ~ - ", \"heading_pointer\": " ~ to!string(pointer_) ~ - ", \"doc_object_pointer\": " ~ to!string(counter_) ~ - ", \"obj_cite_number\": " ~ to!string(obj_cite_number_) ~ - ", \"segment_anchor_tag\": \"" ~ segment_anchor_tag ~ "\"" ~ - ", \"parent_obj_cite_number\": " ~ to!string(p_["obj_cite_number"]) ~ + "\"is\": \"" ~ is_ ~ "\"" ~ + ", \"heading_ptr\": " ~ to!string(ptr_) ~ + ", \"doc_object_ptr\": " ~ to!string(cntr_) ~ + ", \"obj_cite_number\": " ~ to!string(obj_cite_number_) ~ + ", \"segment_anchor_tag\": \"" ~ segment_anchor_tag ~ "\"" ~ + ", \"parent_obj_cite_number\": " ~ to!string(p_["obj_cite_number"]) ~ ", \"parent_lev_markup_number\": " ~ to!string(p_["lev_markup_number"]) ~ " }" ); debug(node) { if (match(lev_markup_number, rgx.levels_numbered_headings)) { - writeln("* ", to!string(_node)); + writeln("x ", to!string(_node)); } else { - writeln("* ", to!string(_node)); + writeln("- ", to!string(_node)); } } JSONValue j = parseJSON(_node); @@ -3793,10 +3801,11 @@ template SiSUdocAbstraction() { string lev_markup_number, string lev_collapsed_number, string segment_anchor_tag, - int obj_cite_number_, - long counter_, - int pointer_, - string is_ + int obj_cite_number_, + long cntr_, + int ptr_, + string is_, + uint html_segnames_ptr, ) in { auto rgx = Rgx(); @@ -3815,15 +3824,15 @@ template SiSUdocAbstraction() { body { auto rgx = Rgx(); int obj_cite_number = to!int(obj_cite_number_); - switch (lev_markup_number) { // switch (to!string(lv)) { - case "0": + switch (to!int(lev_markup_number)) { // switch (to!string(lv)) { + case 0: lv = DocStructMarkupHeading.h_sect_A; lv0 = obj_cite_number; lv1=0; lv2=0; lv3=0; lv4=0; lv5=0; lv6=0; lv7=0; p_["lev_markup_number"] = 0; p_["obj_cite_number"] = 0; break; - case "1": + case 1: lv = DocStructMarkupHeading.h_sect_B; lv1 = obj_cite_number; lv2=0; lv3=0; lv4=0; lv5=0; lv6=0; lv7=0; @@ -3831,7 +3840,7 @@ template SiSUdocAbstraction() { DocStructMarkupHeading.h_sect_A; p_["obj_cite_number"] = lv0; break; - case "2": + case 2: lv = DocStructMarkupHeading.h_sect_C; lv2 = obj_cite_number; lv3=0; lv4=0; lv5=0; lv6=0; lv7=0; @@ -3839,7 +3848,7 @@ template SiSUdocAbstraction() { DocStructMarkupHeading.h_sect_B; p_["obj_cite_number"] = lv1; break; - case "3": + case 3: lv = DocStructMarkupHeading.h_sect_D; lv3=obj_cite_number; lv4=0; lv5=0; lv6=0; lv7=0; @@ -3847,7 +3856,7 @@ template SiSUdocAbstraction() { DocStructMarkupHeading.h_sect_C; p_["obj_cite_number"] = lv2; break; - case "4": + case 4: lv = DocStructMarkupHeading.h_text_1; lv4 = obj_cite_number; lv5=0; lv6=0; lv7=0; @@ -3869,7 +3878,7 @@ template SiSUdocAbstraction() { p_["obj_cite_number"] = lv0; } break; - case "5": + case 5: lv = DocStructMarkupHeading.h_text_2; lv5 = obj_cite_number; lv6=0; lv7=0; @@ -3877,7 +3886,7 @@ template SiSUdocAbstraction() { DocStructMarkupHeading.h_text_1; p_["obj_cite_number"] = lv4; break; - case "6": + case 6: lv = DocStructMarkupHeading.h_text_3; lv6 = obj_cite_number; lv7=0; @@ -3885,7 +3894,7 @@ template SiSUdocAbstraction() { DocStructMarkupHeading.h_text_2; p_["obj_cite_number"] = lv5; break; - case "7": + case 7: lv = DocStructMarkupHeading.h_text_4; lv7 = obj_cite_number; p_["lev_markup_number"] = @@ -3896,15 +3905,16 @@ template SiSUdocAbstraction() { break; } _node=("{ " ~ - "\"is\": \"" ~ is_ ~ "\"" ~ - ", \"heading_pointer\": " ~ to!string(pointer_) ~ - ", \"doc_object_pointer\": " ~ to!string(counter_) ~ - ", \"obj_cite_number\": " ~ to!string(obj_cite_number_) ~ - ", \"lev_markup_number\": " ~ to!string(lev_markup_number) ~ - ", \"lev_collapsed_number\": " ~ to!string(lev_collapsed_number) ~ - ", \"segment_anchor_tag\": \"" ~ segment_anchor_tag ~ "\"" ~ - ", \"parent_obj_cite_number\": " ~ to!string(p_["obj_cite_number"]) ~ - ", \"parent_lev_markup_number\": " ~ to!string(p_["lev_markup_number"]) ~ + "\"is\": \"" ~ is_ ~ "\"" ~ + ", \"heading_ptr\": " ~ to!string(ptr_) ~ + ", \"doc_object_ptr\": " ~ to!string(cntr_) ~ + ", \"html_segnames_ptr\": \"" ~ ((lev_markup_number == "4") ? (to!string(html_segnames_ptr)) : "") ~ "\"" ~ + ", \"obj_cite_number\": " ~ to!string(obj_cite_number_) ~ + ", \"lev_markup_number\": " ~ to!string(lev_markup_number) ~ + ", \"lev_collapsed_number\": " ~ to!string(lev_collapsed_number) ~ + ", \"segment_anchor_tag\": \"" ~ segment_anchor_tag ~ "\"" ~ + ", \"parent_obj_cite_number\": " ~ to!string(p_["obj_cite_number"]) ~ + ", \"parent_lev_markup_number\": " ~ to!string(p_["lev_markup_number"]) ~ " }" ); debug(heading) { @@ -3912,11 +3922,9 @@ template SiSUdocAbstraction() { writeln("* ", to!string(_node)); } } - debug(node) { + debug(nodeheading) { if (match(lev_markup_number, rgx.levels_numbered_headings)) { writeln("* ", to!string(_node)); - } else { - writeln("* ", to!string(_node)); } } JSONValue j = parseJSON(_node); |