aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdp/output
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2018-03-08 16:58:10 -0500
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:14 -0400
commitbdb43e4e7d34ba178ec3bbc351d059c63e162d4b (patch)
tree138c149ef8919ec7b6a19e77946304238edc3a8e /src/sdp/output
parentmake auto numbering related (diff)
footnotes fontface; home button text and links
Diffstat (limited to 'src/sdp/output')
-rw-r--r--src/sdp/output/defaults.d1
-rw-r--r--src/sdp/output/hub.d2
-rw-r--r--src/sdp/output/rgx.d1
-rw-r--r--src/sdp/output/source_sisupod.d59
-rw-r--r--src/sdp/output/xmls.d62
5 files changed, 72 insertions, 53 deletions
diff --git a/src/sdp/output/defaults.d b/src/sdp/output/defaults.d
index a15d438..418a334 100644
--- a/src/sdp/output/defaults.d
+++ b/src/sdp/output/defaults.d
@@ -4,6 +4,7 @@
module sdp.output.defaults;
template InternalMarkup() {
+ import std.array;
static struct InlineMarkup {
auto en_a_o = "【"; auto en_a_c = "】";
auto en_b_o = "〖"; auto en_b_c = "〗";
diff --git a/src/sdp/output/hub.d b/src/sdp/output/hub.d
index 7f03360..830c6d0 100644
--- a/src/sdp/output/hub.d
+++ b/src/sdp/output/hub.d
@@ -16,7 +16,7 @@ template outputHub() {
void outputHub(D,I)(D doc_abstraction, I doc_matters) {
mixin SiSUoutputRgxInit;
static auto rgx = Rgx();
- if ((doc_matters.opt.action.verbose)) {
+ if (doc_matters.opt.action.verbose) {
writeln(doc_matters.xml.keys_seq.seg);
}
if ((doc_matters.opt.action.source)
diff --git a/src/sdp/output/rgx.d b/src/sdp/output/rgx.d
index c125b7e..ee654f6 100644
--- a/src/sdp/output/rgx.d
+++ b/src/sdp/output/rgx.d
@@ -37,6 +37,7 @@ static template SiSUoutputRgxInit() {
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
/+ 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
static inline_notes_al_gen = ctRegex!(`【.+?】`, "m");
static inline_notes_al_gen_text = ctRegex!(`【(?P<text>.+?)】`, "m");
static inline_notes_al_gen_ref = ctRegex!(`【(?P<ref>[*+]\s+)\s*(?P<text>.+?)】`, "mg");
diff --git a/src/sdp/output/source_sisupod.d b/src/sdp/output/source_sisupod.d
index 3f95b62..d0e4e11 100644
--- a/src/sdp/output/source_sisupod.d
+++ b/src/sdp/output/source_sisupod.d
@@ -97,36 +97,35 @@ template SiSUpod() {
}
}
} { /+ bundle sisu_document_make +/
- foreach (extension; [".sdl", ".toml"]) {
- auto fn_src_in = ((doc_matters.src.is_pod)
- ? doc_matters.src.conf_dir_path
- : pth_sisudoc_src.conf_root).to!string
- ~ "/" ~ "sisu_document_make" ~ extension;
- auto fn_src_out_sisupod_zip_base
- = pths_sisupod.conf_root(doc_matters.src.filename).zpod.to!string ~ "/" ~ "sisu_document_make";
- auto fn_src_out_filesystem
- = pths_sisupod.conf_root(doc_matters.src.filename).filesystem_open_zpod.to!string
- ~ "/" ~ "sisu_document_make" ~ extension; // TODO
- if (exists(fn_src_in)) {
- debug(io) {
- writeln("WARNING (io debug) src out found: ", fn_src_in);
- }
- if (doc_matters.opt.action.source) {
- fn_src_in.copy(fn_src_out_filesystem);
- }
- if (doc_matters.opt.action.sisupod) {
- auto zip_arc_member_file = new ArchiveMember();
- zip_arc_member_file.name = fn_src_out_sisupod_zip_base;
- auto zip_data = new OutBuffer();
- zip_data.write((fn_src_in).readText);
- zip_arc_member_file.expandedData = zip_data.toBytes();
- zip.addMember(zip_arc_member_file);
- }
- } else {
- if (doc_matters.opt.action.verbose
- || doc_matters.opt.action.debug_do) {
- writeln("WARNING (io) src out NOT found (document make): ", fn_src_in);
- }
+ auto extension = ".toml";
+ auto fn_src_in = ((doc_matters.src.is_pod)
+ ? doc_matters.src.conf_dir_path
+ : pth_sisudoc_src.conf_root).to!string
+ ~ "/" ~ "sisu_document_make" ~ extension;
+ auto fn_src_out_sisupod_zip_base
+ = pths_sisupod.conf_root(doc_matters.src.filename).zpod.to!string ~ "/" ~ "sisu_document_make";
+ auto fn_src_out_filesystem
+ = pths_sisupod.conf_root(doc_matters.src.filename).filesystem_open_zpod.to!string
+ ~ "/" ~ "sisu_document_make" ~ extension; // TODO
+ if (exists(fn_src_in)) {
+ debug(io) {
+ writeln("WARNING (io debug) src out found: ", fn_src_in);
+ }
+ if (doc_matters.opt.action.source) {
+ fn_src_in.copy(fn_src_out_filesystem);
+ }
+ if (doc_matters.opt.action.sisupod) {
+ auto zip_arc_member_file = new ArchiveMember();
+ zip_arc_member_file.name = fn_src_out_sisupod_zip_base;
+ auto zip_data = new OutBuffer();
+ zip_data.write((fn_src_in).readText);
+ zip_arc_member_file.expandedData = zip_data.toBytes();
+ zip.addMember(zip_arc_member_file);
+ }
+ } else {
+ if (doc_matters.opt.action.verbose
+ || doc_matters.opt.action.debug_do) {
+ writeln("WARNING (io) src out NOT found (document make): ", fn_src_in);
}
}
} { /+ TODO bundle primary file +/
diff --git a/src/sdp/output/xmls.d b/src/sdp/output/xmls.d
index 5e7f2e9..dd2ec67 100644
--- a/src/sdp/output/xmls.d
+++ b/src/sdp/output/xmls.d
@@ -152,12 +152,31 @@ template outputXHTMLs() {
auto site_info_button(Dm)(
Dm doc_matters,
) {
- string _location_1_url ="http://www.sisudoc.org";
- string _location_1_lnk ="SiSU";
- string _location_2_url ="http://www.sisudoc.org";
- string _location_2_lnk ="www.sisudoc.org";
- string _location_3_url ="http://www.sisudoc.org";
- string _location_3_lnk ="sisu";
+ string[string][] _location = [
+ [ "url" : "", "lnk" : "" ],
+ [ "url" : "", "lnk" : "" ],
+ [ "url" : "", "lnk" : "" ]
+ ];
+ 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;
+ }
+ }
+ } 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";
+ }
string o;
o = format(q"¶<div class="flex-menu-option">
<p class="tiny_left"><a href="%s" target="_top">
@@ -170,12 +189,9 @@ template outputXHTMLs() {
%s
</a></p>
</div>¶",
- _location_1_url,
- _location_1_lnk,
- _location_2_url,
- _location_2_lnk,
- _location_3_url,
- _location_3_lnk,
+ _location[0]["url"], _location[0]["lnk"],
+ _location[1]["url"], _location[1]["lnk"],
+ _location[2]["url"], _location[2]["lnk"],
);
return o;
}
@@ -330,16 +346,16 @@ template outputXHTMLs() {
rgx.inline_seg_link,
"$1");
}
- _txt = (_txt).replaceAll(
- rgx.inline_link_fn_suffix,
- ("$1" ~ _suffix));
- _txt = (_txt).replaceAll(
- rgx.inline_link,
- ("<a href=\"$2\">$1</a>"));
- _txt = (_txt).replaceAll(
- rgx.mark_internal_site_lnk,
- ""
- );
+ _txt = (_txt)
+ .replaceAll(
+ rgx.inline_link_fn_suffix,
+ ("$1" ~ _suffix))
+ .replaceAll(
+ rgx.inline_link,
+ ("<a href=\"$2\">$1</a>"))
+ .replaceAll(
+ rgx.mark_internal_site_lnk,
+ "");
}
debug(markup_links) {
if (_txt.match(rgx.inline_link)) {
@@ -368,6 +384,7 @@ template outputXHTMLs() {
string _txt,
) {
if (obj.inline_notes_reg) {
+ _txt = font_face(_txt);
_txt = (_txt).replaceAll(
rgx.inline_notes_delimiter_al_regular_number_note,
("<a href=\"#note_$1\"><note id=\"noteref_$1\">&#160;<sup>$1</sup> </note></a>")
@@ -391,6 +408,7 @@ template outputXHTMLs() {
) {
string[] _endnotes;
if (obj.inline_notes_reg) {
+ _txt = font_face(_txt);
/+ need markup for text, and separated footnote +/
foreach(m; _txt.matchAll(rgx.inline_notes_delimiter_al_regular_number_note)) {
_endnotes ~= format(