diff options
author | Ralph Amissah <ralph@amissah.com> | 2016-04-24 22:08:24 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2016-04-24 22:08:24 -0400 |
commit | ed302d1be74d2b4e69ee4b6e3834637ed531eaea (patch) | |
tree | 0f605c3756788d2fda6fe0782a7a472172a285b9 /lib/sdp/ao_abstract_doc_source.d | |
parent | base ... tag (diff) |
step1doc-reform_v0.0.1
Diffstat (limited to 'lib/sdp/ao_abstract_doc_source.d')
-rw-r--r-- | lib/sdp/ao_abstract_doc_source.d | 367 |
1 files changed, 197 insertions, 170 deletions
diff --git a/lib/sdp/ao_abstract_doc_source.d b/lib/sdp/ao_abstract_doc_source.d index 941c3f0..34e4072 100644 --- a/lib/sdp/ao_abstract_doc_source.d +++ b/lib/sdp/ao_abstract_doc_source.d @@ -1,29 +1,31 @@ -/* +/+ 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) { /+ initialize +/ 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; @@ -67,18 +69,18 @@ mixin template SiSUdocAbstraction() { 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_, @@ -116,11 +118,20 @@ mixin template SiSUdocAbstraction() { "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) { @@ -128,23 +139,26 @@ mixin template SiSUdocAbstraction() { scope(failure) { } scope(exit) { - destroy(contents_arbitrary_max_length_set); + destroy(contents); destroy(object); destroy(processing); destroy(biblio_arr_json); } auto dochead_make = parseJSON(header_make_jsonstr).object; auto dochead_metadata = parseJSON(header_metadata_jsonstr).object; + /+ ↓ loop markup document/text line by line +/ foreach (line; markup_sourcefile_content) { - /* loop markup document/text line by line */ - /* scope */ + /+ ↓ markup document/text line by line +/ + /+ 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 $ @@ -155,13 +169,17 @@ mixin template SiSUdocAbstraction() { } debug(srclines) { if (!line.empty) { // source lines, not empty - writeln(scr_txt_marker["green"], line); + writefln( + "%s%s", + scr_txt_marker["green"], + line + ); } } 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) { @@ -198,7 +216,7 @@ mixin template SiSUdocAbstraction() { } } 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 @@ -229,26 +247,25 @@ mixin template SiSUdocAbstraction() { } } } 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) +/ 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 ); } @@ -257,7 +274,7 @@ mixin template SiSUdocAbstraction() { 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 { @@ -300,29 +317,28 @@ mixin template SiSUdocAbstraction() { 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=""; } } 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 ); @@ -332,10 +348,10 @@ mixin template SiSUdocAbstraction() { } debug(poem) { // poem (curly) close writeln(__LINE__); - writeln( + writefln( + "%s%s %s", scr_txt_marker["fuchsia"], ocn, - " ", line ); } @@ -354,7 +370,7 @@ mixin template SiSUdocAbstraction() { 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"], @@ -386,10 +402,12 @@ mixin template SiSUdocAbstraction() { 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"; @@ -402,7 +420,7 @@ mixin template SiSUdocAbstraction() { ); 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"], @@ -422,9 +440,9 @@ mixin template SiSUdocAbstraction() { 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 ); @@ -443,7 +461,7 @@ mixin template SiSUdocAbstraction() { 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"], @@ -475,10 +493,12 @@ mixin template SiSUdocAbstraction() { 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"; @@ -494,7 +514,7 @@ mixin template SiSUdocAbstraction() { 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"], @@ -511,7 +531,7 @@ mixin template SiSUdocAbstraction() { } } } - /* 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)) { @@ -543,7 +563,7 @@ mixin template SiSUdocAbstraction() { } } } 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 @@ -574,7 +594,7 @@ mixin template SiSUdocAbstraction() { } } } 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 @@ -605,7 +625,7 @@ mixin template SiSUdocAbstraction() { } } } 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 @@ -636,7 +656,7 @@ mixin template SiSUdocAbstraction() { } } } else { - /* not within a block group */ + /+ not within a block group +/ assert( (ft["blocks"] == 0) || (ft["blocks"] == 2), @@ -644,11 +664,11 @@ mixin template SiSUdocAbstraction() { ); assertions_flag_types_block_status_none_or_closed(ft); 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 ); @@ -657,7 +677,7 @@ mixin template SiSUdocAbstraction() { ft["code"] = 1; ft["curly_code"] = 1; } 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"); @@ -665,9 +685,9 @@ mixin template SiSUdocAbstraction() { 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 ); @@ -678,11 +698,11 @@ mixin template SiSUdocAbstraction() { ft["poem"] = 1; ft["curly_poem"] = 1; } 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 ); @@ -691,11 +711,11 @@ mixin template SiSUdocAbstraction() { ft["group"] = 1; ft["curly_group"] = 1; } 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 ); @@ -704,11 +724,11 @@ mixin template SiSUdocAbstraction() { ft["block"] = 1; ft["curly_block"] = 1; } 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 ); @@ -717,11 +737,11 @@ mixin template SiSUdocAbstraction() { ft["quote"] = 1; ft["curly_quote"] = 1; } 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 ); @@ -730,11 +750,11 @@ mixin template SiSUdocAbstraction() { ft["table"] = 1; ft["curly_table"] = 1; } 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 ); @@ -743,7 +763,7 @@ mixin template SiSUdocAbstraction() { ft["code"] = 1; ft["tic_code"] = 1; } 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"); @@ -751,9 +771,9 @@ mixin template SiSUdocAbstraction() { 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 ); @@ -764,11 +784,11 @@ mixin template SiSUdocAbstraction() { ft["poem"] = 1; ft["tic_poem"] = 1; } 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 ); @@ -777,11 +797,11 @@ mixin template SiSUdocAbstraction() { ft["group"] = 1; ft["tic_group"] = 1; } 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 ); @@ -790,11 +810,11 @@ mixin template SiSUdocAbstraction() { ft["block"] = 1; ft["tic_block"] = 1; } 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 ); @@ -803,11 +823,11 @@ mixin template SiSUdocAbstraction() { ft["quote"] = 1; ft["tic_quote"] = 1; } 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 ); @@ -816,8 +836,8 @@ mixin template SiSUdocAbstraction() { ft["table"] = 1; ft["tic_table"] = 1; } else if (!line.empty) { - /* line not empty */ - /* non blocks (headers, paragraphs) & closed blocks */ + /+ line not empty +/ + /+ non blocks (headers, paragraphs) & closed blocks +/ assert( !line.empty, "line tested, line not empty surely" @@ -840,11 +860,13 @@ mixin template SiSUdocAbstraction() { ); } 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"); } @@ -854,24 +876,24 @@ mixin template SiSUdocAbstraction() { 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 = ""; @@ -879,14 +901,14 @@ mixin template SiSUdocAbstraction() { book_idx_tmp ~= line; } } else { - /* not book_index */ + /+ not book_index +/ 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"); @@ -905,7 +927,7 @@ mixin template SiSUdocAbstraction() { ft["para"] = 0; counter++; } else if (auto m = match(line, rgx.header_make)) { - /* matched header_make */ + /+ matched header_make +/ debug(header1) { // header tell_l("yellow", line); } @@ -917,7 +939,7 @@ mixin template SiSUdocAbstraction() { line_occur["header_make"]++; object["obj"] ~= line ~= "\n"; } else if (auto m = match(line, rgx.header_metadata)) { - /* matched header_metadata */ + /+ matched header_metadata +/ debug(header1) { // header tell_l("yellow", line); } @@ -930,9 +952,9 @@ mixin template SiSUdocAbstraction() { object["obj"] ~= line ~= "\n"; } 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); } @@ -941,9 +963,9 @@ mixin template SiSUdocAbstraction() { } } 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); } @@ -954,10 +976,10 @@ mixin template SiSUdocAbstraction() { && (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 +/ if ((to!string(dochead_make["make"]["headings"]).length > 2) && (ft["make_headings"] == 0)) { - /* headings found */ + /+ headings found +/ debug(headingsfound) { writeln(dochead_make["make"]["headings"]); } @@ -1026,7 +1048,7 @@ mixin template SiSUdocAbstraction() { && (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) { @@ -1071,7 +1093,7 @@ mixin template SiSUdocAbstraction() { } } if (auto m = match(line, rgx.heading)) { - /* heading match */ + /+ heading match +/ ft["heading"] = 1; ft["header"] = 0; ft["header_make"] = 0; @@ -1194,7 +1216,7 @@ mixin template SiSUdocAbstraction() { tell_l("yellow", strip(line)); } } 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); @@ -1241,7 +1263,7 @@ mixin template SiSUdocAbstraction() { line_occur["para"]++; } } else if (line_occur["header_make"] > 0) { - /* header_make */ + /+ header_make +/ // should be caught by sub-header debug(header) { tell_l("red", line); @@ -1249,7 +1271,7 @@ mixin template SiSUdocAbstraction() { object["obj"] ~= line ~= "\n"; line_occur["header_make"]++; } else if (line_occur["header_metadata"] > 0) { - /* header_metadata */ + /+ header_metadata +/ // should be caught by sub-header debug(header) { // para tell_l("red", line); @@ -1257,14 +1279,14 @@ mixin template SiSUdocAbstraction() { object["obj"] ~= line ~= "\n"; line_occur["header_metadata"]++; } else if (line_occur["heading"] > 0) { - /* heading */ + /+ heading +/ debug(heading) { // heading tell_l("blue", line); } object["obj"] ~= line ~= "\n"; line_occur["heading"]++; } else if (line_occur["para"] > 0) { - /* paragraph */ + /+ paragraph +/ debug(para) { tell_l("blue", line); } @@ -1273,7 +1295,7 @@ mixin template SiSUdocAbstraction() { } } } else if (ft["blocks"] == 2) { - /* line empty, with blocks flag */ + /+ line empty, with blocks flag +/ assert( line.empty, "line should be empty" @@ -1302,7 +1324,7 @@ mixin template SiSUdocAbstraction() { 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"], @@ -1332,7 +1354,7 @@ mixin template SiSUdocAbstraction() { heading_pointer-1, object["is"] ); - contents_arbitrary_max_length_set[counter] = + contents ~= set_oa.contents_block_ocn_string( "poem", "", @@ -1366,7 +1388,7 @@ mixin template SiSUdocAbstraction() { 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"], @@ -1399,7 +1421,7 @@ mixin template SiSUdocAbstraction() { 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"], @@ -1432,7 +1454,7 @@ mixin template SiSUdocAbstraction() { 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"], @@ -1466,7 +1488,7 @@ mixin template SiSUdocAbstraction() { 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"], @@ -1484,8 +1506,8 @@ mixin template SiSUdocAbstraction() { ft["quote"] = 0; } } else { - /* line empty */ - /* line.empty, post contents, empty variables: */ + /+ line empty +/ + /+ line.empty, post contents, empty variables: +/ assert( line.empty, "line should be empty" @@ -1496,7 +1518,7 @@ mixin template SiSUdocAbstraction() { ); 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)); @@ -1517,7 +1539,7 @@ mixin template SiSUdocAbstraction() { processing.remove("verse"); } 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)); @@ -1540,7 +1562,7 @@ mixin template SiSUdocAbstraction() { processing.remove("verse"); } 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"] : ""; @@ -1561,7 +1583,7 @@ mixin template SiSUdocAbstraction() { 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"], @@ -1593,7 +1615,7 @@ mixin template SiSUdocAbstraction() { processing.remove("verse"); counter++; } 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"] : ""; @@ -1612,7 +1634,7 @@ mixin template SiSUdocAbstraction() { 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"], @@ -1651,47 +1673,52 @@ mixin template SiSUdocAbstraction() { } // close else for line empty } // close else for not the above } // close after non code, other blocks or regular text - 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 + ); } } - } // 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 +/ 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)); @@ -1739,10 +1766,10 @@ mixin template SiSUdocAbstraction() { spc=""; break; } - writeln( - spc, "* ", " ", + writefln( + "%s* $s\n %s", + spc, strip(o["obj"]), - "\n ", o["attrib"] ); // tell_l("yellow", spc, strip(o["obj"])); |