From 0524cd606d45ecc6ee52dc7c8f1655398c75712c Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 2 Mar 2018 17:36:21 -0500 Subject: make auto numbering related --- org/meta_conf_make_meta.org | 76 +++++++++++++++++++++++++++++++++------------ 1 file changed, 56 insertions(+), 20 deletions(-) (limited to 'org/meta_conf_make_meta.org') diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org index fff5275..e784a87 100644 --- a/org/meta_conf_make_meta.org +++ b/org/meta_conf_make_meta.org @@ -74,8 +74,9 @@ struct ConfCompositeMakeStr { string home_button_image; string home_button_text; string italics; - string num_top; - string num_depth; + string auto_num_top_at_level; + int auto_num_top_lv = 9; + int num_depth = 2; string[][] substitute; string texpdf_font; } @@ -122,10 +123,13 @@ struct confCompositeMakeBuild { } return _out; } - auto num_top(string _mk) { + auto auto_num_top_at_level(string _mk) { return _mk; } - auto num_depth(string _mk) { + auto auto_num_top_lv(int _mk) { + return _mk; + } + auto num_depth(int _mk) { return _mk; } auto substitute(string[][] _mk) { @@ -153,8 +157,9 @@ struct ConfCompositeMakeInit { string home_button_image; string home_button_text; string[] italics; - string num_top; - string num_depth; + string auto_num_top_at_level; + int auto_num_top_lv = 9; + int num_depth = 2; string[][] substitute; string texpdf_font; } @@ -328,7 +333,7 @@ static auto ptr_head_sub_make "home_button_image", "home_button_text", "footer", "headings", - "num_top", "num_depth", + "auto_num_top_at_level", "auto_num_top_lv", "num_depth", "breaks", "substitute", "bold", @@ -370,9 +375,8 @@ auto config_jsonstr = `{ }`; #+END_SRC -* 1. JSON to SiSUstruct -** 1. module json :module:sdp:meta_conf_make_meta_json: -*** 0. module template +* 1. JSON to SiSUstruct :module:sdp:meta_conf_make_meta_json: +** 0. module template #+BEGIN_SRC d :tangle ../src/sdp/meta/conf_make_meta_json.d /++ @@ -419,7 +423,7 @@ static template contentJSONtoSiSUstruct() { } #+END_SRC -*** make +** make #+name: json_objects #+BEGIN_SRC d @@ -485,15 +489,46 @@ if ("make" in _json.object) { ) { _struct_composite.make_str.italics = _json.object["make"]["italics"].str; } - if ("num_top" in _json.object["make"] - && (_json.object["make"]["num_top"].type().to!string == "STRING") - ) { - _struct_composite.make_str.num_top = _json.object["make"]["num_top"].str; + if ("auto_num_top_at_level" in _json.object["make"] // str == A - D, 1 - 4 + && (_json.object["make"]["auto_num_top_at_level"].type().to!string == "STRING") + ) { + _struct_composite.make_str.auto_num_top_at_level = _json.object["make"]["auto_num_top_at_level"].str; + switch (_json.object["make"]["auto_num_top_at_level"].str) { + case "A": + break; + case "B": + _struct_composite.make_str.auto_num_top_lv = 1; + break; + case "C": + _struct_composite.make_str.auto_num_top_lv = 2; + break; + case "D": + _struct_composite.make_str.auto_num_top_lv = 3; + break; + case "1": + _struct_composite.make_str.auto_num_top_lv = 4; + break; + case "2": + _struct_composite.make_str.auto_num_top_lv = 5; + break; + case "3": + _struct_composite.make_str.auto_num_top_lv = 6; + break; + case "4": + _struct_composite.make_str.auto_num_top_lv = 7; + break; + default: + break; + } } if ("num_depth" in _json.object["make"] + && (_json.object["make"]["num_depth"].type().to!string == "INTEGER") + ) { + _struct_composite.make_str.num_depth = _json.object["make"]["num_depth"].integer.to!int; + } else if ("num_depth" in _json.object["make"] && (_json.object["make"]["num_depth"].type().to!string == "STRING") ) { - _struct_composite.make_str.num_depth = _json.object["num_depth"][""].str; + _struct_composite.make_str.num_depth = _json.object["make"]["num_depth"].str.to!int; } if ("substitute" in _json.object["make"]) { string[][] _sub; @@ -534,14 +569,15 @@ if ("make" in _json.object) { _struct_composite.make.home_button_image = _mk.home_button_image(_struct_composite.make_str.home_button_image); _struct_composite.make.home_button_text = _mk.home_button_text(_struct_composite.make_str.home_button_text); _struct_composite.make.italics = _mk.italics(_struct_composite.make_str.italics); - _struct_composite.make.num_top = _mk.num_top(_struct_composite.make_str.num_top); + _struct_composite.make.auto_num_top_at_level = _mk.auto_num_top_at_level(_struct_composite.make_str.auto_num_top_at_level); + _struct_composite.make.auto_num_top_lv = _mk.auto_num_top_lv(_struct_composite.make_str.auto_num_top_lv); _struct_composite.make.num_depth = _mk.num_depth(_struct_composite.make_str.num_depth); _struct_composite.make.substitute = _mk.substitute(_struct_composite.make_str.substitute); _struct_composite.make.texpdf_font = _mk.texpdf_font(_struct_composite.make_str.texpdf_font); } #+END_SRC -*** conf +** conf #+name: json_objects #+BEGIN_SRC d @@ -713,7 +749,7 @@ if ("search" in _json.object) { } #+END_SRC -*** meta +** meta #+name: json_objects #+BEGIN_SRC d @@ -1075,7 +1111,7 @@ header. │   ├── home_button_image │   ├── home_button_text │   ├── italics - │   ├── num_top + │   ├── auto_num_top_at_level │   ├── substitute │   └── texpdf_font └── meta // metadata -- cgit v1.2.3