aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/meta/conf_make_meta_json.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2019-05-02 21:45:58 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2019-05-19 19:26:29 -0400
commite8186088585cd04a791c0be89b5c08db8130b3b1 (patch)
tree866d1a4f54d1ade412f15f687adb7be45c991281 /src/doc_reform/meta/conf_make_meta_json.d
parenturl encoding (diff)
cosmetic mostly
Diffstat (limited to 'src/doc_reform/meta/conf_make_meta_json.d')
-rw-r--r--src/doc_reform/meta/conf_make_meta_json.d141
1 files changed, 65 insertions, 76 deletions
diff --git a/src/doc_reform/meta/conf_make_meta_json.d b/src/doc_reform/meta/conf_make_meta_json.d
index 248c9d2..980a802 100644
--- a/src/doc_reform/meta/conf_make_meta_json.d
+++ b/src/doc_reform/meta/conf_make_meta_json.d
@@ -63,64 +63,59 @@ static template contentJSONtoDocReformStruct() {
) {
_struct_composite.make_str.emphasis = _json.object["make"]["emphasis"].str;
}
- if ("footer" in _json.object["make"]
- && (_json.object["make"]["footer"].type().to!string == "string")
- ) {
- char[][] __match_footer_array
- = (cast(char[]) _json.object["make"]["footer"].str)
- .split(_rgx.make_heading_delimiter);
- _struct_composite.make_str.footer = __match_footer_array.to!(string[]);
- } else if ("footer" in _json.object["make"]
- && _json.object["make"]["footer"].type().to!string == "array") {
- string[] _match_footer_array;
- foreach (_match_heading; _json.object["make"]["footer"].arrayNoRef) {
- _match_footer_array ~= _match_heading.str;
+ if ("footer" in _json.object["make"]) {
+ if (_json.object["make"]["footer"].type().to!string == "string") {
+ char[][] __match_footer_array
+ = (cast(char[]) _json.object["make"]["footer"].str)
+ .split(_rgx.make_heading_delimiter);
+ _struct_composite.make_str.footer = __match_footer_array.to!(string[]);
+ } else if (_json.object["make"]["footer"].type().to!string == "array") {
+ string[] _match_footer_array;
+ foreach (_match_heading; _json.object["make"]["footer"].arrayNoRef) {
+ _match_footer_array ~= _match_heading.str;
+ }
+ _struct_composite.make_str.footer = _match_footer_array;
}
- _struct_composite.make_str.footer = _match_footer_array;
- }
- if ("headings" in _json.object["make"]
- && (_json.object["make"]["headings"].type().to!string == "string")
- ) {
- 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;
+ }
+ if ("headings" in _json.object["make"]) {
+ if (_json.object["make"]["headings"].type().to!string == "string") {
+ 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 (_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;
}
- _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")
- ) {
- char[][] __match_home_button_image_array
- = (cast(char[]) _json.object["make"]["home_button_image"].str)
- .split(_rgx.make_heading_delimiter);
- _struct_composite.make_str.home_button_image = __match_home_button_image_array.to!(string[]);
- } else if ("home_button_image" in _json.object["make"]
- && _json.object["make"]["home_button_image"].type().to!string == "array") {
- string[] _match_home_button_image_array;
- foreach (_match_heading; _json.object["make"]["home_button_image"].arrayNoRef) {
- _match_home_button_image_array ~= _match_heading.str;
+ }
+ if ("home_button_image" in _json.object["make"]) {
+ if (_json.object["make"]["home_button_image"].type().to!string == "string") {
+ char[][] __match_home_button_image_array
+ = (cast(char[]) _json.object["make"]["home_button_image"].str)
+ .split(_rgx.make_heading_delimiter);
+ _struct_composite.make_str.home_button_image = __match_home_button_image_array.to!(string[]);
+ } else if (_json.object["make"]["home_button_image"].type().to!string == "array") {
+ string[] _match_home_button_image_array;
+ foreach (_match_heading; _json.object["make"]["home_button_image"].arrayNoRef) {
+ _match_home_button_image_array ~= _match_heading.str;
+ }
+ _struct_composite.make_str.home_button_image = _match_home_button_image_array;
}
- _struct_composite.make_str.home_button_image = _match_home_button_image_array;
}
- if ("home_button_text" in _json.object["make"]
- && (_json.object["make"]["home_button_text"].type().to!string == "string")
- ) {
- _struct_composite.make_str.home_button_text = _json.object["make"]["home_button_text"].str;
- } else if ("home_button_text" in _json.object["make"]
- && _json.object["make"]["home_button_text"].type().to!string == "array"
- ) {
- string[] _match_home_button_text_array;
- foreach (_match_heading; _json.object["make"]["home_button_text"].arrayNoRef) {
- _match_home_button_text_array ~= _match_heading.str;
+ if ("home_button_text" in _json.object["make"]) {
+ if (_json.object["make"]["home_button_text"].type().to!string == "string") {
+ _struct_composite.make_str.home_button_text = _json.object["make"]["home_button_text"].str;
+ } else if (_json.object["make"]["home_button_text"].type().to!string == "array") {
+ string[] _match_home_button_text_array;
+ foreach (_match_heading; _json.object["make"]["home_button_text"].arrayNoRef) {
+ _match_home_button_text_array ~= _match_heading.str;
+ }
+ string _match_home_button_text_str = (_match_home_button_text_array).join("; ");
+ _struct_composite.make_str.home_button_text = _match_home_button_text_str;
}
- string _match_home_button_text_str = (_match_home_button_text_array).join("; ");
- _struct_composite.make_str.home_button_text = _match_home_button_text_str;
}
if ("italics" in _json.object["make"]
&& (_json.object["make"]["italics"].type().to!string == "string")
@@ -152,35 +147,29 @@ static template contentJSONtoDocReformStruct() {
break;
}
}
- if ("auto_num_depth" in _json.object["make"]
- && (_json.object["make"]["auto_num_depth"].type().to!string == "INTEGER")
- ) {
- _struct_composite.make_str.auto_num_depth = _json.object["make"]["auto_num_depth"].integer.to!int;
- } else if ("auto_num_depth" in _json.object["make"]
- && (_json.object["make"]["auto_num_depth"].type().to!string == "string")
- ) {
- _struct_composite.make_str.auto_num_depth = _json.object["make"]["auto_num_depth"].str.to!int;
+ if ("auto_num_depth" in _json.object["make"]) {
+ if (_json.object["make"]["auto_num_depth"].type().to!string == "int") { // TODO watch this match
+ _struct_composite.make_str.auto_num_depth = _json.object["make"]["auto_num_depth"].integer.to!int;
+ } else if (_json.object["make"]["auto_num_depth"].type().to!string == "string") {
+ _struct_composite.make_str.auto_num_depth = _json.object["make"]["auto_num_depth"].str.to!int;
+ }
}
if ("substitute" in _json.object["make"]) {
string[][] _sub;
- if (
- (_json.object["make"]["substitute"].type().to!string == "array")
- && (_json.object["make"]["substitute"][0].type().to!string == "array")
- ) {
- foreach (substitute_pair; _json.object["make"]["substitute"].arrayNoRef) {
- if ((substitute_pair.type().to!string) == "array") {
- if (!empty(substitute_pair[0].str) && !empty(substitute_pair[1].str)) {
- _sub ~= [ substitute_pair[0].str, substitute_pair[1].str];
+ if (_json.object["make"]["substitute"].type().to!string == "array") {
+ if (_json.object["make"]["substitute"][0].type().to!string == "array") {
+ foreach (substitute_pair; _json.object["make"]["substitute"].arrayNoRef) {
+ if ((substitute_pair.type().to!string) == "array") {
+ if (!empty(substitute_pair[0].str) && !empty(substitute_pair[1].str)) {
+ _sub ~= [ substitute_pair[0].str, substitute_pair[1].str];
+ }
}
}
+ } else if (_json.object["make"]["substitute"][0].type().to!string == "string") {
+ if (!empty(_json.object["make"]["substitute"][0].str) && !empty(_json.object["make"]["substitute"][1].str)) {
+ _sub = [[_json.object["make"]["substitute"][0].str, _json.object["make"]["substitute"][1].str]];
+ }
}
- } else if (
- (_json.object["make"]["substitute"].type().to!string == "array")
- && (_json.object["make"]["substitute"][0].type().to!string == "string")
- ) {
- if (!empty(_json.object["make"]["substitute"][0].str) && !empty(_json.object["make"]["substitute"][1].str)) {
- _sub = [[_json.object["make"]["substitute"][0].str, _json.object["make"]["substitute"][1].str]];
- }
}
// writeln(_sub);
_struct_composite.make_str.substitute = _sub;