aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
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
parenttemplate, document head & body (diff)
templates
Diffstat (limited to 'src')
-rwxr-xr-xsrc/sdp.d1
-rw-r--r--src/sdp/ao_abstract_doc_source.d635
-rw-r--r--src/sdp/ao_conf_make_meta.d2
-rw-r--r--src/sdp/ao_conf_make_meta_native.d50
-rw-r--r--src/sdp/ao_conf_make_meta_sdlang.d30
-rw-r--r--src/sdp/output_epub.d25
-rw-r--r--src/sdp/output_html.d23
-rw-r--r--src/sdp/output_xhtmls.d14
-rw-r--r--src/sdp/source_sisupod.d7
9 files changed, 557 insertions, 230 deletions
diff --git a/src/sdp.d b/src/sdp.d
index 4fcabfb..94ef276 100755
--- a/src/sdp.d
+++ b/src/sdp.d
@@ -227,6 +227,7 @@ void main(string[] args) {
_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];
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),
diff --git a/src/sdp/ao_conf_make_meta.d b/src/sdp/ao_conf_make_meta.d
index e0ac269..5c043a2 100644
--- a/src/sdp/ao_conf_make_meta.d
+++ b/src/sdp/ao_conf_make_meta.d
@@ -22,7 +22,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();
diff --git a/src/sdp/ao_conf_make_meta_native.d b/src/sdp/ao_conf_make_meta_native.d
index d95a8dd..6fe38e9 100644
--- a/src/sdp/ao_conf_make_meta_native.d
+++ b/src/sdp/ao_conf_make_meta_native.d
@@ -17,12 +17,18 @@ template SiSUheaderExtractNative() {
auto rgx = Rgx();
enum State { off, on }
string hm, hs;
- 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);
@@ -203,12 +209,18 @@ template SiSUheaderExtractNative() {
static assert(t.length==2);
return t;
}
- 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;
@@ -241,11 +253,16 @@ template SiSUheaderExtractNative() {
}
return an_object;
}
- 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;
@@ -253,7 +270,10 @@ template SiSUheaderExtractNative() {
an_object.remove("is");
an_object.remove("attrib");
}
- 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,
diff --git a/src/sdp/ao_conf_make_meta_sdlang.d b/src/sdp/ao_conf_make_meta_sdlang.d
index 5ced761..801df7e 100644
--- a/src/sdp/ao_conf_make_meta_sdlang.d
+++ b/src/sdp/ao_conf_make_meta_sdlang.d
@@ -11,7 +11,10 @@ template SiSUheaderExtractSDLang() {
mixin SiSUregisters;
mixin RgxInit;
auto rgx = Rgx();
- 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)) {
@@ -28,11 +31,11 @@ template SiSUheaderExtractSDLang() {
}
return conf;
}
- private auto configSettingsSDLangToAAmake(Tag conf_sdlang) {
+ private auto configSettingsSDLangToAAmake(Tag)(Tag conf_sdlang) {
auto conf = sdlangToAAmake(conf_aa, conf_sdlang);
return conf;
}
- 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 +/
@@ -171,7 +174,10 @@ template SiSUheaderExtractSDLang() {
+/
return dochead_make;
}
- 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",
@@ -197,7 +203,10 @@ template SiSUheaderExtractSDLang() {
}
return sdl_root_header;
}
- 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;
@@ -220,7 +229,10 @@ template SiSUheaderExtractSDLang() {
}
return header_sdlang; // sdlang.ast.Tag
}
- 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) {
@@ -252,7 +264,11 @@ template SiSUheaderExtractSDLang() {
static assert(t.length==2);
return t;
}
- 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/src/sdp/output_epub.d b/src/sdp/output_epub.d
index 90f0ca4..8faf9e1 100644
--- a/src/sdp/output_epub.d
+++ b/src/sdp/output_epub.d
@@ -316,15 +316,24 @@ template SiSUoutputEPub() {
oebps_content_opf,
);
}
- 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/src/sdp/output_html.d b/src/sdp/output_html.d
index 1975958..bf1d59c 100644
--- a/src/sdp/output_html.d
+++ b/src/sdp/output_html.d
@@ -2,10 +2,14 @@ template SiSUoutputHTML() {
struct SDPoutputHTML {
mixin SiSUoutputXHTMLs;
- 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 {
@@ -131,11 +135,16 @@ template SiSUoutputHTML() {
doc = xhtml_format.scroll_head(doc_matters.dochead_meta) ~ doc_html ~ xhtml_format.tail;
scroll_write_output_file(doc_matters.source_filename, doc);
}
- 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();
diff --git a/src/sdp/output_xhtmls.d b/src/sdp/output_xhtmls.d
index 7838cbe..c7a23fe 100644
--- a/src/sdp/output_xhtmls.d
+++ b/src/sdp/output_xhtmls.d
@@ -11,9 +11,12 @@ template SiSUoutputXHTMLs() {
}
return tags;
}
- 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"¶<!DOCTYPE html>
<html>
@@ -47,9 +50,12 @@ template SiSUoutputXHTMLs() {
);
return o;
}
- 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"¶<!DOCTYPE html>
<html>
diff --git a/src/sdp/source_sisupod.d b/src/sdp/source_sisupod.d
index 3cd5b94..20e0ef1 100644
--- a/src/sdp/source_sisupod.d
+++ b/src/sdp/source_sisupod.d
@@ -1,9 +1,12 @@
template SiSUpod() {
struct SDPsisupod {
- 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;