From 73f8706880b753c9be8a27b0c28c59a3a45dfa86 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 9 Mar 2018 16:32:41 -0500 Subject: home button text, a redo --- src/sdp/meta/conf_make_meta_json.d | 11 +++++------ src/sdp/meta/conf_make_meta_structs.d | 25 ++++++++++++++----------- src/sdp/meta/rgx.d | 9 ++++++++- 3 files changed, 27 insertions(+), 18 deletions(-) (limited to 'src/sdp/meta') diff --git a/src/sdp/meta/conf_make_meta_json.d b/src/sdp/meta/conf_make_meta_json.d index 3a47f20..d88dda2 100644 --- a/src/sdp/meta/conf_make_meta_json.d +++ b/src/sdp/meta/conf_make_meta_json.d @@ -111,17 +111,16 @@ static template contentJSONtoSiSUstruct() { if ("home_button_text" in _json.object["make"] && (_json.object["make"]["home_button_text"].type().to!string == "STRING") ) { - 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[]); + _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") { + && _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; + 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") diff --git a/src/sdp/meta/conf_make_meta_structs.d b/src/sdp/meta/conf_make_meta_structs.d index a5d2c15..64e45d9 100644 --- a/src/sdp/meta/conf_make_meta_structs.d +++ b/src/sdp/meta/conf_make_meta_structs.d @@ -24,14 +24,18 @@ auto url_markup(string line) { ~ _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") - ); + ) + .replaceAll( + _rgx.arr_delimiter, + _mkup.br_line + ); return line_; } struct ConfCompositeMakeStr { @@ -43,7 +47,9 @@ struct ConfCompositeMakeStr { string[] footer; string[] headings; string[] home_button_image; - string[] home_button_text; + string home_button_text = "{SiSU}http://www.sisudoc.org;" + ~ " {www.sisudoc.org}http://www.sisudoc.org;" + ~ " {sources / git}http://git.sisudoc.org/gitweb/"; string italics; string auto_num_top_at_level; int auto_num_top_lv = 9; @@ -89,13 +95,8 @@ struct confCompositeMakeBuild { auto home_button_image(string[] _mk) { return _mk; } - auto home_button_text(string[] _mk) { - string line_; - string[] _mk2; - foreach (line; _mk) { - _mk2 ~= url_markup(line); - } - return _mk2; + auto home_button_text(string _mk) { + return url_markup(_mk); } auto italics(string _mk) { string[] _out; @@ -129,7 +130,9 @@ struct ConfCompositeMakeInit { string[] footer; string[] headings; string[] home_button_image; - string[] home_button_text; + string home_button_text = "{SiSU}http://www.sisudoc.org;" + ~ " {www.sisudoc.org}http://www.sisudoc.org;" + ~ " {sources / git}http://git.sisudoc.org/gitweb/"; string[] italics; string auto_num_top_at_level; int auto_num_top_lv = 9; diff --git a/src/sdp/meta/rgx.d b/src/sdp/meta/rgx.d index 9fdcb99..1595263 100644 --- a/src/sdp/meta/rgx.d +++ b/src/sdp/meta/rgx.d @@ -146,7 +146,7 @@ static template SiSUrgxInit() { static inline_url_generic = ctRegex!(`(?:^|[}(\[ ])(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)[a-zA-Z0-9_#]`, "mg"); static inline_url = ctRegex!(`((?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)[a-zA-Z0-9_]\S*)`, "mg"); static inline_link_naked_url = ctRegex!(`(?P^|[ ])(?P(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?P[.,;:?!'"]?(?:[ ]|$))`, "mg"); - static inline_link_markup_regular = ctRegex!(`(?P^|[ ])\{\s*(?P.+?)\s*\}(?P(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?P[.,;:?!]?(?:[ ]|$))`, "mg"); + static inline_link_markup_regular = ctRegex!(`(?P^|[ ])\{\s*(?P.+?)\s*\}(?P(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?P(?:[,;:? ]|[!.]?(?:[ ]|$)))`, "mg"); static inline_link_endnote_url_helper_punctuated = ctRegex!(`\{~\^\s+(?P.+?)\}(?P(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?P[.,;:?!]?(?:[ ]|$))`, "mg"); static inline_link_endnote_url_helper = ctRegex!(`\{~\^\s+(?P.+?)\}(?P(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+)`, "mg"); static image = ctRegex!(`([a-zA-Z0-9._-]+?\.(?:png|gif|jpg))`, "mg"); @@ -218,6 +218,13 @@ static template SiSUrgxInit() { static src_base_parent_dir_name = ctRegex!(`[/](?P(?:[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure static src_base_parent_path = ctRegex!(`(?P(?:[/a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure static src_formalised_file_path_parts = ctRegex!(`(?P(?:[/a-zA-Z0-9._-]+?)(?P[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure + /+ line breaks +/ + static br_line = ctRegex!(`┘`, "mg"); + static br_nl = ctRegex!(`┙`, "mg"); + static br_paragraph = ctRegex!(`┚`, "mg"); + static br_page_line = ctRegex!(`┼`, "mg"); + static br_page = ctRegex!(`┿`, "mg"); + static br_page_new = ctRegex!(`╂`, "mg"); /+ inline markup footnotes endnotes +/ static inline_notes_al = ctRegex!(`【(?:[*+]\s+|\s*)(.+?)】`, "mg"); static inline_notes_al_special = ctRegex!(`【(?:[*+]\s+)(.+?)】`, "mg"); // TODO remove match when special footnotes are implemented -- cgit v1.2.3