From 24c9ed3645178a6ee2abbd9201fa4643dba068e2 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 14 May 2019 11:35:24 -0400 Subject: review, reduce use of auto --- org/meta_abstraction.org | 768 ++++++++++++++++------------------------------- 1 file changed, 266 insertions(+), 502 deletions(-) (limited to 'org/meta_abstraction.org') diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index 8f2b76a..35d443f 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -29,64 +29,61 @@ Process markup document, create document abstraction. +/ module doc_reform.meta.metadoc_from_src; template DocReformDocAbstraction() { - /+ ↓ abstraction imports +/ + /+ ↓ abstraction imports +/ <> - /+ ↓ abstraction mixins +/ + /+ ↓ abstraction mixins +/ <> - /+ ↓ abstraction struct init +/ + /+ ↓ abstraction struct init +/ <> <> - /+ ↓ abstract marked up document +/ - auto DocReformDocAbstraction(Src,CMM,Opt,Mfst)( - Src markup_sourcefile_content, - CMM conf_make_meta, - Opt opt_action, - Mfst manifest_matter, - bool _new_doc + /+ ↓ abstract marked up document +/ + auto DocReformDocAbstraction(CMM,Opt,Mf)( + char[][] markup_sourcefile_content, + CMM conf_make_meta, + Opt opt_action, + Mf manifest_matter, + bool _new_doc ) { static auto rgx = Rgx(); - debug(asserts) { - static assert(is(typeof(markup_sourcefile_content) == char[][])); - } - /+ ↓ abstraction init +/ + /+ ↓ abstraction init +/ <> - /+ abstraction init ↑ +/ + /+ abstraction init ↑ +/ <> - /+ ↓ ↻ loop markup document/text line by line +/ + /+ ↓ ↻ loop markup document/text line by line +/ srcDocLoop: - foreach (line; markup_sourcefile_content) { /+ ↓ markup document/text line by line +/ - // "line" variable can be empty but should never be null + 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"] == TriState.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) +/ - /+ heading, glossary, blurb, poem, group, block, quote, table +/ + } 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 +/ <> - } else { /+ not within a block group +/ + } else { /+ not within a block group +/ <> if (line.matchFirst(rgx.block_open)) { <> - } else if (!line.empty) { /+ line not empty +/ - /+ non blocks (headings, paragraphs) & closed blocks +/ + } else if (!line.empty) { /+ line not empty +/ + /+ non blocks (headings, paragraphs) & closed blocks +/ <> - } else if (obj_type_status["blocks"] == TriState.closing) { /+ line empty, with blocks flag +/ + } else if (obj_type_status["blocks"] == TriState.closing) { /+ line empty, with blocks flag +/ <> - } else { /+ line.empty, post contents, empty variables: +/ + } else { /+ line.empty, post contents, empty variables: +/ <> - } // close else for line empty - } // close else for not the above - } // close after non code, other blocks or regular text + } // close else for line empty + } // close else for not the above + } // close after non code, other blocks or regular text <> - } /+ ← srcDocLoop closed: loop markup document/text line by line +/ - /+ ↓ post loop markup document/text +/ + } /+ ← srcDocLoop closed: loop markup document/text line by line +/ + /+ ↓ post loop markup document/text +/ <> <> <> <> - /+ post loop markup document/text ↑ +/ - } /+ ← closed: abstract doc source +/ - /+ ↓ abstraction functions +/ + /+ post loop markup document/text ↑ +/ + } /+ ← closed: abstract doc source +/ + /+ ↓ abstraction functions +/ <> <> <> @@ -104,10 +101,10 @@ template DocReformDocAbstraction() { <> <> <> - /+ abstraction functions ↑ +/ - /+ ↓ abstraction function emitters +/ + /+ abstraction functions ↑ +/ + /+ ↓ abstraction function emitters +/ <> - /+ +/ + /+ +/ <> <> <> @@ -115,28 +112,28 @@ template DocReformDocAbstraction() { <> <> <> - /+ +/ + /+ +/ <> <> <> <> <> <> - /+ +/ + /+ +/ <> <> <> - /+ +/ + /+ +/ <> - /+ +/ + /+ +/ <> - /+ +/ + /+ +/ <> - /+ abstraction functions emitters ↑ +/ - /+ ↓ abstraction functions assertions +/ + /+ abstraction functions emitters ↑ +/ + /+ ↓ abstraction functions assertions +/ <> - /+ abstraction functions assertions ↑ +/ -} /+ ← closed: template DocReformDocAbstraction +/ + /+ abstraction functions assertions ↑ +/ +} /+ ← closed: template DocReformDocAbstraction +/ <> #+END_SRC @@ -247,9 +244,9 @@ enum DomTags { none, open, close, close_and_open, open_still, } #+name: abs_top_init_struct #+BEGIN_SRC d -pure auto obj_heading_ancestors(O)( - O obj, - string[] lv_ancestors_txt, +pure ObjGenericComposite obj_heading_ancestors()( + ObjGenericComposite obj, + string[] lv_ancestors_txt, ) { switch (obj.metainfo.heading_lev_markup) { case 0: @@ -306,10 +303,10 @@ pure auto obj_heading_ancestors(O)( #+name: abs_top_init_struct #+BEGIN_SRC d -pure auto obj_dom_structure_set_markup_tags(O)( - O obj, - int[] dom, - int lev +pure ObjGenericComposite obj_dom_structure_set_markup_tags()( + ObjGenericComposite obj, + int[] dom, + int lev ) { foreach (i; 0 .. 8) { if (i < lev) { @@ -356,10 +353,10 @@ pure auto obj_dom_structure_set_markup_tags(O)( #+name: abs_top_init_struct #+BEGIN_SRC d -pure auto obj_dom_set_collapsed_tags(O)( - O obj, - int[] dom, - int lev +pure ObjGenericComposite obj_dom_set_collapsed_tags()( + ObjGenericComposite obj, + int[] dom, + int lev ) { foreach (i; 0 .. 8) { if (i < lev) { @@ -420,7 +417,7 @@ static auto inline_markup_faces(L)(L line) { } return line; } -static auto links_and_images(L)(L obj_txt) { +static string links_and_images()(string obj_txt) { static auto rgx = Rgx(); static auto mkup = InlineMarkup(); if (obj_txt.match(rgx.smid_inline_url_generic)) { @@ -473,10 +470,10 @@ enum sObj { content, anchor_tag, notes_reg, notes_star, links, image_no_dimensio #+name: abs_inline_para_tag_associations #+BEGIN_SRC d -auto inline_para_link_anchor(O,St,TA)( - O an_object, - St tag_in_seg, - TA tag_assoc +string[string][string] inline_para_link_anchor()( + string[string] an_object, + string[string] tag_in_seg, + string[string][string] tag_assoc ) { static auto rgx = Rgx(); if (auto m = an_object["substantive"].match(rgx.inline_link_anchor)) { @@ -577,7 +574,7 @@ string[string] heading_match_str = [ "h_3": "^(none)", "h_4": "^(none)" ]; -auto heading_match_rgx = [ +Regex!char[string] heading_match_rgx = [ "h_A": regex(r"^(none)"), "h_B": regex(r"^(none)"), "h_C": regex(r"^(none)"), @@ -1711,7 +1708,7 @@ debug(bibliosection) { ***** bibliography components -auto biblio_entry_tags_jsonstr = `{ +JSONValue biblio_entry_tags_jsonstr = `{ "is" : "", "sortby_deemed_author_year_title" : "", "deemed_author" : "", @@ -2266,7 +2263,7 @@ Build here: #+name: abs_post #+BEGIN_SRC d -auto get_decendants(S)(S document_sections) { +auto get_decendants()(ObjGenericComposite[] document_sections) { int[string] _heading_ocn_decendants; string[] _ocn_open_key = ["","","","","","","",""]; auto _doc_sect_length = document_sections.length - 1; @@ -2320,7 +2317,7 @@ auto get_decendants(S)(S document_sections) { #+name: abs_post #+BEGIN_SRC d string[] _images; -auto extract_images(S)(S content_block) { +string[] extract_images()(string content_block) { string[] images_; if (auto m = content_block.matchAll(rgx.image)) { images_ ~= m.captures[1]; @@ -2923,7 +2920,7 @@ comp_obj_heading_ = comp_obj_heading_.obj_heading_ancestors(lv_ancestors_txt); #+name: abs_post #+BEGIN_SRC d -auto document_the = [ +ObjGenericComposite[][string] document_the = [ "head": the_document_head_section, "toc": the_table_of_contents_section, /+ substantive/body: +/ @@ -2985,8 +2982,8 @@ if ((opt_action.html) #+name: abs_post #+BEGIN_SRC d -auto segnames_4 = segnames["html"].dup; -auto segnames_lv1_to_4 = segnames["epub"].dup; +string[] segnames_4 = segnames["html"].dup; +string[] segnames_lv1_to_4 = segnames["epub"].dup; debug(segnames) { writeln("segnames_lv4: ", segnames_4); writeln("segnames_lv1_to_4: ", segnames_lv1_to_4); @@ -3096,10 +3093,7 @@ functions used in document abstraction #+name: abs_functions_object_reset #+BEGIN_SRC d -static auto object_reset(O)(O an_object) { - debug(asserts) { - static assert(is(typeof(an_object) == string[string])); - } +static string[string] object_reset()(string[string] an_object) { an_object.remove("body_nugget"); an_object.remove("substantive"); an_object.remove("is"); @@ -3113,16 +3107,11 @@ static auto object_reset(O)(O an_object) { #+name: abs_functions_header_set_common #+BEGIN_SRC d -auto flow_common_reset_(L,O,T)( - return ref L line_occur, - return ref O an_object, - return ref T obj_type_status +void flow_common_reset_()( + return ref int[string] line_occur, + return ref string[string] an_object, + return ref int[string] obj_type_status, ) { - debug(asserts) { - static assert(is(typeof(line_occur) == int[string])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(obj_type_status) == int[string])); - } line_occur["heading"] = State.off; line_occur["para"] = State.off; obj_type_status["heading"] = State.off; @@ -3135,14 +3124,10 @@ auto flow_common_reset_(L,O,T)( #+name: abs_functions_ocn_status #+BEGIN_SRC d -static auto _check_ocn_status_(L,T)( - L line, - T obj_type_status +static int[string] _check_ocn_status_()( + char[] line, + int[string] obj_type_status, ) { - debug(asserts) { - static assert(is(typeof(line) == char[])); - static assert(is(typeof(obj_type_status) == int[string])); - } static auto rgx = Rgx(); if (!(line.empty) && (obj_type_status["ocn_status_off_for_multiple_objects"] == OCN_off_block_status.off) @@ -3205,13 +3190,10 @@ static auto _check_ocn_status_(L,T)( #+name: abs_functions_substitutions #+BEGIN_SRC d -auto _doc_header_and_make_substitutions_(L,CMM)( - L line, - CMM conf_make_meta, +char[] _doc_header_and_make_substitutions_(CMM)( + char[] line, + CMM conf_make_meta, ) { - debug(asserts) { - static assert(is(typeof(line) == char[])); - } enum Substitute { match, markup, } if (conf_make_meta.make.substitute) { foreach(substitution_pair; conf_make_meta.make.substitute) { @@ -3229,13 +3211,10 @@ auto _doc_header_and_make_substitutions_(L,CMM)( #+name: abs_functions_substitutions #+BEGIN_SRC d -auto _doc_header_and_make_substitutions_fontface_(L,CMM)( - L line, - CMM conf_make_meta, +char[] _doc_header_and_make_substitutions_fontface_(CMM)( + char[] line, + CMM conf_make_meta, ) { - debug(asserts) { - static assert(is(typeof(line) == char[])); - } enum Substitute { match, markup, } if ( conf_make_meta.make.bold) { line = line.replaceAll( @@ -3265,17 +3244,12 @@ auto _doc_header_and_make_substitutions_fontface_(L,CMM)( #+name: abs_functions_block #+BEGIN_SRC d -void flow_txt_block_start(L,T,N)( - L line, - return ref T obj_type_status, +void flow_txt_block_start()( + char[] line, + return ref int[string] obj_type_status, return ref uint[string] dochas, - return ref N object_number_poem + return ref string[string] object_number_poem ) { - debug(asserts) { - static assert(is(typeof(line) == char[])); - static assert(is(typeof(obj_type_status) == int[string])); - static assert(is(typeof(object_number_poem) == string[string])); - } #+END_SRC ****** block (various) curly open :curly: @@ -3554,16 +3528,11 @@ void flow_txt_block_start(L,T,N)( #+name: abs_functions_block_code #+BEGIN_SRC d -void flow_txt_block_code(L,O,T)( - L line, - return ref O an_object, - return ref T obj_type_status +void flow_txt_block_code()( + char[] line, + return ref string[string] an_object, + return ref int[string] obj_type_status ) { - debug(asserts) { - static assert(is(typeof(line) == char[])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(obj_type_status) == int[string])); - } static auto rgx = Rgx(); if (obj_type_status["curly_code"] == TriState.on) { if (line.matchFirst(rgx.block_curly_code_close)) { @@ -3608,10 +3577,7 @@ void flow_txt_block_code(L,O,T)( #+name: abs_functions_block_biblio #+BEGIN_SRC d -final string biblio_tag_map(A)(A abr) { - debug(asserts) { - static assert(is(typeof(abr) == string)); - } +final string biblio_tag_map()(string abr) { auto btm = [ "au" : "author_raw", "ed" : "editor_raw", @@ -3636,10 +3602,7 @@ final string biblio_tag_map(A)(A abr) { #+name: none #+BEGIN_SRC d -final string biblio_tag_map_(A)(A abr) { - debug(asserts) { - static assert(is(typeof(abr) == string)); - } +final string biblio_tag_map_()(string abr) { string name; switch (abr) { case "au": name="author_raw"; break; @@ -3801,16 +3764,11 @@ void flow_txt_block_biblio( #+name: abs_functions_block_quote #+BEGIN_SRC d -auto flow_txt_block_quote(L,O,T)( - L line, - O an_object, - return ref T obj_type_status +string[string] flow_txt_block_quote()( + char[] line, + string[string] an_object, + return ref int[string] obj_type_status ) { - debug(asserts) { - static assert(is(typeof(line) == char[])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(obj_type_status) == int[string])); - } static auto rgx = Rgx(); if (obj_type_status["curly_quote"] == TriState.on) { if (line.matchFirst(rgx.block_curly_quote_close)) { @@ -3854,16 +3812,11 @@ auto flow_txt_block_quote(L,O,T)( #+name: abs_functions_block_group #+BEGIN_SRC d -auto flow_txt_block_group(L,O,T)( - L line, - O an_object, - return ref T obj_type_status +string[string] flow_txt_block_group()( + char[] line, + string[string] an_object, + return ref int[string] obj_type_status ) { - debug(asserts) { - static assert(is(typeof(line) == char[])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(obj_type_status) == int[string])); - } static auto rgx = Rgx(); if (obj_type_status["curly_group"] == State.on) { if (line.matchFirst(rgx.block_curly_group_close)) { @@ -3908,16 +3861,11 @@ auto flow_txt_block_group(L,O,T)( #+name: abs_functions_block_block #+BEGIN_SRC d -auto flow_txt_block_block(L,O,T)( - L line, - O an_object, - return ref T obj_type_status +string[string] flow_txt_block_block()( + char[] line, + string[string] an_object, + return ref int[string] obj_type_status ) { - debug(asserts) { - static assert(is(typeof(line) == char[])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(obj_type_status) == int[string])); - } static auto rgx = Rgx(); if (obj_type_status["curly_block"] == TriState.on) { if (line.matchFirst(rgx.block_curly_block_close)) { @@ -3960,22 +3908,15 @@ why extra object stuff only in poem/verse? #+name: abs_functions_block_poem #+BEGIN_SRC d -auto flow_txt_block_poem(L,O,T,C,N,CMM,Ts)( - L line, - O an_object, - return ref T obj_type_status, - return ref C cntr, - N object_number_poem, - CMM conf_make_meta, - Ts tag_in_seg, +string[string] flow_txt_block_poem(CMM)( + char[] line, + string[string] an_object, + return ref int[string] obj_type_status, + return ref int cntr, + string[string] object_number_poem, + CMM conf_make_meta, + string[string] tag_in_seg, ) { - debug(asserts) { - static assert(is(typeof(line) == char[])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(obj_type_status) == int[string])); - static assert(is(typeof(cntr) == int)); - static assert(is(typeof(object_number_poem) == string[string])); - } static auto rgx = Rgx(); if (obj_type_status["curly_poem"] == TriState.on) { if (line.matchFirst(rgx.block_curly_poem_close)) { @@ -4231,17 +4172,12 @@ you need: #+name: abs_functions_block_table #+BEGIN_SRC d -auto flow_txt_block_table(L,O,T,CMM)( - L line, - O an_object, - return ref T obj_type_status, - return ref CMM conf_make_meta, +string[string] flow_txt_block_table(CMM)( + char[] line, + string[string] an_object, + return ref int[string] obj_type_status, + return ref CMM conf_make_meta, ) { - debug(asserts) { - static assert(is(typeof(line) == char[])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(obj_type_status) == int[string])); - } static auto rgx = Rgx(); if (obj_type_status["curly_table"] == TriState.on) { if (line.matchFirst(rgx.block_curly_table_close)) { @@ -4355,7 +4291,7 @@ void flow_table_closed_make_special_notation_table_(N,CMM)( #+name: abs_functions_block_line_status_empty #+BEGIN_SRC d -auto flow_block_flag_line_empty_(B,N,CMM,Ts)( +string[string] flow_block_flag_line_empty_(B,N,CMM,Ts)( char[] line, string[string] an_object, B bookindex_extract_hash, @@ -4711,19 +4647,13 @@ auto flow_block_flag_line_empty_(B,N,CMM,Ts)( #+name: abs_functions_book_index #+BEGIN_SRC d -auto flow_book_index_(L,I,O,T,B)( - L line, - O an_object, - I book_idx_tmp, - return ref T obj_type_status, - B opt_action, +string[string] flow_book_index_(B)( + char[] line, + string[string] an_object, + return ref string book_idx_tmp, + return ref int[string] obj_type_status, + B opt_action, ) { - debug(asserts) { - static assert(is(typeof(line) == char[])); - static assert(is(typeof(book_idx_tmp) == string)); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(obj_type_status) == int[string])); - } static auto rgx = Rgx(); if (auto m = line.match(rgx.book_index)) { /+ match book_index +/ debug(bookindexmatch) { @@ -4774,20 +4704,13 @@ auto flow_book_index_(L,I,O,T,B)( #+name: abs_functions_heading #+BEGIN_SRC d -auto flow_heading_found_(L,H,X,R,T)( - L line, - H heading_match_str, - X _make_unmarked_headings, - return ref R heading_match_rgx, - return ref T obj_type_status +string[string] flow_heading_found_()( + char[] line, + string[string] heading_match_str, + string[] _make_unmarked_headings, + return ref Regex!(char)[string] heading_match_rgx, + return ref int[string] obj_type_status ) { - debug(asserts) { - static assert(is(typeof(line) == char[])); - static assert(is(typeof(_make_unmarked_headings) == string[])); - static assert(is(typeof(heading_match_str) == string[string])); - static assert(is(typeof(heading_match_rgx) == Regex!(char)[string])); - static assert(is(typeof(obj_type_status) == int[string])); - } static auto rgx = Rgx(); if ((_make_unmarked_headings.length > 2) && (obj_type_status["make_headings"] == State.off)) { /+ headings found +/ @@ -4868,18 +4791,12 @@ auto flow_heading_found_(L,H,X,R,T)( #+name: abs_functions_heading #+BEGIN_SRC d -auto flow_heading_make_set_(L,C,R,T)( - L line, - C line_occur, - return ref R heading_match_rgx, - return ref T obj_type_status +char[] flow_heading_make_set_()( + char[] line, + int[string] line_occur, + return ref Regex!(char)[string] heading_match_rgx, + return ref int[string] obj_type_status ) { - 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])); - static assert(is(typeof(obj_type_status) == int[string])); - } if ((obj_type_status["make_headings"] == State.on) && ((line_occur["para"] == State.off) && (line_occur["heading"] == State.off)) @@ -4936,25 +4853,16 @@ auto flow_heading_make_set_(L,C,R,T)( #+name: abs_functions_heading #+BEGIN_SRC d -auto flow_heading_matched_(L,C,O,K,Lv,Lc,T,CMM)( - L line, - O an_object, - return ref C line_occur, - return ref K an_object_key, - return ref Lv lv, - return ref Lc collapsed_lev, - return ref T obj_type_status, - return ref CMM conf_make_meta, +string[string] flow_heading_matched_(CMM)( + char[] line, + string[string] an_object, + return ref int[string] line_occur, + return ref string an_object_key, + return ref int[string] lv, + return ref int[string] collapsed_lev, + return ref int[string] obj_type_status, + return ref CMM conf_make_meta, ) { - debug(asserts) { - static assert(is(typeof(line) == char[])); - static assert(is(typeof(line_occur) == int[string])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(an_object_key) == string)); - static assert(is(typeof(lv) == int[string])); - static assert(is(typeof(collapsed_lev) == int[string])); - static assert(is(typeof(obj_type_status) == int[string])); - } static auto rgx = Rgx(); if (auto m = line.match(rgx.heading)) { /+ heading match +/ ++line_occur["heading"]; @@ -5097,24 +5005,15 @@ auto flow_heading_matched_(L,C,O,K,Lv,Lc,T,CMM)( #+name: abs_functions_para #+BEGIN_SRC d -auto flow_para_match_(L,O,K,I,B,T,C)( - L line, - O an_object, - return ref K an_object_key, - return ref I indent, - return ref B bullet, - return ref T obj_type_status, - return ref C line_occur, +string[string] flow_para_match_()( + char[] line, + string[string] an_object, + return ref string an_object_key, + return ref int[string] indent, + return ref bool bullet, + return ref int[string] obj_type_status, + return ref int[string] line_occur, ) { - debug(asserts) { - static assert(is(typeof(line) == char[])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(an_object_key) == string)); - static assert(is(typeof(indent) == int[string])); - static assert(is(typeof(bullet) == bool)); - static assert(is(typeof(obj_type_status) == int[string])); - static assert(is(typeof(line_occur) == int[string])); - } static auto rgx = Rgx(); if (line_occur["para"] == State.off) { line = font_faces_line(line); @@ -5165,8 +5064,8 @@ auto flow_para_match_(L,O,K,I,B,T,C)( #+name: abs_functions_para #+BEGIN_SRC d -auto font_faces_line(T)( - T textline, +char[] font_faces_line()( + char[] textline, ) { static auto rgx = Rgx(); static auto mkup = InlineMarkup(); @@ -5194,9 +5093,9 @@ auto font_faces_line(T)( #+name: abs_functions_table #+BEGIN_SRC d -auto flow_table_instructions(O,H)( - return ref O table_object, - return ref H table_head, +ObjGenericComposite flow_table_instructions(H)( + return ref ObjGenericComposite table_object, + H table_head, ) { static auto rgx = Rgx(); table_object.metainfo.is_of_part = "body"; @@ -5225,9 +5124,9 @@ auto flow_table_instructions(O,H)( #+name: abs_functions_table #+BEGIN_SRC d -auto flow_table_array_munge(O,T)( - return ref O table_object, - return ref T table_array, +ObjGenericComposite flow_table_array_munge(T)( + return ref ObjGenericComposite table_object, + return ref T table_array, ) { static auto rgx = Rgx(); static auto mng = InlineMarkup(); @@ -5355,9 +5254,9 @@ auto flow_table_array_munge(O,T)( #+name: abs_functions_table #+BEGIN_SRC d -auto flow_table_substantive_munge(O,T)( - return ref O table_object, - return ref T table_substantive, +ObjGenericComposite flow_table_substantive_munge(T)( + return ref ObjGenericComposite table_object, + return ref T table_substantive, ) { static auto rgx = Rgx(); static auto munge = ObjInlineMarkupMunge(); @@ -5377,9 +5276,9 @@ auto flow_table_substantive_munge(O,T)( #+name: abs_functions_table #+BEGIN_SRC d -auto flow_table_substantive_munge_special(O,T)( - return ref O table_object, - return ref T table_substantive, +ObjGenericComposite flow_table_substantive_munge_special(T)( + return ref ObjGenericComposite table_object, + return ref T table_substantive, ) { static auto rgx = Rgx(); static auto munge = ObjInlineMarkupMunge(); @@ -5475,10 +5374,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - static auto images(Ot)(Ot obj_txt_in) { - debug(asserts) { - static assert(is(typeof(obj_txt_in) == string)); - } + static auto images()(string obj_txt_in) { static auto mng = InlineMarkup(); /+ url matched +/ obj_txt_in = obj_txt_in.replaceAll(rgx.inline_notes_al_special, ""); // TODO reinstate when special footnotes are implemented @@ -5514,10 +5410,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - auto footnotes_endnotes_markup_and_number_or_stars(Ot)(Ot obj_txt_in, bool reset_note_numbers) { - debug(asserts) { - static assert(is(typeof(obj_txt_in) == string)); - } + auto footnotes_endnotes_markup_and_number_or_stars()(string obj_txt_in, bool reset_note_numbers) { /+ endnotes (regular) +/ bool flg_notes_reg = false; bool flg_notes_star = false; @@ -5587,11 +5480,8 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - private auto object_notes_and_links_(Ot)(Ot obj_txt_in, bool reset_note_numbers=false) + private auto object_notes_and_links_()(string obj_txt_in, bool reset_note_numbers=false) in { - debug(asserts) { - assert(is(typeof(obj_txt_in) == string)); - } } body { obj_txt_out = ""; @@ -5663,11 +5553,8 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - auto munge_heading(Ot)(Ot obj_txt_in, bool reset_note_numbers=false) + auto munge_heading()(string obj_txt_in, bool reset_note_numbers=false) in { - debug(asserts) { - static assert(is(typeof(obj_txt_in) == string)); - } } body { obj_txt["munge"] = obj_txt_in @@ -5697,11 +5584,8 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - auto munge_para(Ot)(Ot obj_txt_in) + auto munge_para()(string obj_txt_in) in { - debug(asserts) { - static assert(is(typeof(obj_txt_in) == string)); - } } body { obj_txt["munge"]=(obj_txt_in) @@ -5722,11 +5606,8 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - string munge_quote(Ot)(Ot obj_txt_in) + string munge_quote()(string obj_txt_in) in { - debug(asserts) { - static assert(is(typeof(obj_txt_in) == string)); - } } body { obj_txt["munge"]=obj_txt_in; @@ -5769,11 +5650,8 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - auto munge_block(Ot)(Ot obj_txt_in) + auto munge_block()(string obj_txt_in) in { - debug(asserts) { - static assert(is(typeof(obj_txt_in) == string)); - } } body { obj_txt["munge"]=obj_txt_in; @@ -5795,11 +5673,8 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - auto munge_verse(Ot)(Ot obj_txt_in) + auto munge_verse()(string obj_txt_in) in { - debug(asserts) { - static assert(is(typeof(obj_txt_in) == string)); - } } body { obj_txt["munge"]=obj_txt_in; @@ -5820,11 +5695,8 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - string munge_code(Ot)(Ot obj_txt_in) + string munge_code()(string obj_txt_in) in { - debug(asserts) { - assert(is(typeof(obj_txt_in) == string)); - } } body { obj_txt_in = obj_txt_in.replaceAll(rgx.space, mkup.nbsp); @@ -5841,11 +5713,8 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - string munge_table(Ot)(Ot obj_txt_in) + string munge_table()(string obj_txt_in) in { - debug(asserts) { - static assert(is(typeof(obj_txt_in) == string)); - } } body { obj_txt["munge"]=obj_txt_in; @@ -5859,11 +5728,8 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - string munge_comment(Ot)(Ot obj_txt_in) + string munge_comment()(string obj_txt_in) in { - debug(asserts) { - static assert(is(typeof(obj_txt_in) == string)); - } } body { obj_txt["munge"]=obj_txt_in; @@ -5896,17 +5762,13 @@ static struct ObjInlineMarkup { #+name: meta_emitters_obj_inline_markup_and_anchor_tags_and_misc #+BEGIN_SRC d - auto obj_inline_markup_and_anchor_tags_and_misc(O,K,CMM)( - O obj_, - K obj_key_, - CMM conf_make_meta, - Flag!"_new_doc" _new_doc + auto obj_inline_markup_and_anchor_tags_and_misc(CMM)( + string[string] obj_, + string obj_key_, + CMM conf_make_meta, + Flag!"_new_doc" _new_doc ) in { - debug(asserts) { - static assert(is(typeof(obj_) == string[string])); - static assert(is(typeof(obj_key_) == string)); - } } body { obj_txt["munge"] = obj_[obj_key_].dup; @@ -6002,34 +5864,24 @@ static struct ObjInlineMarkup { #+name: meta_emitters_obj_inline_markup_table_of_contents #+BEGIN_SRC d - auto _clean_heading_toc_(Toc)( - Toc heading_toc_, + auto _clean_heading_toc_()( + char[] heading_toc_, ) { - debug(asserts) { - static assert(is(typeof(heading_toc_) == char[])); - } auto m = (cast(char[]) heading_toc_).matchFirst(rgx.heading); heading_toc_ = (m.post).replaceAll( rgx.inline_notes_curly_gen, ""); return heading_toc_; }; - auto flow_table_of_contents_gather_headings(O,CMM,Ts,Ta,X,Toc)( - O obj_, - CMM conf_make_meta, - Ts tag_in_seg, - Ta _anchor_tag, - return ref X lev4_subtoc, - Toc the_table_of_contents_section, + ObjGenericComposite[] flow_table_of_contents_gather_headings(CMM)( + string[string] obj_, + CMM conf_make_meta, + string[string] tag_in_seg, + string _anchor_tag, + return ref string[][string] lev4_subtoc, + ObjGenericComposite[] the_table_of_contents_section, ) in { - debug(asserts) { - static assert(is(typeof(obj_) == string[string])); - static assert(is(typeof(tag_in_seg) == string[string])); - static assert(is(typeof(_anchor_tag) == string)); - static assert(is(typeof(lev4_subtoc) == string[][string])); - static assert(is(typeof(the_table_of_contents_section) == ObjGenericComposite[])); - } } body { ObjGenericComposite comp_obj_toc; @@ -6121,16 +5973,12 @@ private: static string heading_number_auto_composite = ""; static string heading_number_auto_composite_segname = ""; static bool[] auto_heading_numbering = [ true, true, true, true]; - static string _configured_auto_heading_numbering_and_segment_anchor_tags(M,O,CMM)( - M munge_, - O obj_, - CMM conf_make_meta, - bool _new_doc, + static string _configured_auto_heading_numbering_and_segment_anchor_tags(CMM)( + string munge_, + string[string] obj_, + CMM conf_make_meta, + bool _new_doc, ) { - debug(asserts) { - static assert(is(typeof(munge_) == string)); - static assert(is(typeof(obj_) == string[string])); - } if (_new_doc) { heading_num = [ 0, 0, 0, 0 ]; heading_number_auto_composite = ""; @@ -6275,15 +6123,11 @@ private: #+name: meta_emitters_obj_inline_markup_heading_numbering_segment_anchor_tags #+BEGIN_SRC d static int heading_num_lev1 = 0; - static string _make_segment_anchor_tags_if_none_provided(M,Lv)( - M munge_, - Lv lev_, - bool _new_doc + static string _make_segment_anchor_tags_if_none_provided()( + string munge_, + string lev_, + bool _new_doc ) { - debug(asserts) { - static assert(is(typeof(munge_) == string)); - static assert(is(typeof(lev_) == string)); - } if (!(munge_.match(rgx.heading_anchor_tag))) { if (munge_.match(rgx.heading_identify_anchor_tag)) { if (auto m = munge_.match(rgx.heading_extract_named_anchor_tag)) { @@ -6334,17 +6178,12 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_public #+BEGIN_SRC d - string obj_attributes(Oi,OR,OH)( - Oi obj_is_, - OR obj_raw, - OH _comp_obj_heading, + string obj_attributes()( + string obj_is_, + string obj_raw, + ObjGenericComposite _comp_obj_heading, ) in { - debug(asserts) { - static assert(is(typeof(obj_is_) == string)); - static assert(is(typeof(obj_raw) == string)); - static assert(is(typeof(_comp_obj_heading) == ObjGenericComposite)); - } } body { scope(exit) { @@ -6417,11 +6256,8 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_para_and_blocks(Ot)(Ot obj_txt_in) + string txt_para_and_blocks()(string obj_txt_in) in { - debug(asserts) { - static assert(is(typeof(obj_txt_in) == string)); - } } body { if (obj_txt_in.matchFirst(rgx.para_bullet)) { @@ -6453,11 +6289,8 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_heading(Ot)(Ot obj_txt_in) + string txt_heading()(string obj_txt_in) in { - debug(asserts) { - static assert(is(typeof(obj_txt_in) == string)); - } } body { _obj_attributes = " \"use\": \"content\"," @@ -6473,11 +6306,8 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_para(Ot)(Ot obj_txt_in) + string txt_para()(string obj_txt_in) in { - debug(asserts) { - static assert(is(typeof(obj_txt_in) == string)); - } } body { _obj_attributes = " \"use\": \"content\"," @@ -6493,11 +6323,8 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_quote(Ot)(Ot obj_txt_in) + string txt_quote()(string obj_txt_in) in { - debug(asserts) { - static assert(is(typeof(obj_txt_in) == string)); - } } body { _obj_attributes = " \"use\": \"content\"," @@ -6513,11 +6340,8 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_group(Ot)(Ot obj_txt_in) + string txt_group()(string obj_txt_in) in { - debug(asserts) { - static assert(is(typeof(obj_txt_in) == string)); - } } body { _obj_attributes = " \"use\": \"content\"," @@ -6533,11 +6357,8 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_block(Ot)(Ot obj_txt_in) + string txt_block()(string obj_txt_in) in { - debug(asserts) { - static assert(is(typeof(obj_txt_in) == string)); - } } body { _obj_attributes = " \"use\": \"content\"," @@ -6553,11 +6374,8 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_verse(Ot)(Ot obj_txt_in) + string txt_verse()(string obj_txt_in) in { - debug(asserts) { - static assert(is(typeof(obj_txt_in) == string)); - } } body { _obj_attributes = " \"use\": \"content\"," @@ -6573,11 +6391,8 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_code(Ot)(Ot obj_txt_in) + string txt_code()(string obj_txt_in) in { - debug(asserts) { - static assert(is(typeof(obj_txt_in) == string)); - } } body { _obj_attributes = " \"use\": \"content\"," @@ -6593,11 +6408,8 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_table(Ot)(Ot obj_txt_in) + string txt_table()(string obj_txt_in) in { - debug(asserts) { - static assert(is(typeof(obj_txt_in) == string)); - } } body { _obj_attributes = " \"use\": \"content\"," @@ -6613,11 +6425,8 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_comment(Ot)(Ot obj_txt_in) + string txt_comment()(string obj_txt_in) in { - debug(asserts) { - static assert(is(typeof(obj_txt_in) == string)); - } } body { _obj_attributes = " \"use\": \"comment\"," @@ -6633,16 +6442,11 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_json #+BEGIN_SRC d - string _set_additional_values_parse_as_json(OA,Oi,OH)( - OA _obj_attrib, - Oi obj_is_, - OH _comp_obj_heading, + string _set_additional_values_parse_as_json()( + string _obj_attrib, + string obj_is_, + ObjGenericComposite _comp_obj_heading, ) { - debug(asserts) { - static assert(is(typeof(_obj_attrib) == string)); - static assert(is(typeof(obj_is_) == string)); - static assert(is(typeof(_comp_obj_heading) == ObjGenericComposite)); - } JSONValue oa_j = parseJSON(_obj_attrib); assert( (oa_j.type == JSON_TYPE.OBJECT) @@ -6682,14 +6486,13 @@ struct BookIndexNuggetHash { string[][string][string] bi; string[][string][string] hash_nugget; string[] bi_main_terms_split_arr; - string[][string][string] bookindex_nugget_hash(BI,N,S)( - BI bookindex_section, - N obj_cite_digits, - S tag_in_seg, + string[][string][string] bookindex_nugget_hash(N,S)( + string bookindex_section, + N obj_cite_digits, + S tag_in_seg, ) in { debug(asserts) { - static assert(is(typeof(bookindex_section) == string)); static assert(is(typeof(obj_cite_digits.object_number) == int)); } debug(bookindexraw) { @@ -6763,12 +6566,9 @@ struct BookIndexNuggetHash { #+BEGIN_SRC d struct BookIndexReportIndent { int mkn, skn; - void bookindex_report_indented(BI)( - BI bookindex_unordered_hashes + void bookindex_report_indented()( + string[][string][string] bookindex_unordered_hashes ) { - debug(asserts) { - static assert(is(typeof(bookindex_unordered_hashes) == string[][string][string])); - } auto mainkeys = bookindex_unordered_hashes.byKey.array.sort().release; foreach (mainkey; mainkeys) { @@ -6807,8 +6607,8 @@ struct BookIndexReportSection { #+name: meta_emitters_book_index_report_section #+BEGIN_SRC d - void bookindex_write_section(BI)( - BI bookindex_unordered_hashes + void bookindex_write_section()( + string[][string][string] bookindex_unordered_hashes ) { auto mainkeys = bookindex_unordered_hashes.byKey.array @@ -6842,13 +6642,12 @@ struct BookIndexReportSection { #+name: meta_emitters_book_index_report_section #+BEGIN_SRC d - auto bookindex_build_abstraction_section(BI,N,B)( - BI bookindex_unordered_hashes, - N obj_cite_digits, - B opt_action, + auto bookindex_build_abstraction_section(N,B)( + string[][string][string] bookindex_unordered_hashes, + N obj_cite_digits, + B opt_action, ) { debug(asserts) { - static assert(is(typeof(bookindex_unordered_hashes) == string[][string][string])); static assert(is(typeof(obj_cite_digits.object_number) == int)); } mixin DocReformNode; @@ -7228,15 +7027,11 @@ struct Bibliography { #+name: meta_emitters_bibliography #+BEGIN_SRC d - public JSONValue[] flow_bibliography_(Bi,BJ)( - return ref Bi biblio_unsorted_incomplete, - return ref BJ bib_arr_json + public JSONValue[] flow_bibliography_()( + return ref string[] biblio_unsorted_incomplete, + return ref JSONValue[] bib_arr_json ) in { - debug(asserts) { - static assert(is(typeof(biblio_unsorted_incomplete) == string[])); - static assert(is(typeof(bib_arr_json) == JSONValue[])); - } } body { JSONValue[] biblio_unsorted @@ -7266,14 +7061,10 @@ struct Bibliography { #+name: meta_emitters_bibliography #+BEGIN_SRC d - final private JSONValue[] biblio_make_unsorted_array_of_json_objects(Bi,BJ)( - Bi biblio_unordered, - BJ bib_arr_json + final private JSONValue[] biblio_make_unsorted_array_of_json_objects()( + string[] biblio_unordered, + JSONValue[] bib_arr_json ) { - debug(asserts) { - static assert(is(typeof(biblio_unordered) == string[])); - static assert(is(typeof(bib_arr_json) == JSONValue[])); - } foreach (bibent; biblio_unordered) { /+ update bib to include deemed_author, needed for: sort_bibliography_array_by_deemed_author_year_title @@ -7304,10 +7095,7 @@ struct Bibliography { #+name: meta_emitters_bibliography #+BEGIN_SRC d - final private JSONValue[] biblio_sort(BJ)(BJ biblio_unordered) { - debug(asserts) { - static assert(is(typeof(biblio_unordered) == JSONValue[])); - } + final private JSONValue[] biblio_sort()(JSONValue[] biblio_unordered) { JSONValue[] biblio_sorted_; biblio_sorted_ = sort!((a, b){ @@ -7328,10 +7116,7 @@ struct Bibliography { #+name: meta_emitters_bibliography #+BEGIN_SRC d - void biblio_debug(BJ)(BJ biblio_sorted) { - debug(asserts) { - static assert(is(typeof(biblio_sorted) == JSONValue[])); - } + void biblio_debug()(JSONValue[] biblio_sorted) { debug(biblio0) { foreach (j; biblio_sorted) { if (!empty(j["fulltitle"].str)) { @@ -7365,24 +7150,19 @@ struct NodeStructureMetadata { #+name: meta_emitters_metadata #+BEGIN_SRC d - ObjGenericComposite node_location_emitter(Lv,Tg,La,Ta,N,C,P,I)( - Lv lev_markup_number, - Tg tag_in_seg, - La lev_anchor_tag, - Ta tag_assoc, - N obj_cite_digits, - C cntr_, - P ptr_, - I is_ + ObjGenericComposite node_location_emitter(La,Ta,N)( + string lev_markup_number, + string[string] tag_in_seg, + La lev_anchor_tag, + Ta tag_assoc, + N obj_cite_digits, + int cntr_, + int ptr_, + string is_ ) in { debug(asserts) { - static assert(is(typeof(lev_markup_number) == string)); - static assert(is(typeof(tag_in_seg) == string[string])); static assert(is(typeof(obj_cite_digits.object_number) == int)); - static assert(is(typeof(cntr_) == int)); - static assert(is(typeof(ptr_) == int)); - static assert(is(typeof(is_) == string)); } assert(is_ != "heading"); assert(obj_cite_digits.object_number.to!int >= 0); @@ -7433,37 +7213,28 @@ struct NodeStructureMetadata { #+name: meta_emitters_metadata #+BEGIN_SRC d - ObjGenericComposite node_emitter_heading(T,Lm,Lc,Hd,TaB,TaL,TA,N,C,P,LA,I,PSn,fNr,fNs,fL)( - T _text, - Lm lev_markup_number, - Lc lev_collapsed_number, - Hd dummy_heading_status, - TaB tag_in_seg, - TaL lev_anchor_tag, - TA tag_assoc, - N obj_cite_digits, - C cntr_, - P ptr_, - LA lv_ancestors_txt, - I is_, - PSn html_segnames_ptr, - fNr flag_notes_reg, - fNs flag_notes_star, - fL flag_links, + ObjGenericComposite node_emitter_heading(Hd,TaL,TA,N,fNr,fNs,fL)( + string _text, + string lev_markup_number, + string lev_collapsed_number, + Hd dummy_heading_status, + string[string] tag_in_seg, + TaL lev_anchor_tag, + TA tag_assoc, + N obj_cite_digits, + int cntr_, + int ptr_, + string[] lv_ancestors_txt, + string is_, + int html_segnames_ptr, + fNr flag_notes_reg, + fNs flag_notes_star, + fL flag_links, ) in { debug(asserts) { - static assert(is(typeof(_text) == string)); static assert(is(typeof(lev) == string)); - static assert(is(typeof(lev_markup_number) == string)); - static assert(is(typeof(lev_collapsed_number) == string)); - static assert(is(typeof(tag_in_seg) == string[string])); static assert(is(typeof(obj_cite_digits.object_number) == int)); - static assert(is(typeof(cntr_) == int)); - static assert(is(typeof(ptr_) == int)); - static assert(is(typeof(lv_ancestors_txt) == string[])); - static assert(is(typeof(is_) == string)); - static assert(is(typeof(html_segnames_ptr) == int)); } assert(is_ == "heading"); assert((obj_cite_digits.object_number).to!int >= 0); @@ -7655,14 +7426,10 @@ struct NodeStructureMetadata { #+name: abs_functions_assertions #+BEGIN_SRC d -pure void assertions_doc_structure(O,Lv)( - O an_object, - Lv lv +pure void assertions_doc_structure()( + string[string] an_object, + int[string] lv ) { - debug(asserts) { - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(lv) == int[string])); - } if (lv["h3"] > State.off) { assert(lv["h0"] > State.off); assert(lv["h1"] > State.off); @@ -7840,10 +7607,7 @@ pure void assertions_doc_structure(O,Lv)( #+name: abs_functions_assertions #+BEGIN_SRC d -pure void assertions_flag_types_block_status_none_or_closed(T)(T obj_type_status) { - debug(asserts) { - static assert(is(typeof(obj_type_status) == int[string])); - } +pure void assertions_flag_types_block_status_none_or_closed()(int[string] obj_type_status) { assert( (obj_type_status["code"] == TriState.off) || (obj_type_status["code"] == TriState.closing), -- cgit v1.2.3