aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdp/ao_abstract_doc_source.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2017-01-23 17:17:47 -0500
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:14 -0400
commit334bb9c301bb72d5331a2e9e067211c18e5f7c69 (patch)
tree914d539ce4f228103da8bf465cbcf61a71f96498 /src/sdp/ao_abstract_doc_source.d
parenttemplate, document head & body (diff)
templates
Diffstat (limited to 'src/sdp/ao_abstract_doc_source.d')
-rw-r--r--src/sdp/ao_abstract_doc_source.d635
1 files changed, 449 insertions, 186 deletions
diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d
index 8b1d4cf..cd121c5 100644
--- a/src/sdp/ao_abstract_doc_source.d
+++ b/src/sdp/ao_abstract_doc_source.d
@@ -225,9 +225,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 +/
scope(success) {
@@ -1531,28 +1531,40 @@ template SiSUdocAbstraction() {
/+ post loop markup document/text ↑ +/
} /+ ← closed: abstract doc source +/
/+ ↓ abstraction functions +/
- 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");
an_object.remove("attrib");
an_object.remove("bookindex_nugget");
}
- 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;
type["para"] = State.off;
object_reset(an_object);
}
- 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)) {
@@ -1593,11 +1605,16 @@ template SiSUdocAbstraction() {
}
}
}
- 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]));
+ }
if (matchFirst(line, rgx.block_curly_code_open)) {
/+ curly code open +/
debug(code) { // code (curly) open
@@ -1737,11 +1754,16 @@ template SiSUdocAbstraction() {
type["tic_table"] = TriState.on;
}
}
- 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
@@ -1772,7 +1794,10 @@ template SiSUdocAbstraction() {
}
}
}
- 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",
@@ -1910,14 +1935,22 @@ template SiSUdocAbstraction() {
header_tag_value="";
}
}
- 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
@@ -2103,11 +2136,16 @@ template SiSUdocAbstraction() {
}
}
}
- 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
@@ -2138,11 +2176,16 @@ template SiSUdocAbstraction() {
}
}
}
- 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
@@ -2173,11 +2216,16 @@ template SiSUdocAbstraction() {
}
}
}
- 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
@@ -2208,11 +2256,16 @@ template SiSUdocAbstraction() {
}
}
}
- 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
@@ -2463,13 +2516,20 @@ template SiSUdocAbstraction() {
type["quote"] = TriState.off;
}
}
- 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
@@ -2512,13 +2572,20 @@ template SiSUdocAbstraction() {
}
}
}
- 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 +/
@@ -2596,12 +2663,18 @@ template SiSUdocAbstraction() {
type["make_headings"] = State.on;
}
}
- 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))
@@ -2652,16 +2725,26 @@ template SiSUdocAbstraction() {
}
}
}
- 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;
@@ -2795,15 +2878,24 @@ template SiSUdocAbstraction() {
}
}
}
- 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;
@@ -2879,7 +2971,10 @@ template SiSUdocAbstraction() {
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 +/
@@ -2924,7 +3019,10 @@ template SiSUdocAbstraction() {
}
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(
@@ -2999,8 +3097,12 @@ template SiSUdocAbstraction() {
}
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;
@@ -3015,8 +3117,12 @@ template SiSUdocAbstraction() {
}
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;
@@ -3052,8 +3158,12 @@ template SiSUdocAbstraction() {
}
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"]);
@@ -3061,8 +3171,12 @@ template SiSUdocAbstraction() {
}
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"]);
@@ -3070,24 +3184,36 @@ template SiSUdocAbstraction() {
}
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"];
@@ -3098,12 +3224,18 @@ template SiSUdocAbstraction() {
struct ObjInlineMarkup {
auto munge = ObjInlineMarkupMunge();
string[string] obj_txt;
- 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`)))
@@ -3163,9 +3295,12 @@ template SiSUdocAbstraction() {
}
invariant() {
}
- 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(
@@ -3175,15 +3310,24 @@ template SiSUdocAbstraction() {
);
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;
@@ -3317,11 +3461,16 @@ template SiSUdocAbstraction() {
invariant() {
}
private:
- 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;
@@ -3434,7 +3583,11 @@ template SiSUdocAbstraction() {
}
- 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)) {
@@ -3501,12 +3654,18 @@ template SiSUdocAbstraction() {
/+ +/
struct ObjAttributes {
string[string] _obj_attrib;
- 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_);
@@ -3566,8 +3725,12 @@ template SiSUdocAbstraction() {
}
private:
string _obj_attributes;
- 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)) {
@@ -3593,8 +3756,12 @@ template SiSUdocAbstraction() {
}
return _obj_attributes;
}
- 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\","
@@ -3603,8 +3770,12 @@ template SiSUdocAbstraction() {
}
invariant() {
}
- 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\","
@@ -3613,8 +3784,12 @@ template SiSUdocAbstraction() {
}
invariant() {
}
- 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\","
@@ -3623,8 +3798,12 @@ template SiSUdocAbstraction() {
}
invariant() {
}
- 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\","
@@ -3633,8 +3812,12 @@ template SiSUdocAbstraction() {
}
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_attributes = " \"use\": \"content\","
~ " \"of\": \"block\","
@@ -3643,8 +3826,12 @@ template SiSUdocAbstraction() {
}
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_attributes = " \"use\": \"content\","
~ " \"of\": \"block\","
@@ -3653,8 +3840,12 @@ template SiSUdocAbstraction() {
}
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_attributes = " \"use\": \"content\","
~ " \"of\": \"block\","
@@ -3663,8 +3854,12 @@ template SiSUdocAbstraction() {
}
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_attributes = " \"use\": \"content\","
~ " \"of\": \"block\","
@@ -3673,8 +3868,12 @@ template SiSUdocAbstraction() {
}
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_attributes = " \"use\": \"comment\","
~ " \"of\": \"comment\","
@@ -3683,11 +3882,16 @@ template SiSUdocAbstraction() {
}
invariant() {
}
- 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)
@@ -3715,11 +3919,15 @@ template SiSUdocAbstraction() {
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(
@@ -3783,9 +3991,12 @@ template SiSUdocAbstraction() {
}
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) {
@@ -3811,9 +4022,12 @@ template SiSUdocAbstraction() {
int mkn, skn;
auto rgx = Rgx();
auto munge = ObjInlineMarkupMunge();
- 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, "}! ");
@@ -3837,12 +4051,18 @@ template SiSUdocAbstraction() {
++mkn;
}
}
- 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();
@@ -4128,11 +4348,16 @@ template SiSUdocAbstraction() {
}
/+ +/
struct Bibliography {
- 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);
@@ -4153,10 +4378,14 @@ template SiSUdocAbstraction() {
}
return biblio_sorted__;
}
- 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
@@ -4182,7 +4411,10 @@ template SiSUdocAbstraction() {
bib_arr_json.dup;
return biblio_unsorted_array_of_json_objects;
}
- 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){
@@ -4197,7 +4429,10 @@ template SiSUdocAbstraction() {
}
return biblio_sorted_;
}
- 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)) {
@@ -4212,15 +4447,23 @@ template SiSUdocAbstraction() {
int lv, lv0, lv1, lv2, lv3, lv4, lv5, lv6, lv7;
int obj_cite_number;
int[string] p_; // p_ parent_
- 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);
@@ -4263,20 +4506,33 @@ template SiSUdocAbstraction() {
}
invariant() {
}
- 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);
@@ -4438,10 +4694,14 @@ template SiSUdocAbstraction() {
}
/+ abstraction functions emitters ↑ +/
/+ ↓ abstraction functions assertions +/
- 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);
@@ -4613,7 +4873,10 @@ template SiSUdocAbstraction() {
break;
}
}
- 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),