diff options
Diffstat (limited to 'src/sdp/output')
-rw-r--r-- | src/sdp/output/rgx.d | 7 | ||||
-rw-r--r-- | src/sdp/output/xmls.d | 46 |
2 files changed, 19 insertions, 34 deletions
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; } |