diff options
Diffstat (limited to 'org/ao_abstract_doc_source.org')
-rw-r--r-- | org/ao_abstract_doc_source.org | 369 |
1 files changed, 198 insertions, 171 deletions
diff --git a/org/ao_abstract_doc_source.org b/org/ao_abstract_doc_source.org index 5356a15..a89b14c 100644 --- a/org/ao_abstract_doc_source.org +++ b/org/ao_abstract_doc_source.org @@ -15,7 +15,7 @@ * document abstraction :abstract: [[./sdp.org][sdp]] [[./][org/]] Process markup document, create document abstraction. -** initialize +** initialize :initialize: #+name: abs_init #+BEGIN_SRC d /+ initialize +/ @@ -23,19 +23,20 @@ mixin ObjectSetters; mixin AssertionsOnMarkupDocumentStructure; mixin AssertionsOnBlocks; mixin ScreenTxtColors; -auto rgx = new Rgx(); -auto set_oa = new ObjectAbstractSet(); -auto set_header = new HeaderDocMetadataMakeJson(); -auto notesection = new NotesSection(); -string[string][131072] contents_arbitrary_max_length_set; // 2000 pg * 50 lines == 100000 -string[1024] notes; +auto rgx = Rgx(); +auto set_oa = ObjectAbstractSet(); +auto set_header = HeaderDocMetadataMakeJson(); +auto notesection = NotesSection(); +string[string][] contents; +mixin Structs; string notes_str; string[string] object, processing, head; string biblio_tag_name, biblio_tag_entry, book_idx_tmp, st; -string[1024] biblio_arr_json = biblio_entry_tags_jsonstr; -JSONValue[1024] bib_arr_json; +string[] biblio_arr_json; +JSONValue[] bib_arr_json; uint[string] line_occur; -uint counter, previous_count, count_biblio_entry, ocn, ocn_, verse_line, bib_entry, heading_pointer, notepoint; +uint counter, ocn, ocn_, verse_line, bib_entry, heading_pointer, notepoint, count_biblio_entry; +ulong previous_count; string indent_first, indent_second; string[][string][string] bookindex_unordered_hashes; bool bullet = true; @@ -79,18 +80,18 @@ auto str_h_3 = "^(none)"; auto str_h_4 = "^(none)"; string content_non_header = "8"; string node; -auto obj_im = new ObjInlineMarkup(); -auto obj_att = new ObjAttrib(); -auto object_citation_number = new OCNemitter(); +auto obj_im = ObjInlineMarkup(); +auto obj_att = ObjAttrib(); +auto object_citation_number = OCNemitter(); auto ft = flag_type.dup; int ocn_emit(int ocn_status_flag) { return object_citation_number.ocn_emitter(ocn_status_flag); } -auto bookindex_extract_hash = new BookIndexNuggetHash(); +auto bookindex_extract_hash = BookIndexNuggetHash(); string[][string][string] bkidx_hash(string bookindex, int ocn) { return bookindex_extract_hash.bookindex_nugget_hash(bookindex, ocn); } -auto node_construct = new NodeStructureMetadata(); +auto node_construct = NodeStructureMetadata(); string node_jstr( string lvn, int ocn_, @@ -128,11 +129,20 @@ string[string] ocn_poem = [ "end" : "" ]; int tell_lo(string color, int ocn, in char[] line) { - writeln(scr_txt_marker[color], to!string(ocn), " ", to!string(line)); + writefln( + "%s%s %s", + scr_txt_marker[color], + to!string(ocn), + to!string(line) + ); return 0; } int tell_l(string color, in char[] line) { - writeln(scr_txt_marker[color], line); + writefln( + "%s%s", + scr_txt_marker[color], + line + ); return 0; } scope(success) { @@ -140,7 +150,7 @@ scope(success) { scope(failure) { } scope(exit) { - destroy(contents_arbitrary_max_length_set); + destroy(contents); destroy(object); destroy(processing); destroy(biblio_arr_json); @@ -153,14 +163,16 @@ auto dochead_metadata = parseJSON(header_metadata_jsonstr).object; *** scope :scope: #+name: abs_loop_body_00 #+BEGIN_SRC d -/* scope */ +/+ scope +/ scope(exit) { } scope(failure) { - writeln(__FILE__, ":", __LINE__, " failed here:"); - writeln(" line: ", line); - writeln(" is : ", object["is"]); - writeln(" node: ", node); + writefln( + "%s:%s failed here: \n line: %s", + __FILE__, + __LINE__, + line, + ); } line = replaceAll(line, rgx.true_dollar, "$$$$"); // dollar represented as $$ needed to stop submatching on $ @@ -171,7 +183,11 @@ debug(source) { // source lines } debug(srclines) { if (!line.empty) { // source lines, not empty - writeln(scr_txt_marker["green"], line); + writefln( + "%s%s", + scr_txt_marker["green"], + line + ); } } #+END_SRC @@ -179,9 +195,9 @@ debug(srclines) { #+name: abs_loop_body_00 #+BEGIN_SRC d if ((!line.empty) && (ft["ocn_status_multi_obj"] == 0)) { -/* not multi-line object, check whether ocn is on or turned off */ +/+ not multi-line object, check whether ocn is on or turned off +/ if (match(line, rgx.ocn_block_marks)) { - /* switch off ocn */ + /+ switch off ocn +/ if (match(line, rgx.ocn_off_block)) { ft["ocn_status_multi_obj"] = 1; debug(ocnoff) { @@ -223,7 +239,7 @@ if ((!line.empty) && (ft["ocn_status_multi_obj"] == 0)) { #+name: abs_loop_body_00 #+BEGIN_SRC d if (ft["code"] == 1) { -/* block object: code */ +/+ block object: code +/ if (ft["curly_code"] == 1) { if (auto m = match(line, rgx.block_curly_code_close)) { debug(code) { // code (curly) close @@ -258,7 +274,7 @@ if (ft["code"] == 1) { #+name: abs_loop_body_00 #+BEGIN_SRC d } else if (!match(line, rgx.regular_parse_skip)) { -/* object other than code block object (includes regular text paragraph) */ +/+ object other than code block object (includes regular text paragraph) +/ #+END_SRC ***** within block group [+1] :block:active: ****** within block group: biblio :biblio: @@ -268,21 +284,20 @@ if (((match(line, rgx.heading_biblio) || (ft["heading_biblio"] == 1))) && (!match(line, rgx.heading)) && (!match(line, rgx.comment))) { -/* within block object: biblio */ +/+ within block object: biblio +/ if (match(line, rgx.heading_biblio)) { ft["heading_biblio"] = 1; } if (empty(line) && (bib_entry == 0)) { - count_biblio_entry++; + ++count_biblio_entry; + biblio_arr_json ~= biblio_entry_tags_jsonstr; bib_entry = 1; } debug(biblio) { - writeln( + writefln( + "%s * %s %s", scr_txt_color["yellow"], - "* ", scr_txt_color["off"], - to!string(count_biblio_entry), - " ", line ); } @@ -291,7 +306,7 @@ if (((match(line, rgx.heading_biblio) bib_entry = 0; st=to!string(bt.captures[1]); biblio_tag_entry=to!string(bt.captures[2]); - JSONValue j = parseJSON(biblio_arr_json[count_biblio_entry]); + JSONValue j = parseJSON(biblio_arr_json[count_biblio_entry-1]); // core.exception.RangeError@lib/sdp/ao_abstract_doc_source.d(288): Range violation (LDC) [: same for 343], fix to subtract 1 done! if (match(st, rgx.biblio_abbreviations)) { biblio_tag_name=biblio_tag_map[st]; } else { @@ -334,18 +349,17 @@ if (((match(line, rgx.heading_biblio) auto s = to!string(j); s = j.toString(); debug(biblio) { - writeln( + writefln( + "%s* %s%s: %s\n%s", scr_txt_color["red"], - "* ", scr_txt_color["off"], biblio_tag_name, - ": ", - biblio_tag_entry + biblio_tag_entry, + j[biblio_tag_name] ); - writeln(biblio_arr_json[count_biblio_entry]); writeln(j[biblio_tag_name], ":", j[biblio_tag_name]); } - biblio_arr_json[count_biblio_entry] = s; + biblio_arr_json[count_biblio_entry-1] = s; biblio_tag_entry=""; } #+END_SRC @@ -353,14 +367,14 @@ if (((match(line, rgx.heading_biblio) #+name: abs_loop_body_non_code_obj #+BEGIN_SRC d } else if (ft["poem"] == 1) { -/* within block object: poem */ +/+ within block object: poem +/ if (ft["curly_poem"] == 1) { if (auto m = match(line, rgx.block_curly_poem_close)) { object["obj"]="verse"; // check that this is as you please debug(poem) { // poem (curly) close - writeln( + writefln( + "%s* [poem curly] %s%s", scr_txt_color["red"], - "* [poem curly] ", scr_txt_color["off"], line ); @@ -370,10 +384,10 @@ if (((match(line, rgx.heading_biblio) } debug(poem) { // poem (curly) close writeln(__LINE__); - writeln( + writefln( + "%s%s %s", scr_txt_marker["fuchsia"], ocn, - " ", line ); } @@ -392,7 +406,7 @@ if (((match(line, rgx.heading_biblio) obj_im.obj_inline_markup(object["is"], object["obj"]); object["attrib"] = obj_att.obj_attributes(object["is"], object["obj"], node); - contents_arbitrary_max_length_set[counter] = + contents ~= set_oa.contents_block( object["is"], object["markup"], @@ -424,10 +438,12 @@ if (((match(line, rgx.heading_biblio) verse_line=1; object["obj"] = processing["verse"]; debug(poem) { // poem verse - writeln(scr_txt_marker["green"], - ocn, - " curly\n", - object["obj"]); + writefln( + "%s%s curly\n%s", + scr_txt_marker["green"], + ocn, + object["obj"] + ); } processing.remove("verse"); object["is"] = "verse"; @@ -440,7 +456,7 @@ if (((match(line, rgx.heading_biblio) ); object["markup"] = obj_im.obj_inline_markup(object["is"], object["obj"]); object["attrib"] = obj_att.obj_attributes(object["is"], object["obj"], node); - contents_arbitrary_max_length_set[counter] = + contents ~= set_oa.contents_block( object["is"], object["markup"], @@ -460,9 +476,9 @@ if (((match(line, rgx.heading_biblio) if (auto m = match(line, rgx.block_tic_close)) { // tic_poem_close object["obj"]="verse"; // check that this is as you please debug(poem) { // poem (curly) close - writeln( + writefln( + "%s* [poem tic] %s%s", scr_txt_color["red"], - "* [poem tic] ", scr_txt_color["off"], line ); @@ -481,7 +497,7 @@ if (((match(line, rgx.heading_biblio) obj_im.obj_inline_markup(object["is"], object["obj"]); object["attrib"] = obj_att.obj_attributes(object["is"], object["obj"], node); - contents_arbitrary_max_length_set[counter] = + contents ~= set_oa.contents_block( object["is"], object["markup"], @@ -513,10 +529,12 @@ if (((match(line, rgx.heading_biblio) verse_line=1; object["obj"] = processing["verse"]; debug(poem) { // poem (tic) close - writeln(scr_txt_marker["green"], - ocn, - " tic\n", - object["obj"]); + writefln( + "%s%s tic\n%s", + scr_txt_marker["green"], + ocn, + object["obj"] + ); } processing.remove("verse"); object["is"] = "verse"; @@ -532,7 +550,7 @@ if (((match(line, rgx.heading_biblio) obj_im.obj_inline_markup(object["is"], object["obj"]); object["attrib"] = obj_att.obj_attributes(object["is"], object["obj"], node); - contents_arbitrary_max_length_set[counter] = + contents ~= set_oa.contents_block( object["is"], object["markup"], @@ -553,7 +571,7 @@ if (((match(line, rgx.heading_biblio) ****** within block group: group :group: #+name: abs_loop_body_non_code_obj #+BEGIN_SRC d -/* within block object: group */ +/+ within block object: group +/ } else if (ft["group"] == 1) { if (ft["curly_group"] == 1) { if (auto m = match(line, rgx.block_curly_group_close)) { @@ -589,7 +607,7 @@ if (((match(line, rgx.heading_biblio) #+name: abs_loop_body_non_code_obj #+BEGIN_SRC d } else if (ft["block"] == 1) { -/* within block object: block */ +/+ within block object: block +/ if (ft["curly_block"] == 1) { if (auto m = match(line, rgx.block_curly_block_close)) { debug(block) { // block (curly) close @@ -624,7 +642,7 @@ if (((match(line, rgx.heading_biblio) #+name: abs_loop_body_non_code_obj #+BEGIN_SRC d } else if (ft["quote"] == 1) { -/* within block object: quote */ +/+ within block object: quote +/ if (ft["curly_quote"] == 1) { if (auto m = match(line, rgx.block_curly_quote_close)) { debug(quote) { // quote (curly) close @@ -659,7 +677,7 @@ if (((match(line, rgx.heading_biblio) #+name: abs_loop_body_non_code_obj #+BEGIN_SRC d } else if (ft["table"] == 1) { -/* within block object: table */ +/+ within block object: table +/ if (ft["curly_table"] == 1) { if (auto m = match(line, rgx.block_curly_table_close)) { debug(table) { // table (curly) close @@ -694,7 +712,7 @@ if (((match(line, rgx.heading_biblio) #+name: abs_loop_body_non_code_obj #+BEGIN_SRC d } else { -/* not within a block group */ +/+ not within a block group +/ #+END_SRC ****** assert #+name: abs_loop_body_open_block_obj @@ -711,11 +729,11 @@ assertions_flag_types_block_status_none_or_closed(ft); #+name: abs_loop_body_open_block_obj #+BEGIN_SRC d if (auto m = match(line, rgx.block_curly_code_open)) { -/* curly code open */ +/+ curly code open +/ debug(code) { // code (curly) open - writeln( + writefln( + "%s* [code curly] %s%s", scr_txt_color["blue"], - "* [code curly] ", scr_txt_color["off"], line ); @@ -728,7 +746,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+name: abs_loop_body_open_block_obj #+BEGIN_SRC d } else if (auto m = match(line, rgx.block_curly_poem_open)) { -/* curly poem open */ +/+ curly poem open +/ object.remove("obj"); object.remove("markup"); object.remove("is"); @@ -736,9 +754,9 @@ if (auto m = match(line, rgx.block_curly_code_open)) { object.remove("bookindex"); processing.remove("verse"); debug(poem) { // poem (curly) open - writeln( + writefln( + "%s* [poem curly] %s%s", scr_txt_color["red"], - "* [poem curly] ", scr_txt_color["off"], line ); @@ -753,11 +771,11 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+name: abs_loop_body_open_block_obj #+BEGIN_SRC d } else if (auto m = match(line, rgx.block_curly_group_open)) { -/* curly group open */ +/+ curly group open +/ debug(group) { // group (curly) open - writeln( + writefln( + "%s* [group curly] %s%s", scr_txt_color["blue"], - "* [group curly] ", scr_txt_color["off"], line ); @@ -770,11 +788,11 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+name: abs_loop_body_open_block_obj #+BEGIN_SRC d } else if (auto m = match(line, rgx.block_curly_block_open)) { -/* curly block open */ +/+ curly block open +/ debug(block) { // block (curly) open - writeln( + writefln( + "%s* [block curly] %s%s", scr_txt_color["blue"], - "* [block curly] ", scr_txt_color["off"], line ); @@ -787,11 +805,11 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+name: abs_loop_body_open_block_obj #+BEGIN_SRC d } else if (auto m = match(line, rgx.block_curly_quote_open)) { -/* curly quote open */ +/+ curly quote open +/ debug(quote) { // quote (curly) open - writeln( + writefln( + "%s* [quote curly] %s%s", scr_txt_color["blue"], - "* [quote curly] ", scr_txt_color["off"], line ); @@ -804,11 +822,11 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+name: abs_loop_body_open_block_obj #+BEGIN_SRC d } else if (auto m = match(line, rgx.block_curly_table_open)) { -/* curly table open */ +/+ curly table open +/ debug(table) { // table (curly) open - writeln( + writefln( + "%s* [table curly] %s%s", scr_txt_color["blue"], - "* [table curly] ", scr_txt_color["off"], line ); @@ -822,11 +840,11 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+name: abs_loop_body_open_block_obj #+BEGIN_SRC d } else if (auto m = match(line, rgx.block_tic_code_open)) { -/* tic code open */ +/+ tic code open +/ debug(code) { // code (tic) open - writeln( + writefln( + "%s* [code tic] %s%s", scr_txt_color["blue"], - "* [code tic] ", scr_txt_color["off"], line ); @@ -839,7 +857,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+name: abs_loop_body_open_block_obj #+BEGIN_SRC d } else if (auto m = match(line, rgx.block_tic_poem_open)) { -/* tic poem open */ +/+ tic poem open +/ object.remove("obj"); object.remove("markup"); object.remove("is"); @@ -847,9 +865,9 @@ if (auto m = match(line, rgx.block_curly_code_open)) { object.remove("bookindex"); processing.remove("verse"); debug(poem) { // poem (tic) open - writeln( + writefln( + "%s* [poem tic] %s%s", scr_txt_color["red"], - "* [poem tic] ", scr_txt_color["off"], line ); @@ -864,11 +882,11 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+name: abs_loop_body_open_block_obj #+BEGIN_SRC d } else if (auto m = match(line, rgx.block_tic_group_open)) { -/* tic group open */ +/+ tic group open +/ debug(group) { // group (tic) open - writeln( + writefln( + "%s* [group tic] %s%s", scr_txt_color["blue"], - "* [group tic] ", scr_txt_color["off"], line ); @@ -881,11 +899,11 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+name: abs_loop_body_open_block_obj #+BEGIN_SRC d } else if (auto m = match(line, rgx.block_tic_block_open)) { -/* tic block open */ +/+ tic block open +/ debug(block) { // block (tic) open - writeln( + writefln( + "%s* [block tic] %s%s", scr_txt_color["blue"], - "* [block tic] ", scr_txt_color["off"], line ); @@ -898,11 +916,11 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+name: abs_loop_body_open_block_obj #+BEGIN_SRC d } else if (auto m = match(line, rgx.block_tic_quote_open)) { -/* tic quote open */ +/+ tic quote open +/ debug(quote) { // quote (tic) open - writeln( + writefln( + "%s* [quote tic] %s%s", scr_txt_color["blue"], - "* [quote tic] ", scr_txt_color["off"], line ); @@ -915,11 +933,11 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+name: abs_loop_body_open_block_obj #+BEGIN_SRC d } else if (auto m = match(line, rgx.block_tic_table_open)) { -/* tic table open */ +/+ tic table open +/ debug(table) { // table (tic) open - writeln( + writefln( + "%s* [table tic] %s%s", scr_txt_color["blue"], - "* [table tic] ", scr_txt_color["off"], line ); @@ -932,8 +950,8 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d } else if (!line.empty) { -/* line not empty */ -/* non blocks (headers, paragraphs) & closed blocks */ +/+ line not empty +/ +/+ non blocks (headers, paragraphs) & closed blocks +/ #+END_SRC ******* asserts :assert: #+name: abs_loop_body_not_block_obj @@ -964,11 +982,13 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d if (auto m = match(line, rgx.book_index)) { - /* match book_index */ + /+ match book_index +/ debug(bookindexmatch) { // book index - writeln( - scr_txt_color["blue"], "* [bookindex] ", scr_txt_color["off"], - to!string(m.captures[1]), "\n" + writefln( + "%s* [bookindex] %s%s\n", + scr_txt_color["blue"], + scr_txt_color["off"], + to!string(m.captures[1]), ); // writeln(scr_txt_marker["blue"], to!string(m.captures[1]), "\n"); } @@ -978,24 +998,24 @@ if (auto m = match(line, rgx.block_curly_code_open)) { ft["book_index"] = 1; book_idx_tmp = to!string(m.captures[1]); debug(bookindexmatch) { // book index - writeln( + writefln( + "%s* [bookindex] %s%s\n", scr_txt_color["blue"], - "* [bookindex] ", scr_txt_color["off"], - book_idx_tmp, "\n" + book_idx_tmp, ); } } else if (ft["book_index"] == 1 ) { - /* book_index flag set */ + /+ book_index flag set +/ if (auto m = match(line, rgx.book_index_close)) { ft["book_index"] = 0; object["bookindex"] = book_idx_tmp ~ to!string(m.captures[1]); debug(bookindexmatch) { // book index - writeln( + writefln( + "%s* [bookindex] %s%s\n", scr_txt_color["blue"], - "* [bookindex] ", scr_txt_color["off"], - book_idx_tmp, "\n" + book_idx_tmp, ); } book_idx_tmp = ""; @@ -1007,18 +1027,18 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d } else { - /* not book_index */ + /+ not book_index +/ #+END_SRC ******** matched: comment :comment:match: #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d if (auto m = match(line, rgx.comment)) { - /* matched comment */ + /+ matched comment +/ debug(comment) { tell_l("blue", line); } object["obj"] ~= line ~= "\n"; - contents_arbitrary_max_length_set[counter] = + contents ~= set_oa.contents_comment(strip(object["obj"])); object.remove("obj"); object.remove("markup"); @@ -1041,7 +1061,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d } else if (auto m = match(line, rgx.header_make)) { - /* matched header_make */ + /+ matched header_make +/ debug(header1) { // header tell_l("yellow", line); } @@ -1057,7 +1077,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d } else if (auto m = match(line, rgx.header_metadata)) { - /* matched header_metadata */ + /+ matched header_metadata +/ debug(header1) { // header tell_l("yellow", line); } @@ -1074,9 +1094,9 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+BEGIN_SRC d } else if (ft["header_make"] == 1 && (line_occur["header_make"] > 0)) { - /* header_make flag set */ + /+ header_make flag set +/ if (auto m = match(line, rgx.header_sub)) { - /* sub-header */ + /+ sub-header +/ debug(header1) { tell_l("yellow", line); } @@ -1089,9 +1109,9 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+BEGIN_SRC d } else if (ft["header_metadata"] == 1 && (line_occur["header_metadata"] > 0)) { - /* header_metadata flag set */ + /+ header_metadata flag set +/ if (auto m = match(line, rgx.header_sub)) { - /* sub-header */ + /+ sub-header +/ debug(header1) { tell_l("yellow", line); } @@ -1106,14 +1126,14 @@ if (auto m = match(line, rgx.block_curly_code_open)) { && (line_occur["heading"] == 0)) && ((ft["para"] == 0) && (ft["heading"] == 0))) { - /* heading or para but neither flag nor line exists */ + /+ heading or para but neither flag nor line exists +/ #+END_SRC ********* headings found :heading: #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d if ((to!string(dochead_make["make"]["headings"]).length > 2) && (ft["make_headings"] == 0)) { - /* headings found */ + /+ headings found +/ debug(headingsfound) { writeln(dochead_make["make"]["headings"]); } @@ -1186,7 +1206,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { && (line_occur["heading"] == 0)) && ((ft["para"] == 0) && (ft["heading"] == 0))) { - /* heading make set */ + /+ heading make set +/ if (match(line, rgx_h_B)) { line = "B~ " ~ line; debug(headingsfound) { @@ -1235,7 +1255,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d if (auto m = match(line, rgx.heading)) { - /* heading match */ + /+ heading match +/ ft["heading"] = 1; ft["header"] = 0; ft["header_make"] = 0; @@ -1362,7 +1382,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d } else if (line_occur["para"] == 0) { - /* para matches */ + /+ para matches +/ if (auto m = match(line, rgx.para_indent)) { debug(paraindent) { // para indent tell_l("blue", line); @@ -1413,7 +1433,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d } else if (line_occur["header_make"] > 0) { - /* header_make */ + /+ header_make +/ // should be caught by sub-header debug(header) { tell_l("red", line); @@ -1425,7 +1445,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d } else if (line_occur["header_metadata"] > 0) { - /* header_metadata */ + /+ header_metadata +/ // should be caught by sub-header debug(header) { // para tell_l("red", line); @@ -1437,7 +1457,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d } else if (line_occur["heading"] > 0) { - /* heading */ + /+ heading +/ debug(heading) { // heading tell_l("blue", line); } @@ -1448,7 +1468,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d } else if (line_occur["para"] > 0) { - /* paragraph */ + /+ paragraph +/ debug(para) { tell_l("blue", line); } @@ -1461,7 +1481,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d } else if (ft["blocks"] == 2) { -/* line empty, with blocks flag */ +/+ line empty, with blocks flag +/ assert( line.empty, "line should be empty" @@ -1490,7 +1510,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { obj_im.obj_inline_markup(object["is"], object["obj"]); object["attrib"] = obj_att.obj_attributes(object["is"], object["obj"], node); - contents_arbitrary_max_length_set[counter] = + contents ~= set_oa.contents_block( object["is"], object["markup"], @@ -1520,7 +1540,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { heading_pointer-1, object["is"] ); - contents_arbitrary_max_length_set[counter] = + contents ~= set_oa.contents_block_ocn_string( "poem", "", @@ -1554,7 +1574,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { obj_im.obj_inline_markup(object["is"], object["obj"]); object["attrib"] = obj_att.obj_attributes(object["is"], object["obj"], node); - contents_arbitrary_max_length_set[counter] = + contents ~= set_oa.contents_block( object["is"], object["markup"], @@ -1587,7 +1607,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { obj_im.obj_inline_markup(object["is"], object["obj"]); object["attrib"] = obj_att.obj_attributes(object["is"], object["obj"], node); - contents_arbitrary_max_length_set[counter] = + contents ~= set_oa.contents_block( object["is"], object["markup"], @@ -1620,7 +1640,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { obj_im.obj_inline_markup(object["is"], object["obj"]); object["attrib"] = obj_att.obj_attributes(object["is"], object["obj"], node); - contents_arbitrary_max_length_set[counter] = + contents ~= set_oa.contents_block( object["is"], object["markup"], @@ -1654,7 +1674,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { obj_im.obj_inline_markup(object["is"], object["obj"]); object["attrib"] = obj_att.obj_attributes(object["is"], object["obj"], node); - contents_arbitrary_max_length_set[counter] = + contents ~= set_oa.contents_block( object["is"], object["markup"], @@ -1676,12 +1696,12 @@ if (auto m = match(line, rgx.block_curly_code_open)) { #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d } else { -/* line empty */ +/+ line empty +/ #+END_SRC ******* assert line empty :assert: #+name: abs_loop_body_not_block_obj_line_empty #+BEGIN_SRC d -/* line.empty, post contents, empty variables: */ +/+ line.empty, post contents, empty variables: +/ assert( line.empty, "line should be empty" @@ -1696,7 +1716,7 @@ assert( #+BEGIN_SRC d if ((ft["header_make"] == 1) && (line_occur["header_make"] > 0)) { -/* header_make instructions (current line empty) */ +/+ header_make instructions (current line empty) +/ auto dochead_metadata_and_make = set_header.header_metadata_and_make_jsonstr(strip(object["obj"]), dochead_metadata, dochead_make); static assert(!isTypeTuple!(dochead_metadata_and_make)); @@ -1721,7 +1741,7 @@ if ((ft["header_make"] == 1) #+BEGIN_SRC d } else if ((ft["header_metadata"] == 1) && (line_occur["header_metadata"] > 0)) { -/* header_metadata (current line empty) */ +/+ header_metadata (current line empty) +/ auto dochead_metadata_and_make = set_header.header_metadata_and_make_jsonstr(strip(object["obj"]), dochead_metadata, dochead_make); static assert(!isTypeTuple!(dochead_metadata_and_make)); @@ -1748,7 +1768,7 @@ if ((ft["header_make"] == 1) #+BEGIN_SRC d } else if ((ft["heading"] == 1) && (line_occur["heading"] > 0)) { -/* heading object (current line empty) */ +/+ heading object (current line empty) +/ ocn = ocn_emit(ft["ocn_status"]); object["bookindex"] = ("bookindex" in object) ? object["bookindex"] : ""; @@ -1769,7 +1789,7 @@ if ((ft["header_make"] == 1) object["attrib"] = obj_att.obj_attributes(object["is"], object["obj"], node); heading_pointer++; - contents_arbitrary_max_length_set[counter] = + contents ~= set_oa.contents_heading( ft["ocn_status"], object["markup"], @@ -1805,7 +1825,7 @@ if ((ft["header_make"] == 1) #+name: abs_loop_body_not_block_obj_line_empty #+BEGIN_SRC d } else if ((ft["para"] == 1) && (line_occur["para"] > 0)) { -/* paragraph object (current line empty) */ +/+ paragraph object (current line empty) +/ ocn = ocn_emit(ft["ocn_status"]); object["bookindex"] = ("bookindex" in object) ? object["bookindex"] : ""; @@ -1824,7 +1844,7 @@ if ((ft["header_make"] == 1) obj_im.obj_inline_markup(object["is"], object["obj"]); object["attrib"] = obj_att.obj_attributes(object["is"], object["obj"], node); - contents_arbitrary_max_length_set[counter] = + contents ~= set_oa.contents_para( object["is"], object["markup"], @@ -1871,16 +1891,19 @@ if ((ft["header_make"] == 1) *** regular text objects #+name: abs_loop_body_01 #+BEGIN_SRC d -if (((contents_arbitrary_max_length_set[counter-1]["is"] == "para") -|| (contents_arbitrary_max_length_set[counter-1]["is"] == "heading")) +if (((contents[$-1]["is"] == "para") +|| (contents[$-1]["is"] == "heading")) && (counter-1 > previous_count)) { - if (match(contents_arbitrary_max_length_set[counter-1]["obj"], + if (match(contents[$-1]["obj"], rgx.inline_notes_delimiter_al_regular_number_note)) { // endnotes/ footnotes for // doc objects other than paragraphs & headings // various forms of grouped text - previous_count=counter-1; - notesection.gather_notes_for_endnote_section(contents_arbitrary_max_length_set, counter-1); + previous_count=contents.length -1; + notesection.gather_notes_for_endnote_section( + contents, + contents.length -1 + ); } } #+END_SRC @@ -1891,30 +1914,32 @@ if (((contents_arbitrary_max_length_set[counter-1]["is"] == "para") debug(objectrelated2) { // check tell_l("blue", line); } -/* +/+ Backmatter: * endnotes * glossary * references / bibliography * book index -*/ ++/ obj_im.obj_inline_markup("doc_end_reset", ""); auto en_tuple = notesection.endnote_objects(ocn); static assert(!isTypeTuple!(en_tuple)); auto endnotes = en_tuple[0]; ocn = en_tuple[1]; debug(endnotes) { - writeln(__LINE__, " ", endnotes.length); + writefln( + "%s %s", + __LINE__, + endnotes.length + ); foreach (n; endnotes) { writeln(n); } } -auto contents = contents_arbitrary_max_length_set[0..counter].dup; -auto biblio_unsorted_incomplete = biblio_arr_json[0..count_biblio_entry].dup; -// destroy(biblio_arr_json); -auto biblio = new Bibliography(); -auto biblio_ordered = biblio.bibliography(biblio_unsorted_incomplete); -auto bi = new BookIndexReportSection(); +auto biblio_unsorted_incomplete = biblio_arr_json.dup; +auto biblio = Bibliography(); +auto biblio_ordered = biblio.bibliography(biblio_unsorted_incomplete, bib_arr_json); +auto bi = BookIndexReportSection(); auto bi_tuple = bi.bookindex_build_section(bookindex_unordered_hashes, ocn); static assert(!isTypeTuple!(bi_tuple)); @@ -1962,10 +1987,10 @@ debug(heading) { // heading spc=""; break; } - writeln( - spc, "* ", " ", + writefln( + "%s* $s\n %s", + spc, strip(o["obj"]), - "\n ", o["attrib"] ); // tell_l("yellow", spc, strip(o["obj"])); @@ -1990,17 +2015,19 @@ return t; ** code structure: :ao_abstract_doc_source.d: #+name: tangle_ao_abstract_doc_source #+BEGIN_SRC d :tangle ../lib/sdp/ao_abstract_doc_source.d -/* +/+ document abstraction ao_abstract_doc_source.d -*/ ++/ mixin template SiSUdocAbstraction() { - class Abstraction { - /* abstract marked up document */ + private: + struct Abstraction { + /+ ↓ abstract marked up document +/ auto abstract_doc_source(char[][] markup_sourcefile_content) { <<abs_init>> + /+ ↓ loop markup document/text line by line +/ foreach (line; markup_sourcefile_content) { - /* loop markup document/text line by line */ + /+ ↓ markup document/text line by line +/ <<abs_loop_body_00>> <<abs_loop_body_non_code_obj>> <<abs_loop_body_open_block_obj>> @@ -2008,8 +2035,8 @@ mixin template SiSUdocAbstraction() { <<abs_loop_body_not_block_obj_line_empty>> <<abs_loop_body_00_closed>> <<abs_loop_body_01>> - } // closed: loop markup document/text line by line - /* post loop markup document/text */ + } /+ ← closed: loop markup document/text line by line +/ + /+ ↓ post loop markup document/text +/ <<abs_post>> } } |