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 /org | |
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 'org')
-rw-r--r-- | org/ao_abstract_doc_source.org | 386 | ||||
-rw-r--r-- | org/ao_output_debugs.org | 102 | ||||
-rw-r--r-- | org/output.org | 5 | ||||
-rw-r--r-- | org/sdp.org | 11 |
4 files changed, 232 insertions, 272 deletions
diff --git a/org/ao_abstract_doc_source.org b/org/ao_abstract_doc_source.org index c5535fd..cec9f08 100644 --- a/org/ao_abstract_doc_source.org +++ b/org/ao_abstract_doc_source.org @@ -49,7 +49,7 @@ ObjComposite[] the_document_head_section, the_document_body_section, the_bibliog 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 +/ @@ -75,9 +75,12 @@ string biblio_entry_str_json; 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; @@ -153,7 +156,7 @@ int[string] lv = [ "h5" : State.off, "h6" : State.off, "h7" : State.off, - "lev_collapsed_number" : 0, + "lev_int_collapsed" : 0, ]; int[string] collapsed_lev = [ "h0" : State.off, @@ -196,8 +199,8 @@ auto toc_head = 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], @@ -326,8 +329,8 @@ if there is a glossary section you need to: 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( @@ -336,8 +339,8 @@ if there is a glossary section you need to: 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? @@ -400,8 +403,8 @@ if there is a blurb section you need to: 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( @@ -410,8 +413,8 @@ if there is a blurb section you need to: 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"])) { @@ -450,7 +453,7 @@ if there is a blurb section you need to: #+BEGIN_SRC d } 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; #+END_SRC @@ -585,7 +588,7 @@ if ((matchFirst(line, rgx.book_index)) set_abstract_object.contents_comment(strip(an_object[an_object_key])); _common_reset_(line_occur, an_object, type); processing.remove("verse"); - ++counter; + ++cntr; #+END_SRC ******** flag not set & line not exist: heading or para :heading:paragraph: @@ -666,7 +669,7 @@ _block_flag_line_empty_( bookindex_unordered_hashes, obj_cite_number, _node, - counter, + cntr, type, obj_cite_number_poem, dochead_make_aa @@ -708,34 +711,40 @@ if ((type["heading"] == State.on) 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( @@ -755,7 +764,7 @@ if ((type["heading"] == State.on) an_object.remove("lev"); an_object.remove("lev_markup_number"); processing.remove("verse"); - ++counter; + ++cntr; #+END_SRC ******* paragraph object :paragraph:object: @@ -773,11 +782,11 @@ if ((type["heading"] == State.on) _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); // ... @@ -801,7 +810,7 @@ if ((type["heading"] == State.on) ]; bullet = false; processing.remove("verse"); - ++counter; + ++cntr; } else { assert( line == null, @@ -825,7 +834,7 @@ if (the_document_body_section.length > 0) { && (the_document_body_section.length > previous_length) ) { if ((the_document_body_section[$-1].is_a == "heading") - && (the_document_body_section[$-1].heading_attrib.lev_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; @@ -838,8 +847,8 @@ if (the_document_body_section.length > 0) { 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, ); } } @@ -901,8 +910,8 @@ if (an_object["glossary_nugget"].length == 0) { 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"); @@ -935,8 +944,8 @@ if (biblio_ordered.length > 0) { 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( @@ -945,8 +954,8 @@ if (biblio_ordered.length > 0) { 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 ~= @@ -956,8 +965,8 @@ if (biblio_ordered.length > 0) { 0, // obj_cite_number [""], // anchor tag "B", // lev - 1, // lev_markup_number - 1, // lev_collapsed_number + 1, // lev_int_markup + 1, // lev_int_collapsed ); } #+END_SRC @@ -1044,7 +1053,7 @@ auto bi_tuple = 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)); @@ -1070,8 +1079,8 @@ if (an_object["blurb_nugget"].length == 0) { 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"); @@ -1096,7 +1105,7 @@ if (the_endnotes_section["seg"].length > 1) { 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"] ~= @@ -1130,7 +1139,7 @@ if (the_glossary_section.length > 1) { 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"] ~= @@ -1162,7 +1171,7 @@ if (the_bibliography_section.length > 1){ 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"] ~= @@ -1194,7 +1203,7 @@ if (the_bookindex_section["seg"].length > 1) { 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"] ~= @@ -1228,7 +1237,7 @@ if (the_blurb_section.length > 1) { 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"] ~= @@ -1303,8 +1312,7 @@ destroy(the_bookindex_section); #+BEGIN_SRC d auto t = tuple( document_the, - bookindex_unordered_hashes, - biblio_ordered + html_segnames, ); return t; #+END_SRC @@ -1825,7 +1833,7 @@ void _poem_block_( 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, ) { @@ -1872,7 +1880,7 @@ void _poem_block_( ); object_reset(an_object); processing.remove("verse"); - ++counter; + ++cntr; } obj_cite_number_poem["end"] = to!string(obj_cite_number); @@ -1903,10 +1911,10 @@ void _poem_block_( 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 = @@ -1924,7 +1932,7 @@ void _poem_block_( ); object_reset(an_object); processing.remove("verse"); - ++counter; + ++cntr; } } } else if (type["tic_poem"] == TriState.on) { @@ -1962,7 +1970,7 @@ void _poem_block_( 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; @@ -1992,10 +2000,10 @@ void _poem_block_( _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 = @@ -2013,7 +2021,7 @@ void _poem_block_( ); object_reset(an_object); processing.remove("verse"); - ++counter; + ++cntr; } } } @@ -2195,7 +2203,7 @@ void _block_flag_line_empty_( 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, @@ -2221,10 +2229,10 @@ void _block_flag_line_empty_( _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 = @@ -2242,7 +2250,7 @@ void _block_flag_line_empty_( ); object_reset(an_object); processing.remove("verse"); - ++counter; + ++cntr; type["blocks"] = TriState.off; type["code"] = TriState.off; } else if (type["poem"] == TriState.closing) { @@ -2254,10 +2262,10 @@ void _block_flag_line_empty_( _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 ~= @@ -2282,10 +2290,10 @@ void _block_flag_line_empty_( _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 = @@ -2303,7 +2311,7 @@ void _block_flag_line_empty_( ); object_reset(an_object); processing.remove("verse"); - ++counter; + ++cntr; type["blocks"] = TriState.off; type["table"] = TriState.off; } else if (type["group"] == TriState.closing) { @@ -2317,10 +2325,10 @@ void _block_flag_line_empty_( _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 = @@ -2338,7 +2346,7 @@ void _block_flag_line_empty_( ); object_reset(an_object); processing.remove("verse"); - ++counter; + ++cntr; type["blocks"] = TriState.off; type["group"] = TriState.off; } else if (type["block"] == TriState.closing) { @@ -2351,10 +2359,10 @@ void _block_flag_line_empty_( _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 = @@ -2372,7 +2380,7 @@ void _block_flag_line_empty_( ); object_reset(an_object); processing.remove("verse"); - ++counter; + ++cntr; type["blocks"] = TriState.off; type["block"] = TriState.off; } else if (type["quote"] == TriState.closing) { @@ -2386,10 +2394,10 @@ void _block_flag_line_empty_( _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 = @@ -2407,7 +2415,7 @@ void _block_flag_line_empty_( ); object_reset(an_object); processing.remove("verse"); - ++counter; + ++cntr; type["blocks"] = TriState.off; type["quote"] = TriState.off; } @@ -3184,7 +3192,7 @@ struct ObjInlineMarkup { 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, ) @@ -3279,7 +3287,7 @@ struct ObjInlineMarkup { 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=[ @@ -3300,7 +3308,7 @@ struct ObjInlineMarkup { 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_); @@ -3816,10 +3824,10 @@ struct ObjAttributes { 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"]; @@ -3994,12 +4002,12 @@ struct BookIndexReportSection { 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(); @@ -4011,8 +4019,8 @@ struct BookIndexReportSection { 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", @@ -4020,8 +4028,8 @@ struct BookIndexReportSection { 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( @@ -4030,16 +4038,16 @@ struct BookIndexReportSection { 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", @@ -4047,8 +4055,8 @@ struct BookIndexReportSection { 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( @@ -4057,8 +4065,8 @@ struct BookIndexReportSection { obj_cite_number, ["book_index"], to!string(lev), - lev_markup_number, - lev_collapsed_number + lev_int_markup, + lev_int_collapsed ); ++obj_cite_number; ++mkn; @@ -4068,9 +4076,9 @@ struct BookIndexReportSection { 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 "; @@ -4083,9 +4091,9 @@ struct BookIndexReportSection { 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 "; @@ -4171,20 +4179,20 @@ struct NotesSection { #+BEGIN_SRC d 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) ); } @@ -4193,24 +4201,24 @@ struct NotesSection { 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"] ~= @@ -4391,11 +4399,11 @@ struct Bibliography { 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__; @@ -4499,9 +4507,9 @@ struct NodeStructureMetadata { 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 { @@ -4527,20 +4535,20 @@ struct NodeStructureMetadata { 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); @@ -4561,10 +4569,11 @@ struct NodeStructureMetadata { 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(); @@ -4583,15 +4592,15 @@ struct NodeStructureMetadata { 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; @@ -4599,7 +4608,7 @@ struct NodeStructureMetadata { 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; @@ -4607,7 +4616,7 @@ struct NodeStructureMetadata { 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; @@ -4615,7 +4624,7 @@ struct NodeStructureMetadata { 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; @@ -4637,7 +4646,7 @@ struct NodeStructureMetadata { p_["obj_cite_number"] = lv0; } break; - case "5": + case 5: lv = DocStructMarkupHeading.h_text_2; lv5 = obj_cite_number; lv6=0; lv7=0; @@ -4645,7 +4654,7 @@ struct NodeStructureMetadata { 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; @@ -4653,7 +4662,7 @@ struct NodeStructureMetadata { 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"] = @@ -4664,15 +4673,16 @@ struct NodeStructureMetadata { 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) { @@ -4680,11 +4690,9 @@ struct NodeStructureMetadata { 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); @@ -4948,9 +4956,14 @@ set abstracted objects for downstream processing #+name: ao_structs_init #+BEGIN_SRC d struct HeadingAttrib { - string lev = "9"; - int lev_markup_number = 9; - int lev_collapsed_number = 9; + string lev = "9"; + int lev_int_markup = 9; + int lev_int_collapsed = 9; + int[] closes_lev_collapsed = []; // TODO track + int[] closes_lev_markup = []; // TODO track + int array_ptr = 0; +// heading segments, 1~ lev4: + int heading_array_ptr_segments = 0; // TODO } #+END_SRC @@ -4988,10 +5001,22 @@ struct Comment { #+name: ao_structs_init #+BEGIN_SRC d struct Node { - int ocn = 0; - int parent_lev = 0; - int parent_ocn = 0; - string node = ""; + int ocn = 0; + string seg_anchor_tag = ""; +// parent + int parent_lev_int_markup = 0; + int parent_ocn = 0; + int[] ancestors = []; // TODO track +// heading: + int heading_lev_int_markup = 0; + int heading_lev_int_collapsed = 0; + int[] heading_closes_lev_collapsed = []; // TODO track + int[] heading_closes_lev_markup = []; // TODO track + int heading_array_ptr = 0; +// heading segments, 1~ lev4: + int heading_array_ptr_segments = 0; // TODO +// node info json string: + string node = ""; } #+END_SRC @@ -5047,8 +5072,8 @@ auto contents_heading( in int obj_cite_number, in string[] tags, in string lev, - in int lev_markup_number, - in int lev_collapsed_number, + in int lev_int_markup, + in int lev_int_collapsed, ) { ObjComposite object_set; object_set.use = "content"; @@ -5058,9 +5083,8 @@ auto contents_heading( object_set.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); object_set.anchor_tags ~= tags; object_set.heading_attrib.lev = lev; - object_set.heading_attrib.lev_markup_number = lev_markup_number; - object_set.heading_attrib.lev_collapsed_number = lev_collapsed_number; - // object_set.node_structure.node = _node; + object_set.heading_attrib.lev_int_markup = lev_int_markup; + object_set.heading_attrib.lev_int_collapsed = lev_int_collapsed; return object_set; } #+END_SRC @@ -5075,7 +5099,7 @@ auto contents_para( in string attrib, in int obj_cite_number, in int[string] indent, - in bool bullet + in bool bullet, ) { ObjComposite object_set; object_set.use = "content"; @@ -5101,7 +5125,7 @@ auto contents_toc( in string attrib, in int obj_cite_number, in int[string] indent, - in bool bullet + in bool bullet, ) { ObjComposite object_set; object_set.use = "content"; @@ -5149,7 +5173,7 @@ auto contents_block( in string type, in string object, in string attrib, - in int obj_cite_number + in int obj_cite_number, ) { ObjComposite object_set; object_set.use = "content"; @@ -5170,7 +5194,7 @@ auto contents_block_code( in string type, in string object, in string attrib_language_syntax, - in int obj_cite_number + in int obj_cite_number, ) { ObjComposite object_set; object_set.use = "content"; diff --git a/org/ao_output_debugs.org b/org/ao_output_debugs.org index 5349200..c576264 100644 --- a/org/ao_output_debugs.org +++ b/org/ao_output_debugs.org @@ -24,36 +24,6 @@ auto markup = InlineMarkup(); string key; #+END_SRC -** book index (sort &) report :report: - -#+name: book_index_sorted_report -#+BEGIN_SRC d -struct BookIndexReport { - int mkn, skn; - auto bookindex_report_sorted( - string[][string][string] bookindex_unordered_hashes - ) { - auto mainkeys=bookindex_unordered_hashes.byKey.array. - sort!("toLower(a) < toLower(b)", SwapStrategy.stable).release; - foreach (mainkey; mainkeys) { - auto subkeys=bookindex_unordered_hashes[mainkey].byKey.array. - sort!("toLower(a) < toLower(b)", SwapStrategy.stable).release; - foreach (subkey; subkeys) { - debug(bookindex) { - writeln( - mainkey, ": ", - subkey, ": ", - to!string(bookindex_unordered_hashes[mainkey][subkey]) - ); - } - ++skn; - } - ++mkn; - } - } -} -#+END_SRC - ** (parent) :parent: #+name: ao_output_debugs @@ -72,7 +42,7 @@ debug(parent) { "%s node: %s heading: %s %s", obj.obj_cite_number, obj.node, - obj.lev_markup_number, + obj.lev_int_markup, obj.object, ); } @@ -395,12 +365,12 @@ debug(headermakejson) { "%s\n%s\n%s", "document header, metadata & make instructions:", dochead_meta, - pointer_head_main, + ptr_head_main, ); - foreach (main_header; pointer_head_main) { + foreach (main_header; ptr_head_main) { switch (main_header) { case "make": - foreach (sub_header; pointer_head_sub_make) { + foreach (sub_header; ptr_head_sub_make) { if (to!string(dochead_meta[main_header][sub_header]).length > 2) { writefln( "%s:%s: %s", @@ -427,12 +397,12 @@ debug(headermetadatajson) { "%s\n%s\n%s", "document header, metadata & make instructions:", dochead_meta, - pointer_head_main, + ptr_head_main, ); - foreach (main_header; pointer_head_main) { + foreach (main_header; ptr_head_main) { switch (main_header) { case "creator": - foreach (sub_header; pointer_head_sub_creator) { + foreach (sub_header; ptr_head_sub_creator) { if (to!string(dochead_meta[main_header][sub_header]).length > 2) { writefln( "%s:%s: %s", @@ -444,7 +414,7 @@ debug(headermetadatajson) { } break; case "title": - foreach (sub_header; pointer_head_sub_title) { + foreach (sub_header; ptr_head_sub_title) { if (to!string(dochead_meta[main_header][sub_header]).length > 2) { writefln( "%s:%s: %s", @@ -456,7 +426,7 @@ debug(headermetadatajson) { } break; case "rights": - foreach (sub_header; pointer_head_sub_rights) { + foreach (sub_header; ptr_head_sub_rights) { if (to!string(dochead_meta[main_header][sub_header]).length > 2) { writefln( "%s:%s: %s", @@ -468,7 +438,7 @@ debug(headermetadatajson) { } break; case "date": - foreach (sub_header; pointer_head_sub_date) { + foreach (sub_header; ptr_head_sub_date) { if (to!string(dochead_meta[main_header][sub_header]).length > 2) { writefln( "%s:%s: %s", @@ -480,7 +450,7 @@ debug(headermetadatajson) { } break; case "original": - foreach (sub_header; pointer_head_sub_original) { + foreach (sub_header; ptr_head_sub_original) { if (to!string(dochead_meta[main_header][sub_header]).length > 2) { writefln( "%s:%s: %s", @@ -492,7 +462,7 @@ debug(headermetadatajson) { } break; case "classify": - foreach (sub_header; pointer_head_sub_classify) { + foreach (sub_header; ptr_head_sub_classify) { if (to!string(dochead_meta[main_header][sub_header]).length > 2) { writefln( "%s:%s: %s", @@ -504,7 +474,7 @@ debug(headermetadatajson) { } break; case "identifier": - foreach (sub_header; pointer_head_sub_identifier) { + foreach (sub_header; ptr_head_sub_identifier) { if (to!string(dochead_meta[main_header][sub_header]).length > 2) { writefln( "%s:%s: %s", @@ -516,7 +486,7 @@ debug(headermetadatajson) { } break; case "notes": - foreach (sub_header; pointer_head_sub_notes) { + foreach (sub_header; ptr_head_sub_notes) { if (to!string(dochead_meta[main_header][sub_header]).length > 2) { writefln( "%s:%s: %s", @@ -528,7 +498,7 @@ debug(headermetadatajson) { } break; case "publisher": - foreach (sub_header; pointer_head_sub_publisher) { + foreach (sub_header; ptr_head_sub_publisher) { if (to!string(dochead_meta[main_header][sub_header]).length > 2) { writefln( "%s:%s: %s", @@ -546,39 +516,6 @@ debug(headermetadatajson) { } #+END_SRC -** (bookindex) :bookindex: - -#+name: ao_output_debugs -#+BEGIN_SRC d -debug(bookindex) { - writefln( - "%s\n%s:%s", - "-------------------------------", - __FILE__, - __LINE__, - ); - auto bookindex = BookIndexReport(); - bookindex.bookindex_report_sorted(bookindex_unordered_hashes); -} -#+END_SRC - -*** biblio (biblio) - -#+name: ao_output_debugs -#+BEGIN_SRC d - -debug(biblio) { - foreach (entry; biblio) { - writefln( - "%s; (%s)", - entry["sortby_deemed_author_year_title"], - entry["author"], - ); - } -} - -#+END_SRC - ** anchor tags #+name: ao_output_debugs @@ -616,7 +553,7 @@ debug(heading) { // heading foreach (k; document_section_keys_sequenced["seg"]) { foreach (o; contents[k]) { if (o.is_a == "heading") { - switch (o.heading_attrib.lev_markup_number) { + switch (o.heading_attrib.lev_int_markup) { case 0: spc=""; break; @@ -652,8 +589,8 @@ debug(heading) { // heading "%s* %s\n (markup level: %s; collapsed level: %s)", spc, strip(o.object), - o.heading_attrib.lev_markup_number, - o.heading_attrib.lev_collapsed_number + o.heading_attrib.lev_int_markup, + o.heading_attrib.lev_int_collapsed ); } } @@ -901,8 +838,7 @@ template SiSUoutputDebugs() { auto abstract_doc_source_debugs(S)( auto ref const S contents, string[][string] document_section_keys_sequenced, - string[][string][string] bookindex_unordered_hashes, // redundant, consider - JSONValue[] biblio, // redundant, consider + string[] html_segnames, string[string][string] dochead_make, string[string][string] dochead_meta, string fn_src, diff --git a/org/output.org b/org/output.org index b77c2dd..8331a59 100644 --- a/org/output.org +++ b/org/output.org @@ -38,12 +38,12 @@ auto html_heading(O)( ΒΆ", obj.obj_cite_number, obj.obj_cite_number, - obj.heading_attrib.lev_markup_number, + obj.heading_attrib.lev_int_markup, obj.is_a, obj.obj_cite_number, obj.obj_cite_number, obj.object, - obj.heading_attrib.lev_markup_number + obj.heading_attrib.lev_int_markup ); return o; } @@ -1618,6 +1618,7 @@ template SiSUoutputHub() { void hub(S)( auto ref const S contents, string[][string] document_section_keys_sequenced, + string[] html_segnames, string[string][string] dochead_make, string[string][string] dochead_meta, string fn_src, diff --git a/org/sdp.org b/org/sdp.org index a016400..a8e8724 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -24,7 +24,7 @@ struct Version { int minor; int patch; } -enum ver = Version(0, 9, 2); +enum ver = Version(0, 9, 3); #+END_SRC * sdp.d sisu document parser :sdp.d: @@ -377,8 +377,7 @@ string[string][string] dochead_meta = header_make_and_meta_tuple[1]; auto t = abs.abstract_doc_source(content_body, dochead_make, dochead_meta, opt_action_bool); static assert(!isTypeTuple!(t)); auto doc_ao_contents = t[0]; // head ~ toc ~ contents ~ endnotes_seg ~ glossary ~ bibliography ~ bookindex ~blurb; -auto doc_ao_bookindex_unordered_hashes = t[1]; // redundant? -auto doc_ao_biblio = t[2]; // redundant? +auto doc_html_segnames = t[1]; #+END_SRC **** document section keys view @@ -442,8 +441,7 @@ debug(checkdoc) { dbg.abstract_doc_source_debugs( doc_ao_contents, document_section_keys_sequenced, - doc_ao_bookindex_unordered_hashes, // redundant? - doc_ao_biblio, // redundant? + doc_html_segnames, dochead_make, dochead_meta, fn_src, @@ -460,6 +458,7 @@ debug(checkdoc) { output.hub( doc_ao_contents, document_section_keys_sequenced, + doc_html_segnames, dochead_make, dochead_meta, fn_src, @@ -481,7 +480,7 @@ scope(exit) { destroy(content_body); destroy(t); destroy(doc_ao_contents); - destroy(doc_ao_biblio); + destroy(doc_html_segnames); destroy(fn_src); } #+END_SRC |