From 6711b5abd3d46694127fc4729ae863a6456036ec Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 5 May 2020 17:33:30 -0400 Subject: doc abstraction, state - block_is, block_state, block_delim --- src/doc_reform/meta/metadoc_from_src.d | 1553 ++++++++++++++++---------------- 1 file changed, 788 insertions(+), 765 deletions(-) (limited to 'src') diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 8d07d48..b354764 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -49,6 +49,29 @@ template docAbstraction() { book_index, blurb, } + enum blk_is { + off, + para, + heading, + code, + poem, + block, + group, + table, + quote, + } + enum blk_state { + off, + on, + closing, + } + enum blk_delim { + off, + curly, + tic, + curly_special, + tic_special, + } } return _e(); } @@ -409,7 +432,9 @@ template docAbstraction() { int[string] pith = [ "ocn" : 1, "section" : 0, - "block" : 0, + "block_is" : 0, + "block_state" : 0, + "block_delim" : 0, "obj" : 0, "dummy_heading_status" : 0, "no_ocn_multiple_objects" : 0, @@ -555,9 +580,11 @@ template docAbstraction() { if (!line.empty) { pith = line._check_ocn_status_(pith); } - if (obj_type_status["code"] == eN.tri.on) { + if ( pith["block_is"] == eN.blk_is.code + && pith["block_state"] == eN.blk_state.on + ) { /+ block object: code +/ - line.flow_txt_block_code(an_object, obj_type_status); + line.flow_txt_block_code(an_object, pith); continue; } else if (!matchFirst(line, rgx.skip_from_regular_parse)) { /+ object other than "code block" object +/ /+ (includes regular text paragraph, headings & blocks other than code) +/ @@ -572,7 +599,7 @@ template docAbstraction() { ) { pith["section"] = eN.sect.bibliography; if (opt_action.backmatter && opt_action.section_biblio) { - line.flow_txt_block_biblio(obj_type_status, bib_entry, biblio_entry_str_json, biblio_arr_json, pith); + line.flow_txt_block_biblio(pith, bib_entry, biblio_entry_str_json, biblio_arr_json); debug(bibliobuild) { writeln("- ", biblio_entry_str_json); writeln("-> ", biblio_arr_json.length); @@ -655,7 +682,7 @@ template docAbstraction() { tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; } } else { - an_object = line.flow_para_match_(an_object, an_object_key, indent, bullet, obj_type_status, line_occur); + an_object = line.flow_para_match_(an_object, an_object_key, indent, bullet, obj_type_status, pith, line_occur); comp_obj_para = comp_obj_para.init; comp_obj_para.metainfo.is_of_part = "backmatter"; comp_obj_para.metainfo.is_of_section = "glossary"; @@ -801,7 +828,7 @@ template docAbstraction() { tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html; tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; } else { - an_object = line.flow_para_match_(an_object, an_object_key, indent, bullet, obj_type_status, line_occur); + an_object = line.flow_para_match_(an_object, an_object_key, indent, bullet, obj_type_status, pith, line_occur); comp_obj_para = comp_obj_para.init; comp_obj_para.metainfo.is_of_part = "backmatter"; comp_obj_para.metainfo.is_of_section = "blurb"; @@ -821,50 +848,50 @@ template docAbstraction() { pith["ocn"] = eN.ocn.on; } continue; - } else if (obj_type_status["quote"] == eN.tri.on) { /+ within block object: quote +/ - line = line - ._doc_header_and_make_substitutions_(conf_make_meta) - ._doc_header_and_make_substitutions_fontface_(conf_make_meta); - an_object = line.flow_txt_block_quote(an_object, obj_type_status); - continue; - /+ within block object: group +/ - } else if (obj_type_status["group"] == eN.tri.on) { /+ within block object: group +/ - line = line - ._doc_header_and_make_substitutions_(conf_make_meta) - ._doc_header_and_make_substitutions_fontface_(conf_make_meta) - .replaceAll(rgx.para_delimiter, mkup.br_paragraph ~ "$1"); - an_object = line.flow_txt_block_group(an_object, obj_type_status); - continue; - } else if (obj_type_status["block"] == eN.tri.on) { /+ within block object: block +/ - line = line - ._doc_header_and_make_substitutions_(conf_make_meta) - ._doc_header_and_make_substitutions_fontface_(conf_make_meta); - if (auto m = line.match(rgx.spaces_keep)) { + } else if (pith["block_state"] == eN.blk_state.on) { + if (pith["block_is"] == eN.blk_is.quote) { + line = line + ._doc_header_and_make_substitutions_(conf_make_meta) + ._doc_header_and_make_substitutions_fontface_(conf_make_meta); + an_object = line.flow_txt_block_quote(an_object, pith); + continue; + } else if (pith["block_is"] == eN.blk_is.group) { line = line - .replaceAll(rgx.spaces_keep, (m.captures[1]).translate([ ' ' : mkup.nbsp ])); + ._doc_header_and_make_substitutions_(conf_make_meta) + ._doc_header_and_make_substitutions_fontface_(conf_make_meta) + .replaceAll(rgx.para_delimiter, mkup.br_paragraph ~ "$1"); + an_object = line.flow_txt_block_group(an_object, pith); + continue; + } else if (pith["block_is"] == eN.blk_is.block) { + line = line + ._doc_header_and_make_substitutions_(conf_make_meta) + ._doc_header_and_make_substitutions_fontface_(conf_make_meta); + if (auto m = line.match(rgx.spaces_keep)) { + line = line + .replaceAll(rgx.spaces_keep, (m.captures[1]).translate([ ' ' : mkup.nbsp ])); + } + an_object = line.flow_txt_block_block(an_object, pith); + continue; + } else if (pith["block_is"] == eN.blk_is.poem) { + an_object = line.flow_txt_block_poem(an_object, obj_type_status, pith, cntr, object_number_poem, conf_make_meta, tag_in_seg); + continue; + } else if (pith["block_is"] == eN.blk_is.table) { + an_object = line.flow_txt_block_table(an_object, obj_type_status, pith, conf_make_meta); + continue; } - an_object = line.flow_txt_block_block(an_object, obj_type_status); - continue; - } else if (obj_type_status["poem"] == eN.tri.on) { /+ within block object: poem +/ - an_object = line.flow_txt_block_poem(an_object, obj_type_status, pith, cntr, object_number_poem, conf_make_meta, tag_in_seg); - continue; - } else if (obj_type_status["table"] == eN.tri.on) { /+ within block object: table +/ - an_object = line.flow_txt_block_table(an_object, obj_type_status, pith, conf_make_meta); - continue; } else { /+ not within a block group +/ assert( - (obj_type_status["blocks"] == eN.tri.off) - || (obj_type_status["blocks"] == eN.tri.closing), + (pith["block_state"] == eN.blk_state.off) + || (pith["block_state"] == eN.blk_state.closing), "block status: none or closed" ); - assertions_flag_types_block_status_none_or_closed(obj_type_status); if (line.matchFirst(rgx.block_open)) { if (line.matchFirst(rgx.block_poem_open)) { /+ poem to verse exceptions! +/ object_reset(an_object); processing.remove("verse"); object_number_poem["start"] = obj_cite_digits.object_number.to!string; } - line.flow_txt_block_start(obj_type_status, dochas, object_number_poem); + line.flow_txt_block_start(obj_type_status, pith, dochas, object_number_poem); continue; } else if (!line.empty) { /+ line not empty +/ /+ non blocks (headings, paragraphs) & closed blocks +/ @@ -873,11 +900,11 @@ template docAbstraction() { "line tested, line not empty surely:\n \"" ~ line ~ "\"" ); assert( - (obj_type_status["blocks"] == eN.tri.off) - || (obj_type_status["blocks"] == eN.tri.closing), + (pith["block_state"] == eN.blk_state.off) + || (pith["block_state"] == eN.tri.closing), "code block status: none or closed" ); - if (obj_type_status["blocks"] == eN.tri.closing) { + if (pith["block_state"] == eN.blk_state.closing) { debug(check) { writeln(__LINE__); writeln(line); @@ -893,7 +920,7 @@ template docAbstraction() { if (line.matchFirst(rgx.book_index_item) || line.matchFirst(rgx.book_index_item_open) || pith["section"] == eN.sect.book_index) { /+ book_index +/ - an_object = line.flow_book_index_(an_object, book_idx_tmp, obj_type_status, pith, opt_action); + an_object = line.flow_book_index_(an_object, book_idx_tmp, pith, opt_action); } else { /+ not book_index +/ an_object_key="body_nugget"; if (auto m = line.matchFirst(rgx.comment)) { /+ matched comment +/ @@ -908,7 +935,7 @@ template docAbstraction() { comp_obj_comment.metainfo.is_a = "comment"; comp_obj_comment.text = an_object[an_object_key].strip; the_document_body_section ~= comp_obj_comment; - flow_common_reset_(line_occur, an_object, obj_type_status); + flow_common_reset_(line_occur, an_object, obj_type_status, pith); processing.remove("verse"); ++cntr; } else if (((line_occur["para"] == eN.bi.off) @@ -917,14 +944,14 @@ template docAbstraction() { && (obj_type_status["heading"] == eN.bi.off))) { /+ heading or para but neither flag nor line exists +/ if ((conf_make_meta.make.headings.length > 2) && (obj_type_status["make_headings"] == eN.bi.off)) { /+ heading found +/ - heading_match_str = line.flow_heading_found_(heading_match_str, conf_make_meta.make.headings, heading_match_rgx, obj_type_status); + heading_match_str = line.flow_heading_found_(heading_match_str, conf_make_meta.make.headings, heading_match_rgx, obj_type_status, pith); } if ((obj_type_status["make_headings"] == eN.bi.on) && ((line_occur["para"] == eN.bi.off) && (line_occur["heading"] == eN.bi.off)) && ((obj_type_status["para"] == eN.bi.off) && (obj_type_status["heading"] == eN.bi.off))) { /+ heading make set +/ - line = line.flow_heading_make_set_(line_occur, heading_match_rgx, obj_type_status); + line = line.flow_heading_make_set_(line_occur, heading_match_rgx, obj_type_status, pith); } /+ TODO node info: all headings identified at this point, - extract node info here?? @@ -941,15 +968,15 @@ template docAbstraction() { lv, collapsed_lev, obj_type_status, - conf_make_meta, pith, + conf_make_meta, ); } else if (line_occur["para"] == eN.bi.off) { /+ para match +/ an_object_key="body_nugget"; line = line ._doc_header_and_make_substitutions_(conf_make_meta) ._doc_header_and_make_substitutions_fontface_(conf_make_meta); - an_object = line.flow_para_match_(an_object, an_object_key, indent, bullet, obj_type_status, line_occur); + an_object = line.flow_para_match_(an_object, an_object_key, indent, bullet, obj_type_status, pith, line_occur); } } else if (line_occur["heading"] > eN.bi.off) { /+ heading +/ debug(heading) { @@ -968,7 +995,7 @@ template docAbstraction() { ++line_occur["para"]; } } - } else if (obj_type_status["blocks"] == eN.tri.closing) { /+ line empty, with blocks flag +/ + } else if (pith["block_state"] == eN.tri.closing) { /+ line empty, with blocks flag +/ an_object = line.flow_block_flag_line_empty_( an_object, bookindex_extract_hash, @@ -977,7 +1004,6 @@ template docAbstraction() { obj_cite_digits, comp_obj_heading, cntr, - obj_type_status, pith, object_number_poem, conf_make_meta, @@ -990,7 +1016,7 @@ template docAbstraction() { ~ line ~ "\"" ); assert( - (obj_type_status["blocks"] == eN.bi.off), + (pith["block_state"] == eN.blk_state.off), "code block status: none" ); if (_new_doc) { @@ -1115,7 +1141,7 @@ template docAbstraction() { debug(objectrelated1) { // check writeln(line); } - flow_common_reset_(line_occur, an_object, obj_type_status); + flow_common_reset_(line_occur, an_object, obj_type_status, pith); an_object.remove("lev"); an_object.remove("lev_markup_number"); processing.remove("verse"); @@ -1171,7 +1197,7 @@ template docAbstraction() { comp_obj_para.has.image_without_dimensions = substantive_obj_misc_tuple[sObj.image_no_dimensions]; the_document_body_section ~= comp_obj_para; tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); - flow_common_reset_(line_occur, an_object, obj_type_status); + flow_common_reset_(line_occur, an_object, obj_type_status, pith); indent=[ "hang_position" : 0, "base_position" : 0, @@ -2468,6 +2494,7 @@ template docAbstraction() { return ref int[string] line_occur, return ref string[string] an_object, return ref int[string] obj_type_status, + return ref int[string] pith, ) { line_occur["heading"] = eN.bi.off; line_occur["para"] = eN.bi.off; @@ -2572,6 +2599,7 @@ template docAbstraction() { @safe void flow_txt_block_start()( char[] line, return ref int[string] obj_type_status, + return ref int[string] pith, return ref uint[string] dochas, return ref string[string] object_number_poem ) { @@ -2587,9 +2615,9 @@ template docAbstraction() { line ); } - obj_type_status["blocks"] = eN.tri.on; - obj_type_status["code"] = eN.tri.on; - obj_type_status["curly_code"] = eN.tri.on; + pith["block_is"] = eN.blk_is.code; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.curly; } else if (auto m = line.matchFirst(rgx.block_curly_poem_open)) { dochas["poem"]++; an_object["syntax"] = ""; @@ -2602,10 +2630,10 @@ template docAbstraction() { ); } object_number_poem["start"] = obj_cite_digits.object_number.to!string; - obj_type_status["blocks"] = eN.tri.on; + pith["block_is"] = eN.blk_is.poem; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.curly; obj_type_status["verse_new"] = eN.bi.on; - obj_type_status["poem"] = eN.tri.on; - obj_type_status["curly_poem"] = eN.tri.on; } else if (auto m = line.matchFirst(rgx.block_curly_group_open)) { dochas["group"]++; an_object["syntax"] = ""; @@ -2617,9 +2645,9 @@ template docAbstraction() { line ); } - obj_type_status["blocks"] = eN.tri.on; - obj_type_status["group"] = eN.tri.on; - obj_type_status["curly_group"] = eN.tri.on; + pith["block_is"] = eN.blk_is.group; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.curly; } else if (auto m = line.matchFirst(rgx.block_curly_block_open)) { dochas["block"]++; an_object["syntax"] = ""; @@ -2631,9 +2659,9 @@ template docAbstraction() { line ); } - obj_type_status["blocks"] = eN.tri.on; - obj_type_status["block"] = eN.tri.on; - obj_type_status["curly_block"] = eN.tri.on; + pith["block_is"] = eN.blk_is.block; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.curly; } else if (auto m = line.matchFirst(rgx.block_curly_quote_open)) { dochas["quote"]++; an_object["syntax"] = ""; @@ -2645,9 +2673,9 @@ template docAbstraction() { line ); } - obj_type_status["blocks"] = eN.tri.on; - obj_type_status["quote"] = eN.tri.on; - obj_type_status["curly_quote"] = eN.tri.on; + pith["block_is"] = eN.blk_is.quote; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.curly; } else if (auto m = line.matchFirst(rgx.block_curly_table_open)) { /+ curly table open +/ debug(table) { // table (curly) open writefln( @@ -2656,18 +2684,18 @@ template docAbstraction() { ); } dochas["table"] ++; - an_object["table_head"] = m["attrib"].to!string; - an_object["block_type"] = "curly"; - obj_type_status["blocks"] = eN.tri.on; - obj_type_status["table"] = eN.tri.on; - obj_type_status["curly_table"] = eN.tri.on; + an_object["table_head"] = m["attrib"].to!string; + an_object["block_type"] = "curly"; + pith["block_is"] = eN.blk_is.table; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.curly; } else if (auto m = line.matchFirst(rgx.block_curly_table_special_markup)) { /+ table: special table block markup syntax! +/ dochas["table"]++; - an_object["table_head"] = m["attrib"].to!string; - an_object["block_type"] = "special"; - obj_type_status["blocks"] = eN.tri.on; - obj_type_status["table"] = eN.tri.on; - obj_type_status["curly_table_special_markup"] = eN.tri.on; + an_object["table_head"] = m["attrib"].to!string; + an_object["block_type"] = "special"; + pith["block_is"] = eN.blk_is.table; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.curly_special; } else if (auto m = line.matchFirst(rgx.block_tic_code_open)) { dochas["codeblock"]++; an_object["lang"] = ""; @@ -2679,9 +2707,9 @@ template docAbstraction() { line ); } - obj_type_status["blocks"] = eN.tri.on; - obj_type_status["code"] = eN.tri.on; - obj_type_status["tic_code"] = eN.tri.on; + pith["block_is"] = eN.blk_is.code; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.tic; } else if (auto m = line.matchFirst(rgx.block_tic_poem_open)) { dochas["poem"]++; an_object["syntax"] = ""; @@ -2693,11 +2721,11 @@ template docAbstraction() { line ); } - object_number_poem["start"] = obj_cite_digits.object_number.to!string; - obj_type_status["blocks"] = eN.tri.on; - obj_type_status["verse_new"] = eN.bi.on; - obj_type_status["poem"] = eN.tri.on; - obj_type_status["tic_poem"] = eN.tri.on; + object_number_poem["start"] = obj_cite_digits.object_number.to!string; + pith["block_is"] = eN.blk_is.poem; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.tic; + obj_type_status["verse_new"] = eN.bi.on; } else if (auto m = line.matchFirst(rgx.block_tic_group_open)) { dochas["group"]++; an_object["syntax"] = ""; @@ -2709,9 +2737,9 @@ template docAbstraction() { line ); } - obj_type_status["blocks"] = eN.tri.on; - obj_type_status["group"] = eN.tri.on; - obj_type_status["tic_group"] = eN.tri.on; + pith["block_is"] = eN.blk_is.group; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.tic; } else if (auto m = line.matchFirst(rgx.block_tic_block_open)) { dochas["block"]++; an_object["syntax"] = ""; @@ -2723,9 +2751,9 @@ template docAbstraction() { line ); } - obj_type_status["blocks"] = eN.tri.on; - obj_type_status["block"] = eN.tri.on; - obj_type_status["tic_block"] = eN.tri.on; + pith["block_is"] = eN.blk_is.block; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.tic; } else if (auto m = line.matchFirst(rgx.block_tic_quote_open)) { dochas["quote"]++; an_object["syntax"] = ""; @@ -2737,9 +2765,9 @@ template docAbstraction() { line ); } - obj_type_status["blocks"] = eN.tri.on; - obj_type_status["quote"] = eN.tri.on; - obj_type_status["tic_quote"] = eN.tri.on; + pith["block_is"] = eN.blk_is.quote; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.tic; } else if (auto m = line.matchFirst(rgx.block_tic_table_open)) { /+ tic table open +/ debug(table) { // table (tic) open writefln( @@ -2748,48 +2776,50 @@ template docAbstraction() { ); } dochas["table"] ++; - an_object["table_head"] = m["attrib"].to!string; - an_object["block_type"] = "tic"; - obj_type_status["blocks"] = eN.tri.on; - obj_type_status["table"] = eN.tri.on; - obj_type_status["tic_table"] = eN.tri.on; + an_object["table_head"] = m["attrib"].to!string; + an_object["block_type"] = "tic"; + pith["block_is"] = eN.blk_is.table; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.tic; } } @safe string[string] flow_txt_block_quote()( char[] line, string[string] an_object, - return ref int[string] obj_type_status + return ref int[string] pith, ) { static auto rgx = RgxI(); - if (obj_type_status["curly_quote"] == eN.tri.on) { - if (line.matchFirst(rgx.block_curly_quote_close)) { - debug(quote) { // quote (curly) close - writeln(line); - } - an_object[an_object_key] = an_object[an_object_key].stripRight; - obj_type_status["blocks"] = eN.tri.closing; - obj_type_status["quote"] = eN.tri.closing; - obj_type_status["curly_quote"] = eN.tri.off; - } else { - debug(quote) { - writeln(line); - } - an_object[an_object_key] ~= line ~= "\n"; // build quote array (or string) - } - } else if (obj_type_status["tic_quote"] == eN.tri.on) { - if (line.matchFirst(rgx.block_tic_close)) { - debug(quote) { // quote (tic) close - writeln(line); + if (pith["block_is"] == eN.blk_is.quote){ + if (pith["block_delim"] == eN.blk_delim.curly) { + if (line.matchFirst(rgx.block_curly_quote_close)) { + debug(quote) { + writeln(line); + } + an_object[an_object_key] = an_object[an_object_key].stripRight; + pith["block_is"] = eN.blk_is.quote; + pith["block_state"] = eN.blk_state.closing; + pith["block_delim"] = eN.blk_delim.off; + } else { + debug(quote) { + writeln(line); + } + an_object[an_object_key] ~= line ~= "\n"; } - an_object[an_object_key] = an_object[an_object_key].stripRight; - obj_type_status["blocks"] = eN.tri.closing; - obj_type_status["quote"] = eN.tri.closing; - obj_type_status["tic_quote"] = eN.tri.off; - } else { - debug(quote) { - writeln(line); + } else if (pith["block_delim"] == eN.blk_delim.tic) { + if (line.matchFirst(rgx.block_tic_close)) { + debug(quote) { + writeln(line); + } + an_object[an_object_key] = an_object[an_object_key].stripRight; + pith["block_is"] = eN.blk_is.quote; + pith["block_state"] = eN.blk_state.closing; + pith["block_delim"] = eN.blk_delim.off; + } else { + debug(quote) { + writeln(line); + } + an_object[an_object_key] ~= line ~= "\n"; } - an_object[an_object_key] ~= line ~= "\n"; // build quote array (or string) } } return an_object; @@ -2797,38 +2827,40 @@ template docAbstraction() { @safe string[string] flow_txt_block_group()( char[] line, string[string] an_object, - return ref int[string] obj_type_status + return ref int[string] pith, ) { static auto rgx = RgxI(); - if (obj_type_status["curly_group"] == eN.bi.on) { - if (line.matchFirst(rgx.block_curly_group_close)) { - debug(group) { - writeln(line); - } - an_object[an_object_key] = an_object[an_object_key].stripRight; - obj_type_status["blocks"] = eN.tri.closing; - obj_type_status["group"] = eN.tri.closing; - obj_type_status["curly_group"] = eN.tri.off; - } else { - debug(group) { - writeln(line); - } - an_object[an_object_key] ~= line ~= "\n"; // build group array (or string) - } - } else if (obj_type_status["tic_group"] == eN.tri.on) { - if (line.matchFirst(rgx.block_tic_close)) { - debug(group) { - writeln(line); + if (pith["block_is"] == eN.blk_is.group) { + if (pith["block_delim"] == eN.blk_delim.curly) { + if (line.matchFirst(rgx.block_curly_group_close)) { + debug(group) { + writeln(line); + } + an_object[an_object_key] = an_object[an_object_key].stripRight; + pith["block_is"] = eN.blk_is.group; + pith["block_state"] = eN.blk_state.closing; + pith["block_delim"] = eN.blk_delim.off; + } else { + debug(group) { + writeln(line); + } + an_object[an_object_key] ~= line ~= "\n"; } - an_object[an_object_key] = an_object[an_object_key].stripRight; - obj_type_status["blocks"] = eN.tri.closing; - obj_type_status["group"] = eN.tri.closing; - obj_type_status["tic_group"] = eN.tri.off; - } else { - debug(group) { - writeln(line); + } else if (pith["block_delim"] == eN.blk_delim.tic) { + if (line.matchFirst(rgx.block_tic_close)) { + debug(group) { + writeln(line); + } + an_object[an_object_key] = an_object[an_object_key].stripRight; + pith["block_is"] = eN.blk_is.group; + pith["block_state"] = eN.blk_state.closing; + pith["block_delim"] = eN.blk_delim.off; + } else { + debug(group) { + writeln(line); + } + an_object[an_object_key] ~= line ~= "\n"; } - an_object[an_object_key] ~= line ~= "\n"; // build group array (or string) } } return an_object; @@ -2836,38 +2868,40 @@ template docAbstraction() { @safe string[string] flow_txt_block_block()( char[] line, string[string] an_object, - return ref int[string] obj_type_status + return ref int[string] pith, ) { static auto rgx = RgxI(); - if (obj_type_status["curly_block"] == eN.tri.on) { - if (line.matchFirst(rgx.block_curly_block_close)) { - debug(block) { // block (curly) close - writeln(line); - } - an_object[an_object_key] = an_object[an_object_key].stripRight; - obj_type_status["blocks"] = eN.tri.closing; - obj_type_status["block"] = eN.tri.closing; - obj_type_status["curly_block"] = eN.tri.off; - } else { - debug(block) { - writeln(line); - } - an_object[an_object_key] ~= line ~= "\n"; // build block array (or string) - } - } else if (obj_type_status["tic_block"] == eN.tri.on) { - if (line.matchFirst(rgx.block_tic_close)) { - debug(block) { - writeln(line); + if (pith["block_is"] == eN.blk_is.block) { + if (pith["block_delim"] == eN.blk_delim.curly) { + if (line.matchFirst(rgx.block_curly_block_close)) { + debug(block) { + writeln(line); + } + an_object[an_object_key] = an_object[an_object_key].stripRight; + pith["block_is"] = eN.blk_is.block; + pith["block_state"] = eN.blk_state.closing; + pith["block_delim"] = eN.blk_delim.off; + } else { + debug(block) { + writeln(line); + } + an_object[an_object_key] ~= line ~= "\n"; } - an_object[an_object_key] = an_object[an_object_key].stripRight; - obj_type_status["blocks"] = eN.tri.closing; - obj_type_status["block"] = eN.tri.closing; - obj_type_status["tic_block"] = eN.tri.off; - } else { - debug(block) { - writeln(line); + } else if (pith["block_delim"] == eN.blk_delim.tic) { + if (line.matchFirst(rgx.block_tic_close)) { + debug(block) { + writeln(line); + } + an_object[an_object_key] = an_object[an_object_key].stripRight; + pith["block_is"] = eN.blk_is.block; + pith["block_state"] = eN.blk_state.closing; + pith["block_delim"] = eN.blk_delim.off; + } else { + debug(block) { + writeln(line); + } + an_object[an_object_key] ~= line ~= "\n"; } - an_object[an_object_key] ~= line ~= "\n"; // build block array (or string) } } return an_object; @@ -2883,36 +2917,209 @@ template docAbstraction() { string[string] tag_in_seg, ) { static auto rgx = RgxI(); - if (obj_type_status["curly_poem"] == eN.tri.on) { - if (line.matchFirst(rgx.block_curly_poem_close)) { - if (an_object_key in an_object - || processing.length > 0) { - an_object[an_object_key] = ""; - debug(poem) { - writefln( - "* [poem curly] %s", - line - ); + if (pith["block_is"] == eN.blk_is.poem) { + if (pith["block_delim"] == eN.blk_delim.curly) { + if (line.matchFirst(rgx.block_curly_poem_close)) { + if (an_object_key in an_object + || processing.length > 0) { + an_object[an_object_key] = ""; + debug(poem) { + writefln( + "* [poem curly] %s", + line + ); + } + if (processing.length > 0) { + an_object[an_object_key] = processing["verse"]; + } + debug(poem) { + writeln(__LINE__); + writefln( + "* %s %s", + obj_cite_digits.object_number, + line + ); + } + if (an_object.length > 0) { + debug(poem) { + writeln( + obj_cite_digits.object_number, + an_object[an_object_key] + ); + } + an_object["is"] = "verse"; + TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; + comp_obj_block = comp_obj_block.init; + comp_obj_block.metainfo.is_of_part = "body"; + comp_obj_block.metainfo.is_of_section = "body"; + comp_obj_block.metainfo.is_of_type = "block"; + comp_obj_block.metainfo.is_a = "verse"; + comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; + comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; + comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; + comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; + comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; + comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; + comp_obj_block.text = an_object["substantive"]; + comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; + the_document_body_section ~= comp_obj_block; + tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); + } + object_reset(an_object); + processing.remove("verse"); + ++cntr; } - if (processing.length > 0) { + object_number_poem["end"] = obj_cite_digits.object_number.to!string; + pith["block_is"] = eN.blk_is.poem; + pith["block_state"] = eN.blk_state.closing; + pith["block_delim"] = eN.blk_delim.off; + } else { + processing["verse"] ~= line ~= "\n"; + if (obj_type_status["verse_new"] == eN.bi.on) { + obj_cite_digits = ocn_emit(pith["ocn"]); + obj_type_status["verse_new"] = eN.bi.off; + } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) { + processing["verse"] = processing["verse"].stripRight; + verse_line = eN.tri.off; + obj_type_status["verse_new"] = eN.bi.on; + } + if (obj_type_status["verse_new"] == eN.bi.on) { + verse_line=1; an_object[an_object_key] = processing["verse"]; + debug(poem) { + writefln( + "* %s curly\n%s", + obj_cite_digits.object_number, + an_object[an_object_key] + ); + } + processing.remove("verse"); + an_object["is"] = "verse"; + auto comp_obj_location = node_construct.node_location_emitter( + content_non_header, + tag_in_seg, + lev_anchor_tag, + tag_assoc, + obj_cite_digits, + cntr, + heading_ptr-1, + an_object["is"] + ); + TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; + comp_obj_block = comp_obj_block.init; + comp_obj_block.metainfo.is_of_part = "body"; + comp_obj_block.metainfo.is_of_section = "body"; + comp_obj_block.metainfo.is_of_type = "block"; + comp_obj_block.metainfo.is_a = "verse"; + comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; + comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; + comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; + comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; + comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; + comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; + comp_obj_block.text = an_object["substantive"]; + comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; + the_document_body_section ~= comp_obj_block; + tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); + object_reset(an_object); + processing.remove("verse"); + ++cntr; } + } + } else if (pith["block_delim"] == eN.blk_delim.tic) { + if (auto m = line.matchFirst(rgx.block_tic_close)) { + an_object[an_object_key]="verse"; debug(poem) { - writeln(__LINE__); writefln( - "* %s %s", - obj_cite_digits.object_number, + "* [poem tic] %s", line ); } + if (processing.length > 0) { + an_object[an_object_key] = processing["verse"]; + } if (an_object.length > 0) { - debug(poem) { // poem (curly) close - writeln( + debug(poem) { + writeln(__LINE__); + writeln(obj_cite_digits.object_number, line); + } + processing.remove("verse"); + an_object["is"] = "verse"; + TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; + comp_obj_block = comp_obj_block.init; + comp_obj_block.metainfo.is_of_part = "body"; + comp_obj_block.metainfo.is_of_section = "body"; + comp_obj_block.metainfo.is_of_type = "block"; + comp_obj_block.metainfo.is_a = "verse"; + comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; + comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; + comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; + comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; + comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; + comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; + comp_obj_block.text = an_object["substantive"]; + comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; + the_document_body_section ~= comp_obj_block; + tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); + object_number_poem["end"] = obj_cite_digits.object_number.to!string; + object_reset(an_object); + processing.remove("verse"); + ++cntr; + } + pith["block_is"] = eN.blk_is.poem; + pith["block_state"] = eN.blk_state.closing; + pith["block_delim"] = eN.blk_delim.off; + } else { + processing["verse"] ~= line ~= "\n"; + if (obj_type_status["verse_new"] == eN.bi.on) { + obj_cite_digits = ocn_emit(pith["ocn"]); + obj_type_status["verse_new"] = eN.bi.off; + } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) { + processing["verse"] = processing["verse"].stripRight; + obj_type_status["verse_new"] = eN.bi.on; + verse_line = eN.tri.off; + } + if (obj_type_status["verse_new"] == eN.bi.on) { + verse_line=1; + an_object[an_object_key] = processing["verse"]; + debug(poem) { + writefln( + "* %s tic\n%s", obj_cite_digits.object_number, an_object[an_object_key] ); } + processing.remove("verse"); an_object["is"] = "verse"; + auto comp_obj_location + = node_construct.node_location_emitter( + content_non_header, + tag_in_seg, + lev_anchor_tag, + tag_assoc, + obj_cite_digits, + cntr, + heading_ptr-1, + an_object["is"] + ); TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; @@ -2935,181 +3142,10 @@ template docAbstraction() { comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); + object_reset(an_object); + processing.remove("verse"); + ++cntr; } - object_reset(an_object); - processing.remove("verse"); - ++cntr; - } - object_number_poem["end"] = obj_cite_digits.object_number.to!string; - obj_type_status["blocks"] = eN.tri.closing; - obj_type_status["poem"] = eN.tri.closing; - obj_type_status["curly_poem"] = eN.tri.off; - } else { - processing["verse"] ~= line ~= "\n"; - if (obj_type_status["verse_new"] == eN.bi.on) { - obj_cite_digits = ocn_emit(pith["ocn"]); - obj_type_status["verse_new"] = eN.bi.off; - } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) { - processing["verse"] = processing["verse"].stripRight; - verse_line = eN.tri.off; - obj_type_status["verse_new"] = eN.bi.on; - } - if (obj_type_status["verse_new"] == eN.bi.on) { - verse_line=1; - an_object[an_object_key] = processing["verse"]; - debug(poem) { // poem verse - writefln( - "* %s curly\n%s", - obj_cite_digits.object_number, - an_object[an_object_key] - ); - } - processing.remove("verse"); - an_object["is"] = "verse"; - auto comp_obj_location = node_construct.node_location_emitter( - content_non_header, - tag_in_seg, - lev_anchor_tag, - tag_assoc, - obj_cite_digits, - cntr, - heading_ptr-1, - an_object["is"] - ); - TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); - an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; - anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; - comp_obj_block = comp_obj_block.init; - comp_obj_block.metainfo.is_of_part = "body"; - comp_obj_block.metainfo.is_of_section = "body"; - comp_obj_block.metainfo.is_of_type = "block"; - comp_obj_block.metainfo.is_a = "verse"; - comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; - comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; - comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; - comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; - comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; - comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; - comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; - comp_obj_block.text = an_object["substantive"]; - comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; - comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; - comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; - the_document_body_section ~= comp_obj_block; - tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); - object_reset(an_object); - processing.remove("verse"); - ++cntr; - } - } - } else if (obj_type_status["tic_poem"] == eN.tri.on) { - if (auto m = line.matchFirst(rgx.block_tic_close)) { // tic_poem_close - an_object[an_object_key]="verse"; - debug(poem) { - writefln( - "* [poem tic] %s", - line - ); - } - if (processing.length > 0) { - an_object[an_object_key] = processing["verse"]; - } - if (an_object.length > 0) { - debug(poem) { // poem (tic) close - writeln(__LINE__); - writeln(obj_cite_digits.object_number, line); - } - processing.remove("verse"); - an_object["is"] = "verse"; - TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); - an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; - anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; - comp_obj_block = comp_obj_block.init; - comp_obj_block.metainfo.is_of_part = "body"; - comp_obj_block.metainfo.is_of_section = "body"; - comp_obj_block.metainfo.is_of_type = "block"; - comp_obj_block.metainfo.is_a = "verse"; - comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; - comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; - comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; - comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; - comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; - comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; - comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; - comp_obj_block.text = an_object["substantive"]; - comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; - comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; - comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; - the_document_body_section ~= comp_obj_block; - tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); - object_number_poem["end"] = obj_cite_digits.object_number.to!string; - object_reset(an_object); - processing.remove("verse"); - ++cntr; - } - obj_type_status["blocks"] = eN.tri.closing; - obj_type_status["poem"] = eN.tri.closing; - obj_type_status["tic_poem"] = eN.tri.off; - } else { - processing["verse"] ~= line ~= "\n"; - if (obj_type_status["verse_new"] == eN.bi.on) { - obj_cite_digits = ocn_emit(pith["ocn"]); - obj_type_status["verse_new"] = eN.bi.off; - } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) { - processing["verse"] = processing["verse"].stripRight; - obj_type_status["verse_new"] = eN.bi.on; - verse_line = eN.tri.off; - } - if (obj_type_status["verse_new"] == eN.bi.on) { - verse_line=1; - an_object[an_object_key] = processing["verse"]; - debug(poem) { // poem (tic) close - writefln( - "* %s tic\n%s", - obj_cite_digits.object_number, - an_object[an_object_key] - ); - } - processing.remove("verse"); - an_object["is"] = "verse"; - auto comp_obj_location - = node_construct.node_location_emitter( - content_non_header, - tag_in_seg, - lev_anchor_tag, - tag_assoc, - obj_cite_digits, - cntr, - heading_ptr-1, - an_object["is"] - ); - TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); - an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; - anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; - comp_obj_block = comp_obj_block.init; - comp_obj_block.metainfo.is_of_part = "body"; - comp_obj_block.metainfo.is_of_section = "body"; - comp_obj_block.metainfo.is_of_type = "block"; - comp_obj_block.metainfo.is_a = "verse"; - comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; - comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; - comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; - comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; - comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; - comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; - comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; - comp_obj_block.text = an_object["substantive"]; - comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; - comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; - comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; - the_document_body_section ~= comp_obj_block; - tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); - object_reset(an_object); - processing.remove("verse"); - ++cntr; } } } @@ -3118,42 +3154,44 @@ template docAbstraction() { @safe void flow_txt_block_code()( char[] line, return ref string[string] an_object, - return ref int[string] obj_type_status + return ref int[string] pith, ) { static auto rgx = RgxI(); - if (obj_type_status["curly_code"] == eN.tri.on) { - if (line.matchFirst(rgx.block_curly_code_close)) { - debug(codecurly) { // code (curly) close - writeln(line); - } - an_object[an_object_key] = an_object[an_object_key] - .replaceFirst(rgx.newline_eol_delimiter_only, "") - .stripRight; - obj_type_status["blocks"] = eN.tri.closing; - obj_type_status["code"] = eN.tri.closing; - obj_type_status["curly_code"] = eN.tri.off; - } else { - debug(codecurly) { // code (curly) line - writeln(line); - } - an_object[an_object_key] ~= line ~= "\n"; // code (curly) line - } - } else if (obj_type_status["tic_code"] == eN.tri.on) { - if (line.matchFirst(rgx.block_tic_close)) { - debug(codetic) { // code (tic) close - writeln(line); + if ( pith["block_is"] == eN.blk_is.code) { + if (pith["block_delim"] == eN.blk_delim.curly) { + if (line.matchFirst(rgx.block_curly_code_close)) { + debug(codecurly) { + writeln(line); + } + an_object[an_object_key] = an_object[an_object_key] + .replaceFirst(rgx.newline_eol_delimiter_only, "") + .stripRight; + pith["block_is"] = eN.blk_is.code; + pith["block_state"] = eN.blk_state.closing; + pith["block_delim"] = eN.blk_delim.off; + } else { + debug(codecurly) { + writeln(line); + } + an_object[an_object_key] ~= line ~= "\n"; } - an_object[an_object_key] = an_object[an_object_key] - .replaceFirst(rgx.newline_eol_delimiter_only, "") - .stripRight; - obj_type_status["blocks"] = eN.tri.closing; - obj_type_status["code"] = eN.tri.closing; - obj_type_status["tic_code"] = eN.tri.off; - } else { - debug(codetic) { // code (tic) line - writeln(line); + } else if (pith["block_delim"] == eN.blk_delim.tic) { + if (line.matchFirst(rgx.block_tic_close)) { + debug(codetic) { + writeln(line); + } + an_object[an_object_key] = an_object[an_object_key] + .replaceFirst(rgx.newline_eol_delimiter_only, "") + .stripRight; + pith["block_is"] = eN.blk_is.code; + pith["block_state"] = eN.blk_state.closing; + pith["block_delim"] = eN.blk_delim.off; + } else { + debug(codetic) { + writeln(line); + } + an_object[an_object_key] ~= line ~= "\n"; } - an_object[an_object_key] ~= line ~= "\n"; // code (tic) line } } } @@ -3165,54 +3203,55 @@ template docAbstraction() { return ref CMM conf_make_meta, ) { static auto rgx = RgxI(); - if (obj_type_status["curly_table"] == eN.tri.on) { - if (line.matchFirst(rgx.block_curly_table_close)) { - debug(table) { // table (curly) close - writeln(line); - } - obj_type_status["blocks"] = eN.tri.closing; - obj_type_status["table"] = eN.tri.closing; - obj_type_status["curly_table"] = eN.tri.off; - } else { - debug(table) { // table - writeln(line); - } - an_object[an_object_key] ~= line ~= "\n"; // build table array (or string) - } - } else if (obj_type_status["curly_table_special_markup"] == eN.tri.on) { - if (line.empty) { - obj_type_status["blocks"] = eN.tri.off; - obj_type_status["table"] = eN.tri.off; - obj_type_status["curly_table_special_markup"] = eN.tri.off; - line.flow_table_closed_make_special_notation_table_( - an_object, - the_document_body_section, - obj_cite_digits, - comp_obj_heading, - cntr, - obj_type_status, - pith, - conf_make_meta, - ); - } else { - debug(table) { - writeln(line); - } - an_object[an_object_key] ~= line ~= "\n"; - } - } else if (obj_type_status["tic_table"] == eN.tri.on) { - if (line.matchFirst(rgx.block_tic_close)) { - debug(table) { // table (tic) close - writeln(line); + if (pith["block_is"] == eN.blk_is.table) { + if (pith["block_delim"] == eN.blk_delim.curly) { + if (line.matchFirst(rgx.block_curly_table_close)) { + debug(table) { + writeln(line); + } + pith["block_is"] = eN.blk_is.table; + pith["block_state"] = eN.blk_state.closing; + pith["block_delim"] = eN.blk_delim.off; + } else { + debug(table) { + writeln(line); + } + an_object[an_object_key] ~= line ~= "\n"; + } + } else if (pith["block_delim"] == eN.blk_delim.curly_special) { + if (line.empty) { + pith["block_is"] = eN.blk_is.table; + pith["block_state"] = eN.blk_state.off; + pith["block_delim"] = eN.blk_delim.off; + line.flow_table_closed_make_special_notation_table_( + an_object, + the_document_body_section, + obj_cite_digits, + comp_obj_heading, + cntr, + pith, + conf_make_meta, + ); + } else { + debug(table) { + writeln(line); + } + an_object[an_object_key] ~= line ~= "\n"; } - obj_type_status["blocks"] = eN.tri.closing; - obj_type_status["table"] = eN.tri.closing; - obj_type_status["tic_table"] = eN.tri.off; - } else { - debug(table) { // table - writeln(line); + } else if (pith["block_delim"] == eN.blk_delim.tic) { + if (line.matchFirst(rgx.block_tic_close)) { + debug(table) { + writeln(line); + } + pith["block_is"] = eN.blk_is.table; + pith["block_state"] = eN.blk_state.closing; + pith["block_delim"] = eN.blk_delim.off; + } else { + debug(table) { + writeln(line); + } + an_object[an_object_key] ~= line ~= "\n"; } - an_object[an_object_key] ~= line ~= "\n"; // build table array (or string) } } return an_object; @@ -3238,11 +3277,10 @@ template docAbstraction() { } @system void flow_txt_block_biblio( char[] line, - return ref int[string] obj_type_status, + return ref int[string] pith, return ref int bib_entry, return ref string biblio_entry_str_json, return ref string[] biblio_arr_json, - return ref int[string] pith, ) { mixin spineBiblio; auto jsn = BibJsnStr(); @@ -3364,7 +3402,6 @@ template docAbstraction() { return ref N obj_cite_digits, return ref ObjGenericComposite _comp_obj_heading, return ref int cntr, - return ref int[string] obj_type_status, return ref int[string] pith, CMM conf_make_meta ) { @@ -3408,7 +3445,6 @@ template docAbstraction() { return ref N obj_cite_digits, return ref ObjGenericComposite _comp_obj_heading, return ref int cntr, - return ref int[string] obj_type_status, return ref int[string] pith, string[string] object_number_poem, CMM conf_make_meta, @@ -3420,293 +3456,300 @@ template docAbstraction() { ~ line ~ "\"" ); assert( - (obj_type_status["blocks"] == eN.tri.closing), + (pith["block_state"] == eN.blk_state.closing), "code block status: closed" ); - assertions_flag_types_block_status_none_or_closed(obj_type_status); static auto rgx = RgxI(); - if (obj_type_status["quote"] == eN.tri.closing) { - obj_cite_digits = ocn_emit(pith["ocn"]); - an_object["bookindex_nugget"] - = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; - bookindex_unordered_hashes - = bookindex_extract_hash.bookindex_nugget_hash( - an_object["bookindex_nugget"], - obj_cite_digits, - tag_in_seg - ); - an_object["is"] = "quote"; - auto comp_obj_location - = node_construct.node_location_emitter( - content_non_header, - tag_in_seg, - lev_anchor_tag, - tag_assoc, - obj_cite_digits, - cntr, - heading_ptr-1, - an_object["is"] - ); - TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); - an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; - anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; - comp_obj_block = comp_obj_block.init; - comp_obj_block.metainfo.is_of_part = "body"; - comp_obj_block.metainfo.is_of_section = "body"; - comp_obj_block.metainfo.is_of_type = "block"; - comp_obj_block.metainfo.is_a = "quote"; - comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; - comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; - comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; - comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; - comp_obj_block.metainfo.object_number_type = obj_cite_digit_type; - comp_obj_block.metainfo.lang = an_object["lang"]; - comp_obj_block.metainfo.attrib = an_object["attrib"]; - comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; - comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; - comp_obj_block.text = an_object["substantive"]; - comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; - comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; - comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; - the_document_body_section ~= comp_obj_block; - tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); - obj_type_status["blocks"] = eN.tri.off; - obj_type_status["quote"] = eN.tri.off; - object_reset(an_object); - processing.remove("verse"); - ++cntr; - } else if (obj_type_status["group"] == eN.tri.closing) { - obj_cite_digits = ocn_emit(pith["ocn"]); - an_object["bookindex_nugget"] - = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; - bookindex_unordered_hashes - = bookindex_extract_hash.bookindex_nugget_hash( - an_object["bookindex_nugget"], - obj_cite_digits, - tag_in_seg - ); - an_object["is"] = "group"; - auto comp_obj_location - = node_construct.node_location_emitter( - content_non_header, - tag_in_seg, - lev_anchor_tag, - tag_assoc, - obj_cite_digits, - cntr, - heading_ptr-1, - an_object["is"] - ); - TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); - an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; - anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; - comp_obj_block = comp_obj_block.init; - comp_obj_block.metainfo.is_of_part = "body"; - comp_obj_block.metainfo.is_of_section = "body"; - comp_obj_block.metainfo.is_of_type = "block"; - comp_obj_block.metainfo.is_a = "group"; - comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; - comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; - comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; - comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; - comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; - comp_obj_block.metainfo.lang = an_object["lang"]; - comp_obj_block.metainfo.attrib = an_object["attrib"]; - comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; - comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; - comp_obj_block.text = an_object["substantive"]; - comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; - comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; - comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; - the_document_body_section ~= comp_obj_block; - tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); - obj_type_status["blocks"] = eN.tri.off; - obj_type_status["group"] = eN.tri.off; - object_reset(an_object); - processing.remove("verse"); - ++cntr; - } else if (obj_type_status["block"] == eN.tri.closing) { - obj_cite_digits = ocn_emit(pith["ocn"]); - an_object["bookindex_nugget"] - = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; - bookindex_unordered_hashes - = bookindex_extract_hash.bookindex_nugget_hash( - an_object["bookindex_nugget"], - obj_cite_digits, - tag_in_seg - ); - an_object["is"] = "block"; - auto comp_obj_location - = node_construct.node_location_emitter( - content_non_header, - tag_in_seg, - lev_anchor_tag, - tag_assoc, - obj_cite_digits, - cntr, - heading_ptr-1, - an_object["is"] - ); - TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); - an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; - // anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; - comp_obj_block = comp_obj_block.init; - comp_obj_block.metainfo.is_of_part = "body"; - comp_obj_block.metainfo.is_of_section = "body"; - comp_obj_block.metainfo.is_of_type = "block"; - comp_obj_block.metainfo.is_a = "block"; - comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; - comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; - comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; - comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; - comp_obj_block.metainfo.object_number_type = obj_cite_digit_type; - comp_obj_block.metainfo.lang = an_object["lang"]; - comp_obj_block.metainfo.attrib = an_object["attrib"]; - comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; - comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; - comp_obj_block.text = an_object["substantive"]; - comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; - comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; - comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; - the_document_body_section ~= comp_obj_block; - obj_type_status["blocks"] = eN.tri.off; - obj_type_status["block"] = eN.tri.off; - object_reset(an_object); - processing.remove("verse"); - ++cntr; - } else if (obj_type_status["poem"] == eN.tri.closing) { - an_object["bookindex_nugget"] - = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; - bookindex_unordered_hashes - = bookindex_extract_hash.bookindex_nugget_hash( - an_object["bookindex_nugget"], - obj_cite_digits, - tag_in_seg - ); - an_object["is"] = "verse"; - auto comp_obj_location - = node_construct.node_location_emitter( - content_non_header, - tag_in_seg, - lev_anchor_tag, - tag_assoc, - obj_cite_digits, - cntr, - heading_ptr-1, - an_object["is"] - ); - comp_obj_poem_ocn = comp_obj_poem_ocn.init; - comp_obj_poem_ocn.metainfo.is_of_part = "body"; - comp_obj_poem_ocn.metainfo.is_of_section = "body"; - comp_obj_poem_ocn.metainfo.is_of_type = "block"; - comp_obj_poem_ocn.metainfo.is_a = "poem"; - comp_obj_poem_ocn.metainfo.ocn = obj_cite_digits.object_number; - comp_obj_poem_ocn.metainfo.identifier = obj_cite_digits.identifier; - comp_obj_poem_ocn.metainfo.object_number_off = obj_cite_digits.off; - comp_obj_poem_ocn.metainfo.o_n_book_index = obj_cite_digits.bkidx; - comp_obj_poem_ocn.metainfo.object_number_type = obj_cite_digits.type; - comp_obj_poem_ocn.text = ""; - the_document_body_section ~= comp_obj_poem_ocn; - obj_type_status["blocks"] = eN.tri.off; - obj_type_status["poem"] = eN.tri.off; - object_reset(an_object); - processing.remove("verse"); - } else if (obj_type_status["code"] == eN.tri.closing) { - obj_cite_digits = ocn_emit(pith["ocn"]); - an_object["bookindex_nugget"] - = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; - bookindex_unordered_hashes - = bookindex_extract_hash.bookindex_nugget_hash( - an_object["bookindex_nugget"], - obj_cite_digits, - tag_in_seg - ); - an_object["is"] = "code"; - auto comp_obj_location - = node_construct.node_location_emitter( - content_non_header, - tag_in_seg, - lev_anchor_tag, - tag_assoc, - obj_cite_digits, - cntr, - heading_ptr-1, - an_object["is"] - ); - TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); - an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; - anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; - comp_obj_code = comp_obj_code.init; - comp_obj_code.metainfo.is_of_part = "body"; - comp_obj_code.metainfo.is_of_section = "body"; - comp_obj_code.metainfo.is_of_type = "block"; - comp_obj_code.metainfo.is_a = "code"; - comp_obj_code.metainfo.ocn = obj_cite_digits.object_number; - comp_obj_code.metainfo.identifier = obj_cite_digits.identifier; - comp_obj_code.metainfo.object_number_off = obj_cite_digits.off; - comp_obj_code.metainfo.o_n_book_index = obj_cite_digits.bkidx; - comp_obj_code.metainfo.object_number_type = obj_cite_digits.type; - comp_obj_code.metainfo.syntax = an_object["syntax"]; - comp_obj_code.metainfo.attrib = an_object["attrib"]; - comp_obj_code.code_block.linenumbers = (an_object["attrib"].match(rgx.code_numbering)) ? true : false; - comp_obj_code.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; - comp_obj_code.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; - comp_obj_code.text = an_object["substantive"]; - comp_obj_code.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; - comp_obj_code.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; - comp_obj_code.has.inline_links = substantive_obj_misc_tuple[sObj.links]; - the_document_body_section ~= comp_obj_code; - obj_type_status["blocks"] = eN.tri.off; - obj_type_status["code"] = eN.tri.off; - object_reset(an_object); - processing.remove("verse"); - ++cntr; - } else if (obj_type_status["table"] == eN.tri.closing) { - comp_obj_block = comp_obj_block.init; - obj_cite_digits = ocn_emit(pith["ocn"]); - an_object["bookindex_nugget"] - = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; - bookindex_unordered_hashes - = bookindex_extract_hash.bookindex_nugget_hash( - an_object["bookindex_nugget"], - obj_cite_digits, - tag_in_seg - ); - an_object["is"] = "table"; - auto comp_obj_location - = node_construct.node_location_emitter( - content_non_header, - tag_in_seg, - lev_anchor_tag, - tag_assoc, - obj_cite_digits, - cntr, - heading_ptr-1, - an_object["is"] - ); - TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); - an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; - comp_obj_block = comp_obj_block.init; - comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; - comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; - comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; - comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; - comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; - comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; - comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; - comp_obj_block = comp_obj_block.flow_table_instructions(an_object["table_head"]); - comp_obj_block = comp_obj_block.flow_table_substantive_munge(an_object["substantive"]); - the_document_body_section ~= comp_obj_block; - obj_type_status["blocks"] = eN.tri.off; - obj_type_status["table"] = eN.tri.off; - object_reset(an_object); - processing.remove("verse"); - ++cntr; + if (pith["block_state"] == eN.blk_state.closing) { + if (pith["block_is"] == eN.blk_is.quote) { + obj_cite_digits = ocn_emit(pith["ocn"]); + an_object["bookindex_nugget"] + = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; + bookindex_unordered_hashes + = bookindex_extract_hash.bookindex_nugget_hash( + an_object["bookindex_nugget"], + obj_cite_digits, + tag_in_seg + ); + an_object["is"] = "quote"; + auto comp_obj_location + = node_construct.node_location_emitter( + content_non_header, + tag_in_seg, + lev_anchor_tag, + tag_assoc, + obj_cite_digits, + cntr, + heading_ptr-1, + an_object["is"] + ); + TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; + comp_obj_block = comp_obj_block.init; + comp_obj_block.metainfo.is_of_part = "body"; + comp_obj_block.metainfo.is_of_section = "body"; + comp_obj_block.metainfo.is_of_type = "block"; + comp_obj_block.metainfo.is_a = "quote"; + comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; + comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; + comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; + comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; + comp_obj_block.metainfo.object_number_type = obj_cite_digit_type; + comp_obj_block.metainfo.lang = an_object["lang"]; + comp_obj_block.metainfo.attrib = an_object["attrib"]; + comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; + comp_obj_block.text = an_object["substantive"]; + comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; + the_document_body_section ~= comp_obj_block; + tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); + pith["block_is"] = eN.blk_is.quote; + pith["block_state"] = eN.blk_state.off; + pith["block_delim"] = eN.blk_delim.off; + object_reset(an_object); + processing.remove("verse"); + ++cntr; + } else if (pith["block_is"] == eN.blk_is.group) { + obj_cite_digits = ocn_emit(pith["ocn"]); + an_object["bookindex_nugget"] + = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; + bookindex_unordered_hashes + = bookindex_extract_hash.bookindex_nugget_hash( + an_object["bookindex_nugget"], + obj_cite_digits, + tag_in_seg + ); + an_object["is"] = "group"; + auto comp_obj_location + = node_construct.node_location_emitter( + content_non_header, + tag_in_seg, + lev_anchor_tag, + tag_assoc, + obj_cite_digits, + cntr, + heading_ptr-1, + an_object["is"] + ); + TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; + comp_obj_block = comp_obj_block.init; + comp_obj_block.metainfo.is_of_part = "body"; + comp_obj_block.metainfo.is_of_section = "body"; + comp_obj_block.metainfo.is_of_type = "block"; + comp_obj_block.metainfo.is_a = "group"; + comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; + comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; + comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; + comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; + comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; + comp_obj_block.metainfo.lang = an_object["lang"]; + comp_obj_block.metainfo.attrib = an_object["attrib"]; + comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; + comp_obj_block.text = an_object["substantive"]; + comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; + the_document_body_section ~= comp_obj_block; + tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); + pith["block_is"] = eN.blk_is.poem; + pith["block_state"] = eN.blk_state.off; + pith["block_delim"] = eN.blk_delim.off; + object_reset(an_object); + processing.remove("verse"); + ++cntr; + } else if (pith["block_is"] == eN.blk_is.block) { + obj_cite_digits = ocn_emit(pith["ocn"]); + an_object["bookindex_nugget"] + = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; + bookindex_unordered_hashes + = bookindex_extract_hash.bookindex_nugget_hash( + an_object["bookindex_nugget"], + obj_cite_digits, + tag_in_seg + ); + an_object["is"] = "block"; + auto comp_obj_location + = node_construct.node_location_emitter( + content_non_header, + tag_in_seg, + lev_anchor_tag, + tag_assoc, + obj_cite_digits, + cntr, + heading_ptr-1, + an_object["is"] + ); + TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + // anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; + comp_obj_block = comp_obj_block.init; + comp_obj_block.metainfo.is_of_part = "body"; + comp_obj_block.metainfo.is_of_section = "body"; + comp_obj_block.metainfo.is_of_type = "block"; + comp_obj_block.metainfo.is_a = "block"; + comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; + comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; + comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; + comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; + comp_obj_block.metainfo.object_number_type = obj_cite_digit_type; + comp_obj_block.metainfo.lang = an_object["lang"]; + comp_obj_block.metainfo.attrib = an_object["attrib"]; + comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; + comp_obj_block.text = an_object["substantive"]; + comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; + the_document_body_section ~= comp_obj_block; + pith["block_is"] = eN.blk_is.block; + pith["block_state"] = eN.blk_state.off; + pith["block_delim"] = eN.blk_delim.off; + object_reset(an_object); + processing.remove("verse"); + ++cntr; + } else if (pith["block_is"] == eN.blk_is.poem) { + an_object["bookindex_nugget"] + = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; + bookindex_unordered_hashes + = bookindex_extract_hash.bookindex_nugget_hash( + an_object["bookindex_nugget"], + obj_cite_digits, + tag_in_seg + ); + an_object["is"] = "verse"; + auto comp_obj_location + = node_construct.node_location_emitter( + content_non_header, + tag_in_seg, + lev_anchor_tag, + tag_assoc, + obj_cite_digits, + cntr, + heading_ptr-1, + an_object["is"] + ); + comp_obj_poem_ocn = comp_obj_poem_ocn.init; + comp_obj_poem_ocn.metainfo.is_of_part = "body"; + comp_obj_poem_ocn.metainfo.is_of_section = "body"; + comp_obj_poem_ocn.metainfo.is_of_type = "block"; + comp_obj_poem_ocn.metainfo.is_a = "poem"; + comp_obj_poem_ocn.metainfo.ocn = obj_cite_digits.object_number; + comp_obj_poem_ocn.metainfo.identifier = obj_cite_digits.identifier; + comp_obj_poem_ocn.metainfo.object_number_off = obj_cite_digits.off; + comp_obj_poem_ocn.metainfo.o_n_book_index = obj_cite_digits.bkidx; + comp_obj_poem_ocn.metainfo.object_number_type = obj_cite_digits.type; + comp_obj_poem_ocn.text = ""; + the_document_body_section ~= comp_obj_poem_ocn; + pith["block_is"] = eN.blk_is.poem; + pith["block_state"] = eN.blk_state.off; + pith["block_delim"] = eN.blk_delim.off; + object_reset(an_object); + processing.remove("verse"); + } else if (pith["block_is"] == eN.blk_is.code) { + obj_cite_digits = ocn_emit(pith["ocn"]); + an_object["bookindex_nugget"] + = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; + bookindex_unordered_hashes + = bookindex_extract_hash.bookindex_nugget_hash( + an_object["bookindex_nugget"], + obj_cite_digits, + tag_in_seg + ); + an_object["is"] = "code"; + auto comp_obj_location + = node_construct.node_location_emitter( + content_non_header, + tag_in_seg, + lev_anchor_tag, + tag_assoc, + obj_cite_digits, + cntr, + heading_ptr-1, + an_object["is"] + ); + TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; + comp_obj_code = comp_obj_code.init; + comp_obj_code.metainfo.is_of_part = "body"; + comp_obj_code.metainfo.is_of_section = "body"; + comp_obj_code.metainfo.is_of_type = "block"; + comp_obj_code.metainfo.is_a = "code"; + comp_obj_code.metainfo.ocn = obj_cite_digits.object_number; + comp_obj_code.metainfo.identifier = obj_cite_digits.identifier; + comp_obj_code.metainfo.object_number_off = obj_cite_digits.off; + comp_obj_code.metainfo.o_n_book_index = obj_cite_digits.bkidx; + comp_obj_code.metainfo.object_number_type = obj_cite_digits.type; + comp_obj_code.metainfo.syntax = an_object["syntax"]; + comp_obj_code.metainfo.attrib = an_object["attrib"]; + comp_obj_code.code_block.linenumbers = (an_object["attrib"].match(rgx.code_numbering)) ? true : false; + comp_obj_code.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_code.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; + comp_obj_code.text = an_object["substantive"]; + comp_obj_code.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_code.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_code.has.inline_links = substantive_obj_misc_tuple[sObj.links]; + the_document_body_section ~= comp_obj_code; + pith["block_is"] = eN.blk_is.code; + pith["block_state"] = eN.blk_state.off; + pith["block_delim"] = eN.blk_delim.off; + object_reset(an_object); + processing.remove("verse"); + ++cntr; + } else if (pith["block_is"] == eN.blk_is.table) { + comp_obj_block = comp_obj_block.init; + obj_cite_digits = ocn_emit(pith["ocn"]); + an_object["bookindex_nugget"] + = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; + bookindex_unordered_hashes + = bookindex_extract_hash.bookindex_nugget_hash( + an_object["bookindex_nugget"], + obj_cite_digits, + tag_in_seg + ); + an_object["is"] = "table"; + auto comp_obj_location + = node_construct.node_location_emitter( + content_non_header, + tag_in_seg, + lev_anchor_tag, + tag_assoc, + obj_cite_digits, + cntr, + heading_ptr-1, + an_object["is"] + ); + TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + comp_obj_block = comp_obj_block.init; + comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; + comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; + comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; + comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; + comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; + comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; + comp_obj_block = comp_obj_block.flow_table_instructions(an_object["table_head"]); + comp_obj_block = comp_obj_block.flow_table_substantive_munge(an_object["substantive"]); + the_document_body_section ~= comp_obj_block; + pith["block_is"] = eN.blk_is.table; + pith["block_state"] = eN.blk_state.off; + pith["block_delim"] = eN.blk_delim.off; + object_reset(an_object); + processing.remove("verse"); + ++cntr; + } } return an_object; } @@ -3714,7 +3757,6 @@ template docAbstraction() { char[] line, string[string] an_object, return ref string book_idx_tmp, - return ref int[string] obj_type_status, return ref int[string] pith, B opt_action, ) { @@ -3766,7 +3808,8 @@ template docAbstraction() { string[string] heading_match_str, string[] _make_unmarked_headings, return ref Regex!(char)[string] heading_match_rgx, - return ref int[string] obj_type_status + return ref int[string] obj_type_status, + return ref int[string] pith, ) { static auto rgx = RgxI(); if ((_make_unmarked_headings.length > 2) @@ -3846,7 +3889,8 @@ template docAbstraction() { char[] line, int[string] line_occur, return ref Regex!(char)[string] heading_match_rgx, - return ref int[string] obj_type_status + return ref int[string] obj_type_status, + return ref int[string] pith, ) { if ((obj_type_status["make_headings"] == eN.bi.on) && ((line_occur["para"] == eN.bi.off) @@ -3906,8 +3950,8 @@ template docAbstraction() { return ref int[string] lv, return ref int[string] collapsed_lev, return ref int[string] obj_type_status, - return ref CMM conf_make_meta, return ref int[string] pith, + return ref CMM conf_make_meta, ) { static auto rgx = RgxI(); if (auto m = line.match(rgx.headings)) { /+ heading match +/ @@ -4057,6 +4101,7 @@ template docAbstraction() { return ref int[string] indent, return ref bool bullet, return ref int[string] obj_type_status, + return ref int[string] pith, return ref int[string] line_occur, ) { static auto rgx = RgxI(); @@ -6185,28 +6230,6 @@ template docAbstraction() { default: break; } - } - @safe pure void assertions_flag_types_block_status_none_or_closed()(int[string] obj_type_status) { - assert( - (obj_type_status["code"] == eN.tri.off) - || (obj_type_status["code"] == eN.tri.closing), - "code block status: off or closing"); - assert( - (obj_type_status["poem"] == eN.tri.off) - || (obj_type_status["poem"] == eN.tri.closing), - "poem status: off or closing"); - assert( - (obj_type_status["table"] == eN.tri.off) - || (obj_type_status["table"] == eN.tri.closing), - "table status: off or closing"); - assert( - (obj_type_status["group"] == eN.tri.off) - || (obj_type_status["group"] == eN.tri.closing), - "group block status: off or closing"); - assert( - (obj_type_status["block"] == eN.tri.off) - || (obj_type_status["block"] == eN.tri.closing), - "block status: off or closing"); } /+ abstraction functions assertions ↑ +/ } /+ ← closed: template docAbstraction +/ -- cgit v1.2.3