From 334bb9c301bb72d5331a2e9e067211c18e5f7c69 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 23 Jan 2017 17:17:47 -0500 Subject: templates --- org/ao_abstract_doc_source.org | 640 +++++++++++++++++++++++++++++------------ org/ao_conf_make_meta.org | 82 ++++-- org/output.org | 69 +++-- org/sdp.org | 1 + 4 files changed, 561 insertions(+), 231 deletions(-) (limited to 'org') diff --git a/org/ao_abstract_doc_source.org b/org/ao_abstract_doc_source.org index 2100faf..a7d3d84 100644 --- a/org/ao_abstract_doc_source.org +++ b/org/ao_abstract_doc_source.org @@ -40,9 +40,9 @@ template SiSUdocAbstraction() { ) { debug(asserts){ static assert(is(typeof(markup_sourcefile_content) == char[][])); - static assert(is(typeof(dochead_make_aa) == string[string][string])); - static assert(is(typeof(dochead_meta_aa) == string[string][string])); - static assert(is(typeof(opt_action_bool) == bool[string])); + static assert(is(typeof(dochead_make_aa) == string[string][string])); + static assert(is(typeof(dochead_meta_aa) == string[string][string])); + static assert(is(typeof(opt_action_bool) == bool[string])); } /+ ↓ abstraction init +/ <> @@ -2016,7 +2016,10 @@ functions used in document abstraction #+name: abs_functions_object_reset #+BEGIN_SRC d -auto object_reset(ref string[string] an_object) { +auto object_reset(O)(ref O an_object) { + debug(asserts){ + static assert(is(typeof(an_object) == string[string])); + } an_object.remove("body_nugget"); an_object.remove("substantive"); an_object.remove("is"); @@ -2029,11 +2032,16 @@ auto object_reset(ref string[string] an_object) { #+name: abs_functions_header_set_common #+BEGIN_SRC d -auto _common_reset_( - ref int[string] line_occur, - ref string[string] an_object, - ref int[string] type +auto _common_reset_(L,O,T)( + ref L line_occur, + ref O an_object, + ref T type ) { + debug(asserts){ + static assert(is(typeof(line_occur) == int[string])); + static assert(is(typeof(an_object) == string[string])); + static assert(is(typeof(type) == int[string])); + } line_occur["heading"] = State.off; line_occur["para"] = State.off; type["heading"] = State.off; @@ -2046,10 +2054,14 @@ auto _common_reset_( #+name: abs_functions_ocn_status #+BEGIN_SRC d -void _check_ocn_status_( - char[] line, - ref int[string] type +void _check_ocn_status_(L,T)( + L line, + ref T type ) { + debug(asserts){ + static assert(is(typeof(line) == char[])); + static assert(is(typeof(type) == int[string])); + } if ((!line.empty) && (type["ocn_status_multi_obj"] == TriState.off)) { /+ not multi-line object, check whether obj_cite_number is on or turned off +/ if (matchFirst(line, rgx.obj_cite_number_block_marks)) { @@ -2098,11 +2110,16 @@ void _check_ocn_status_( #+name: abs_functions_block #+BEGIN_SRC d -void _start_block_( - char[] line, - ref int[string] type, - string[string] obj_cite_number_poem +void _start_block_(L,T,N)( + L line, + ref T type, + N obj_cite_number_poem ) { + debug(asserts){ + static assert(is(typeof(line) == char[])); + static assert(is(typeof(type) == int[string])); + static assert(is(typeof(obj_cite_number_poem) == string[string])); + } #+END_SRC ***** block (various) curly open :curly: @@ -2267,11 +2284,16 @@ void _start_block_( #+name: abs_functions_block_code #+BEGIN_SRC d -void _code_block_( - char[] line, - ref string[string] an_object, - ref int[string] type +void _code_block_(L,O,T)( + ref L line, + ref O an_object, + ref T type ) { + debug(asserts){ + static assert(is(typeof(line) == char[])); + static assert(is(typeof(an_object) == string[string])); + static assert(is(typeof(type) == int[string])); + } if (type["curly_code"] == TriState.on) { if (matchFirst(line, rgx.block_curly_code_close)) { debug(code) { // code (curly) close @@ -2309,7 +2331,10 @@ void _code_block_( #+name: abs_functions_block_biblio #+BEGIN_SRC d -final string biblio_tag_map(string abr) { +final string biblio_tag_map(A)(A abr) { + debug(asserts){ + static assert(is(typeof(abr) == string)); + } auto btm = [ "au" : "author_raw", "ed" : "editor_raw", @@ -2334,7 +2359,10 @@ final string biblio_tag_map(string abr) { #+name: none #+BEGIN_SRC d -final string biblio_tag_map_(string abr) { +final string biblio_tag_map_(A)(A abr) { + debug(asserts){ + static assert(is(typeof(abr) == string)); + } string name; switch (abr) { case "au": @@ -2518,14 +2546,22 @@ why extra object stuff only in poem/verse? #+name: abs_functions_block_poem #+BEGIN_SRC d -void _poem_block_( - char[] line, - ref string[string] an_object, - ref int[string] type, - ref int cntr, - string[string] obj_cite_number_poem, - string[string][string] dochead_make_aa, +void _poem_block_(L,O,T,C,N,Ma)( + L line, + ref O an_object, + ref T type, + ref C cntr, + N obj_cite_number_poem, + Ma dochead_make_aa, ) { + debug(asserts){ + static assert(is(typeof(line) == char[])); + static assert(is(typeof(an_object) == string[string])); + static assert(is(typeof(type) == int[string])); + static assert(is(typeof(cntr) == int)); + static assert(is(typeof(obj_cite_number_poem) == string[string])); + static assert(is(typeof(dochead_make_aa) == string[string][string])); + } if (type["curly_poem"] == TriState.on) { if (matchFirst(line, rgx.block_curly_poem_close)) { an_object[an_object_key]="verse"; // check that this is as you please @@ -2717,11 +2753,16 @@ void _poem_block_( #+name: abs_functions_block_group #+BEGIN_SRC d -void _group_block_( - char[] line, - ref string[string] an_object, - ref int[string] type +void _group_block_(L,O,T)( + ref L line, + ref O an_object, + ref T type ) { + debug(asserts){ + static assert(is(typeof(line) == char[])); + static assert(is(typeof(an_object) == string[string])); + static assert(is(typeof(type) == int[string])); + } if (type["curly_group"] == State.on) { if (matchFirst(line, rgx.block_curly_group_close)) { debug(group) { // group (curly) close @@ -2758,11 +2799,16 @@ void _group_block_( #+name: abs_functions_block_block #+BEGIN_SRC d -void _block_block_( - char[] line, - ref string[string] an_object, - ref int[string] type +void _block_block_(L,O,T)( + ref L line, + ref O an_object, + ref T type ) { + debug(asserts){ + static assert(is(typeof(line) == char[])); + static assert(is(typeof(an_object) == string[string])); + static assert(is(typeof(type) == int[string])); + } if (type["curly_block"] == TriState.on) { if (matchFirst(line, rgx.block_curly_block_close)) { debug(block) { // block (curly) close @@ -2799,11 +2845,16 @@ void _block_block_( #+name: abs_functions_block_quote #+BEGIN_SRC d -void _quote_block_( - char[] line, - ref string[string] an_object, - ref int[string] type +void _quote_block_(L,O,T)( + ref L line, + ref O an_object, + ref T type ) { + debug(asserts){ + static assert(is(typeof(line) == char[])); + static assert(is(typeof(an_object) == string[string])); + static assert(is(typeof(type) == int[string])); + } if (type["curly_quote"] == TriState.on) { if (matchFirst(line, rgx.block_curly_quote_close)) { debug(quote) { // quote (curly) close @@ -2840,11 +2891,16 @@ void _quote_block_( #+name: abs_functions_block_table #+BEGIN_SRC d -void _table_block_( - char[] line, - ref string[string] an_object, - ref int[string] type +void _table_block_(L,O,T)( + ref L line, + ref O an_object, + ref T type ) { + debug(asserts){ + static assert(is(typeof(line) == char[])); + static assert(is(typeof(an_object) == string[string])); + static assert(is(typeof(type) == int[string])); + } if (type["curly_table"] == TriState.on) { if (matchFirst(line, rgx.block_curly_table_close)) { debug(table) { // table (curly) close @@ -3107,13 +3163,20 @@ void _block_flag_line_empty_( #+name: abs_functions_book_index #+BEGIN_SRC d -auto _book_index_( - char[] line, - ref string book_idx_tmp, - ref string[string] an_object, - ref int[string] type, - bool[string] opt_action_bool, +auto _book_index_(L,I,O,T,B)( + L line, + ref I book_idx_tmp, + ref O an_object, + ref T type, + B opt_action_bool, ) { + 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(type) == int[string])); + static assert(is(typeof(opt_action_bool) == bool[string])); + } if (auto m = match(line, rgx.book_index)) { /+ match book_index +/ debug(bookindexmatch) { // book index @@ -3163,13 +3226,20 @@ auto _book_index_( #+name: abs_functions_heading #+BEGIN_SRC d -auto _heading_found_( - char[] line, - string dochead_make_identify_unmarked_headings, - ref string[string] heading_match_str, - ref Regex!(char)[string] heading_match_rgx, - ref int[string] type +auto _heading_found_(L,X,H,R,T)( + L line, + X dochead_make_identify_unmarked_headings, + ref H heading_match_str, + ref R heading_match_rgx, + ref T type ) { + debug(asserts){ + static assert(is(typeof(line) == char[])); + static assert(is(typeof(dochead_make_identify_unmarked_headings) == string)); + static assert(is(typeof(heading_match_str) == string[string])); + static assert(is(typeof(heading_match_rgx) == Regex!(char)[string])); + static assert(is(typeof(type) == int[string])); + } if ((dochead_make_identify_unmarked_headings.length > 2) && (type["make_headings"] == State.off)) { /+ headings found +/ @@ -3253,12 +3323,18 @@ auto _heading_found_( #+name: abs_functions_heading #+BEGIN_SRC d -auto _heading_make_set_( - ref char[] line, - ref int[string] line_occur, - ref Regex!(char)[string] heading_match_rgx, - ref int[string] type +auto _heading_make_set_(L,C,R,T)( + L line, + C line_occur, + ref R heading_match_rgx, + ref T type ) { + 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(type) == int[string])); + } if ((type["make_headings"] == State.on) && ((line_occur["para"] == State.off) && (line_occur["heading"] == State.off)) @@ -3315,16 +3391,26 @@ auto _heading_make_set_( #+name: abs_functions_heading #+BEGIN_SRC d -auto _heading_matched_( - char[] line, - ref int[string] line_occur, - ref string[string] an_object, - ref string an_object_key, - ref int[string] lv, - ref int[string] collapsed_lev, - ref int[string] type, - ref string[string][string] dochead_meta_aa +auto _heading_matched_(L,C,O,K,Lv,Lc,T,Me)( + ref L line, + ref C line_occur, + ref O an_object, + ref K an_object_key, + ref Lv lv, + ref Lc collapsed_lev, + ref T type, + ref Me dochead_meta_aa, ) { + 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(type) == int[string])); + static assert(is(typeof(dochead_meta_aa) == string[string][string])); + } if (auto m = match(line, rgx.heading)) { /+ heading match +/ type["heading"] = State.on; @@ -3464,15 +3550,24 @@ auto _heading_matched_( #+name: abs_functions_para #+BEGIN_SRC d -auto _para_match_( - char[] line, - ref string[string] an_object, - ref string an_object_key, - ref int[string] indent, - ref bool bullet, - ref int[string] type, - ref int[string] line_occur, +auto _para_match_(L,O,K,I,B,T,C)( + ref L line, + ref O an_object, + ref K an_object_key, + ref I indent, + ref B bullet, + ref T type, + ref C 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(type) == int[string])); + static assert(is(typeof(line_occur) == int[string])); + } if (line_occur["para"] == State.off) { /+ para matches +/ type["para"] = State.on; @@ -3559,7 +3654,10 @@ struct ObjInlineMarkupMunge { n_foot_sp_asterisk = 0; n_foot_sp_plus = 0; } - string url_links(string obj_txt_in) { + string url_links(Ot)(Ot obj_txt_in) { + debug(asserts){ + static assert(is(typeof(obj_txt_in) == string)); + } /+ url matched +/ if (auto m = matchAll(obj_txt_in, rgx.inline_url)) { /+ link: naked url: http://url +/ @@ -3604,7 +3702,10 @@ struct ObjInlineMarkupMunge { } return obj_txt_in; } - string footnotes_endnotes_markup_and_number_or_stars(string obj_txt_in) { + string footnotes_endnotes_markup_and_number_or_stars(Ot)(Ot obj_txt_in) { // here endnotes are marked up + debug(asserts){ + static assert(is(typeof(obj_txt_in) == string)); + } /+ endnotes (regular) +/ obj_txt_in = replaceAll( @@ -3679,8 +3780,12 @@ struct ObjInlineMarkupMunge { } return obj_txt_out; } - string para(string obj_txt_in) - in { } + string para(Ot)(Ot obj_txt_in) + in { + debug(asserts){ + static assert(is(typeof(obj_txt_in) == string)); + } + } body { auto rgx = Rgx(); obj_txt["munge"]=obj_txt_in; @@ -3695,8 +3800,12 @@ struct ObjInlineMarkupMunge { } return obj_txt["munge"]; } - string heading(string obj_txt_in) - in { } + string heading(Ot)(Ot obj_txt_in) + in { + debug(asserts){ + static assert(is(typeof(obj_txt_in) == string)); + } + } body { auto rgx = Rgx(); obj_txt["munge"]=obj_txt_in; @@ -3732,8 +3841,12 @@ struct ObjInlineMarkupMunge { } invariant() { } - string block(string obj_txt_in) - in { } + string block(Ot)(Ot obj_txt_in) + in { + debug(asserts){ + static assert(is(typeof(obj_txt_in) == string)); + } + } body { obj_txt["munge"]=obj_txt_in; obj_txt["munge"]=object_notes_(obj_txt["munge"]); @@ -3741,8 +3854,12 @@ struct ObjInlineMarkupMunge { } invariant() { } - string verse(string obj_txt_in) - in { } + string verse(Ot)(Ot obj_txt_in) + in { + debug(asserts){ + static assert(is(typeof(obj_txt_in) == string)); + } + } body { obj_txt["munge"]=obj_txt_in; obj_txt["munge"]=object_notes_(obj_txt["munge"]); @@ -3750,24 +3867,36 @@ struct ObjInlineMarkupMunge { } invariant() { } - string quote(string obj_txt_in) - in { } + string quote(Ot)(Ot obj_txt_in) + in { + debug(asserts){ + static assert(is(typeof(obj_txt_in) == string)); + } + } body { obj_txt["munge"]=obj_txt_in; return obj_txt["munge"]; } invariant() { } - string table(string obj_txt_in) - in { } + string table(Ot)(Ot obj_txt_in) + in { + debug(asserts){ + static assert(is(typeof(obj_txt_in) == string)); + } + } body { obj_txt["munge"]=obj_txt_in; return obj_txt["munge"]; } invariant() { } - string comment(string obj_txt_in) - in { } + string comment(Ot)(Ot obj_txt_in) + in { + debug(asserts){ + static assert(is(typeof(obj_txt_in) == string)); + } + } body { obj_txt["munge"]=obj_txt_in; return obj_txt["munge"]; @@ -3791,12 +3920,18 @@ struct ObjInlineMarkup { #+name: ao_emitters_obj_inline_markup_and_anchor_tags #+BEGIN_SRC d - auto obj_inline_markup_and_anchor_tags( - string[string] obj_, - string obj_key_, - string[string][string] dochead_make_aa + auto obj_inline_markup_and_anchor_tags(O,K,Ma)( + O obj_, + K obj_key_, + Ma dochead_make_aa ) - in { } + in { + debug(asserts){ + static assert(is(typeof(obj_) == string[string])); + static assert(is(typeof(obj_key_) == string)); + static assert(is(typeof(dochead_make_aa) == string[string][string])); + } + } body { obj_txt["munge"]=obj_[obj_key_].dup; obj_txt["munge"]=(match(obj_["is"], ctRegex!(`verse|code`))) @@ -3862,9 +3997,12 @@ struct ObjInlineMarkup { #+name: ao_emitters_obj_inline_markup_table_of_contents #+BEGIN_SRC d - auto _clean_heading_toc_( - char[] heading_toc_, + auto _clean_heading_toc_(Toc)( + Toc heading_toc_, ) { + debug(asserts){ + static assert(is(typeof(heading_toc_) == char[])); + } auto m = matchFirst(cast(char[]) heading_toc_, rgx.heading); heading_toc_ = replaceAll( @@ -3874,15 +4012,24 @@ struct ObjInlineMarkup { ); return heading_toc_; }; - auto table_of_contents_gather_headings( - string[string] obj_, - string[string][string] dochead_make_aa, - string segment_anchor_tag_that_object_belongs_to, - string _anchor_tag, - ref string[][string] lev4_subtoc, - ObjGenericComposite[][string] the_table_of_contents_section, + auto table_of_contents_gather_headings(O,Ma,Ts,Ta,X,Toc)( + O obj_, + Ma dochead_make_aa, + Ts segment_anchor_tag_that_object_belongs_to, + Ta _anchor_tag, + ref X lev4_subtoc, + Toc the_table_of_contents_section, ) - in { } + in { + debug(asserts){ + static assert(is(typeof(obj_) == string[string])); + static assert(is(typeof(dochead_make_aa) == string[string][string])); + static assert(is(typeof(segment_anchor_tag_that_object_belongs_to) == string)); + 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[][string])); + } + } body { ObjGenericComposite comp_obj_toc; mixin InternalMarkup; @@ -4028,11 +4175,16 @@ private: #+name: ao_emitters_obj_inline_markup_heading_numbering_segment_anchor_tags #+BEGIN_SRC d - static string _configured_auto_heading_numbering_and_segment_anchor_tags( - string munge_, - string[string] obj_, - string[string][string] dochead_make_aa + static string _configured_auto_heading_numbering_and_segment_anchor_tags(M,O,Ma)( + M munge_, + O obj_, + Ma dochead_make_aa ) { + debug(asserts){ + static assert(is(typeof(munge_) == string)); + static assert(is(typeof(obj_) == string[string])); + static assert(is(typeof(dochead_make_aa) == string[string][string])); + } if (dochead_make_aa["make"]["num_top"].length > 0) { if (!(match(munge_, rgx.heading_anchor_tag))) { static __gshared int heading_num_top_level=9; @@ -4156,7 +4308,11 @@ private: #+name: ao_emitters_obj_inline_markup_heading_numbering_segment_anchor_tags #+BEGIN_SRC d - static string _make_segment_anchor_tags_if_none_provided(string munge_, string lev_) { + static string _make_segment_anchor_tags_if_none_provided(M,Lv)(M munge_, Lv lev_) { + debug(asserts){ + static assert(is(typeof(munge_) == string)); + static assert(is(typeof(lev_) == string)); + } if (!(match(munge_, rgx.heading_anchor_tag))) { // if (anchor_tags_.length == 0) { if (match(munge_, rgx.heading_identify_anchor_tag)) { if (auto m = match(munge_, rgx.heading_extract_named_anchor_tag)) { @@ -4247,12 +4403,18 @@ struct ObjAttributes { #+name: ao_emitters_obj_attributes_public #+BEGIN_SRC d - string obj_attributes( - string obj_is_, - string obj_raw, - ObjGenericComposite _comp_obj_heading, + string obj_attributes(Oi,OR,OH)( + Oi obj_is_, + OR obj_raw, + OH _comp_obj_heading, ) - in { } + 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) { destroy(obj_is_); @@ -4325,8 +4487,12 @@ struct ObjAttributes { #+name: ao_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string _para_and_blocks(string obj_txt_in) - in { } + string _para_and_blocks(Ot)(Ot obj_txt_in) + in { + debug(asserts){ + static assert(is(typeof(obj_txt_in) == string)); + } + } body { auto rgx = Rgx(); if (matchFirst(obj_txt_in, rgx.para_bullet)) { @@ -4358,8 +4524,12 @@ struct ObjAttributes { #+name: ao_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string _para(string obj_txt_in) - in { } + string _para(Ot)(Ot obj_txt_in) + in { + debug(asserts){ + static assert(is(typeof(obj_txt_in) == string)); + } + } body { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"para\"," @@ -4374,8 +4544,12 @@ struct ObjAttributes { #+name: ao_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string _heading(string obj_txt_in) - in { } + string _heading(Ot)(Ot obj_txt_in) + in { + debug(asserts){ + static assert(is(typeof(obj_txt_in) == string)); + } + } body { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"para\"," @@ -4390,8 +4564,12 @@ struct ObjAttributes { #+name: ao_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string _code(string obj_txt_in) - in { } + string _code(Ot)(Ot obj_txt_in) + in { + debug(asserts){ + static assert(is(typeof(obj_txt_in) == string)); + } + } body { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," @@ -4406,8 +4584,12 @@ struct ObjAttributes { #+name: ao_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string _group(string obj_txt_in) - in { } + string _group(Ot)(Ot obj_txt_in) + in { + debug(asserts){ + static assert(is(typeof(obj_txt_in) == string)); + } + } body { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," @@ -4422,8 +4604,12 @@ struct ObjAttributes { #+name: ao_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string _block(string obj_txt_in) - in { } + string _block(Ot)(Ot obj_txt_in) + in { + debug(asserts){ + static assert(is(typeof(obj_txt_in) == string)); + } + } body { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," @@ -4438,8 +4624,12 @@ struct ObjAttributes { #+name: ao_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string _verse(string obj_txt_in) - in { } + string _verse(Ot)(Ot obj_txt_in) + in { + debug(asserts){ + static assert(is(typeof(obj_txt_in) == string)); + } + } body { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," @@ -4454,8 +4644,12 @@ struct ObjAttributes { #+name: ao_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string _quote(string obj_txt_in) - in { } + string _quote(Ot)(Ot obj_txt_in) + in { + debug(asserts){ + static assert(is(typeof(obj_txt_in) == string)); + } + } body { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," @@ -4470,8 +4664,12 @@ struct ObjAttributes { #+name: ao_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string _table(string obj_txt_in) - in { } + string _table(Ot)(Ot obj_txt_in) + in { + debug(asserts){ + static assert(is(typeof(obj_txt_in) == string)); + } + } body { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," @@ -4486,8 +4684,12 @@ struct ObjAttributes { #+name: ao_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string _comment(string obj_txt_in) - in { } + string _comment(Ot)(Ot obj_txt_in) + in { + debug(asserts){ + static assert(is(typeof(obj_txt_in) == string)); + } + } body { _obj_attributes = " \"use\": \"comment\"," ~ " \"of\": \"comment\"," @@ -4502,11 +4704,16 @@ struct ObjAttributes { #+name: ao_emitters_obj_attributes_private_json #+BEGIN_SRC d - string _set_additional_values_parse_as_json( - string _obj_attrib, - string obj_is_, - ObjGenericComposite _comp_obj_heading, + string _set_additional_values_parse_as_json(OA,Oi,OH)( + OA _obj_attrib, + Oi obj_is_, + OH _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) @@ -4546,11 +4753,15 @@ struct BookIndexNuggetHash { string[][string][string] bi; string[][string][string] hash_nugget; string[] bi_main_terms_split_arr; - string[][string][string] bookindex_nugget_hash( - string bookindex_section, - int obj_cite_number + string[][string][string] bookindex_nugget_hash(BI,N)( + BI bookindex_section, + N obj_cite_number ) in { + debug(asserts){ + static assert(is(typeof(bookindex_section) == string)); + static assert(is(typeof(obj_cite_number) == int)); + } debug(bookindexraw) { if (!bookindex_section.empty) { writeln( @@ -4620,9 +4831,12 @@ struct BookIndexNuggetHash { #+BEGIN_SRC d struct BookIndexReportIndent { int mkn, skn; - auto bookindex_report_indented( - string[][string][string] bookindex_unordered_hashes + auto bookindex_report_indented(BI)( + BI 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) { @@ -4661,9 +4875,12 @@ struct BookIndexReportSection { #+name: ao_emitters_book_index_report_section #+BEGIN_SRC d - auto bookindex_write_section( - string[][string][string] bookindex_unordered_hashes + auto bookindex_write_section(BI)( + BI 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) { write("_0_1 !{", mainkey, "}! "); @@ -4693,12 +4910,18 @@ struct BookIndexReportSection { #+name: ao_emitters_book_index_report_section #+BEGIN_SRC d - auto bookindex_build_abstraction_section( - string[][string][string] bookindex_unordered_hashes, - int obj_cite_number, - string segment_anchor_tag_that_object_belongs_to, - bool[string] opt_action_bool, + auto bookindex_build_abstraction_section(BI,N,Ta,B)( + BI bookindex_unordered_hashes, + N obj_cite_number, + Ta segment_anchor_tag_that_object_belongs_to, + B opt_action_bool, ) { + debug(asserts){ + static assert(is(typeof(bookindex_unordered_hashes) == string[][string][string])); + static assert(is(typeof(obj_cite_number) == int)); + static assert(is(typeof(segment_anchor_tag_that_object_belongs_to) == string)); + static assert(is(typeof(opt_action_bool) == bool[string])); + } mixin SiSUnode; mixin InternalMarkup; auto mkup = InlineMarkup(); @@ -5031,11 +5254,16 @@ struct Bibliography { #+name: ao_emitters_bibliography #+BEGIN_SRC d - public JSONValue[] _bibliography_( - ref string[] biblio_unsorted_incomplete, - ref JSONValue[] bib_arr_json + public JSONValue[] _bibliography_(Bi,BJ)( + ref Bi biblio_unsorted_incomplete, + ref BJ bib_arr_json ) - in { } + in { + debug(asserts){ + static assert(is(typeof(biblio_unsorted_incomplete) == string[])); + static assert(is(typeof(bib_arr_json) == JSONValue[])); + } + } body { JSONValue[] biblio_unsorted = _biblio_unsorted_complete_(biblio_unsorted_incomplete, bib_arr_json); @@ -5062,10 +5290,14 @@ struct Bibliography { #+name: ao_emitters_bibliography #+BEGIN_SRC d - final private JSONValue[] _biblio_unsorted_complete_( - string[] biblio_unordered, - ref JSONValue[] bib_arr_json + final private JSONValue[] _biblio_unsorted_complete_(Bi,BJ)( + Bi biblio_unordered, + ref BJ 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 @@ -5097,7 +5329,10 @@ struct Bibliography { #+name: ao_emitters_bibliography #+BEGIN_SRC d - final private JSONValue[] biblio_sort(JSONValue[] biblio_unordered) { + final private JSONValue[] biblio_sort(BJ)(BJ biblio_unordered) { + debug(asserts){ + static assert(is(typeof(biblio_unordered) == JSONValue[])); + } JSONValue[] biblio_sorted_; biblio_sorted_ = sort!((a, b){ @@ -5118,7 +5353,10 @@ struct Bibliography { #+name: ao_emitters_bibliography #+BEGIN_SRC d - void biblio_debug(JSONValue[] biblio_sorted) { + void biblio_debug(BJ)(BJ biblio_sorted) { + debug(asserts){ + static assert(is(typeof(biblio_sorted) == JSONValue[])); + } debug(biblio0) { foreach (j; biblio_sorted) { if (!empty(j["fulltitle"].str)) { @@ -5151,15 +5389,23 @@ struct NodeStructureMetadata { #+name: ao_emitters_metadata #+BEGIN_SRC d - ObjGenericComposite node_location_emitter( - string lev_markup_number, - string segment_anchor_tag, - int obj_cite_number_, - int cntr_, - int ptr_, - string is_ + ObjGenericComposite node_location_emitter(Lv,Ta,N,C,P,I)( + Lv lev_markup_number, + Ta segment_anchor_tag, + N obj_cite_number_, + C cntr_, + P ptr_, + I is_ ) in { + debug(asserts){ + static assert(is(typeof(lev_markup_number) == string)); + static assert(is(typeof(segment_anchor_tag) == string)); + static assert(is(typeof(obj_cite_number_) == int)); + static assert(is(typeof(cntr_) == int)); + static assert(is(typeof(ptr_) == int)); + static assert(is(typeof(is_) == string)); + } auto rgx = Rgx(); assert(is_ != "heading"); assert(to!int(obj_cite_number_) >= 0); @@ -5208,20 +5454,33 @@ struct NodeStructureMetadata { #+name: ao_emitters_metadata #+BEGIN_SRC d - ObjGenericComposite node_emitter_heading( - string _text, - string lev, - string lev_markup_number, - string lev_collapsed_number, - string segment_anchor_tag, - int obj_cite_number_, - int cntr_, - int ptr_, - string[] lv_ancestors, - string is_, - int html_segnames_ptr, + ObjGenericComposite node_emitter_heading(T,L,Lm,Lc,Ta,N,C,P,LA,I,PSn)( + T _text, + L lev, + Lm lev_markup_number, + Lc lev_collapsed_number, + Ta segment_anchor_tag, + N obj_cite_number_, + C cntr_, + P ptr_, + LA lv_ancestors, + I is_, + PSn html_segnames_ptr, ) 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(segment_anchor_tag) == string)); + static assert(is(typeof(obj_cite_number_) == int)); + static assert(is(typeof(cntr_) == int)); + static assert(is(typeof(ptr_) == int)); + static assert(is(typeof(lv_ancestors) == string[])); + static assert(is(typeof(is_) == string)); + static assert(is(typeof(html_segnames_ptr) == int)); + } auto rgx = Rgx(); assert(is_ == "heading"); assert(to!int(obj_cite_number_) >= 0); @@ -5394,10 +5653,14 @@ struct NodeStructureMetadata { #+name: abs_functions_assertions #+BEGIN_SRC d -auto assertions_doc_structure( - string[string] an_object, - int[string] lv +auto assertions_doc_structure(O,Lv)( + O an_object, + Lv 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); @@ -5575,7 +5838,10 @@ auto assertions_doc_structure( #+name: abs_functions_assertions #+BEGIN_SRC d -auto assertions_flag_types_block_status_none_or_closed(int[string] type) { +auto assertions_flag_types_block_status_none_or_closed(T)(T type) { + debug(asserts){ + static assert(is(typeof(type) == int[string])); + } assert( (type["code"] == TriState.off) || (type["code"] == TriState.closing), diff --git a/org/ao_conf_make_meta.org b/org/ao_conf_make_meta.org index eb39f73..df6d456 100644 --- a/org/ao_conf_make_meta.org +++ b/org/ao_conf_make_meta.org @@ -41,7 +41,7 @@ template SiSUheaderExtractHub() { DocMake conf_doc_make_aa ) { debug(asserts){ - static assert(is(typeof(header_src) == char[])); + static assert(is(typeof(header_src) == char[])); static assert(is(typeof(conf_doc_make_aa) == string[string][string])); } auto head_native = HeaderDocMetadataAndMakeNativeToAA(); @@ -109,7 +109,10 @@ template SiSUheaderExtractSDLang() { #+name: ao_conf_make_meta_sdl #+BEGIN_SRC d -private auto sdlangToAAmake(string[string][string] conf, Tag conf_sdlang) { +private auto sdlangToAAmake(C,Tag)(C conf, Tag conf_sdlang) { + debug(asserts){ + static assert(is(typeof(conf) == string[string][string])); + } foreach (maintag, subtags; conf) { foreach (subtag, content; subtags) { if (!(conf_sdlang.maybe.tags[maintag].empty)) { @@ -132,7 +135,7 @@ private auto sdlangToAAmake(string[string][string] conf, Tag conf_sdlang) { #+name: ao_conf_make_meta_sdl #+BEGIN_SRC d -private auto configSettingsSDLangToAAmake(Tag conf_sdlang) { +private auto configSettingsSDLangToAAmake(Tag)(Tag conf_sdlang) { auto conf = sdlangToAAmake(conf_aa, conf_sdlang); return conf; } @@ -142,7 +145,7 @@ private auto configSettingsSDLangToAAmake(Tag conf_sdlang) { #+name: ao_conf_make_meta_sdl #+BEGIN_SRC d -private auto documentMakeSDLangToAAmake(Tag document_make_sdlang) { +private auto documentMakeSDLangToAAmake(Tag)(Tag document_make_sdlang) { auto dochead_make = sdlangToAAmake(make_aa, document_make_sdlang); /+ /+ dochead +/ @@ -290,12 +293,18 @@ private auto documentMakeSDLangToAAmake(Tag document_make_sdlang) { #+name: ao_markup_header_extract_native #+BEGIN_SRC d -auto header_metadata_and_make_aa( - string header, - string[string][string] dochead_meta, - string[string][string] dochead_make +auto header_metadata_and_make_aa(H,Me,Ma)( + H header, + Me dochead_meta, + Ma dochead_make ) -in { } +in { + debug(asserts){ + static assert(is(typeof(header) == string)); + static assert(is(typeof(dochead_meta) == string[string][string])); + static assert(is(typeof(dochead_make) == string[string][string])); + } +} body { scope(exit) { destroy(header); @@ -482,12 +491,18 @@ body { #+name: ao_markup_header_extract_native #+BEGIN_SRC d -private auto native_header_extract( - char[] line, - ref int[string] line_occur, - ref string[string] an_object, - ref int[string] type +private auto native_header_extract(L,Lo,O,T)( + L line, + ref Lo line_occur, + ref O an_object, + ref T type ) { + 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(type) == int[string])); + } if (matchFirst(line, rgx.native_header_make)) { /+ matched header_make +/ debug(header1) { /+ writeln(line); +/ } type["header"] = State.on; @@ -526,11 +541,16 @@ private auto native_header_extract( #+name: ao_markup_header_extract_native #+BEGIN_SRC d -auto header_reset_states_common( - ref int[string] line_occur, - ref string[string] an_object, - ref int[string] type +auto header_reset_states_common(Lo,O,T)( + ref Lo line_occur, + ref O an_object, + ref T type ) { + debug(asserts){ + static assert(is(typeof(line_occur) == int[string])); + static assert(is(typeof(an_object) == string[string])); + static assert(is(typeof(type) == int[string])); + } line_occur["header_make"] = State.off; line_occur["header_meta"] = State.off; type["header"] = State.off; @@ -544,7 +564,10 @@ auto header_reset_states_common( #+name: ao_markup_header_extract_native #+BEGIN_SRC d -private auto headerNativeToAA(in char[] src_header) { +private auto headerNativeToAA(Hn)(Hn src_header) { + debug(asserts){ + static assert(is(typeof(src_header) == char[])); + } auto type = flags_type_init; type = [ "header" : State.off, @@ -600,7 +623,10 @@ private auto headerNativeToAA(in char[] src_header) { #+name: ao_conf_make_meta_sdl #+BEGIN_SRC d -final private auto headerMakeSDLang(in string src_header) { +final private auto headerMakeSDLang(Hs)(Hs src_header) { + debug(asserts){ + static assert(is(typeof(src_header) == string)); + } scope(failure) { stderr.writefln( "%s\n%s\n%s:%s failed here:\n src_header: %s", @@ -632,7 +658,10 @@ final private auto headerMakeSDLang(in string src_header) { #+name: ao_conf_make_meta_sdl #+BEGIN_SRC d -private auto headerSDLangGet(in char[] src_header) { +private auto headerSDLangGet(Hs)(Hs src_header) { + debug(asserts){ + static assert(is(typeof(src_header) == char[])); + } char[][] source_header_arr = split(cast(char[]) src_header, rgx.newline_eol_delimiter); char[] header_clean; @@ -661,7 +690,10 @@ private auto headerSDLangGet(in char[] src_header) { #+name: ao_conf_make_meta_sdl #+BEGIN_SRC d -private auto headerSDLangToAAmake(Tag header_sdlang, string[string][string] dochead_make) { +private auto headerSDLangToAAmake(Tag,Ma)(Tag header_sdlang, Ma dochead_make) { + debug(asserts){ + static assert(is(typeof(dochead_make) == string[string][string])); + } dochead_make = sdlangToAAmake(dochead_make, header_sdlang); auto dochead_meta = sdlangToAAmake(meta_aa, header_sdlang); if (dochead_meta["title"]["main"].empty) { @@ -699,7 +731,11 @@ private auto headerSDLangToAAmake(Tag header_sdlang, string[string][string] doch #+name: ao_conf_make_meta_sdl #+BEGIN_SRC d -private auto headerSDLangToAA(char[] header_sdlang_src, string[string][string] conf_doc_make_aa) { +private auto headerSDLangToAA(Hs,Ma)(Hs header_sdlang_src, Ma conf_doc_make_aa) { + debug(asserts){ + static assert(is(typeof(header_sdlang_src) == char[])); + static assert(is(typeof(conf_doc_make_aa) == string[string][string])); + } auto header_sdlang_tag = headerSDLangGet(header_sdlang_src); // sdlang.ast.Tag auto header_aa_tuple = headerSDLangToAAmake(header_sdlang_tag, conf_doc_make_aa); return header_aa_tuple; diff --git a/org/output.org b/org/output.org index fe1a869..259d4dd 100644 --- a/org/output.org +++ b/org/output.org @@ -161,9 +161,12 @@ template SiSUoutputEPub() { #+name: source_sisupod_config #+BEGIN_SRC d -void sisupod_assemble( - string fn_src, +void sisupod_assemble(S)( + S fn_src, ) { + debug(asserts){ + static assert(is(typeof(fn_src) == string)); + } mixin SiSUpaths; auto pth_sisupod = SiSUpodPaths(); mixin SiSUlanguageCodes; @@ -226,9 +229,12 @@ string _xhtml_anchor_tags(const(string[]) anchor_tags) { #+name: xhtml_format_objects #+BEGIN_SRC d -auto scroll_head( - string[string][string] dochead_meta, +auto scroll_head(Me)( + Me dochead_meta, ) { + debug(asserts){ + static assert(is(typeof(dochead_meta) == string[string][string])); + } string o; o = format(q"¶ @@ -268,9 +274,12 @@ dochead_meta["title"]["full"], #+name: xhtml_format_objects #+BEGIN_SRC d -auto seg_head( - string[string][string] dochead_meta, +auto seg_head(Me)( + Me dochead_meta, ) { + debug(asserts){ + static assert(is(typeof(dochead_meta) == string[string][string])); + } string o; o = format(q"¶ @@ -526,10 +535,14 @@ auto endnote(O)( #+name: output_html_scroll #+BEGIN_SRC d -void scroll_write_output_file( - string fn_src, - string[] doc, +void scroll_write_output_file(Fn,D)( + Fn fn_src, + D doc, ) { + debug(asserts){ + static assert(is(typeof(fn_src) == string)); + static assert(is(typeof(doc) == string[])); + } mixin SiSUpaths; auto pth_html = HtmlPaths(); try { @@ -668,11 +681,16 @@ void scroll(C,T)( #+name: output_html_seg #+BEGIN_SRC d -void seg_write_output_files( - string fn_src, - string[] seg_filenames, - string[][string] doc_html, +void seg_write_output_files(Fn,FnS,D)( + Fn fn_src, + FnS seg_filenames, + D doc_html, ) { + debug(asserts){ + static assert(is(typeof(fn_src) == string)); + static assert(is(typeof(seg_filenames) == string[])); + static assert(is(typeof(doc_html) == string[][string])); + } mixin SiSUpaths; auto pth_html = HtmlPaths(); auto xhtml_format = SDPoutputXHTMLs(); @@ -2512,15 +2530,24 @@ void doc_content(C,T)( #+name: output_epub_xhtml_seg #+BEGIN_SRC d -void epub_write_output_files( - string fn_src, - string[] seg_filenames, - string[][string] doc_epub, - string mimetypes, - string meta_inf_container_xml, - string oebps_toc_ncx, - string oebps_content_opf, +void epub_write_output_files(Fn,FnS,De,Mt,Mic,Ot,Oc)( + Fn fn_src, + FnS seg_filenames, + De doc_epub, + Mt mimetypes, + Mic meta_inf_container_xml, + Ot oebps_toc_ncx, + Oc oebps_content_opf, ) { + debug(asserts){ + static assert(is(typeof(fn_src) == string)); + static assert(is(typeof(seg_filenames) == string[])); + static assert(is(typeof(doc_epub) == string[][string])); + static assert(is(typeof(mimetypes) == string)); + static assert(is(typeof(meta_inf_container_xml) == string)); + static assert(is(typeof(oebps_toc_ncx) == string)); + static assert(is(typeof(oebps_content_opf) == string)); + } mixin SiSUpaths; auto pth_epub = EpubPaths(); // doc = xhtml_format.scroll_head ~ doc_epub ~ xhtml_format.tail; diff --git a/org/sdp.org b/org/sdp.org index 6c204f4..f14c82e 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -426,6 +426,7 @@ auto t = abs.SiSUdocAbstraction( _opt_action_bool ); static assert(!isTypeTuple!(t)); +static assert(t.length==3); auto doc_abstraction = t[0]; // head ~ toc ~ contents ~ endnotes_seg ~ glossary ~ bibliography ~ bookindex ~blurb; string[][string] _document_section_keys_sequenced = t[1]; string[] _doc_html_segnames = t[2]; -- cgit v1.2.3