From bdb43e4e7d34ba178ec3bbc351d059c63e162d4b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 8 Mar 2018 16:58:10 -0500 Subject: footnotes fontface; home button text and links --- src/sdp/output/defaults.d | 1 + src/sdp/output/hub.d | 2 +- src/sdp/output/rgx.d | 1 + src/sdp/output/source_sisupod.d | 59 +++++++++++++++++++-------------------- src/sdp/output/xmls.d | 62 ++++++++++++++++++++++++++--------------- 5 files changed, 72 insertions(+), 53 deletions(-) (limited to 'src/sdp/output') 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(?:[/a-zA-Z0-9._-]+?)(?P[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.+?)】`, "m"); static inline_notes_al_gen_ref = ctRegex!(`【(?P[*+]\s+)\s*(?P.+?)】`, "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"¶¶", - _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, - ("$1")); - _txt = (_txt).replaceAll( - rgx.mark_internal_site_lnk, - "" - ); + _txt = (_txt) + .replaceAll( + rgx.inline_link_fn_suffix, + ("$1" ~ _suffix)) + .replaceAll( + rgx.inline_link, + ("$1")) + .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, (" $1 ") @@ -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( -- cgit v1.2.3