aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2018-03-09 16:32:41 -0500
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:14 -0400
commit73f8706880b753c9be8a27b0c28c59a3a45dfa86 (patch)
treeb76b4b5e12828812efaaa2e4d52e4a6917bb46f0
parentfootnotes fontface; home button text and links (diff)
home button text, a redo
-rw-r--r--org/default_regex.org15
-rw-r--r--org/meta_conf_make_meta.org36
-rw-r--r--org/output_xmls.org46
-rw-r--r--src/sdp/meta/conf_make_meta_json.d11
-rw-r--r--src/sdp/meta/conf_make_meta_structs.d25
-rw-r--r--src/sdp/meta/rgx.d9
-rw-r--r--src/sdp/output/rgx.d7
-rw-r--r--src/sdp/output/xmls.d46
8 files changed, 91 insertions, 104 deletions
diff --git a/org/default_regex.org b/org/default_regex.org
index 59bd11e..9dbab82 100644
--- a/org/default_regex.org
+++ b/org/default_regex.org
@@ -252,7 +252,7 @@ static note_ref = ctRegex!(`^\S+?noteref_(
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<before>^|[ ])(?P<link>(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?P<after>[.,;:?!'"]?(?:[ ]|$))`, "mg");
-static inline_link_markup_regular = ctRegex!(`(?P<before>^|[ ])\{\s*(?P<content>.+?)\s*\}(?P<link>(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?P<after>[.,;:?!]?(?:[ ]|$))`, "mg");
+static inline_link_markup_regular = ctRegex!(`(?P<before>^|[ ])\{\s*(?P<content>.+?)\s*\}(?P<link>(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?P<after>(?:[,;:? ]|[!.]?(?:[ ]|$)))`, "mg");
static inline_link_endnote_url_helper_punctuated = ctRegex!(`\{~\^\s+(?P<content>.+?)\}(?P<link>(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?P<after>[.,;:?!]?(?:[ ]|$))`, "mg");
static inline_link_endnote_url_helper = ctRegex!(`\{~\^\s+(?P<content>.+?)\}(?P<link>(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+)`, "mg");
#+END_SRC
@@ -436,6 +436,19 @@ static src_formalised_file_path_parts = ctRegex!(`(?P<pth>(?:[/a
#+END_SRC
** inline markup
+
+*** inline breaks
+
+#+name: prgmkup_rgx
+#+BEGIN_SRC d
+/+ 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");
+#+END_SRC
*** inline (internal program) markup footnotes endnotes :inline:footnote:
#+name: prgmkup_rgx
diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org
index 9f6fbf7..fba8663 100644
--- a/org/meta_conf_make_meta.org
+++ b/org/meta_conf_make_meta.org
@@ -84,14 +84,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 {
@@ -103,7 +107,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;
@@ -149,13 +155,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;
@@ -196,7 +197,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;
@@ -543,17 +546,16 @@ if ("make" in _json.object) {
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/org/output_xmls.org b/org/output_xmls.org
index 9a34534..0c79bf9 100644
--- a/org/output_xmls.org
+++ b/org/output_xmls.org
@@ -230,46 +230,24 @@ auto header_metadata(Dm)(
auto site_info_button(Dm)(
Dm doc_matters,
) {
- string[string][] _location = [
- [ "url" : "", "lnk" : "" ],
- [ "url" : "", "lnk" : "" ],
- [ "url" : "", "lnk" : "" ]
- ];
+ string _locations;
if (doc_matters.conf_make_meta.make.home_button_text.length > 0) {
- foreach(int key, string line; doc_matters.conf_make_meta.make.home_button_text) {
- if (auto m = line.match(rgx.inline_link)) {
- if (key < 3) {
- _location[key] = [ "url" : m.captures[2], "lnk" : m.captures[1] ];
- } else {
- writeln("WARNING markup error info button content too long (max length 3 used), length: ",
- doc_matters.conf_make_meta.make.home_button_text.length,
- " button: ", doc_matters.conf_make_meta.make.home_button_text);
- }
- } else {
- _location[key]["url"] = "";
- _location[key]["lnk"] = line;
- }
- }
+ _locations = (doc_matters.conf_make_meta.make.home_button_text)
+ .replaceAll(
+ rgx.inline_link,
+ ("<p class=\"tiny_left\"><a href=\"$2\">$1</a></p>"))
+ .replaceAll(
+ rgx.br_line, "")
+ .replaceAll(
+ rgx.br_nl, "");
} else {
- _location[0]["url"] = "http://www.sisudoc.org"; _location[0]["lnk"] = "SiSU";
- _location[1]["url"] = "http://www.sisudoc.org"; _location[1]["lnk"] = "www.sisudoc.org";
- _location[2]["url"] = "http://www.sisudoc.org"; _location[2]["lnk"] = "sisu";
+ writeln("WARNING home button text expected");
}
string o;
o = format(q"¶<div class="flex-menu-option">
- <p class="tiny_left"><a href="%s" target="_top">
- %s
- </a></p>
- <p class="tiny_left"><a href="%s" target="_top">
- %s
- </a></p>
- <p class="tiny_left"><a href="%s" target="_top">
- %s
- </a></p>
+ %s
</div>¶",
- _location[0]["url"], _location[0]["lnk"],
- _location[1]["url"], _location[1]["lnk"],
- _location[2]["url"], _location[2]["lnk"],
+ _locations,
);
return o;
}
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<before>^|[ ])(?P<link>(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?P<after>[.,;:?!'"]?(?:[ ]|$))`, "mg");
- static inline_link_markup_regular = ctRegex!(`(?P<before>^|[ ])\{\s*(?P<content>.+?)\s*\}(?P<link>(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?P<after>[.,;:?!]?(?:[ ]|$))`, "mg");
+ static inline_link_markup_regular = ctRegex!(`(?P<before>^|[ ])\{\s*(?P<content>.+?)\s*\}(?P<link>(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?P<after>(?:[,;:? ]|[!.]?(?:[ ]|$)))`, "mg");
static inline_link_endnote_url_helper_punctuated = ctRegex!(`\{~\^\s+(?P<content>.+?)\}(?P<link>(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?P<after>[.,;:?!]?(?:[ ]|$))`, "mg");
static inline_link_endnote_url_helper = ctRegex!(`\{~\^\s+(?P<content>.+?)\}(?P<link>(?:(?: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<dir>(?:[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
static src_base_parent_path = ctRegex!(`(?P<dir>(?:[/a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
static src_formalised_file_path_parts = ctRegex!(`(?P<pth>(?:[/a-zA-Z0-9._-]+?)(?P<dir>[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
diff --git a/src/sdp/output/rgx.d b/src/sdp/output/rgx.d
index ee654f6..adadf9e 100644
--- a/src/sdp/output/rgx.d
+++ b/src/sdp/output/rgx.d
@@ -35,6 +35,13 @@ static template SiSUoutputRgxInit() {
static src_base_parent_dir_name = ctRegex!(`[/](?P<dir>(?:[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
static src_base_parent_path = ctRegex!(`(?P<dir>(?:[/a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
static src_formalised_file_path_parts = ctRegex!(`(?P<pth>(?:[/a-zA-Z0-9._-]+?)(?P<dir>[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
diff --git a/src/sdp/output/xmls.d b/src/sdp/output/xmls.d
index dd2ec67..952c9cd 100644
--- a/src/sdp/output/xmls.d
+++ b/src/sdp/output/xmls.d
@@ -152,46 +152,24 @@ template outputXHTMLs() {
auto site_info_button(Dm)(
Dm doc_matters,
) {
- string[string][] _location = [
- [ "url" : "", "lnk" : "" ],
- [ "url" : "", "lnk" : "" ],
- [ "url" : "", "lnk" : "" ]
- ];
+ string _locations;
if (doc_matters.conf_make_meta.make.home_button_text.length > 0) {
- foreach(int key, string line; doc_matters.conf_make_meta.make.home_button_text) {
- if (auto m = line.match(rgx.inline_link)) {
- if (key < 3) {
- _location[key] = [ "url" : m.captures[2], "lnk" : m.captures[1] ];
- } else {
- writeln("WARNING markup error info button content too long (max length 3 used), length: ",
- doc_matters.conf_make_meta.make.home_button_text.length,
- " button: ", doc_matters.conf_make_meta.make.home_button_text);
- }
- } else {
- _location[key]["url"] = "";
- _location[key]["lnk"] = line;
- }
- }
+ _locations = (doc_matters.conf_make_meta.make.home_button_text)
+ .replaceAll(
+ rgx.inline_link,
+ ("<p class=\"tiny_left\"><a href=\"$2\">$1</a></p>"))
+ .replaceAll(
+ rgx.br_line, "")
+ .replaceAll(
+ rgx.br_nl, "");
} else {
- _location[0]["url"] = "http://www.sisudoc.org"; _location[0]["lnk"] = "SiSU";
- _location[1]["url"] = "http://www.sisudoc.org"; _location[1]["lnk"] = "www.sisudoc.org";
- _location[2]["url"] = "http://www.sisudoc.org"; _location[2]["lnk"] = "sisu";
+ writeln("WARNING home button text expected");
}
string o;
o = format(q"¶<div class="flex-menu-option">
- <p class="tiny_left"><a href="%s" target="_top">
- %s
- </a></p>
- <p class="tiny_left"><a href="%s" target="_top">
- %s
- </a></p>
- <p class="tiny_left"><a href="%s" target="_top">
- %s
- </a></p>
+ %s
</div>¶",
- _location[0]["url"], _location[0]["lnk"],
- _location[1]["url"], _location[1]["lnk"],
- _location[2]["url"], _location[2]["lnk"],
+ _locations,
);
return o;
}