diff options
author | Ralph Amissah <ralph@amissah.com> | 2018-03-08 16:58:10 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:14 -0400 |
commit | bdb43e4e7d34ba178ec3bbc351d059c63e162d4b (patch) | |
tree | 138c149ef8919ec7b6a19e77946304238edc3a8e /org/meta_conf_make_meta.org | |
parent | make auto numbering related (diff) |
footnotes fontface; home button text and links
Diffstat (limited to 'org/meta_conf_make_meta.org')
-rw-r--r-- | org/meta_conf_make_meta.org | 123 |
1 files changed, 97 insertions, 26 deletions
diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org index e784a87..9f6fbf7 100644 --- a/org/meta_conf_make_meta.org +++ b/org/meta_conf_make_meta.org @@ -46,6 +46,13 @@ import sdp.meta.conf_make_meta_structs; #+BEGIN_SRC d :tangle ../src/sdp/meta/conf_make_meta_structs.d module sdp.meta.conf_make_meta_structs; +<<meta_defaults_template_structs>> +#+END_SRC + +** initialize, imports etc. + +#+name: meta_defaults_template_structs +#+BEGIN_SRC d import std.exception, std.json, @@ -56,27 +63,51 @@ import std.typecons, std.utf, std.conv : to; -<<meta_defaults_template_structs>> +import + sdp.meta.defaults, + sdp.meta.rgx; +mixin SiSUrgxInit; +static auto _rgx = Rgx(); +mixin InternalMarkup; +auto _mkup = InlineMarkup(); #+END_SRC ** struct Generic ConfComposite #+name: meta_defaults_template_structs #+BEGIN_SRC d +auto url_markup(string line) { + auto line_ = (line) + .replaceAll( + _rgx.inline_link_markup_regular, + ("$1" + ~ _mkup.lnk_o ~ "$2" ~ _mkup.lnk_c + ~ _mkup.url_o ~ "$3" ~ _mkup.url_c + ~ "$4") // ("$1{ $2 }$3$4") + ) + .replaceAll( + _rgx.inline_link_naked_url, + ("$1" + ~ _mkup.lnk_o ~ "$2" ~ _mkup.lnk_c + ~ _mkup.url_o ~ "$2" ~ _mkup.url_c + ~ "$3") // ("$1{ $2 }$2$3") + ); + return line_; +} struct ConfCompositeMakeStr { string bold; string breaks; string cover_image; string css; string emphasis; - string footer; + string[] footer; string[] headings; - string home_button_image; - string home_button_text; + string[] home_button_image; + string[] home_button_text; string italics; string auto_num_top_at_level; int auto_num_top_lv = 9; - int num_depth = 2; + int auto_num_depth = 2; string[][] substitute; string texpdf_font; } @@ -104,17 +135,27 @@ struct confCompositeMakeBuild { } return _out; } - auto footer(string _mk) { - return _mk; + auto footer(string[] _mk) { + string line_; + string[] _mk2; + foreach (line; _mk) { + _mk2 ~= url_markup(line); + } + return _mk2; } auto headings(string[] _mk) { return _mk; } - auto home_button_image(string _mk) { + auto home_button_image(string[] _mk) { return _mk; } - auto home_button_text(string _mk) { - return _mk; + auto home_button_text(string[] _mk) { + string line_; + string[] _mk2; + foreach (line; _mk) { + _mk2 ~= url_markup(line); + } + return _mk2; } auto italics(string _mk) { string[] _out; @@ -129,7 +170,7 @@ struct confCompositeMakeBuild { auto auto_num_top_lv(int _mk) { return _mk; } - auto num_depth(int _mk) { + auto auto_num_depth(int _mk) { return _mk; } auto substitute(string[][] _mk) { @@ -152,14 +193,14 @@ struct ConfCompositeMakeInit { string cover_image; string css; string[] emphasis; - string footer; + string[] footer; string[] headings; - string home_button_image; - string home_button_text; + string[] home_button_image; + string[] home_button_text; string[] italics; string auto_num_top_at_level; int auto_num_top_lv = 9; - int num_depth = 2; + int auto_num_depth = 2; string[][] substitute; string texpdf_font; } @@ -333,7 +374,7 @@ static auto ptr_head_sub_make "home_button_image", "home_button_text", "footer", "headings", - "auto_num_top_at_level", "auto_num_top_lv", "num_depth", + "auto_num_top_at_level", "auto_num_top_lv", "auto_num_depth", "breaks", "substitute", "bold", @@ -457,7 +498,17 @@ if ("make" in _json.object) { if ("footer" in _json.object["make"] && (_json.object["make"]["footer"].type().to!string == "STRING") ) { - _struct_composite.make_str.footer = _json.object["make"]["footer"].str; + 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; + } + _struct_composite.make_str.footer = _match_footer_array; } if ("headings" in _json.object["make"] && (_json.object["make"]["headings"].type().to!string == "STRING") @@ -477,12 +528,32 @@ if ("make" in _json.object) { if ("home_button_image" in _json.object["make"] && (_json.object["make"]["home_button_image"].type().to!string == "STRING") ) { - _struct_composite.make_str.home_button_image = _json.object["make"]["home_button_image"].str; + 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; + } + _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; + char[][] __match_home_button_text_array + = (cast(char[]) _json.object["make"]["home_button_text"].str) + .split(_rgx.make_heading_delimiter); + _struct_composite.make_str.home_button_text = __match_home_button_text_array.to!(string[]); + } 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; + } + _struct_composite.make_str.home_button_text = _match_home_button_text_array; } if ("italics" in _json.object["make"] && (_json.object["make"]["italics"].type().to!string == "STRING") @@ -521,14 +592,14 @@ if ("make" in _json.object) { break; } } - if ("num_depth" in _json.object["make"] - && (_json.object["make"]["num_depth"].type().to!string == "INTEGER") + if ("auto_num_depth" in _json.object["make"] + && (_json.object["make"]["auto_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.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.num_depth = _json.object["make"]["num_depth"].str.to!int; + _struct_composite.make_str.auto_num_depth = _json.object["make"]["auto_num_depth"].str.to!int; } if ("substitute" in _json.object["make"]) { string[][] _sub; @@ -571,7 +642,7 @@ if ("make" in _json.object) { _struct_composite.make.italics = _mk.italics(_struct_composite.make_str.italics); _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.auto_num_depth = _mk.auto_num_depth(_struct_composite.make_str.auto_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); } |