From 1eba4830ee85784dfe44e56be9508151349b7e4e Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 14 Mar 2017 12:25:23 -0400 Subject: org files minor touches --- src/sdp/ao_abstract_doc_source.d | 621 ++++++++++++++++++++------------------- 1 file changed, 323 insertions(+), 298 deletions(-) (limited to 'src/sdp/ao_abstract_doc_source.d') diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d index 066ef3a..82341cd 100644 --- a/src/sdp/ao_abstract_doc_source.d +++ b/src/sdp/ao_abstract_doc_source.d @@ -234,7 +234,7 @@ template SiSUdocAbstraction() { Opt opt_action_bool, ) { auto rgx = Rgx(); - debug(asserts){ + debug(asserts) { static assert(is(typeof(markup_sourcefile_content) == char[][])); static assert(is(typeof(dochead_make_aa) == string[string][string])); static assert(is(typeof(dochead_meta_aa) == string[string][string])); @@ -386,6 +386,7 @@ template SiSUdocAbstraction() { } else if (!matchFirst(line, rgx.skip_from_regular_parse)) { /+ object other than "code block" object (includes regular text paragraph, headings & blocks other than code) +/ + /+ heading, glossary, blurb, poem, group, block, quote, table +/ if ((matchFirst(line, rgx.heading_biblio) || (type["biblio_section"] == State.on && (!matchFirst(line, rgx.heading_blurb_glossary)))) @@ -556,10 +557,6 @@ template SiSUdocAbstraction() { type["ocn_status"] = TriState.off; } continue; - } else if (type["poem"] == TriState.on) { - /+ within block object: poem +/ - _poem_block_(line, an_object, type, cntr, obj_cite_number_poem, dochead_make_aa); - continue; /+ within block object: group +/ } else if (type["group"] == TriState.on) { /+ within block object: group +/ @@ -569,6 +566,10 @@ template SiSUdocAbstraction() { /+ within block object: block +/ _block_block_(line, an_object, type); continue; + } else if (type["poem"] == TriState.on) { + /+ within block object: poem +/ + _poem_block_(line, an_object, type, cntr, obj_cite_number_poem, dochead_make_aa); + continue; } else if (type["quote"] == TriState.on) { /+ within block object: quote +/ _quote_block_(line, an_object, type); @@ -789,7 +790,8 @@ template SiSUdocAbstraction() { an_object.remove("lev_markup_number"); processing.remove("verse"); ++cntr; - } else if ((type["para"] == State.on) && (line_occur["para"] > State.off)) { + } else if ((type["para"] == State.on) + && (line_occur["para"] > State.off)) { /+ paragraph object (current line empty) +/ obj_cite_number = ocn_emit(type["ocn_status"]); an_object["bookindex_nugget"] = @@ -846,10 +848,9 @@ template SiSUdocAbstraction() { /+ unless (the_document_body_section.length == 0) ? +/ if (the_document_body_section.length > 0) { if (((the_document_body_section[$-1].is_a == "para") - || (the_document_body_section[$-1].is_a == "heading") - || (the_document_body_section[$-1].is_a == "group")) - && (the_document_body_section.length > previous_length) - ) { + || (the_document_body_section[$-1].is_a == "heading") + || (the_document_body_section[$-1].is_a == "group")) + && (the_document_body_section.length > previous_length)) { if ((the_document_body_section[$-1].is_a == "heading") && (the_document_body_section[$-1].heading_lev_markup < 5)) { type["biblio_section"] = State.off; @@ -1603,7 +1604,7 @@ template SiSUdocAbstraction() { } /+ ← closed: abstract doc source +/ /+ ↓ abstraction functions +/ auto object_reset(O)(ref O an_object) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(an_object) == string[string])); } an_object.remove("body_nugget"); @@ -1617,7 +1618,7 @@ template SiSUdocAbstraction() { return ref O an_object, return ref T type ) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(line_occur) == int[string])); static assert(is(typeof(an_object) == string[string])); static assert(is(typeof(type) == int[string])); @@ -1632,7 +1633,7 @@ template SiSUdocAbstraction() { L line, return ref T type ) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(line) == char[])); static assert(is(typeof(type) == int[string])); } @@ -1682,7 +1683,7 @@ template SiSUdocAbstraction() { return ref T type, N obj_cite_number_poem ) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(line) == char[])); static assert(is(typeof(type) == int[string])); static assert(is(typeof(obj_cite_number_poem) == string[string])); @@ -1754,8 +1755,8 @@ template SiSUdocAbstraction() { line ); } - type["blocks"] = TriState.on; - type["table"] = TriState.on; + type["blocks"] = TriState.on; + type["table"] = TriState.on; type["curly_table"] = TriState.on; } else if (matchFirst(line, rgx.block_tic_code_open)) { /+ tic code open +/ @@ -1822,8 +1823,8 @@ template SiSUdocAbstraction() { line ); } - type["blocks"] = TriState.on; - type["table"] = TriState.on; + type["blocks"] = TriState.on; + type["table"] = TriState.on; type["tic_table"] = TriState.on; } } @@ -1832,7 +1833,7 @@ template SiSUdocAbstraction() { return ref O an_object, return ref T type ) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(line) == char[])); static assert(is(typeof(an_object) == string[string])); static assert(is(typeof(type) == int[string])); @@ -1869,7 +1870,7 @@ template SiSUdocAbstraction() { } } final string biblio_tag_map(A)(A abr) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(abr) == string)); } auto btm = [ @@ -2013,6 +2014,88 @@ template SiSUdocAbstraction() { } } // + void _group_block_(L,O,T)( + return ref L line, + return ref O an_object, + return ref T type + ) { + debug(asserts) { + static assert(is(typeof(line) == char[])); + static assert(is(typeof(an_object) == string[string])); + static assert(is(typeof(type) == int[string])); + } + auto rgx = Rgx(); + if (type["curly_group"] == State.on) { + if (matchFirst(line, rgx.block_curly_group_close)) { + debug(group) { + writeln(line); + } + type["blocks"] = TriState.closing; + type["group"] = TriState.closing; + type["curly_group"] = TriState.off; + } else { + debug(group) { + writeln(line); + } + an_object[an_object_key] ~= line ~= "\n"; // build group array (or string) + } + } else if (type["tic_group"] == TriState.on) { + if (matchFirst(line, rgx.block_tic_close)) { + debug(group) { + writeln(line); + } + type["blocks"] = TriState.closing; + type["group"] = TriState.closing; + type["tic_group"] = TriState.off; + } else { + debug(group) { // group + writeln(line); + } + an_object[an_object_key] ~= line ~= "\n"; // build group array (or string) + } + } + } + void _block_block_(L,O,T)( + return ref L line, + return ref O an_object, + return ref T type + ) { + debug(asserts) { + static assert(is(typeof(line) == char[])); + static assert(is(typeof(an_object) == string[string])); + static assert(is(typeof(type) == int[string])); + } + auto rgx = Rgx(); + if (type["curly_block"] == TriState.on) { + if (matchFirst(line, rgx.block_curly_block_close)) { + debug(block) { // block (curly) close + writeln(line); + } + type["blocks"] = TriState.closing; + type["block"] = TriState.closing; + type["curly_block"] = TriState.off; + } else { + debug(block) { + writeln(line); + } + an_object[an_object_key] ~= line ~= "\n"; // build block array (or string) + } + } else if (type["tic_block"] == TriState.on) { + if (matchFirst(line, rgx.block_tic_close)) { + debug(block) { + writeln(line); + } + type["blocks"] = TriState.closing; + type["block"] = TriState.closing; + type["tic_block"] = TriState.off; + } else { + debug(block) { + writeln(line); + } + an_object[an_object_key] ~= line ~= "\n"; // build block array (or string) + } + } + } void _poem_block_(L,O,T,C,N,Ma)( L line, return ref O an_object, @@ -2021,7 +2104,7 @@ template SiSUdocAbstraction() { N obj_cite_number_poem, Ma dochead_make_aa, ) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(line) == char[])); static assert(is(typeof(an_object) == string[string])); static assert(is(typeof(type) == int[string])); @@ -2227,94 +2310,12 @@ template SiSUdocAbstraction() { } } } - void _group_block_(L,O,T)( - return ref L line, - return ref O an_object, - return ref T type - ) { - debug(asserts){ - static assert(is(typeof(line) == char[])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(type) == int[string])); - } - auto rgx = Rgx(); - if (type["curly_group"] == State.on) { - if (matchFirst(line, rgx.block_curly_group_close)) { - debug(group) { // group (curly) close - writeln(line); - } - type["blocks"] = TriState.closing; - type["group"] = TriState.closing; - type["curly_group"] = TriState.off; - } else { - debug(group) { // group - writeln(line); - } - an_object[an_object_key] ~= line ~= "\n"; // build group array (or string) - } - } else if (type["tic_group"] == TriState.on) { - if (matchFirst(line, rgx.block_tic_close)) { - debug(group) { // group (tic) close - writeln(line); - } - type["blocks"] = TriState.closing; - type["group"] = TriState.closing; - type["tic_group"] = TriState.off; - } else { - debug(group) { // group - writeln(line); - } - an_object[an_object_key] ~= line ~= "\n"; // build group array (or string) - } - } - } - void _block_block_(L,O,T)( - return ref L line, - return ref O an_object, - return ref T type - ) { - debug(asserts){ - static assert(is(typeof(line) == char[])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(type) == int[string])); - } - auto rgx = Rgx(); - if (type["curly_block"] == TriState.on) { - if (matchFirst(line, rgx.block_curly_block_close)) { - debug(block) { // block (curly) close - writeln(line); - } - type["blocks"] = TriState.closing; - type["block"] = TriState.closing; - type["curly_block"] = TriState.off; - } else { - debug(block) { // block - writeln(line); - } - an_object[an_object_key] ~= line ~= "\n"; // build block array (or string) - } - } else if (type["tic_block"] == TriState.on) { - if (matchFirst(line, rgx.block_tic_close)) { - debug(block) { // block (tic) close - writeln(line); - } - type["blocks"] = TriState.closing; - type["block"] = TriState.closing; - type["tic_block"] = TriState.off; - } else { - debug(block) { // block - writeln(line); - } - an_object[an_object_key] ~= line ~= "\n"; // build block array (or string) - } - } - } void _quote_block_(L,O,T)( return ref L line, return ref O an_object, return ref T type ) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(line) == char[])); static assert(is(typeof(an_object) == string[string])); static assert(is(typeof(type) == int[string])); @@ -2325,8 +2326,8 @@ template SiSUdocAbstraction() { debug(quote) { // quote (curly) close writeln(line); } - type["blocks"] = TriState.closing; - type["quote"] = TriState.closing; + type["blocks"] = TriState.closing; + type["quote"] = TriState.closing; type["curly_quote"] = TriState.off; } else { debug(quote) { @@ -2339,8 +2340,8 @@ template SiSUdocAbstraction() { debug(quote) { // quote (tic) close writeln(line); } - type["blocks"] = TriState.closing; - type["quote"] = TriState.closing; + type["blocks"] = TriState.closing; + type["quote"] = TriState.closing; type["tic_quote"] = TriState.off; } else { debug(quote) { @@ -2355,7 +2356,7 @@ template SiSUdocAbstraction() { return ref O an_object, return ref T type ) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(line) == char[])); static assert(is(typeof(an_object) == string[string])); static assert(is(typeof(type) == int[string])); @@ -2392,8 +2393,8 @@ template SiSUdocAbstraction() { } } void _block_flag_line_empty_(B)( - B bookindex_extract_hash, - char[] line, + B bookindex_extract_hash, + char[] line, return ref string[string] an_object, return ref ObjGenericComposite[] the_document_body_section, return ref string[][string][string] bookindex_unordered_hashes, @@ -2414,14 +2415,18 @@ template SiSUdocAbstraction() { "code block status: closed" ); assertions_flag_types_block_status_none_or_closed(type); - if (type["code"] == TriState.closing) { + if (type["group"] == TriState.closing) { obj_cite_number = ocn_emit(type["ocn_status"]); 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_number, segment_anchor_tag_that_object_belongs_to); - an_object["is"] = "code"; + bookindex_extract_hash.bookindex_nugget_hash( + an_object["bookindex_nugget"], + obj_cite_number, + segment_anchor_tag_that_object_belongs_to + ); + an_object["is"] = "group"; auto comp_obj_location = node_construct.node_location_emitter( content_non_header, @@ -2435,57 +2440,33 @@ template SiSUdocAbstraction() { obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; - comp_obj_code = comp_obj_code.init; - comp_obj_code.use = "body"; - comp_obj_code.is_of = "block"; - comp_obj_code.is_a = "code"; - comp_obj_code.ocn = obj_cite_number; - comp_obj_code.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); - comp_obj_code.text = an_object["substantive"]; - comp_obj_code.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; - comp_obj_code.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; - comp_obj_code.inline_links = substantive_obj_misc_tuple[sObj.links]; - the_document_body_section ~= comp_obj_code; + comp_obj_block = comp_obj_block.init; + comp_obj_block.use = "body"; + comp_obj_block.is_of = "block"; + comp_obj_block.is_a = "group"; + comp_obj_block.ocn = obj_cite_number; + comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_block.text = an_object["substantive"]; + comp_obj_block.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links]; + the_document_body_section ~= comp_obj_block; + type["blocks"] = TriState.off; + type["group"] = TriState.off; object_reset(an_object); processing.remove("verse"); ++cntr; - type["blocks"] = TriState.off; - type["code"] = TriState.off; - } else if (type["poem"] == TriState.closing) { + } else if (type["block"] == TriState.closing) { + obj_cite_number = ocn_emit(type["ocn_status"]); 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_number, segment_anchor_tag_that_object_belongs_to); - an_object["is"] = "verse"; // check also - auto comp_obj_location = - node_construct.node_location_emitter( - content_non_header, - segment_anchor_tag_that_object_belongs_to, + bookindex_extract_hash.bookindex_nugget_hash( + an_object["bookindex_nugget"], obj_cite_number, - cntr, - heading_ptr-1, - an_object["is"] + segment_anchor_tag_that_object_belongs_to ); - comp_obj_poem_ocn = comp_obj_poem_ocn.init; - comp_obj_poem_ocn.use = "body"; - comp_obj_poem_ocn.is_of = "block"; - comp_obj_poem_ocn.is_a = "poem"; - comp_obj_poem_ocn.ocn = obj_cite_number; - comp_obj_poem_ocn.obj_cite_number = (obj_cite_number_poem["start"], obj_cite_number_poem["end"]); - comp_obj_poem_ocn.text = ""; // an_object["substantive"]; - the_document_body_section ~= comp_obj_poem_ocn; - object_reset(an_object); - processing.remove("verse"); - type["blocks"] = TriState.off; - type["poem"] = TriState.off; - } else if (type["table"] == TriState.closing) { - obj_cite_number = - ocn_emit(type["ocn_status"]); - 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_number, segment_anchor_tag_that_object_belongs_to); - an_object["is"] = "table"; + an_object["is"] = "block"; auto comp_obj_location = node_construct.node_location_emitter( content_non_header, @@ -2494,7 +2475,7 @@ template SiSUdocAbstraction() { cntr, heading_ptr-1, an_object["is"] - ); + ); auto substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; @@ -2502,7 +2483,7 @@ template SiSUdocAbstraction() { comp_obj_block = comp_obj_block.init; comp_obj_block.use = "body"; comp_obj_block.is_of = "block"; - comp_obj_block.is_a = "table"; + comp_obj_block.is_a = "block"; comp_obj_block.ocn = obj_cite_number; comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); comp_obj_block.text = an_object["substantive"]; @@ -2510,19 +2491,23 @@ template SiSUdocAbstraction() { comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; + type["blocks"] = TriState.off; + type["block"] = TriState.off; object_reset(an_object); processing.remove("verse"); ++cntr; - type["blocks"] = TriState.off; - type["table"] = TriState.off; - } else if (type["group"] == TriState.closing) { + } else if (type["code"] == TriState.closing) { obj_cite_number = ocn_emit(type["ocn_status"]); 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_number, segment_anchor_tag_that_object_belongs_to); - an_object["is"] = "group"; + bookindex_extract_hash.bookindex_nugget_hash( + an_object["bookindex_nugget"], + obj_cite_number, + segment_anchor_tag_that_object_belongs_to + ); + an_object["is"] = "code"; auto comp_obj_location = node_construct.node_location_emitter( content_non_header, @@ -2536,29 +2521,32 @@ template SiSUdocAbstraction() { obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; - comp_obj_block = comp_obj_block.init; - comp_obj_block.use = "body"; - comp_obj_block.is_of = "block"; - comp_obj_block.is_a = "group"; - comp_obj_block.ocn = obj_cite_number; - comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); - comp_obj_block.text = an_object["substantive"]; - comp_obj_block.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; - comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; - comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links]; - the_document_body_section ~= comp_obj_block; + comp_obj_code = comp_obj_code.init; + comp_obj_code.use = "body"; + comp_obj_code.is_of = "block"; + comp_obj_code.is_a = "code"; + comp_obj_code.ocn = obj_cite_number; + comp_obj_code.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_code.text = an_object["substantive"]; + comp_obj_code.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_code.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_code.inline_links = substantive_obj_misc_tuple[sObj.links]; + the_document_body_section ~= comp_obj_code; + type["blocks"] = TriState.off; + type["code"] = TriState.off; object_reset(an_object); processing.remove("verse"); ++cntr; - type["blocks"] = TriState.off; - type["group"] = TriState.off; - } else if (type["block"] == TriState.closing) { - obj_cite_number = ocn_emit(type["ocn_status"]); + } else if (type["poem"] == TriState.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_number, segment_anchor_tag_that_object_belongs_to); - an_object["is"] = "block"; + bookindex_extract_hash.bookindex_nugget_hash( + an_object["bookindex_nugget"], + obj_cite_number, + segment_anchor_tag_that_object_belongs_to + ); + an_object["is"] = "verse"; // check also auto comp_obj_location = node_construct.node_location_emitter( content_non_header, @@ -2567,15 +2555,48 @@ template SiSUdocAbstraction() { cntr, heading_ptr-1, an_object["is"] - ); + ); + comp_obj_poem_ocn = comp_obj_poem_ocn.init; + comp_obj_poem_ocn.use = "body"; + comp_obj_poem_ocn.is_of = "block"; + comp_obj_poem_ocn.is_a = "poem"; + comp_obj_poem_ocn.ocn = obj_cite_number; + comp_obj_poem_ocn.obj_cite_number = (obj_cite_number_poem["start"], obj_cite_number_poem["end"]); + comp_obj_poem_ocn.text = ""; // an_object["substantive"]; + the_document_body_section ~= comp_obj_poem_ocn; + type["blocks"] = TriState.off; + type["poem"] = TriState.off; + object_reset(an_object); + processing.remove("verse"); + } else if (type["quote"] == TriState.closing) { + obj_cite_number = + ocn_emit(type["ocn_status"]); + 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_number, + segment_anchor_tag_that_object_belongs_to + ); + an_object["is"] = "quote"; + auto comp_obj_location = + node_construct.node_location_emitter( + content_non_header, + segment_anchor_tag_that_object_belongs_to, + obj_cite_number, + cntr, + heading_ptr-1, + an_object["is"] + ); auto substantive_obj_misc_tuple = - obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); - an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); // ... + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; // ... anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; comp_obj_block.use = "body"; comp_obj_block.is_of = "block"; - comp_obj_block.is_a = "block"; + comp_obj_block.is_a = "quote"; comp_obj_block.ocn = obj_cite_number; comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); comp_obj_block.text = an_object["substantive"]; @@ -2587,15 +2608,19 @@ template SiSUdocAbstraction() { processing.remove("verse"); ++cntr; type["blocks"] = TriState.off; - type["block"] = TriState.off; - } else if (type["quote"] == TriState.closing) { + type["quote"] = TriState.off; + } else if (type["table"] == TriState.closing) { obj_cite_number = ocn_emit(type["ocn_status"]); 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_number, segment_anchor_tag_that_object_belongs_to); - an_object["is"] = "quote"; + bookindex_extract_hash.bookindex_nugget_hash( + an_object["bookindex_nugget"], + obj_cite_number, + segment_anchor_tag_that_object_belongs_to + ); + an_object["is"] = "table"; auto comp_obj_location = node_construct.node_location_emitter( content_non_header, @@ -2606,13 +2631,13 @@ template SiSUdocAbstraction() { an_object["is"] ); auto substantive_obj_misc_tuple = - obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); // ... - an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; // ... + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; comp_obj_block.use = "body"; comp_obj_block.is_of = "block"; - comp_obj_block.is_a = "quote"; + comp_obj_block.is_a = "table"; comp_obj_block.ocn = obj_cite_number; comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); comp_obj_block.text = an_object["substantive"]; @@ -2620,11 +2645,11 @@ template SiSUdocAbstraction() { comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; + type["blocks"] = TriState.off; + type["table"] = TriState.off; object_reset(an_object); processing.remove("verse"); ++cntr; - type["blocks"] = TriState.off; - type["quote"] = TriState.off; } } auto _book_index_(L,I,O,T,B)( @@ -2634,7 +2659,7 @@ template SiSUdocAbstraction() { return ref T type, B opt_action_bool, ) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(line) == char[])); static assert(is(typeof(book_idx_tmp) == string)); static assert(is(typeof(an_object) == string[string])); @@ -2693,7 +2718,7 @@ template SiSUdocAbstraction() { return ref R heading_match_rgx, return ref T type ) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(line) == char[])); static assert(is(typeof(dochead_make_identify_unmarked_headings) == string)); static assert(is(typeof(heading_match_str) == string[string])); @@ -2784,7 +2809,7 @@ template SiSUdocAbstraction() { return ref R heading_match_rgx, return ref T type ) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(line) == char[])); static assert(is(typeof(line_occur) == int[string])); static assert(is(typeof(heading_match_rgx) == Regex!(char)[string])); @@ -2850,7 +2875,7 @@ template SiSUdocAbstraction() { return ref T type, return ref Me dochead_meta_aa, ) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(line) == char[])); static assert(is(typeof(line_occur) == int[string])); static assert(is(typeof(an_object) == string[string])); @@ -3004,7 +3029,7 @@ template SiSUdocAbstraction() { return ref T type, return ref C line_occur, ) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(line) == char[])); static assert(is(typeof(an_object) == string[string])); static assert(is(typeof(an_object_key) == string)); @@ -3105,7 +3130,7 @@ template SiSUdocAbstraction() { n_foot_sp_plus = 0; } string url_links(Ot)(Ot obj_txt_in) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(obj_txt_in) == string)); } /+ url matched +/ @@ -3159,7 +3184,7 @@ template SiSUdocAbstraction() { return obj_txt_in; } auto footnotes_endnotes_markup_and_number_or_stars(Ot)(Ot obj_txt_in, bool reset_note_numbers) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(obj_txt_in) == string)); } /+ endnotes (regular) +/ @@ -3216,7 +3241,7 @@ template SiSUdocAbstraction() { } private auto object_notes_and_links_(Ot)(Ot obj_txt_in, bool reset_note_numbers=false) in { - debug(asserts){ + debug(asserts) { assert(is(typeof(obj_txt_in) == string)); } } @@ -3270,17 +3295,18 @@ template SiSUdocAbstraction() { } invariant() { } - auto para(Ot)(Ot obj_txt_in) + auto munge_heading(Ot)(Ot obj_txt_in, bool reset_note_numbers=false) in { - debug(asserts){ + debug(asserts) { static assert(is(typeof(obj_txt_in) == string)); } } body { obj_txt["munge"]=(obj_txt_in) - .replaceFirst(rgx.para_attribs, "") - .replaceFirst(rgx.obj_cite_number_off_all, ""); - auto t = object_notes_and_links_(obj_txt["munge"]); + .replaceFirst(rgx.heading, "") + .replaceFirst(rgx.obj_cite_number_off_all, "") + .strip; + auto t = object_notes_and_links_(obj_txt["munge"], reset_note_numbers); debug(munge) { writeln(__LINE__); writeln(obj_txt_in); @@ -3289,18 +3315,19 @@ template SiSUdocAbstraction() { } return t; } - auto heading(Ot)(Ot obj_txt_in, bool reset_note_numbers=false) + invariant() { + } + auto munge_para(Ot)(Ot obj_txt_in) in { - debug(asserts){ + debug(asserts) { static assert(is(typeof(obj_txt_in) == string)); } } body { obj_txt["munge"]=(obj_txt_in) - .replaceFirst(rgx.heading, "") - .replaceFirst(rgx.obj_cite_number_off_all, "") - .strip; - auto t = object_notes_and_links_(obj_txt["munge"], reset_note_numbers); + .replaceFirst(rgx.para_attribs, "") + .replaceFirst(rgx.obj_cite_number_off_all, ""); + auto t = object_notes_and_links_(obj_txt["munge"]); debug(munge) { writeln(__LINE__); writeln(obj_txt_in); @@ -3309,22 +3336,7 @@ template SiSUdocAbstraction() { } return t; } - invariant() { - } - string code(Ot)(Ot obj_txt_in) - in { - debug(asserts){ - assert(is(typeof(obj_txt_in) == string)); - } - } - body { - obj_txt_in = (obj_txt_in).replaceAll(rgx.two_spaces, mkup.nbsp ~ mkup.nbsp); - obj_txt["munge"] = obj_txt_in; - return obj_txt["munge"]; - } - invariant() { - } - auto group(string obj_txt_in) + auto munge_group(string obj_txt_in) in { } body { obj_txt["munge"]=obj_txt_in; @@ -3333,9 +3345,9 @@ template SiSUdocAbstraction() { } invariant() { } - auto block(Ot)(Ot obj_txt_in) + auto munge_block(Ot)(Ot obj_txt_in) in { - debug(asserts){ + debug(asserts) { static assert(is(typeof(obj_txt_in) == string)); } } @@ -3346,9 +3358,9 @@ template SiSUdocAbstraction() { } invariant() { } - auto verse(Ot)(Ot obj_txt_in) + auto munge_verse(Ot)(Ot obj_txt_in) in { - debug(asserts){ + debug(asserts) { static assert(is(typeof(obj_txt_in) == string)); } } @@ -3359,9 +3371,22 @@ template SiSUdocAbstraction() { } invariant() { } - string quote(Ot)(Ot obj_txt_in) + string munge_code(Ot)(Ot obj_txt_in) in { - debug(asserts){ + debug(asserts) { + assert(is(typeof(obj_txt_in) == string)); + } + } + body { + obj_txt_in = (obj_txt_in).replaceAll(rgx.two_spaces, mkup.nbsp ~ mkup.nbsp); + obj_txt["munge"] = obj_txt_in; + return obj_txt["munge"]; + } + invariant() { + } + string munge_table(Ot)(Ot obj_txt_in) + in { + debug(asserts) { static assert(is(typeof(obj_txt_in) == string)); } } @@ -3371,9 +3396,9 @@ template SiSUdocAbstraction() { } invariant() { } - string table(Ot)(Ot obj_txt_in) + string munge_quote(Ot)(Ot obj_txt_in) in { - debug(asserts){ + debug(asserts) { static assert(is(typeof(obj_txt_in) == string)); } } @@ -3383,9 +3408,9 @@ template SiSUdocAbstraction() { } invariant() { } - string comment(Ot)(Ot obj_txt_in) + string munge_comment(Ot)(Ot obj_txt_in) in { - debug(asserts){ + debug(asserts) { static assert(is(typeof(obj_txt_in) == string)); } } @@ -3406,15 +3431,15 @@ template SiSUdocAbstraction() { Ma dochead_make_aa ) in { - debug(asserts){ + debug(asserts) { static assert(is(typeof(obj_) == string[string])); static assert(is(typeof(obj_key_) == string)); static assert(is(typeof(dochead_make_aa) == string[string][string])); } } body { - obj_txt["munge"]=obj_[obj_key_].dup; - obj_txt["munge"]=(match(obj_["is"], ctRegex!(`verse|code`))) + obj_txt["munge"] = obj_[obj_key_].dup; + obj_txt["munge"] = (match(obj_["is"], ctRegex!(`verse|code`))) ? obj_txt["munge"] : strip(obj_txt["munge"]); static __gshared string[] anchor_tags_ = []; @@ -3435,37 +3460,38 @@ template SiSUdocAbstraction() { } else if (obj_["lev"] == "1") { writeln("heading anchor tag missing: ", obj_txt["munge"]); } - x =munge.heading(obj_txt["munge"], reset_note_numbers); + x =munge.munge_heading(obj_txt["munge"], reset_note_numbers); reset_note_numbers=false; goto default; case "para": - x = munge.para(obj_txt["munge"]); + x = munge.munge_para(obj_txt["munge"]); goto default; case "group": - x = munge.group(obj_txt["munge"]); + x = munge.munge_group(obj_txt["munge"]); goto default; case "block": - x = munge.block(obj_txt["munge"]); + x = munge.munge_block(obj_txt["munge"]); goto default; case "verse": - x = munge.verse(obj_txt["munge"]); + x = munge.munge_verse(obj_txt["munge"]); goto default; case "code": - obj_txt["munge"]=munge.code(obj_txt["munge"]); - break; - case "quote": - obj_txt["munge"]=munge.quote(obj_txt["munge"]); + obj_txt["munge"] = munge.munge_code(obj_txt["munge"]); break; case "table": - obj_txt["munge"]=munge.table(obj_txt["munge"]); + obj_txt["munge"] = munge.munge_table(obj_txt["munge"]); + break; + case "quote": + obj_txt["munge"] = munge.munge_quote(obj_txt["munge"]); break; case "comment": - obj_txt["munge"]=munge.comment(obj_txt["munge"]); + obj_txt["munge"] = munge.munge_comment(obj_txt["munge"]); break; case "doc_end_reset": munge.initialize_note_numbers(); break; default: + /+ para, heading, group, block, verse +/ obj_txt["munge"]=x[0]; obj_notes_and_links["notes_reg"] = x[1]; obj_notes_and_links["notes_star"] = x[2]; @@ -3487,7 +3513,7 @@ template SiSUdocAbstraction() { auto _clean_heading_toc_(Toc)( Toc heading_toc_, ) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(heading_toc_) == char[])); } auto m = matchFirst(cast(char[]) heading_toc_, rgx.heading); @@ -3505,7 +3531,7 @@ template SiSUdocAbstraction() { Toc the_table_of_contents_section, ) in { - debug(asserts){ + debug(asserts) { static assert(is(typeof(obj_) == string[string])); static assert(is(typeof(dochead_make_aa) == string[string][string])); static assert(is(typeof(segment_anchor_tag_that_object_belongs_to) == string)); @@ -3662,13 +3688,12 @@ template SiSUdocAbstraction() { O obj_, Ma dochead_make_aa ) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(munge_) == string)); static assert(is(typeof(obj_) == string[string])); static assert(is(typeof(dochead_make_aa) == string[string][string])); } if (dochead_make_aa["make"]["num_top"].length > 0) { - // if (!(match(munge_, rgx.heading_anchor_tag))) { static __gshared int heading_num_top_level=9; static __gshared int heading_num_depth=2; static __gshared int heading_num_0 = 0; @@ -3796,7 +3821,7 @@ template SiSUdocAbstraction() { static string _make_segment_anchor_tags_if_none_provided(M,Lv)(M munge_, Lv lev_) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(munge_) == string)); static assert(is(typeof(lev_) == string)); } @@ -3875,7 +3900,7 @@ template SiSUdocAbstraction() { OH _comp_obj_heading, ) in { - debug(asserts){ + debug(asserts) { static assert(is(typeof(obj_is_) == string)); static assert(is(typeof(obj_raw) == string)); static assert(is(typeof(_comp_obj_heading) == ObjGenericComposite)); @@ -3942,7 +3967,7 @@ template SiSUdocAbstraction() { string _obj_attributes; string _para_and_blocks(Ot)(Ot obj_txt_in) in { - debug(asserts){ + debug(asserts) { static assert(is(typeof(obj_txt_in) == string)); } } @@ -3970,121 +3995,121 @@ template SiSUdocAbstraction() { } return _obj_attributes; } - string _para(Ot)(Ot obj_txt_in) + string _heading(Ot)(Ot obj_txt_in) in { - debug(asserts){ + debug(asserts) { static assert(is(typeof(obj_txt_in) == string)); } } body { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"para\"," - ~ " \"is\": \"para\""; + ~ " \"is\": \"heading\""; return _obj_attributes; } invariant() { } - string _heading(Ot)(Ot obj_txt_in) + string _para(Ot)(Ot obj_txt_in) in { - debug(asserts){ + debug(asserts) { static assert(is(typeof(obj_txt_in) == string)); } } body { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"para\"," - ~ " \"is\": \"heading\""; + ~ " \"is\": \"para\""; return _obj_attributes; } invariant() { } - string _code(Ot)(Ot obj_txt_in) + string _group(Ot)(Ot obj_txt_in) in { - debug(asserts){ + debug(asserts) { static assert(is(typeof(obj_txt_in) == string)); } } body { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," - ~ " \"is\": \"code\""; + ~ " \"is\": \"group\""; return _obj_attributes; } invariant() { } - string _group(Ot)(Ot obj_txt_in) + string _block(Ot)(Ot obj_txt_in) in { - debug(asserts){ + debug(asserts) { static assert(is(typeof(obj_txt_in) == string)); } } body { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," - ~ " \"is\": \"group\""; + ~ " \"is\": \"block\""; return _obj_attributes; } invariant() { } - string _block(Ot)(Ot obj_txt_in) + string _verse(Ot)(Ot obj_txt_in) in { - debug(asserts){ + debug(asserts) { static assert(is(typeof(obj_txt_in) == string)); } } body { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," - ~ " \"is\": \"block\""; + ~ " \"is\": \"verse\""; return _obj_attributes; } invariant() { } - string _verse(Ot)(Ot obj_txt_in) + string _code(Ot)(Ot obj_txt_in) in { - debug(asserts){ + debug(asserts) { static assert(is(typeof(obj_txt_in) == string)); } } body { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," - ~ " \"is\": \"verse\""; + ~ " \"is\": \"code\""; return _obj_attributes; } invariant() { } - string _quote(Ot)(Ot obj_txt_in) + string _table(Ot)(Ot obj_txt_in) in { - debug(asserts){ + debug(asserts) { static assert(is(typeof(obj_txt_in) == string)); } } body { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," - ~ " \"is\": \"quote\""; + ~ " \"is\": \"table\""; return _obj_attributes; } invariant() { } - string _table(Ot)(Ot obj_txt_in) + string _quote(Ot)(Ot obj_txt_in) in { - debug(asserts){ + debug(asserts) { static assert(is(typeof(obj_txt_in) == string)); } } body { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," - ~ " \"is\": \"table\""; + ~ " \"is\": \"quote\""; return _obj_attributes; } invariant() { } string _comment(Ot)(Ot obj_txt_in) in { - debug(asserts){ + debug(asserts) { static assert(is(typeof(obj_txt_in) == string)); } } @@ -4101,7 +4126,7 @@ template SiSUdocAbstraction() { Oi obj_is_, OH _comp_obj_heading, ) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(_obj_attrib) == string)); static assert(is(typeof(obj_is_) == string)); static assert(is(typeof(_comp_obj_heading) == ObjGenericComposite)); @@ -4139,7 +4164,7 @@ template SiSUdocAbstraction() { S segment_anchor_tag, ) in { - debug(asserts){ + debug(asserts) { static assert(is(typeof(bookindex_section) == string)); static assert(is(typeof(obj_cite_number) == int)); } @@ -4213,7 +4238,7 @@ template SiSUdocAbstraction() { auto bookindex_report_indented(BI)( BI bookindex_unordered_hashes ) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(bookindex_unordered_hashes) == string[][string][string])); } auto mainkeys= @@ -4244,7 +4269,7 @@ template SiSUdocAbstraction() { auto bookindex_write_section(BI)( BI bookindex_unordered_hashes ) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(bookindex_unordered_hashes) == string[][string][string])); } auto mainkeys=bookindex_unordered_hashes.byKey.array.sort().release; @@ -4275,7 +4300,7 @@ template SiSUdocAbstraction() { N obj_cite_number, B opt_action_bool, ) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(bookindex_unordered_hashes) == string[][string][string])); static assert(is(typeof(obj_cite_number) == int)); static assert(is(typeof(opt_action_bool) == bool[string])); @@ -4597,7 +4622,7 @@ template SiSUdocAbstraction() { return ref BJ bib_arr_json ) in { - debug(asserts){ + debug(asserts) { static assert(is(typeof(biblio_unsorted_incomplete) == string[])); static assert(is(typeof(bib_arr_json) == JSONValue[])); } @@ -4628,7 +4653,7 @@ template SiSUdocAbstraction() { Bi biblio_unordered, return ref BJ bib_arr_json ) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(biblio_unordered) == string[])); static assert(is(typeof(bib_arr_json) == JSONValue[])); } @@ -4659,7 +4684,7 @@ template SiSUdocAbstraction() { return biblio_unsorted_array_of_json_objects; } final private JSONValue[] biblio_sort(BJ)(BJ biblio_unordered) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(biblio_unordered) == JSONValue[])); } JSONValue[] biblio_sorted_; @@ -4677,7 +4702,7 @@ template SiSUdocAbstraction() { return biblio_sorted_; } void biblio_debug(BJ)(BJ biblio_sorted) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(biblio_sorted) == JSONValue[])); } debug(biblio0) { @@ -4704,7 +4729,7 @@ template SiSUdocAbstraction() { I is_ ) in { - debug(asserts){ + debug(asserts) { static assert(is(typeof(lev_markup_number) == string)); static assert(is(typeof(segment_anchor_tag) == string)); static assert(is(typeof(obj_cite_number_) == int)); @@ -4770,7 +4795,7 @@ template SiSUdocAbstraction() { fL flag_links, ) in { - debug(asserts){ + debug(asserts) { static assert(is(typeof(_text) == string)); static assert(is(typeof(lev) == string)); static assert(is(typeof(lev_markup_number) == string)); @@ -4949,7 +4974,7 @@ template SiSUdocAbstraction() { O an_object, Lv lv ) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(an_object) == string[string])); static assert(is(typeof(lv) == int[string])); } @@ -5125,7 +5150,7 @@ template SiSUdocAbstraction() { } } auto assertions_flag_types_block_status_none_or_closed(T)(T type) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(type) == int[string])); } assert( -- cgit v1.2.3