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 --- org/metaverse.org | 1568 +++++++++++++++++++++++++++-------------------------- 1 file changed, 795 insertions(+), 773 deletions(-) (limited to 'org') diff --git a/org/metaverse.org b/org/metaverse.org index 53e4014..d368103 100644 --- a/org/metaverse.org +++ b/org/metaverse.org @@ -54,7 +54,9 @@ template docAbstraction() { foreach (line; markup_sourcefile_content) { /+ ↓ markup document/text line by line +/ // "line" variable can be empty but should never be null <> - if (obj_type_status["code"] == eN.tri.on) { + if ( pith["block_is"] == eN.blk_is.code + && pith["block_state"] == eN.blk_state.on + ) { <> } else if (!matchFirst(line, rgx.skip_from_regular_parse)) { /+ object other than "code block" object +/ /+ (includes regular text paragraph, headings & blocks other than code) +/ @@ -67,7 +69,7 @@ template docAbstraction() { } else if (!line.empty) { /+ line not empty +/ /+ non blocks (headings, paragraphs) & closed blocks +/ <> - } 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 +/ <> } else { /+ line.empty, post contents, empty variables: +/ <> @@ -191,6 +193,29 @@ mixin spineRgxIn; 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(); } @@ -589,7 +614,9 @@ auto obj_type_status = flags_type_init; 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, @@ -757,7 +784,7 @@ if (!line.empty) { #+NAME: abs_in_loop_body_00_code_block #+BEGIN_SRC d /+ block object: code +/ -line.flow_txt_block_code(an_object, obj_type_status); +line.flow_txt_block_code(an_object, pith); continue; #+END_SRC @@ -783,7 +810,7 @@ if (line.matchFirst(rgx.heading_biblio) ) { 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); @@ -879,7 +906,7 @@ if there is a glossary section you need to: 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"; @@ -1038,7 +1065,7 @@ if there is a blurb section you need to: 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"; @@ -1061,64 +1088,70 @@ if there is a blurb section you need to: #+END_SRC ***** in blocks [+1] :block:active: + +#+NAME: abs_in_loop_body_non_code_obj +#+BEGIN_SRC d +} else if (pith["block_state"] == eN.blk_state.on) { +#+END_SRC + ****** in block: quote :quote: #+NAME: abs_in_loop_body_non_code_obj #+BEGIN_SRC d -} 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; + 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; #+END_SRC ****** in block: group :group: #+NAME: abs_in_loop_body_non_code_obj #+BEGIN_SRC d -/+ 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 (pith["block_is"] == eN.blk_is.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, pith); + continue; #+END_SRC ****** in block: block :block: #+NAME: abs_in_loop_body_non_code_obj #+BEGIN_SRC d -} 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_is"] == eN.blk_is.block) { line = line - .replaceAll(rgx.spaces_keep, (m.captures[1]).translate([ ' ' : mkup.nbsp ])); - } - an_object = line.flow_txt_block_block(an_object, obj_type_status); - continue; + ._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; #+END_SRC ****** in block: poem :poem: #+NAME: abs_in_loop_body_non_code_obj #+BEGIN_SRC d -} 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 (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; #+END_SRC ****** in block: table :table: #+NAME: abs_in_loop_body_non_code_obj #+BEGIN_SRC d -} 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 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; + } #+END_SRC ***** not identified as being within block group (could still be, or not) [+3] @@ -1127,11 +1160,10 @@ if there is a blurb section you need to: #+NAME: abs_in_loop_body_open_block_obj_assert #+BEGIN_SRC d 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); #+END_SRC ****** catch misc +block open+ @@ -1143,7 +1175,7 @@ if (line.matchFirst(rgx.block_poem_open)) { / 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; #+END_SRC @@ -1157,11 +1189,11 @@ assert( "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); @@ -1183,7 +1215,7 @@ if (obj_type_status["blocks"] == eN.tri.closing) { 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); #+END_SRC ******* not book index [+1] @@ -1210,7 +1242,7 @@ if (line.matchFirst(rgx.book_index_item) 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; #+END_SRC @@ -1225,14 +1257,14 @@ if (line.matchFirst(rgx.book_index_item) && (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?? @@ -1249,15 +1281,15 @@ if (line.matchFirst(rgx.book_index_item) 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); } #+END_SRC @@ -1302,7 +1334,6 @@ an_object = line.flow_block_flag_line_empty_( obj_cite_digits, comp_obj_heading, cntr, - obj_type_status, pith, object_number_poem, conf_make_meta, @@ -1321,7 +1352,7 @@ assert( ~ line ~ "\"" ); assert( - (obj_type_status["blocks"] == eN.bi.off), + (pith["block_state"] == eN.blk_state.off), "code block status: none" ); #+END_SRC @@ -1452,7 +1483,7 @@ if ((obj_type_status["heading"] == eN.bi.on) 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"); @@ -1514,7 +1545,7 @@ if ((obj_type_status["heading"] == eN.bi.on) 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, @@ -3163,6 +3194,7 @@ functions used in document abstraction 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; @@ -3294,6 +3326,7 @@ functions used in document abstraction @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 ) { @@ -3321,9 +3354,9 @@ functions used in document abstraction 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; #+END_SRC ******* poem @@ -3342,10 +3375,10 @@ functions used in document abstraction ); } 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; #+END_SRC ******* group @@ -3363,9 +3396,9 @@ functions used in document abstraction 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; #+END_SRC ******* block @@ -3383,9 +3416,9 @@ functions used in document abstraction 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; #+END_SRC ******* quote @@ -3403,9 +3436,9 @@ functions used in document abstraction 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; #+END_SRC ******* table @@ -3420,11 +3453,11 @@ functions used in document abstraction ); } 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; #+END_SRC ******* table special @@ -3433,11 +3466,11 @@ functions used in document abstraction #+BEGIN_SRC d } 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; #+END_SRC ****** block (various) tic open :tic: @@ -3456,9 +3489,9 @@ functions used in document abstraction 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; #+END_SRC ******* poem @@ -3476,11 +3509,11 @@ functions used in document abstraction 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; #+END_SRC ******* group @@ -3498,9 +3531,9 @@ functions used in document abstraction 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; #+END_SRC ******* block @@ -3518,9 +3551,9 @@ functions used in document abstraction 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; #+END_SRC ******* quote @@ -3538,9 +3571,9 @@ functions used in document abstraction 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; #+END_SRC ******* table @@ -3555,11 +3588,11 @@ functions used in document abstraction ); } 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; } #+END_SRC @@ -3578,42 +3611,44 @@ functions used in document abstraction @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 } } } @@ -3678,11 +3713,10 @@ final string biblio_tag_map_()(string abr) { #+BEGIN_SRC d @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(); @@ -3806,38 +3840,40 @@ final string biblio_tag_map_()(string abr) { @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; @@ -3854,38 +3890,40 @@ final string biblio_tag_map_()(string abr) { @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; @@ -3903,38 +3941,40 @@ final string biblio_tag_map_()(string abr) { @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; @@ -3958,36 +3998,209 @@ why extra object stuff only in poem/verse? 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]; @@ -4010,181 +4223,10 @@ why extra object stuff only in poem/verse? 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; } } } @@ -4220,54 +4262,55 @@ you need: 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; @@ -4291,7 +4334,6 @@ process and use an_object["table_head"] (then empty it) 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 ) { @@ -4343,7 +4385,6 @@ process and use an_object["table_head"] (then empty it) 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, @@ -4355,10 +4396,9 @@ process and use an_object["table_head"] (then empty it) ~ 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(); #+END_SRC @@ -4366,325 +4406,333 @@ process and use an_object["table_head"] (then empty it) #+NAME: abs_functions_block_line_status_empty #+BEGIN_SRC d - 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; + 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; #+END_SRC ****** make: group block #+NAME: abs_functions_block_line_status_empty #+BEGIN_SRC d - } 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 (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; #+END_SRC ****** make: block #+NAME: abs_functions_block_line_status_empty #+BEGIN_SRC d - } 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 (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; #+END_SRC ****** make: poem #+NAME: abs_functions_block_line_status_empty #+BEGIN_SRC d - } 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 (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"); #+END_SRC ****** make: code block #+NAME: abs_functions_block_line_status_empty #+BEGIN_SRC d - } 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 (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; #+END_SRC ****** make: table #+NAME: abs_functions_block_line_status_empty #+BEGIN_SRC d - } 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; - } + } 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; + } #+END_SRC ***** } #+NAME: abs_functions_block_line_status_empty #+BEGIN_SRC d + } return an_object; } #+END_SRC @@ -4697,7 +4745,6 @@ process and use an_object["table_head"] (then empty it) 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, ) { @@ -4756,7 +4803,8 @@ process and use an_object["table_head"] (then empty it) 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) @@ -4842,7 +4890,8 @@ process and use an_object["table_head"] (then empty it) 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) @@ -4908,8 +4957,8 @@ process and use an_object["table_head"] (then empty it) 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 +/ @@ -5065,6 +5114,7 @@ process and use an_object["table_head"] (then empty it) 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(); @@ -7628,34 +7678,6 @@ struct NodeStructureMetadata { } #+END_SRC -**** assertions on blocks :blocks: - -#+NAME: abs_functions_assertions -#+BEGIN_SRC d -@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"); -} -#+END_SRC - *** doc sect keys seq #+NAME: template_doc_sect_keys_seq -- cgit v1.2.3