aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--org/meta_abstraction.org76
-rw-r--r--org/meta_conf_make_meta.org22
-rw-r--r--src/sdp/meta/conf_make_meta_json.d12
-rw-r--r--src/sdp/meta/conf_make_meta_structs.d10
-rw-r--r--src/sdp/meta/metadoc_from_src.d69
5 files changed, 117 insertions, 72 deletions
diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org
index d112a51..03da5cf 100644
--- a/org/meta_abstraction.org
+++ b/org/meta_abstraction.org
@@ -540,6 +540,9 @@ int cnt1 = 1; int cnt2 = 1; int cnt3 = 1;
#+BEGIN_SRC d
debug (substitutions) {
writeln(__LINE__, ":", __FILE__, ": DEBUG substitutions:");
+ if (!(conf_make_meta.make.headings.empty)) {
+ writeln(conf_make_meta.make.headings);
+ }
if (conf_make_meta.make.substitute) {
foreach(substitution_pair; conf_make_meta.make.substitute) {
writeln("regex to match: ", substitution_pair[0]);
@@ -854,7 +857,7 @@ if there is a blurb section you need to:
#+BEGIN_SRC d
} else if (obj_type_status["quote"] == TriState.on) {
/+ within block object: quote +/
- line = _doc_header_and_make_substitutions_(line, conf_make_meta);
+ line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
_quote_block_(line, an_object, obj_type_status);
continue;
#+END_SRC
@@ -866,7 +869,7 @@ if there is a blurb section you need to:
/+ within block object: group +/
} else if (obj_type_status["group"] == TriState.on) {
/+ within block object: group +/
- line = _doc_header_and_make_substitutions_(line, conf_make_meta);
+ line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
line = (line)
.replaceAll(rgx.para_delimiter, mkup.br_paragraph ~ "$1");
_group_block_(line, an_object, obj_type_status);
@@ -879,7 +882,7 @@ if there is a blurb section you need to:
#+BEGIN_SRC d
} else if (obj_type_status["block"] == TriState.on) {
/+ within block object: block +/
- line = _doc_header_and_make_substitutions_(line, conf_make_meta);
+ line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
if (auto m = line.match(rgx.spaces_line_start)) {
line = (line)
.replaceAll(rgx.spaces_line_start, (m.captures[1]).translate([ ' ' : mkup.nbsp ]));
@@ -935,7 +938,7 @@ if (line.matchFirst(rgx.block_poem_open)) {
processing.remove("verse");
obj_cite_number_poem["start"] = obj_cite_digits.on.to!string;
}
-line = _doc_header_and_make_substitutions_(line, conf_make_meta);
+line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
_start_block_(line, obj_type_status, obj_cite_number_poem);
continue;
#+END_SRC
@@ -1045,7 +1048,7 @@ if (line.matchFirst(rgx.book_index)
} else if (line_occur["para"] == State.off) {
/+ para match +/
an_object_key="body_nugget";
- line = _doc_header_and_make_substitutions_(line, conf_make_meta);
+ line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
_para_match_(line, an_object, an_object_key, indent, bullet, obj_type_status, line_occur);
}
#+END_SRC
@@ -1072,7 +1075,7 @@ if (line.matchFirst(rgx.book_index)
debug(para) {
writeln(an_object_key, "-> ", line);
}
- line = _doc_header_and_make_substitutions_(line, conf_make_meta);
+ line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
an_object[an_object_key] ~= " " ~ line;
++line_occur["para"];
}
@@ -2560,6 +2563,7 @@ static auto _check_ocn_status_(L,T)(
#+END_SRC
*** make substitutions
+**** project
#+name: abs_functions_substitutions
#+BEGIN_SRC d
@@ -2578,6 +2582,21 @@ auto _doc_header_and_make_substitutions_(L,CMM)(
);
}
}
+ return line;
+}
+#+END_SRC
+
+**** fontface
+
+#+name: abs_functions_substitutions
+#+BEGIN_SRC d
+auto _doc_header_and_make_substitutions_fontface_(L,CMM)(
+ L line,
+ CMM conf_make_meta,
+) {
+ debug(asserts) {
+ static assert(is(typeof(line) == char[]));
+ }
if (!(
conf_make_meta.make.bold_rgxmatch == "=NULL"
|| conf_make_meta.make.bold_rgxmatch.empty
@@ -3993,85 +4012,82 @@ auto _book_index_(L,I,O,T,B)(
#+BEGIN_SRC d
auto _heading_found_(L,X,H,R,T)(
L line,
- X dochead_make_identify_unmarked_headings,
+ X _make_unmarked_headings,
return ref H heading_match_str,
return ref R heading_match_rgx,
return ref T obj_type_status
) {
debug(asserts) {
static assert(is(typeof(line) == char[]));
- static assert(is(typeof(dochead_make_identify_unmarked_headings) == string));
+ static assert(is(typeof(_make_unmarked_headings) == string[]));
static assert(is(typeof(heading_match_str) == string[string]));
static assert(is(typeof(heading_match_rgx) == Regex!(char)[string]));
static assert(is(typeof(obj_type_status) == int[string]));
}
static auto rgx = Rgx();
- if ((dochead_make_identify_unmarked_headings.length > 2)
+ if ((_make_unmarked_headings.length > 2)
&& (obj_type_status["make_headings"] == State.off)) {
/+ headings found +/
debug(headingsfound) {
- writeln(dochead_make_identify_unmarked_headings);
+ writeln(_make_unmarked_headings);
}
- char[][] make_headings_spl
- = (cast(char[]) dochead_make_identify_unmarked_headings)
- .split(rgx.make_heading_delimiter);
debug(headingsfound) {
- writeln(make_headings_spl.length);
- writeln(make_headings_spl);
+ writeln(_make_unmarked_headings.length);
+ writeln(_make_unmarked_headings);
}
- switch (make_headings_spl.length) {
+ switch (_make_unmarked_headings.length) {
case 7 :
- if (!empty(make_headings_spl[6])) {
+ if (!empty(_make_unmarked_headings[6])) {
heading_match_str["h_4"]
- = "^(" ~ make_headings_spl[6].to!string ~ ")";
+ = "^(" ~ _make_unmarked_headings[6].to!string ~ ")";
heading_match_rgx["h_4"]
= regex(heading_match_str["h_4"]);
}
goto case;
case 6 :
- if (!empty(make_headings_spl[5])) {
+ if (!empty(_make_unmarked_headings[5])) {
heading_match_str["h_3"]
- = "^(" ~ make_headings_spl[5].to!string ~ ")";
+ = "^(" ~ _make_unmarked_headings[5].to!string ~ ")";
heading_match_rgx["h_3"]
= regex(heading_match_str["h_3"]);
}
goto case;
case 5 :
- if (!empty(make_headings_spl[4])) {
+ if (!empty(_make_unmarked_headings[4])) {
heading_match_str["h_2"]
- = "^(" ~ make_headings_spl[4].to!string ~ ")";
+ = "^(" ~ _make_unmarked_headings[4].to!string ~ ")";
heading_match_rgx["h_2"]
= regex(heading_match_str["h_2"]);
}
goto case;
case 4 :
- if (!empty(make_headings_spl[3])) {
+ if (!empty(_make_unmarked_headings[3])) {
heading_match_str["h_1"]
- = "^(" ~ make_headings_spl[3].to!string ~ ")";
+ = "^(" ~ _make_unmarked_headings[3].to!string ~ ")";
heading_match_rgx["h_1"]
= regex(heading_match_str["h_1"]);
}
goto case;
case 3 :
- if (!empty(make_headings_spl[2])) {
+ if (!empty(_make_unmarked_headings[2])) {
heading_match_str["h_D"]
- = "^(" ~ make_headings_spl[2].to!string ~ ")";
+ = "^(" ~ _make_unmarked_headings[2].to!string ~ ")";
heading_match_rgx["h_D"]
= regex(heading_match_str["h_D"]);
}
goto case;
case 2 :
- if (!empty(make_headings_spl[1])) {
+ if (!empty(_make_unmarked_headings[1])) {
heading_match_str["h_C"]
- = "^(" ~ make_headings_spl[1].to!string ~ ")";
+ = "^(" ~ _make_unmarked_headings[1].to!string ~ ")";
heading_match_rgx["h_C"]
= regex(heading_match_str["h_C"]);
}
goto case;
case 1 :
- if (!empty(make_headings_spl[0])) {
+ if (!empty(_make_unmarked_headings[0])) {
heading_match_str["h_B"]
- = "^(" ~ make_headings_spl[0].to!string ~ ")";
+ = "^(" ~ _make_unmarked_headings[0].to!string ~ ")";
heading_match_rgx["h_B"]
= regex(heading_match_str["h_B"]);
}
diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org
index bd18695..c6c4b2c 100644
--- a/org/meta_conf_make_meta.org
+++ b/org/meta_conf_make_meta.org
@@ -70,13 +70,13 @@ struct ConfCompositeMakeStr {
string css = "";
string emphasis = "";
string footer = "";
- string headings = "";
+ string[] headings;
string home_button_image = "";
string home_button_text = "";
string italics = "";
string num_top = "";
string num_depth = "";
- string[][] substitute; // = [["", ""]];
+ string[][] substitute;
string texpdf_font = "";
}
struct confCompositeMakeBuild {
@@ -122,7 +122,7 @@ struct confCompositeMakeBuild {
auto footer(string _mk) {
return _mk;
}
- auto headings(string _mk) {
+ auto headings(string[] _mk) {
return _mk;
}
auto home_button_image(string _mk) {
@@ -179,7 +179,7 @@ struct ConfCompositeMakeInit {
auto emphasis_substitute_sisu_markup = "!{$1}!";
auto emphasis_substitute_html = "<em>$1</em>";
string footer = "";
- string headings = "";
+ string[] headings;
string home_button_image = "";
string home_button_text = "";
char[] italics_rgxmatch = `=NULL`.dup;
@@ -188,7 +188,7 @@ struct ConfCompositeMakeInit {
auto italics_substitute_html = "<i>$1</i>";
string num_top = "";
string num_depth = "";
- string[][] substitute; // = [["", ""]];
+ string[][] substitute;
string texpdf_font = "";
}
#+END_SRC
@@ -491,7 +491,17 @@ if ("make" in _json.object) {
if ("headings" in _json.object["make"]
&& (_json.object["make"]["headings"].type().to!string == "STRING")
) {
- _struct_composite.make_str.headings = _json.object["make"]["headings"].str;
+ char[][] __match_headings_array
+ = (cast(char[]) _json.object["make"]["headings"].str)
+ .split(_rgx.make_heading_delimiter);
+ _struct_composite.make_str.headings = __match_headings_array.to!(string[]);
+ } else if ("headings" in _json.object["make"]
+ && _json.object["make"]["headings"].type().to!string == "ARRAY") {
+ string[] _match_headings_array;
+ foreach (_match_heading; _json.object["make"]["headings"].arrayNoRef) {
+ _match_headings_array ~= _match_heading.str;
+ }
+ _struct_composite.make_str.headings = _match_headings_array;
}
if ("home_button_image" in _json.object["make"]
&& (_json.object["make"]["home_button_image"].type().to!string == "STRING")
diff --git a/src/sdp/meta/conf_make_meta_json.d b/src/sdp/meta/conf_make_meta_json.d
index 2ccf2c3..916dd33 100644
--- a/src/sdp/meta/conf_make_meta_json.d
+++ b/src/sdp/meta/conf_make_meta_json.d
@@ -71,7 +71,17 @@ static template contentJSONtoSiSUstruct() {
if ("headings" in _json.object["make"]
&& (_json.object["make"]["headings"].type().to!string == "STRING")
) {
- _struct_composite.make_str.headings = _json.object["make"]["headings"].str;
+ char[][] __match_headings_array
+ = (cast(char[]) _json.object["make"]["headings"].str)
+ .split(_rgx.make_heading_delimiter);
+ _struct_composite.make_str.headings = __match_headings_array.to!(string[]);
+ } else if ("headings" in _json.object["make"]
+ && _json.object["make"]["headings"].type().to!string == "ARRAY") {
+ string[] _match_headings_array;
+ foreach (_match_heading; _json.object["make"]["headings"].arrayNoRef) {
+ _match_headings_array ~= _match_heading.str;
+ }
+ _struct_composite.make_str.headings = _match_headings_array;
}
if ("home_button_image" in _json.object["make"]
&& (_json.object["make"]["home_button_image"].type().to!string == "STRING")
diff --git a/src/sdp/meta/conf_make_meta_structs.d b/src/sdp/meta/conf_make_meta_structs.d
index 88ec9ed..d46b462 100644
--- a/src/sdp/meta/conf_make_meta_structs.d
+++ b/src/sdp/meta/conf_make_meta_structs.d
@@ -16,13 +16,13 @@ struct ConfCompositeMakeStr {
string css = "";
string emphasis = "";
string footer = "";
- string headings = "";
+ string[] headings;
string home_button_image = "";
string home_button_text = "";
string italics = "";
string num_top = "";
string num_depth = "";
- string[][] substitute; // = [["", ""]];
+ string[][] substitute;
string texpdf_font = "";
}
struct confCompositeMakeBuild {
@@ -68,7 +68,7 @@ struct confCompositeMakeBuild {
auto footer(string _mk) {
return _mk;
}
- auto headings(string _mk) {
+ auto headings(string[] _mk) {
return _mk;
}
auto home_button_image(string _mk) {
@@ -118,7 +118,7 @@ struct ConfCompositeMakeInit {
auto emphasis_substitute_sisu_markup = "!{$1}!";
auto emphasis_substitute_html = "<em>$1</em>";
string footer = "";
- string headings = "";
+ string[] headings;
string home_button_image = "";
string home_button_text = "";
char[] italics_rgxmatch = `=NULL`.dup;
@@ -127,7 +127,7 @@ struct ConfCompositeMakeInit {
auto italics_substitute_html = "<i>$1</i>";
string num_top = "";
string num_depth = "";
- string[][] substitute; // = [["", ""]];
+ string[][] substitute;
string texpdf_font = "";
}
struct ConfCompositeSiteLocal {
diff --git a/src/sdp/meta/metadoc_from_src.d b/src/sdp/meta/metadoc_from_src.d
index 816f479..54bedfe 100644
--- a/src/sdp/meta/metadoc_from_src.d
+++ b/src/sdp/meta/metadoc_from_src.d
@@ -360,6 +360,9 @@ template SiSUdocAbstraction() {
/+ abstraction init ↑ +/
debug (substitutions) {
writeln(__LINE__, ":", __FILE__, ": DEBUG substitutions:");
+ if (!(conf_make_meta.make.headings.empty)) {
+ writeln(conf_make_meta.make.headings);
+ }
if (conf_make_meta.make.substitute) {
foreach(substitution_pair; conf_make_meta.make.substitute) {
writeln("regex to match: ", substitution_pair[0]);
@@ -623,20 +626,20 @@ template SiSUdocAbstraction() {
continue;
} else if (obj_type_status["quote"] == TriState.on) {
/+ within block object: quote +/
- line = _doc_header_and_make_substitutions_(line, conf_make_meta);
+ line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
_quote_block_(line, an_object, obj_type_status);
continue;
/+ within block object: group +/
} else if (obj_type_status["group"] == TriState.on) {
/+ within block object: group +/
- line = _doc_header_and_make_substitutions_(line, conf_make_meta);
+ line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
line = (line)
.replaceAll(rgx.para_delimiter, mkup.br_paragraph ~ "$1");
_group_block_(line, an_object, obj_type_status);
continue;
} else if (obj_type_status["block"] == TriState.on) {
/+ within block object: block +/
- line = _doc_header_and_make_substitutions_(line, conf_make_meta);
+ line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
if (auto m = line.match(rgx.spaces_line_start)) {
line = (line)
.replaceAll(rgx.spaces_line_start, (m.captures[1]).translate([ ' ' : mkup.nbsp ]));
@@ -670,7 +673,7 @@ template SiSUdocAbstraction() {
processing.remove("verse");
obj_cite_number_poem["start"] = obj_cite_digits.on.to!string;
}
- line = _doc_header_and_make_substitutions_(line, conf_make_meta);
+ line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
_start_block_(line, obj_type_status, obj_cite_number_poem);
continue;
} else if (!line.empty) {
@@ -752,7 +755,7 @@ template SiSUdocAbstraction() {
} else if (line_occur["para"] == State.off) {
/+ para match +/
an_object_key="body_nugget";
- line = _doc_header_and_make_substitutions_(line, conf_make_meta);
+ line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
_para_match_(line, an_object, an_object_key, indent, bullet, obj_type_status, line_occur);
}
} else if (line_occur["heading"] > State.off) {
@@ -767,7 +770,7 @@ template SiSUdocAbstraction() {
debug(para) {
writeln(an_object_key, "-> ", line);
}
- line = _doc_header_and_make_substitutions_(line, conf_make_meta);
+ line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
an_object[an_object_key] ~= " " ~ line;
++line_occur["para"];
}
@@ -1960,6 +1963,15 @@ template SiSUdocAbstraction() {
);
}
}
+ return line;
+ }
+ auto _doc_header_and_make_substitutions_fontface_(L,CMM)(
+ L line,
+ CMM conf_make_meta,
+ ) {
+ debug(asserts) {
+ static assert(is(typeof(line) == char[]));
+ }
if (!(
conf_make_meta.make.bold_rgxmatch == "=NULL"
|| conf_make_meta.make.bold_rgxmatch.empty
@@ -3139,85 +3151,82 @@ template SiSUdocAbstraction() {
}
auto _heading_found_(L,X,H,R,T)(
L line,
- X dochead_make_identify_unmarked_headings,
+ X _make_unmarked_headings,
return ref H heading_match_str,
return ref R heading_match_rgx,
return ref T obj_type_status
) {
debug(asserts) {
static assert(is(typeof(line) == char[]));
- static assert(is(typeof(dochead_make_identify_unmarked_headings) == string));
+ static assert(is(typeof(_make_unmarked_headings) == string[]));
static assert(is(typeof(heading_match_str) == string[string]));
static assert(is(typeof(heading_match_rgx) == Regex!(char)[string]));
static assert(is(typeof(obj_type_status) == int[string]));
}
static auto rgx = Rgx();
- if ((dochead_make_identify_unmarked_headings.length > 2)
+ if ((_make_unmarked_headings.length > 2)
&& (obj_type_status["make_headings"] == State.off)) {
/+ headings found +/
debug(headingsfound) {
- writeln(dochead_make_identify_unmarked_headings);
+ writeln(_make_unmarked_headings);
}
- char[][] make_headings_spl
- = (cast(char[]) dochead_make_identify_unmarked_headings)
- .split(rgx.make_heading_delimiter);
debug(headingsfound) {
- writeln(make_headings_spl.length);
- writeln(make_headings_spl);
+ writeln(_make_unmarked_headings.length);
+ writeln(_make_unmarked_headings);
}
- switch (make_headings_spl.length) {
+ switch (_make_unmarked_headings.length) {
case 7 :
- if (!empty(make_headings_spl[6])) {
+ if (!empty(_make_unmarked_headings[6])) {
heading_match_str["h_4"]
- = "^(" ~ make_headings_spl[6].to!string ~ ")";
+ = "^(" ~ _make_unmarked_headings[6].to!string ~ ")";
heading_match_rgx["h_4"]
= regex(heading_match_str["h_4"]);
}
goto case;
case 6 :
- if (!empty(make_headings_spl[5])) {
+ if (!empty(_make_unmarked_headings[5])) {
heading_match_str["h_3"]
- = "^(" ~ make_headings_spl[5].to!string ~ ")";
+ = "^(" ~ _make_unmarked_headings[5].to!string ~ ")";
heading_match_rgx["h_3"]
= regex(heading_match_str["h_3"]);
}
goto case;
case 5 :
- if (!empty(make_headings_spl[4])) {
+ if (!empty(_make_unmarked_headings[4])) {
heading_match_str["h_2"]
- = "^(" ~ make_headings_spl[4].to!string ~ ")";
+ = "^(" ~ _make_unmarked_headings[4].to!string ~ ")";
heading_match_rgx["h_2"]
= regex(heading_match_str["h_2"]);
}
goto case;
case 4 :
- if (!empty(make_headings_spl[3])) {
+ if (!empty(_make_unmarked_headings[3])) {
heading_match_str["h_1"]
- = "^(" ~ make_headings_spl[3].to!string ~ ")";
+ = "^(" ~ _make_unmarked_headings[3].to!string ~ ")";
heading_match_rgx["h_1"]
= regex(heading_match_str["h_1"]);
}
goto case;
case 3 :
- if (!empty(make_headings_spl[2])) {
+ if (!empty(_make_unmarked_headings[2])) {
heading_match_str["h_D"]
- = "^(" ~ make_headings_spl[2].to!string ~ ")";
+ = "^(" ~ _make_unmarked_headings[2].to!string ~ ")";
heading_match_rgx["h_D"]
= regex(heading_match_str["h_D"]);
}
goto case;
case 2 :
- if (!empty(make_headings_spl[1])) {
+ if (!empty(_make_unmarked_headings[1])) {
heading_match_str["h_C"]
- = "^(" ~ make_headings_spl[1].to!string ~ ")";
+ = "^(" ~ _make_unmarked_headings[1].to!string ~ ")";
heading_match_rgx["h_C"]
= regex(heading_match_str["h_C"]);
}
goto case;
case 1 :
- if (!empty(make_headings_spl[0])) {
+ if (!empty(_make_unmarked_headings[0])) {
heading_match_str["h_B"]
- = "^(" ~ make_headings_spl[0].to!string ~ ")";
+ = "^(" ~ _make_unmarked_headings[0].to!string ~ ")";
heading_match_rgx["h_B"]
= regex(heading_match_str["h_B"]);
}