diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2019-05-14 11:35:24 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2019-08-19 14:42:43 -0400 |
commit | 24c9ed3645178a6ee2abbd9201fa4643dba068e2 (patch) | |
tree | 37cd2dbe489d8ab850fd814cdec63004c9a3150c /src/doc_reform/meta | |
parent | doc_abstraction reduce use of return ref, check (diff) |
review, reduce use of auto
Diffstat (limited to 'src/doc_reform/meta')
-rw-r--r-- | src/doc_reform/meta/conf_make_meta_json.d | 2 | ||||
-rw-r--r-- | src/doc_reform/meta/conf_make_meta_structs.d | 58 | ||||
-rw-r--r-- | src/doc_reform/meta/conf_make_meta_toml.d | 6 | ||||
-rw-r--r-- | src/doc_reform/meta/defaults.d | 72 | ||||
-rw-r--r-- | src/doc_reform/meta/metadoc_from_src.d | 761 | ||||
-rw-r--r-- | src/doc_reform/meta/metadoc_summary.d | 6 |
6 files changed, 336 insertions, 569 deletions
diff --git a/src/doc_reform/meta/conf_make_meta_json.d b/src/doc_reform/meta/conf_make_meta_json.d index 980a802..d7ab551 100644 --- a/src/doc_reform/meta/conf_make_meta_json.d +++ b/src/doc_reform/meta/conf_make_meta_json.d @@ -532,7 +532,7 @@ static template contentJSONtoDocReformStruct() { } } string[] authors_arr; - auto authors_raw_arr + string[] authors_raw_arr = _struct_composite.meta.creator_author.split(_rgx.arr_delimiter); foreach (author_raw; authors_raw_arr) { authors_arr ~= author_raw.replace(_rgx.raw_author_munge, "$2 $1"); diff --git a/src/doc_reform/meta/conf_make_meta_structs.d b/src/doc_reform/meta/conf_make_meta_structs.d index e7b9a5b..e214565 100644 --- a/src/doc_reform/meta/conf_make_meta_structs.d +++ b/src/doc_reform/meta/conf_make_meta_structs.d @@ -16,8 +16,8 @@ mixin DocReformRgxInit; static auto _rgx = Rgx(); mixin InternalMarkup; auto _mkup = InlineMarkup(); -auto url_markup(string line) { - auto line_ = line +string url_markup(string line) { + string line_ = line .replaceAll( _rgx.smid_inline_link_markup_regular, ("$1" @@ -58,30 +58,30 @@ struct ConfCompositeMakeStr { string texpdf_font; } struct confCompositeMakeBuild { - auto bold(string _mk) { + string[] bold(string _mk) { string[] _out; if (_mk) { _out = [ (cast(string) (`(` ~ _mk.dup ~ `)`)), "*{$1}*", "<b>$1</b>"]; } return _out; } - auto breaks(string _mk) { + string breaks(string _mk) { return _mk; } - auto cover_image(string _mk) { + string cover_image(string _mk) { return _mk; } - auto css(string _mk) { + string css(string _mk) { return _mk; } - auto emphasis(string _mk) { + string[] emphasis(string _mk) { string[] _out; if (_mk) { _out = [ (cast(string) (`(` ~ _mk.dup ~ `)`)), "!{$1}!", "<em>$1</em>" ]; } return _out; } - auto footer(string[] _mk) { + string[] footer(string[] _mk) { string line_; string[] _mk2; foreach (line; _mk) { @@ -89,35 +89,35 @@ struct confCompositeMakeBuild { } return _mk2; } - auto headings(string[] _mk) { + string[] headings(string[] _mk) { return _mk; } - auto home_button_image(string[] _mk) { + string[] home_button_image(string[] _mk) { return _mk; } - auto home_button_text(string _mk) { + string home_button_text(string _mk) { return url_markup(_mk); } - auto italics(string _mk) { + string[] italics(string _mk) { string[] _out; if (_mk) { _out = [ (cast(string) (`(` ~ _mk.dup ~ `)`)), "/{$1}/", "<i>$1</i>" ]; } return _out; } - auto auto_num_top_at_level(string _mk) { + string auto_num_top_at_level(string _mk) { return _mk; } - auto auto_num_top_lv(int _mk) { + int auto_num_top_lv(int _mk) { return _mk; } - auto auto_num_depth(int _mk) { + int auto_num_depth(int _mk) { return _mk; } - auto substitute(string[][] _mk) { + string[][] substitute(string[][] _mk) { return _mk; } - auto texpdf_font(string _mk) { + string texpdf_font(string _mk) { return _mk; } } @@ -235,7 +235,7 @@ struct ConfCompositePlus { ConfCompositeMakeStr make_str; ConfCompositeSiteLocal conf; } -static auto ptr_head_main +static string[] ptr_head_main = [ "classify", "creator", @@ -248,7 +248,7 @@ static auto ptr_head_main "rights", "title" ]; -static auto ptr_head_sub_classify +static string[] ptr_head_sub_classify = [ "dewey", "keywords", @@ -256,7 +256,7 @@ static auto ptr_head_sub_classify "subject", "topic_register" ]; -static auto ptr_head_sub_creator +static string[] ptr_head_sub_creator = [ "author", "author_email", @@ -264,7 +264,7 @@ static auto ptr_head_sub_creator "illustrator", "translator" ]; -static auto ptr_head_sub_date +static string[] ptr_head_sub_date = [ "added_to_site", "available", @@ -274,14 +274,14 @@ static auto ptr_head_sub_date "published", "valid" ]; -static auto ptr_head_sub_identifier +static string[] ptr_head_sub_identifier = [ "isbn", "oclc", "pg" ]; /+ make +/ -static auto ptr_head_sub_make +static string[] ptr_head_sub_make = [ "cover_image", "home_button_image", @@ -296,27 +296,27 @@ static auto ptr_head_sub_make "texpdf_font", "css" ]; -static auto ptr_head_sub_notes +static string[] ptr_head_sub_notes = [ "abstract", "description" ]; -static auto ptr_head_sub_original +static string[] ptr_head_sub_original = [ "language", "source", "title" ]; -static auto ptr_head_sub_publisher +static string[] ptr_head_sub_publisher = [ "name" ]; -static auto ptr_head_sub_rights +static string[] ptr_head_sub_rights = [ "copyright", "cover", "illustrations", "license" ]; -static auto ptr_head_sub_title +static string[] ptr_head_sub_title = [ "edition", "full", @@ -325,5 +325,5 @@ static auto ptr_head_sub_title "note", "sub" ]; -auto config_jsonstr = `{ +JSONValue config_jsonstr = `{ }`; diff --git a/src/doc_reform/meta/conf_make_meta_toml.d b/src/doc_reform/meta/conf_make_meta_toml.d index 46bd6a3..f047c5d 100644 --- a/src/doc_reform/meta/conf_make_meta_toml.d +++ b/src/doc_reform/meta/conf_make_meta_toml.d @@ -18,7 +18,7 @@ static template configParseTOMLreturnJSON() { ){ TOMLDocument _doc; _doc = parseTOML(cast(string)(_text.content)); - auto _doc_json = toJSON(_doc); + auto _doc_json = _doc.toJSON; return _doc_json; } } @@ -35,7 +35,7 @@ static template configParseTOMLreturnDocReformStruct() { T _document_struct ){ TOMLDocument _doc = parseTOML(cast(string)(_document_struct.content)); - auto _doc_json = toJSON(_doc); + auto _doc_json = _doc.toJSON; _make_and_meta_struct = contentJSONtoDocReformStruct!()(_make_and_meta_struct, _doc_json, _document_struct.filename); // struct from json return _make_and_meta_struct; @@ -71,7 +71,7 @@ static template docHeaderMakeAndMetaTupTomlExtractAndConvertToStruct() { } _doc = parseTOML(cast(string)(header_src)); } - auto _doc_json = toJSON(_doc); + auto _doc_json = _doc.toJSON; auto _header_and_make_and_meta_struct = contentJSONtoDocReformStruct!()(_make_and_meta_struct, _doc_json, "header"); return _header_and_make_and_meta_struct; diff --git a/src/doc_reform/meta/defaults.d b/src/doc_reform/meta/defaults.d index 8fb9b89..3df8816 100644 --- a/src/doc_reform/meta/defaults.d +++ b/src/doc_reform/meta/defaults.d @@ -46,7 +46,7 @@ template DocReformRgxInitFlags() { } template DocReformNode() { static string[string] node_metadata_heading_str() { - auto _node = [ + string[string] _node = [ "is" : "", "ocn" : "", "marked_up_lev" : "", @@ -57,7 +57,7 @@ template DocReformNode() { return _node; } static int[string] node_metadata_heading_int() { - auto _node = [ + int[string] _node = [ "ocn" : 0, // decide whether to use or keep? "ptr_doc_object" : 0, "ptr_html_segnames" : 0, @@ -70,7 +70,7 @@ template DocReformNode() { return _node; } static string[string] node_metadata_para_str() { - auto _node = [ + string[string] _node = [ "is" : "", "ocn" : "", "attrib" : "", @@ -78,7 +78,7 @@ template DocReformNode() { return _node; } static int[string] node_metadata_para_int() { - auto _node = [ + int[string] _node = [ "ocn" : 0, "indent_base" : 0, "indent_hang" : 0, @@ -127,36 +127,36 @@ template DocReformBiblio() { template InternalMarkup() { import std.array; static struct InlineMarkup { - auto en_a_o = "【"; auto en_a_c = "】"; - auto en_b_o = "〖"; auto en_b_c = "〗"; - auto quote_o = "“"; auto quote_c = "”"; - auto ff_o = "┨"; auto ff_c = "┣"; // fontface - auto lnk_o = "┥"; auto lnk_c = "┝"; - auto url_o = "┤"; auto url_c = "├"; - auto emph = "*"; - auto bold = "!"; - auto italic = "/"; - auto underscore = "_"; - auto superscript = "^"; - auto subscript = ","; - auto mono = "■"; - auto cite = "‖"; - auto mark_internal_site_lnk = "¤"; - auto nbsp = "░"; - auto br_line = "┘"; - auto br_nl = "┙"; - auto br_paragraph = "┚"; - auto br_obj = "break_obj"; - auto br_page_line = "┼"; - auto br_page = "┿"; - auto br_page_new = "╂"; - auto tc_s = "┊"; - auto tc_o = "┏"; - auto tc_c = "┚"; - auto tc_p = "┆"; - auto img = "☼"; - auto on_o = "「"; auto on_c = "」"; - auto mk_bullet = "● "; + string en_a_o = "【"; string en_a_c = "】"; + string en_b_o = "〖"; string en_b_c = "〗"; + string quote_o = "“"; string quote_c = "”"; + string ff_o = "┨"; string ff_c = "┣"; // fontface + string lnk_o = "┥"; string lnk_c = "┝"; + string url_o = "┤"; string url_c = "├"; + string emph = "*"; + string bold = "!"; + string italic = "/"; + string underscore = "_"; + string superscript = "^"; + string subscript = ","; + string mono = "■"; + string cite = "‖"; + string mark_internal_site_lnk = "¤"; + string nbsp = "░"; + string br_line = "┘"; + string br_nl = "┙"; + string br_paragraph = "┚"; + string br_obj = "break_obj"; + string br_page_line = "┼"; + string br_page = "┿"; + string br_page_new = "╂"; + string tc_s = "┊"; + string tc_o = "┏"; + string tc_c = "┚"; + string tc_p = "┆"; + string img = "☼"; + string on_o = "「"; auto on_c = "」"; + string mk_bullet = "● "; static string indent_by_spaces_provided(int indent, string _indent_spaces ="░░") { _indent_spaces = replicate(_indent_spaces, indent); return _indent_spaces; @@ -238,11 +238,11 @@ template DocReformLanguageCodes() { return _lang_codes; } static string[] code_arr_ptr() { - auto _lang_codes = ["am", "bg", "bn", "br", "ca", "cs", "cy", "da", "de", "el", "en", "eo", "es", "et", "eu", "fi", "fr", "ga", "gl", "he", "hi", "hr", "hy", "ia", "is", "it", "ja", "ko", "la", "lo", "lt", "lv", "ml", "mr", "nl", "no", "nn", "oc", "pl", "pt", "pt_BR", "ro", "ru", "sa", "se", "sk", "sl", "sq", "sr", "sv", "ta", "te", "th", "tk", "tr", "uk", "ur", "us", "vi", "zh", "en", "xx",]; + string[] _lang_codes = ["am", "bg", "bn", "br", "ca", "cs", "cy", "da", "de", "el", "en", "eo", "es", "et", "eu", "fi", "fr", "ga", "gl", "he", "hi", "hr", "hy", "ia", "is", "it", "ja", "ko", "la", "lo", "lt", "lv", "ml", "mr", "nl", "no", "nn", "oc", "pl", "pt", "pt_BR", "ro", "ru", "sa", "se", "sk", "sl", "sq", "sr", "sv", "ta", "te", "th", "tk", "tr", "uk", "ur", "us", "vi", "zh", "en", "xx",]; return _lang_codes; } static string[] code_arr() { - auto _lang_codes = ["am", "bg", "bn", "br", "ca", "cs", "cy", "da", "de", "el", "en", "eo", "es", "et", "eu", "fi", "fr", "ga", "gl", "he", "hi", "hr", "hy", "ia", "is", "it", "ja", "ko", "la", "lo", "lt", "lv", "ml", "mr", "nl", "no", "nn", "oc", "pl", "pt", "pt_BR", "ro", "ru", "sa", "se", "sk", "sl", "sq", "sr", "sv", "ta", "te", "th", "tk", "tr", "uk", "ur", "vi", "zh"]; + string[] _lang_codes = ["am", "bg", "bn", "br", "ca", "cs", "cy", "da", "de", "el", "en", "eo", "es", "et", "eu", "fi", "fr", "ga", "gl", "he", "hi", "hr", "hy", "ia", "is", "it", "ja", "ko", "la", "lo", "lt", "lv", "ml", "mr", "nl", "no", "nn", "oc", "pl", "pt", "pt_BR", "ro", "ru", "sa", "se", "sk", "sl", "sq", "sr", "sv", "ta", "te", "th", "tk", "tr", "uk", "ur", "vi", "zh"]; return _lang_codes; } static auto codes_() { diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 99e834d..6b6714d 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -5,7 +5,7 @@ +/ module doc_reform.meta.metadoc_from_src; template DocReformDocAbstraction() { - /+ ↓ abstraction imports +/ + /+ ↓ abstraction imports +/ import doc_reform.meta; import std.algorithm, @@ -17,11 +17,11 @@ template DocReformDocAbstraction() { doc_reform.meta.defaults, doc_reform.meta.object_setter, doc_reform.meta.rgx; - /+ ↓ abstraction mixins +/ + /+ ↓ abstraction mixins +/ mixin ObjectSetter; mixin InternalMarkup; mixin DocReformRgxInit; - /+ ↓ abstraction struct init +/ + /+ ↓ abstraction struct init +/ /+ initialize +/ ObjGenericComposite[] the_table_of_contents_section; ObjGenericComposite[] the_document_head_section, the_document_body_section, the_bibliography_section, the_glossary_section, the_blurb_section; @@ -90,9 +90,9 @@ template DocReformDocAbstraction() { int[] dom_structure_collapsed_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; int[] dom_structure_collapsed_tags_status_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; enum DomTags { none, open, close, close_and_open, open_still, } - 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: @@ -143,10 +143,10 @@ template DocReformDocAbstraction() { } return obj; } - 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) { @@ -187,10 +187,10 @@ template DocReformDocAbstraction() { obj.metainfo.dom_structure_markedup_tags_status = dom.dup; return obj; } - 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) { @@ -245,7 +245,7 @@ template DocReformDocAbstraction() { } 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)) { @@ -292,10 +292,10 @@ template DocReformDocAbstraction() { ObjGenericComposite comp_obj_heading, comp_obj_location, comp_obj_block, comp_obj_code, comp_obj_poem_ocn, comp_obj_comment; auto node_construct = NodeStructureMetadata(); enum sObj { content, anchor_tag, notes_reg, notes_star, links, image_no_dimensions } - 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)) { @@ -308,19 +308,16 @@ template DocReformDocAbstraction() { } return tag_assoc; } - /+ ↓ 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 +/ scope(success) { } scope(failure) { @@ -397,7 +394,7 @@ template DocReformDocAbstraction() { "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)"), @@ -445,7 +442,7 @@ template DocReformDocAbstraction() { string[][string] lev4_subtoc; string[][string] segnames = ["html": ["toc"], "epub": ["toc"]]; int cnt1 = 1; int cnt2 = 1; int cnt3 = 1; - /+ abstraction init ↑ +/ + /+ abstraction init ↑ +/ enum Substitute { match, markup, } debug (substitutions) { writeln(__LINE__, ":", __FILE__, ": DEBUG substitutions:"); @@ -471,10 +468,10 @@ template DocReformDocAbstraction() { writeln("substitution to make: ", conf_make_meta.make.italics[Substitute.markup]); } } - /+ ↓ ↻ 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 /+ scope +/ scope(exit) { } @@ -504,9 +501,9 @@ template DocReformDocAbstraction() { /+ block object: code +/ line.flow_txt_block_code(an_object, obj_type_status); continue; - } else if (!matchFirst(line, rgx.skip_from_regular_parse)) { /+ object other than "code block" object +/ - /+ (includes regular text paragraph, headings & blocks other than code) +/ - /+ 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 +/ line = line.inline_markup_faces; // by text line (rather than by text object), linebreaks in para problematic if ((line.matchFirst(rgx.heading_biblio) && obj_type_status["para"] != State.on @@ -806,7 +803,7 @@ template DocReformDocAbstraction() { } else if (obj_type_status["table"] == TriState.on) { /+ within block object: table +/ an_object = line.flow_txt_block_table(an_object, obj_type_status, conf_make_meta); continue; - } else { /+ not within a block group +/ + } else { /+ not within a block group +/ assert( (obj_type_status["blocks"] == TriState.off) || (obj_type_status["blocks"] == TriState.closing), @@ -821,8 +818,8 @@ template DocReformDocAbstraction() { } line.flow_txt_block_start(obj_type_status, dochas, object_number_poem); continue; - } 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 +/ assert( !line.empty, "line tested, line not empty surely:\n \"" ~ line ~ "\"" @@ -914,7 +911,7 @@ template DocReformDocAbstraction() { ++line_occur["para"]; } } - } 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 +/ an_object = line.flow_block_flag_line_empty_( an_object, bookindex_extract_hash, @@ -928,7 +925,7 @@ template DocReformDocAbstraction() { conf_make_meta, tag_in_seg, ); - } else { /+ line.empty, post contents, empty variables: +/ + } else { /+ line.empty, post contents, empty variables: +/ assert( line.empty, "\nline should be empty:\n \"" @@ -1127,9 +1124,9 @@ template DocReformDocAbstraction() { } else { // could be useful to test line variable should be empty and never null } - } // 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 /+ unless (the_document_body_section.length == 0) ? +/ if (the_document_body_section.length > 0) { if (((the_document_body_section[$-1].metainfo.is_a == "para") @@ -1175,8 +1172,8 @@ template DocReformDocAbstraction() { previous_length = the_document_body_section.length.to!int; } } - } /+ ← 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 +/ auto en_tuple = note_section.endnote_objects(obj_cite_digits, opt_action); static assert(!isTypeTuple!(en_tuple)); @@ -1709,7 +1706,7 @@ template DocReformDocAbstraction() { } html_segnames_ptr_cntr++; } - 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; @@ -1757,7 +1754,7 @@ template DocReformDocAbstraction() { return pairs.sort; } 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]; @@ -2267,7 +2264,7 @@ template DocReformDocAbstraction() { comp_obj_heading_ = comp_obj_heading_.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, 0); comp_obj_heading_ = comp_obj_heading_.obj_heading_ancestors(lv_ancestors_txt); // the_dom_tail_section ~= comp_obj_heading_; // remove tail for now, decide on later - auto document_the = [ + ObjGenericComposite[][string] document_the = [ "head": the_document_head_section, "toc": the_table_of_contents_section, /+ substantive/body: +/ @@ -2317,8 +2314,8 @@ template DocReformDocAbstraction() { document_section_keys_sequenced["scroll"] ~= "tail"; document_section_keys_sequenced["seg"] ~= "tail"; } - 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); @@ -2400,13 +2397,10 @@ template DocReformDocAbstraction() { doc_has, ); return t; - /+ post loop markup document/text ↑ +/ - } /+ ← closed: abstract doc source +/ - /+ ↓ abstraction functions +/ - static auto object_reset(O)(O an_object) { - debug(asserts) { - static assert(is(typeof(an_object) == string[string])); - } + /+ post loop markup document/text ↑ +/ + } /+ ← closed: abstract doc source +/ + /+ ↓ abstraction functions +/ + static string[string] object_reset()(string[string] an_object) { an_object.remove("body_nugget"); an_object.remove("substantive"); an_object.remove("is"); @@ -2414,30 +2408,21 @@ template DocReformDocAbstraction() { an_object.remove("bookindex_nugget"); return an_object; } - 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; obj_type_status["para"] = State.off; an_object = an_object.object_reset; } - 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) @@ -2493,13 +2478,10 @@ template DocReformDocAbstraction() { } return obj_type_status; } - 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) { @@ -2511,13 +2493,10 @@ template DocReformDocAbstraction() { } return line; } - 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( @@ -2539,17 +2518,12 @@ template DocReformDocAbstraction() { } return line; } - 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])); - } static auto rgx = Rgx(); if (auto m = line.matchFirst(rgx.block_curly_code_open)) { dochas["codeblock"]++; @@ -2730,16 +2704,11 @@ template DocReformDocAbstraction() { obj_type_status["tic_table"] = TriState.on; } } - 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)) { @@ -2774,16 +2743,11 @@ template DocReformDocAbstraction() { } return an_object; } - 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)) { @@ -2818,16 +2782,11 @@ template DocReformDocAbstraction() { } return an_object; } - 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)) { @@ -2862,22 +2821,15 @@ template DocReformDocAbstraction() { } return an_object; } - 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)) { @@ -3111,16 +3063,11 @@ template DocReformDocAbstraction() { } return an_object; } - 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)) { @@ -3158,17 +3105,12 @@ template DocReformDocAbstraction() { } } } - 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)) { @@ -3221,10 +3163,7 @@ template DocReformDocAbstraction() { } return an_object; } - 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", @@ -3413,7 +3352,7 @@ template DocReformDocAbstraction() { processing.remove("verse"); ++cntr; } - 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, @@ -3721,19 +3660,13 @@ template DocReformDocAbstraction() { } return an_object; } - 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) { @@ -3777,20 +3710,13 @@ template DocReformDocAbstraction() { } return an_object; } - 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 +/ @@ -3865,18 +3791,12 @@ template DocReformDocAbstraction() { } return heading_match_str; } - 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)) @@ -3927,25 +3847,16 @@ template DocReformDocAbstraction() { } return line; } - 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"]; @@ -4082,24 +3993,15 @@ template DocReformDocAbstraction() { } return an_object; } - 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); @@ -4144,8 +4046,8 @@ template DocReformDocAbstraction() { } return an_object; } - auto font_faces_line(T)( - T textline, + char[] font_faces_line()( + char[] textline, ) { static auto rgx = Rgx(); static auto mkup = InlineMarkup(); @@ -4158,9 +4060,9 @@ template DocReformDocAbstraction() { } return textline; } - 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"; @@ -4183,9 +4085,9 @@ template DocReformDocAbstraction() { } return table_object; } - 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(); @@ -4307,9 +4209,9 @@ template DocReformDocAbstraction() { comp_obj_block.text = _table_substantive; return table_object; } - 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(); @@ -4323,9 +4225,9 @@ template DocReformDocAbstraction() { table_object = table_object.flow_table_array_munge(_table); return table_object; } - 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(); @@ -4339,8 +4241,8 @@ template DocReformDocAbstraction() { table_object = table_object.flow_table_array_munge(_table); return table_object; } - /+ abstraction functions ↑ +/ - /+ ↓ abstraction function emitters +/ + /+ abstraction functions ↑ +/ + /+ ↓ abstraction function emitters +/ pure struct OCNemitter { int ocn_digit, ocn_object_number, ocn_on_, ocn_off_, ocn_bkidx, ocn_bkidx_; string object_identifier; @@ -4389,7 +4291,7 @@ template DocReformDocAbstraction() { invariant() { } } - /+ +/ + /+ +/ static struct ObjInlineMarkupMunge { string[string] obj_txt; int n_foot, n_foot_reg, n_foot_sp_asterisk, n_foot_sp_plus; @@ -4404,10 +4306,7 @@ template DocReformDocAbstraction() { n_foot_sp_asterisk = 0; n_foot_sp_plus = 0; } - 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 @@ -4437,10 +4336,7 @@ template DocReformDocAbstraction() { } return obj_txt_in; } - 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; @@ -4504,11 +4400,8 @@ template DocReformDocAbstraction() { ); return t; } - 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 = ""; @@ -4572,11 +4465,8 @@ template DocReformDocAbstraction() { } invariant() { } - 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 @@ -4594,11 +4484,8 @@ template DocReformDocAbstraction() { } invariant() { } - 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) @@ -4613,11 +4500,8 @@ template DocReformDocAbstraction() { } return t; } - 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; @@ -4634,11 +4518,8 @@ template DocReformDocAbstraction() { } invariant() { } - 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; @@ -4647,11 +4528,8 @@ template DocReformDocAbstraction() { } invariant() { } - 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; @@ -4660,11 +4538,8 @@ template DocReformDocAbstraction() { } invariant() { } - 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); @@ -4673,11 +4548,8 @@ template DocReformDocAbstraction() { } invariant() { } - 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; @@ -4685,11 +4557,8 @@ template DocReformDocAbstraction() { } invariant() { } - 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; @@ -4703,17 +4572,13 @@ template DocReformDocAbstraction() { static auto munge = ObjInlineMarkupMunge(); string[string] obj_txt; static string anchor_tag = ""; - 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; @@ -4803,34 +4668,24 @@ template DocReformDocAbstraction() { } invariant() { } - 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; @@ -4910,16 +4765,12 @@ template DocReformDocAbstraction() { 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 = ""; @@ -5058,15 +4909,11 @@ template DocReformDocAbstraction() { return munge_; } 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)) { @@ -5096,20 +4943,15 @@ template DocReformDocAbstraction() { return munge_; } } - /+ +/ + /+ +/ struct ObjAttributes { string[string] _obj_attrib; - 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) { @@ -5170,11 +5012,8 @@ template DocReformDocAbstraction() { } private: string _obj_attributes; - 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)) { @@ -5200,11 +5039,8 @@ template DocReformDocAbstraction() { } return _obj_attributes; } - 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\"," @@ -5214,11 +5050,8 @@ template DocReformDocAbstraction() { } invariant() { } - 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\"," @@ -5228,11 +5061,8 @@ template DocReformDocAbstraction() { } invariant() { } - 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\"," @@ -5242,11 +5072,8 @@ template DocReformDocAbstraction() { } invariant() { } - 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\"," @@ -5256,11 +5083,8 @@ template DocReformDocAbstraction() { } invariant() { } - 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\"," @@ -5270,11 +5094,8 @@ template DocReformDocAbstraction() { } invariant() { } - 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\"," @@ -5284,11 +5105,8 @@ template DocReformDocAbstraction() { } invariant() { } - 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\"," @@ -5298,11 +5116,8 @@ template DocReformDocAbstraction() { } invariant() { } - 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\"," @@ -5312,11 +5127,8 @@ template DocReformDocAbstraction() { } invariant() { } - 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\"," @@ -5326,16 +5138,11 @@ template DocReformDocAbstraction() { } invariant() { } - 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) @@ -5355,7 +5162,7 @@ template DocReformDocAbstraction() { return _obj_attrib; } } - /+ +/ + /+ +/ struct BookIndexNuggetHash { string main_term, sub_term, sub_term_bits; int object_number_offset, object_number_endpoint; @@ -5363,14 +5170,13 @@ template DocReformDocAbstraction() { 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) { @@ -5438,12 +5244,9 @@ template DocReformDocAbstraction() { } 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) { @@ -5469,8 +5272,8 @@ template DocReformDocAbstraction() { int mkn, skn; static auto rgx = Rgx(); static auto munge = ObjInlineMarkupMunge(); - 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 @@ -5498,13 +5301,12 @@ template DocReformDocAbstraction() { ++mkn; } } - 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; @@ -5652,7 +5454,7 @@ template DocReformDocAbstraction() { return t; } } - /+ +/ + /+ +/ struct NotesSection { string[string] object_notes; int previous_count; @@ -5835,17 +5637,13 @@ template DocReformDocAbstraction() { return t; } } - /+ +/ + /+ +/ struct Bibliography { - 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 @@ -5869,14 +5667,10 @@ template DocReformDocAbstraction() { } return biblio_sorted__; } - 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 @@ -5901,10 +5695,7 @@ template DocReformDocAbstraction() { } return bib_arr_json.dup; } - 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){ @@ -5919,10 +5710,7 @@ template DocReformDocAbstraction() { } return biblio_sorted_; } - 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)) { @@ -5932,30 +5720,25 @@ template DocReformDocAbstraction() { } } } - /+ +/ + /+ +/ struct NodeStructureMetadata { int lv, lv0, lv1, lv2, lv3, lv4, lv5, lv6, lv7; int obj_cite_digit; int[string] p_; // p_ parent_ static auto rgx = Rgx(); - 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); @@ -6000,37 +5783,28 @@ template DocReformDocAbstraction() { } invariant() { } - 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); @@ -6209,16 +5983,12 @@ template DocReformDocAbstraction() { invariant() { } } - /+ abstraction functions emitters ↑ +/ - /+ ↓ abstraction functions assertions +/ - pure void assertions_doc_structure(O,Lv)( - O an_object, - Lv lv + /+ abstraction functions emitters ↑ +/ + /+ ↓ abstraction functions assertions +/ + 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); @@ -6390,10 +6160,7 @@ template DocReformDocAbstraction() { break; } } - 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), @@ -6415,8 +6182,8 @@ template DocReformDocAbstraction() { || (obj_type_status["block"] == TriState.closing), "block status: off or closing"); } - /+ abstraction functions assertions ↑ +/ -} /+ ← closed: template DocReformDocAbstraction +/ + /+ abstraction functions assertions ↑ +/ +} /+ ← closed: template DocReformDocAbstraction +/ template docSectKeysSeq() { auto docSectKeysSeq(string[][string] document_section_keys_sequenced) { struct doc_sect_keys_seq { diff --git a/src/doc_reform/meta/metadoc_summary.d b/src/doc_reform/meta/metadoc_summary.d index 30f4a83..768cebd 100644 --- a/src/doc_reform/meta/metadoc_summary.d +++ b/src/doc_reform/meta/metadoc_summary.d @@ -1,8 +1,8 @@ module doc_reform.meta.metadoc_summary; template DocReformAbstractionSummary() { - auto DocReformAbstractionSummary(S,T)( - auto ref const S doc_abstraction, - auto ref T doc_matters, + void DocReformAbstractionSummary(S,T)( + const S doc_abstraction, + T doc_matters, ) { import doc_reform.meta.defaults, |