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 --- org/default_misc.org | 1 + org/default_regex.org | 3 +- org/meta_abstraction.org | 67 +++++++++++------- org/meta_conf_make_meta.org | 123 +++++++++++++++++++++++++++------- org/output_hub.org | 2 +- org/output_sisupod.org | 59 ++++++++-------- org/output_xmls.org | 62 +++++++++++------ org/sdp.org | 2 +- src/sdp/meta/conf_make_meta_json.d | 50 +++++++++++--- src/sdp/meta/conf_make_meta_structs.d | 65 +++++++++++++----- src/sdp/meta/defaults.d | 1 + src/sdp/meta/metadoc_from_src.d | 67 +++++++++++------- src/sdp/meta/rgx.d | 3 +- 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 +++++++++++------ 18 files changed, 418 insertions(+), 212 deletions(-) diff --git a/org/default_misc.org b/org/default_misc.org index da1d0ae..a2a6a72 100644 --- a/org/default_misc.org +++ b/org/default_misc.org @@ -214,6 +214,7 @@ import #+name: defaults_template_markup #+BEGIN_SRC d 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/org/default_regex.org b/org/default_regex.org index 8edf0c1..59bd11e 100644 --- a/org/default_regex.org +++ b/org/default_regex.org @@ -127,7 +127,7 @@ static native_subhead_classify = ctRegex!(`^(?:topic_regi static native_subhead_identifier = ctRegex!(`^(?:oclc|pg|isbn)$`, "m"); static native_subhead_notes = ctRegex!(`^(?:abstract|description)$`, "m"); static native_subhead_publisher = ctRegex!(`^(?:name)$`, "m"); -static native_subhead_make = ctRegex!(`^(?:cover_image|home_button_image|home_button_text|footer|headings|num_top|num_depth|breaks|substitute|bold|italics|emphasis|texpdf_font|css)$`, "m"); +static native_subhead_make = ctRegex!(`^(?:cover_image|home_button_image|home_button_text|footer|headings|num_top|auto_num_depth|breaks|substitute|bold|italics|emphasis|texpdf_font|css)$`, "m"); #+END_SRC ** heading & paragraph operators :paragraph:operator: @@ -442,6 +442,7 @@ static src_formalised_file_path_parts = ctRegex!(`(?P(?:[/a #+BEGIN_SRC d /+ 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/org/meta_abstraction.org b/org/meta_abstraction.org index b8ab4e6..0e379c7 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -4704,7 +4704,7 @@ pure struct OCNemitter { static struct ObjInlineMarkupMunge { string[string] obj_txt; int n_foot, n_foot_reg, n_foot_sp_asterisk, n_foot_sp_plus; - string asterisks_; + string asterisks_, plus_; string obj_txt_out, tail, note; static auto rgx = Rgx(); static auto mkup = InlineMarkup(); @@ -4728,6 +4728,7 @@ static struct ObjInlineMarkupMunge { static auto mng = InlineMarkup(); obj_txt_in = obj_txt_in.replaceAll(rgx.inline_mono, (mng.mono ~ "{$1}" ~ mng.mono)); /+ url matched +/ + obj_txt_in = obj_txt_in.replaceAll(rgx.inline_notes_al_special, ""); // TODO reinstate when special footnotes are implemented if (obj_txt_in.match(rgx.inline_url_generic)) { /+ link: naked url: http://url +/ if (obj_txt_in.match(rgx.inline_link_naked_url)) { @@ -4745,22 +4746,23 @@ static struct ObjInlineMarkupMunge { { link which includes url as footnote }http://url~{ { http://url }http://url }~ +/ if (obj_txt_in.match(rgx.inline_link_endnote_url_helper)) { - obj_txt_in = (obj_txt_in).replaceAll( - rgx.inline_link_endnote_url_helper_punctuated, - (mkup.lnk_o ~ "$1" ~ mkup.lnk_c - ~ mkup.url_o ~ "$2" ~ mkup.url_c - ~ "~{ " ~ mkup.lnk_o ~ " $2 " ~ mkup.lnk_c - ~ mkup.url_o ~ "$2" ~ mkup.url_c - ~ " }~$3") // ("{ $1 }$2~{ { $2 }$2 }~$3") - ); - obj_txt_in = (obj_txt_in).replaceAll( - rgx.inline_link_endnote_url_helper, - (mkup.lnk_o ~ "$1" ~ mkup.lnk_c - ~ mkup.url_o ~ "$2" ~ mkup.url_c - ~ "~{ " ~ mkup.lnk_o ~ " $2 " ~ mkup.lnk_c - ~ mkup.url_o ~ "$2" ~ mkup.url_c - ~ " }~") // ("{ $1 }$2~{ { $2 }$2 }~") - ); + obj_txt_in = (obj_txt_in) + .replaceAll( + rgx.inline_link_endnote_url_helper_punctuated, + (mkup.lnk_o ~ "$1" ~ mkup.lnk_c + ~ mkup.url_o ~ "$2" ~ mkup.url_c + ~ "~{ " ~ mkup.lnk_o ~ " $2 " ~ mkup.lnk_c + ~ mkup.url_o ~ "$2" ~ mkup.url_c + ~ " }~$3") // ("{ $1 }$2~{ { $2 }$2 }~$3") + ) + .replaceAll( + rgx.inline_link_endnote_url_helper, + (mkup.lnk_o ~ "$1" ~ mkup.lnk_c + ~ mkup.url_o ~ "$2" ~ mkup.url_c + ~ "~{ " ~ mkup.lnk_o ~ " $2 " ~ mkup.lnk_c + ~ mkup.url_o ~ "$2" ~ mkup.url_c + ~ " }~") // ("{ $1 }$2~{ { $2 }$2 }~") + ); } /+ link with regular markup: { linked text or image }http://url @@ -4791,6 +4793,7 @@ static struct ObjInlineMarkupMunge { /+ endnotes (regular) +/ bool flg_notes_reg = false; bool flg_notes_star = false; + bool flg_notes_plus = false; obj_txt_in = (obj_txt_in).replaceAll( rgx.inline_notes_curly, (mkup.en_a_o ~ " $1" ~ mkup.en_a_c) @@ -4817,6 +4820,15 @@ static struct ObjInlineMarkupMunge { rgx.inline_al_delimiter_open_symbol_star, (mkup.en_a_o ~ replicate(asterisks_, n_foot_sp_asterisk) ~ " ") ) ~ "\n"; + } else if (n.hit.to!string.match(rgx.inline_al_delimiter_open_symbol_plus)) { + flg_notes_plus = true; + ++n_foot_sp_plus; + plus_ = "*"; + n_foot=n_foot_sp_plus; + obj_txt_out ~= n.hit.to!string.replaceFirst( + rgx.inline_al_delimiter_open_symbol_plus, + (mkup.en_a_o ~ replicate(plus_, n_foot_sp_plus) ~ " ") + ) ~ "\n"; } else if (n.hit.to!string.match(rgx.inline_al_delimiter_open_regular)) { flg_notes_reg = true; ++n_foot_reg; @@ -4837,6 +4849,7 @@ static struct ObjInlineMarkupMunge { obj_txt_out, flg_notes_reg, flg_notes_star, + flg_notes_plus, ); return t; } @@ -4888,6 +4901,7 @@ static struct ObjInlineMarkupMunge { obj_txt_out, ftn[1], ftn[2], + ftn[3], urls, ); return t; @@ -5208,7 +5222,8 @@ static struct ObjInlineMarkup { obj_txt["munge"] = x[0]; obj_notes_and_links["notes_reg"] = x[1]; obj_notes_and_links["notes_star"] = x[2]; - obj_notes_and_links["links"] = x[3]; + obj_notes_and_links["notes_plus"] = x[3]; + obj_notes_and_links["links"] = x[4]; break; } auto t = tuple( @@ -5443,7 +5458,7 @@ private: heading_num[3] = 0; heading_number_auto_composite = ""; } - /+ num_depth minimum 0 + /+ auto_num_depth minimum 0 (1.) default 2 (1.1.1) max 3 (1.1.1.1) implement +/ if ( conf_make_meta.make.auto_num_top_lv @@ -5481,7 +5496,7 @@ private: } if (heading_num[3] > 0) { heading_number_auto_composite - = (conf_make_meta.make.num_depth.to!uint == 3) + = (conf_make_meta.make.auto_num_depth.to!uint == 3) ? ( heading_num[0].to!string ~ "." ~ heading_num[1].to!string ~ "." ~ heading_num[2].to!string ~ "." @@ -5490,8 +5505,8 @@ private: : ""; } else if (heading_num[2] > 0) { heading_number_auto_composite - = ((conf_make_meta.make.num_depth.to!uint >= 2) - && (conf_make_meta.make.num_depth.to!uint <= 3)) + = ((conf_make_meta.make.auto_num_depth.to!uint >= 2) + && (conf_make_meta.make.auto_num_depth.to!uint <= 3)) ? ( heading_num[0].to!string ~ "." ~ heading_num[1].to!string ~ "." ~ heading_num[2].to!string @@ -5499,16 +5514,16 @@ private: : ""; } else if (heading_num[1] > 0) { heading_number_auto_composite - = ((conf_make_meta.make.num_depth.to!uint >= 1) - && (conf_make_meta.make.num_depth.to!uint <= 3)) + = ((conf_make_meta.make.auto_num_depth.to!uint >= 1) + && (conf_make_meta.make.auto_num_depth.to!uint <= 3)) ? ( heading_num[0].to!string ~ "." ~ heading_num[1].to!string ) : ""; } else if (heading_num[0] > 0) { heading_number_auto_composite - = ((conf_make_meta.make.num_depth.to!uint >= 0) - && (conf_make_meta.make.num_depth.to!uint <= 3)) + = ((conf_make_meta.make.auto_num_depth.to!uint >= 0) + && (conf_make_meta.make.auto_num_depth.to!uint <= 3)) ? (heading_num[0].to!string) : ""; } else { diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org index e784a87..9f6fbf7 100644 --- a/org/meta_conf_make_meta.org +++ b/org/meta_conf_make_meta.org @@ -46,6 +46,13 @@ import sdp.meta.conf_make_meta_structs; #+BEGIN_SRC d :tangle ../src/sdp/meta/conf_make_meta_structs.d module sdp.meta.conf_make_meta_structs; +<> +#+END_SRC + +** initialize, imports etc. + +#+name: meta_defaults_template_structs +#+BEGIN_SRC d import std.exception, std.json, @@ -56,27 +63,51 @@ import std.typecons, std.utf, std.conv : to; -<> +import + sdp.meta.defaults, + sdp.meta.rgx; +mixin SiSUrgxInit; +static auto _rgx = Rgx(); +mixin InternalMarkup; +auto _mkup = InlineMarkup(); #+END_SRC ** struct Generic ConfComposite #+name: meta_defaults_template_structs #+BEGIN_SRC d +auto url_markup(string line) { + auto line_ = (line) + .replaceAll( + _rgx.inline_link_markup_regular, + ("$1" + ~ _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") + ); + return line_; +} struct ConfCompositeMakeStr { string bold; string breaks; string cover_image; string css; string emphasis; - string footer; + string[] footer; string[] headings; - string home_button_image; - string home_button_text; + string[] home_button_image; + string[] home_button_text; string italics; string auto_num_top_at_level; int auto_num_top_lv = 9; - int num_depth = 2; + int auto_num_depth = 2; string[][] substitute; string texpdf_font; } @@ -104,17 +135,27 @@ struct confCompositeMakeBuild { } return _out; } - auto footer(string _mk) { - return _mk; + auto footer(string[] _mk) { + string line_; + string[] _mk2; + foreach (line; _mk) { + _mk2 ~= url_markup(line); + } + return _mk2; } auto headings(string[] _mk) { return _mk; } - auto home_button_image(string _mk) { + auto home_button_image(string[] _mk) { return _mk; } - auto home_button_text(string _mk) { - return _mk; + auto home_button_text(string[] _mk) { + string line_; + string[] _mk2; + foreach (line; _mk) { + _mk2 ~= url_markup(line); + } + return _mk2; } auto italics(string _mk) { string[] _out; @@ -129,7 +170,7 @@ struct confCompositeMakeBuild { auto auto_num_top_lv(int _mk) { return _mk; } - auto num_depth(int _mk) { + auto auto_num_depth(int _mk) { return _mk; } auto substitute(string[][] _mk) { @@ -152,14 +193,14 @@ struct ConfCompositeMakeInit { string cover_image; string css; string[] emphasis; - string footer; + string[] footer; string[] headings; - string home_button_image; - string home_button_text; + string[] home_button_image; + string[] home_button_text; string[] italics; string auto_num_top_at_level; int auto_num_top_lv = 9; - int num_depth = 2; + int auto_num_depth = 2; string[][] substitute; string texpdf_font; } @@ -333,7 +374,7 @@ static auto ptr_head_sub_make "home_button_image", "home_button_text", "footer", "headings", - "auto_num_top_at_level", "auto_num_top_lv", "num_depth", + "auto_num_top_at_level", "auto_num_top_lv", "auto_num_depth", "breaks", "substitute", "bold", @@ -457,7 +498,17 @@ if ("make" in _json.object) { if ("footer" in _json.object["make"] && (_json.object["make"]["footer"].type().to!string == "STRING") ) { - _struct_composite.make_str.footer = _json.object["make"]["footer"].str; + char[][] __match_footer_array + = (cast(char[]) _json.object["make"]["footer"].str) + .split(_rgx.make_heading_delimiter); + _struct_composite.make_str.footer = __match_footer_array.to!(string[]); + } else if ("footer" in _json.object["make"] + && _json.object["make"]["footer"].type().to!string == "ARRAY") { + string[] _match_footer_array; + foreach (_match_heading; _json.object["make"]["footer"].arrayNoRef) { + _match_footer_array ~= _match_heading.str; + } + _struct_composite.make_str.footer = _match_footer_array; } if ("headings" in _json.object["make"] && (_json.object["make"]["headings"].type().to!string == "STRING") @@ -477,12 +528,32 @@ if ("make" in _json.object) { if ("home_button_image" in _json.object["make"] && (_json.object["make"]["home_button_image"].type().to!string == "STRING") ) { - _struct_composite.make_str.home_button_image = _json.object["make"]["home_button_image"].str; + char[][] __match_home_button_image_array + = (cast(char[]) _json.object["make"]["home_button_image"].str) + .split(_rgx.make_heading_delimiter); + _struct_composite.make_str.home_button_image = __match_home_button_image_array.to!(string[]); + } else if ("home_button_image" in _json.object["make"] + && _json.object["make"]["home_button_image"].type().to!string == "ARRAY") { + string[] _match_home_button_image_array; + foreach (_match_heading; _json.object["make"]["home_button_image"].arrayNoRef) { + _match_home_button_image_array ~= _match_heading.str; + } + _struct_composite.make_str.home_button_image = _match_home_button_image_array; } if ("home_button_text" in _json.object["make"] && (_json.object["make"]["home_button_text"].type().to!string == "STRING") ) { - _struct_composite.make_str.home_button_text = _json.object["make"]["home_button_text"].str; + 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[]); + } else if ("home_button_text" in _json.object["make"] + && _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; } if ("italics" in _json.object["make"] && (_json.object["make"]["italics"].type().to!string == "STRING") @@ -521,14 +592,14 @@ if ("make" in _json.object) { break; } } - if ("num_depth" in _json.object["make"] - && (_json.object["make"]["num_depth"].type().to!string == "INTEGER") + if ("auto_num_depth" in _json.object["make"] + && (_json.object["make"]["auto_num_depth"].type().to!string == "INTEGER") ) { - _struct_composite.make_str.num_depth = _json.object["make"]["num_depth"].integer.to!int; - } else if ("num_depth" in _json.object["make"] - && (_json.object["make"]["num_depth"].type().to!string == "STRING") + _struct_composite.make_str.auto_num_depth = _json.object["make"]["auto_num_depth"].integer.to!int; + } else if ("auto_num_depth" in _json.object["make"] + && (_json.object["make"]["auto_num_depth"].type().to!string == "STRING") ) { - _struct_composite.make_str.num_depth = _json.object["make"]["num_depth"].str.to!int; + _struct_composite.make_str.auto_num_depth = _json.object["make"]["auto_num_depth"].str.to!int; } if ("substitute" in _json.object["make"]) { string[][] _sub; @@ -571,7 +642,7 @@ if ("make" in _json.object) { _struct_composite.make.italics = _mk.italics(_struct_composite.make_str.italics); _struct_composite.make.auto_num_top_at_level = _mk.auto_num_top_at_level(_struct_composite.make_str.auto_num_top_at_level); _struct_composite.make.auto_num_top_lv = _mk.auto_num_top_lv(_struct_composite.make_str.auto_num_top_lv); - _struct_composite.make.num_depth = _mk.num_depth(_struct_composite.make_str.num_depth); + _struct_composite.make.auto_num_depth = _mk.auto_num_depth(_struct_composite.make_str.auto_num_depth); _struct_composite.make.substitute = _mk.substitute(_struct_composite.make_str.substitute); _struct_composite.make.texpdf_font = _mk.texpdf_font(_struct_composite.make_str.texpdf_font); } diff --git a/org/output_hub.org b/org/output_hub.org index 3c44e7d..0221652 100644 --- a/org/output_hub.org +++ b/org/output_hub.org @@ -62,7 +62,7 @@ import sdp.output, #+name: output_options #+BEGIN_SRC d -if ((doc_matters.opt.action.verbose)) { +if (doc_matters.opt.action.verbose) { writeln(doc_matters.xml.keys_seq.seg); } #+END_SRC diff --git a/org/output_sisupod.org b/org/output_sisupod.org index 7af3573..ef1a85f 100644 --- a/org/output_sisupod.org +++ b/org/output_sisupod.org @@ -152,36 +152,35 @@ auto fn_sisupod = pths_sisupod.sisupod_filename(doc_matters.src.filename).zpod; } } } { /+ 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/org/output_xmls.org b/org/output_xmls.org index 4a0babb..9a34534 100644 --- a/org/output_xmls.org +++ b/org/output_xmls.org @@ -230,12 +230,31 @@ auto header_metadata(Dm)( 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; } @@ -439,16 +455,16 @@ auto inline_links(O)( 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)) { @@ -483,6 +499,7 @@ auto inline_notes_scroll(O)( string _txt, ) { if (obj.inline_notes_reg) { + _txt = font_face(_txt); _txt = (_txt).replaceAll( rgx.inline_notes_delimiter_al_regular_number_note, (" $1 ") @@ -512,6 +529,7 @@ auto inline_notes_seg(O)( ) { 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( diff --git a/org/sdp.org b/org/sdp.org index 463b03f..202bf9b 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -1321,7 +1321,7 @@ provide the result as a single set of make instructions for each document parsed | | - home_button_text | - home_button_text | - home_button_text | | | | - italics | - italics | - italics | | | | - num_top | - num_top | - num_top | | -| | - num_depth | - num_depth | - num_depth | | +| | - auto_num_depth | - auto_num_depth | - auto_num_depth | | | | - substitute | - substitute | - substitute | | | | - texpdf_font | - texpdf_font | - texpdf_font | | |---------------------+--------------------------+----------------------------+------------------------+-----------------------------| diff --git a/src/sdp/meta/conf_make_meta_json.d b/src/sdp/meta/conf_make_meta_json.d index e192c70..3a47f20 100644 --- a/src/sdp/meta/conf_make_meta_json.d +++ b/src/sdp/meta/conf_make_meta_json.d @@ -66,7 +66,17 @@ static template contentJSONtoSiSUstruct() { if ("footer" in _json.object["make"] && (_json.object["make"]["footer"].type().to!string == "STRING") ) { - _struct_composite.make_str.footer = _json.object["make"]["footer"].str; + char[][] __match_footer_array + = (cast(char[]) _json.object["make"]["footer"].str) + .split(_rgx.make_heading_delimiter); + _struct_composite.make_str.footer = __match_footer_array.to!(string[]); + } else if ("footer" in _json.object["make"] + && _json.object["make"]["footer"].type().to!string == "ARRAY") { + string[] _match_footer_array; + foreach (_match_heading; _json.object["make"]["footer"].arrayNoRef) { + _match_footer_array ~= _match_heading.str; + } + _struct_composite.make_str.footer = _match_footer_array; } if ("headings" in _json.object["make"] && (_json.object["make"]["headings"].type().to!string == "STRING") @@ -86,12 +96,32 @@ static template contentJSONtoSiSUstruct() { if ("home_button_image" in _json.object["make"] && (_json.object["make"]["home_button_image"].type().to!string == "STRING") ) { - _struct_composite.make_str.home_button_image = _json.object["make"]["home_button_image"].str; + char[][] __match_home_button_image_array + = (cast(char[]) _json.object["make"]["home_button_image"].str) + .split(_rgx.make_heading_delimiter); + _struct_composite.make_str.home_button_image = __match_home_button_image_array.to!(string[]); + } else if ("home_button_image" in _json.object["make"] + && _json.object["make"]["home_button_image"].type().to!string == "ARRAY") { + string[] _match_home_button_image_array; + foreach (_match_heading; _json.object["make"]["home_button_image"].arrayNoRef) { + _match_home_button_image_array ~= _match_heading.str; + } + _struct_composite.make_str.home_button_image = _match_home_button_image_array; } if ("home_button_text" in _json.object["make"] && (_json.object["make"]["home_button_text"].type().to!string == "STRING") ) { - _struct_composite.make_str.home_button_text = _json.object["make"]["home_button_text"].str; + 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[]); + } else if ("home_button_text" in _json.object["make"] + && _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; } if ("italics" in _json.object["make"] && (_json.object["make"]["italics"].type().to!string == "STRING") @@ -130,14 +160,14 @@ static template contentJSONtoSiSUstruct() { break; } } - if ("num_depth" in _json.object["make"] - && (_json.object["make"]["num_depth"].type().to!string == "INTEGER") + if ("auto_num_depth" in _json.object["make"] + && (_json.object["make"]["auto_num_depth"].type().to!string == "INTEGER") ) { - _struct_composite.make_str.num_depth = _json.object["make"]["num_depth"].integer.to!int; - } else if ("num_depth" in _json.object["make"] - && (_json.object["make"]["num_depth"].type().to!string == "STRING") + _struct_composite.make_str.auto_num_depth = _json.object["make"]["auto_num_depth"].integer.to!int; + } else if ("auto_num_depth" in _json.object["make"] + && (_json.object["make"]["auto_num_depth"].type().to!string == "STRING") ) { - _struct_composite.make_str.num_depth = _json.object["make"]["num_depth"].str.to!int; + _struct_composite.make_str.auto_num_depth = _json.object["make"]["auto_num_depth"].str.to!int; } if ("substitute" in _json.object["make"]) { string[][] _sub; @@ -180,7 +210,7 @@ static template contentJSONtoSiSUstruct() { _struct_composite.make.italics = _mk.italics(_struct_composite.make_str.italics); _struct_composite.make.auto_num_top_at_level = _mk.auto_num_top_at_level(_struct_composite.make_str.auto_num_top_at_level); _struct_composite.make.auto_num_top_lv = _mk.auto_num_top_lv(_struct_composite.make_str.auto_num_top_lv); - _struct_composite.make.num_depth = _mk.num_depth(_struct_composite.make_str.num_depth); + _struct_composite.make.auto_num_depth = _mk.auto_num_depth(_struct_composite.make_str.auto_num_depth); _struct_composite.make.substitute = _mk.substitute(_struct_composite.make_str.substitute); _struct_composite.make.texpdf_font = _mk.texpdf_font(_struct_composite.make_str.texpdf_font); } diff --git a/src/sdp/meta/conf_make_meta_structs.d b/src/sdp/meta/conf_make_meta_structs.d index 41af6ba..a5d2c15 100644 --- a/src/sdp/meta/conf_make_meta_structs.d +++ b/src/sdp/meta/conf_make_meta_structs.d @@ -9,20 +9,45 @@ import std.typecons, std.utf, std.conv : to; +import + sdp.meta.defaults, + sdp.meta.rgx; +mixin SiSUrgxInit; +static auto _rgx = Rgx(); +mixin InternalMarkup; +auto _mkup = InlineMarkup(); +auto url_markup(string line) { + auto line_ = (line) + .replaceAll( + _rgx.inline_link_markup_regular, + ("$1" + ~ _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") + ); + return line_; +} struct ConfCompositeMakeStr { string bold; string breaks; string cover_image; string css; string emphasis; - string footer; + string[] footer; string[] headings; - string home_button_image; - string home_button_text; + string[] home_button_image; + string[] home_button_text; string italics; string auto_num_top_at_level; int auto_num_top_lv = 9; - int num_depth = 2; + int auto_num_depth = 2; string[][] substitute; string texpdf_font; } @@ -50,17 +75,27 @@ struct confCompositeMakeBuild { } return _out; } - auto footer(string _mk) { - return _mk; + auto footer(string[] _mk) { + string line_; + string[] _mk2; + foreach (line; _mk) { + _mk2 ~= url_markup(line); + } + return _mk2; } auto headings(string[] _mk) { return _mk; } - auto home_button_image(string _mk) { + auto home_button_image(string[] _mk) { return _mk; } - auto home_button_text(string _mk) { - return _mk; + auto home_button_text(string[] _mk) { + string line_; + string[] _mk2; + foreach (line; _mk) { + _mk2 ~= url_markup(line); + } + return _mk2; } auto italics(string _mk) { string[] _out; @@ -75,7 +110,7 @@ struct confCompositeMakeBuild { auto auto_num_top_lv(int _mk) { return _mk; } - auto num_depth(int _mk) { + auto auto_num_depth(int _mk) { return _mk; } auto substitute(string[][] _mk) { @@ -91,14 +126,14 @@ struct ConfCompositeMakeInit { string cover_image; string css; string[] emphasis; - string footer; + string[] footer; string[] headings; - string home_button_image; - string home_button_text; + string[] home_button_image; + string[] home_button_text; string[] italics; string auto_num_top_at_level; int auto_num_top_lv = 9; - int num_depth = 2; + int auto_num_depth = 2; string[][] substitute; string texpdf_font; } @@ -248,7 +283,7 @@ static auto ptr_head_sub_make "home_button_image", "home_button_text", "footer", "headings", - "auto_num_top_at_level", "auto_num_top_lv", "num_depth", + "auto_num_top_at_level", "auto_num_top_lv", "auto_num_depth", "breaks", "substitute", "bold", diff --git a/src/sdp/meta/defaults.d b/src/sdp/meta/defaults.d index 13bf312..f0137cb 100644 --- a/src/sdp/meta/defaults.d +++ b/src/sdp/meta/defaults.d @@ -122,6 +122,7 @@ template SiSUbiblio() { } } 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/meta/metadoc_from_src.d b/src/sdp/meta/metadoc_from_src.d index 6035825..784991c 100644 --- a/src/sdp/meta/metadoc_from_src.d +++ b/src/sdp/meta/metadoc_from_src.d @@ -3767,7 +3767,7 @@ template SiSUdocAbstraction() { static struct ObjInlineMarkupMunge { string[string] obj_txt; int n_foot, n_foot_reg, n_foot_sp_asterisk, n_foot_sp_plus; - string asterisks_; + string asterisks_, plus_; string obj_txt_out, tail, note; static auto rgx = Rgx(); static auto mkup = InlineMarkup(); @@ -3785,6 +3785,7 @@ template SiSUdocAbstraction() { static auto mng = InlineMarkup(); obj_txt_in = obj_txt_in.replaceAll(rgx.inline_mono, (mng.mono ~ "{$1}" ~ mng.mono)); /+ url matched +/ + obj_txt_in = obj_txt_in.replaceAll(rgx.inline_notes_al_special, ""); // TODO reinstate when special footnotes are implemented if (obj_txt_in.match(rgx.inline_url_generic)) { /+ link: naked url: http://url +/ if (obj_txt_in.match(rgx.inline_link_naked_url)) { @@ -3802,22 +3803,23 @@ template SiSUdocAbstraction() { { link which includes url as footnote }http://url~{ { http://url }http://url }~ +/ if (obj_txt_in.match(rgx.inline_link_endnote_url_helper)) { - obj_txt_in = (obj_txt_in).replaceAll( - rgx.inline_link_endnote_url_helper_punctuated, - (mkup.lnk_o ~ "$1" ~ mkup.lnk_c - ~ mkup.url_o ~ "$2" ~ mkup.url_c - ~ "~{ " ~ mkup.lnk_o ~ " $2 " ~ mkup.lnk_c - ~ mkup.url_o ~ "$2" ~ mkup.url_c - ~ " }~$3") // ("{ $1 }$2~{ { $2 }$2 }~$3") - ); - obj_txt_in = (obj_txt_in).replaceAll( - rgx.inline_link_endnote_url_helper, - (mkup.lnk_o ~ "$1" ~ mkup.lnk_c - ~ mkup.url_o ~ "$2" ~ mkup.url_c - ~ "~{ " ~ mkup.lnk_o ~ " $2 " ~ mkup.lnk_c - ~ mkup.url_o ~ "$2" ~ mkup.url_c - ~ " }~") // ("{ $1 }$2~{ { $2 }$2 }~") - ); + obj_txt_in = (obj_txt_in) + .replaceAll( + rgx.inline_link_endnote_url_helper_punctuated, + (mkup.lnk_o ~ "$1" ~ mkup.lnk_c + ~ mkup.url_o ~ "$2" ~ mkup.url_c + ~ "~{ " ~ mkup.lnk_o ~ " $2 " ~ mkup.lnk_c + ~ mkup.url_o ~ "$2" ~ mkup.url_c + ~ " }~$3") // ("{ $1 }$2~{ { $2 }$2 }~$3") + ) + .replaceAll( + rgx.inline_link_endnote_url_helper, + (mkup.lnk_o ~ "$1" ~ mkup.lnk_c + ~ mkup.url_o ~ "$2" ~ mkup.url_c + ~ "~{ " ~ mkup.lnk_o ~ " $2 " ~ mkup.lnk_c + ~ mkup.url_o ~ "$2" ~ mkup.url_c + ~ " }~") // ("{ $1 }$2~{ { $2 }$2 }~") + ); } /+ link with regular markup: { linked text or image }http://url @@ -3842,6 +3844,7 @@ template SiSUdocAbstraction() { /+ endnotes (regular) +/ bool flg_notes_reg = false; bool flg_notes_star = false; + bool flg_notes_plus = false; obj_txt_in = (obj_txt_in).replaceAll( rgx.inline_notes_curly, (mkup.en_a_o ~ " $1" ~ mkup.en_a_c) @@ -3868,6 +3871,15 @@ template SiSUdocAbstraction() { rgx.inline_al_delimiter_open_symbol_star, (mkup.en_a_o ~ replicate(asterisks_, n_foot_sp_asterisk) ~ " ") ) ~ "\n"; + } else if (n.hit.to!string.match(rgx.inline_al_delimiter_open_symbol_plus)) { + flg_notes_plus = true; + ++n_foot_sp_plus; + plus_ = "*"; + n_foot=n_foot_sp_plus; + obj_txt_out ~= n.hit.to!string.replaceFirst( + rgx.inline_al_delimiter_open_symbol_plus, + (mkup.en_a_o ~ replicate(plus_, n_foot_sp_plus) ~ " ") + ) ~ "\n"; } else if (n.hit.to!string.match(rgx.inline_al_delimiter_open_regular)) { flg_notes_reg = true; ++n_foot_reg; @@ -3888,6 +3900,7 @@ template SiSUdocAbstraction() { obj_txt_out, flg_notes_reg, flg_notes_star, + flg_notes_plus, ); return t; } @@ -3933,6 +3946,7 @@ template SiSUdocAbstraction() { obj_txt_out, ftn[1], ftn[2], + ftn[3], urls, ); return t; @@ -4143,7 +4157,8 @@ template SiSUdocAbstraction() { obj_txt["munge"] = x[0]; obj_notes_and_links["notes_reg"] = x[1]; obj_notes_and_links["notes_star"] = x[2]; - obj_notes_and_links["links"] = x[3]; + obj_notes_and_links["notes_plus"] = x[3]; + obj_notes_and_links["links"] = x[4]; break; } auto t = tuple( @@ -4360,7 +4375,7 @@ template SiSUdocAbstraction() { heading_num[3] = 0; heading_number_auto_composite = ""; } - /+ num_depth minimum 0 + /+ auto_num_depth minimum 0 (1.) default 2 (1.1.1) max 3 (1.1.1.1) implement +/ if ( conf_make_meta.make.auto_num_top_lv @@ -4398,7 +4413,7 @@ template SiSUdocAbstraction() { } if (heading_num[3] > 0) { heading_number_auto_composite - = (conf_make_meta.make.num_depth.to!uint == 3) + = (conf_make_meta.make.auto_num_depth.to!uint == 3) ? ( heading_num[0].to!string ~ "." ~ heading_num[1].to!string ~ "." ~ heading_num[2].to!string ~ "." @@ -4407,8 +4422,8 @@ template SiSUdocAbstraction() { : ""; } else if (heading_num[2] > 0) { heading_number_auto_composite - = ((conf_make_meta.make.num_depth.to!uint >= 2) - && (conf_make_meta.make.num_depth.to!uint <= 3)) + = ((conf_make_meta.make.auto_num_depth.to!uint >= 2) + && (conf_make_meta.make.auto_num_depth.to!uint <= 3)) ? ( heading_num[0].to!string ~ "." ~ heading_num[1].to!string ~ "." ~ heading_num[2].to!string @@ -4416,16 +4431,16 @@ template SiSUdocAbstraction() { : ""; } else if (heading_num[1] > 0) { heading_number_auto_composite - = ((conf_make_meta.make.num_depth.to!uint >= 1) - && (conf_make_meta.make.num_depth.to!uint <= 3)) + = ((conf_make_meta.make.auto_num_depth.to!uint >= 1) + && (conf_make_meta.make.auto_num_depth.to!uint <= 3)) ? ( heading_num[0].to!string ~ "." ~ heading_num[1].to!string ) : ""; } else if (heading_num[0] > 0) { heading_number_auto_composite - = ((conf_make_meta.make.num_depth.to!uint >= 0) - && (conf_make_meta.make.num_depth.to!uint <= 3)) + = ((conf_make_meta.make.auto_num_depth.to!uint >= 0) + && (conf_make_meta.make.auto_num_depth.to!uint <= 3)) ? (heading_num[0].to!string) : ""; } else { diff --git a/src/sdp/meta/rgx.d b/src/sdp/meta/rgx.d index 4cc1fe1..9fdcb99 100644 --- a/src/sdp/meta/rgx.d +++ b/src/sdp/meta/rgx.d @@ -64,7 +64,7 @@ static template SiSUrgxInit() { static native_subhead_identifier = ctRegex!(`^(?:oclc|pg|isbn)$`, "m"); static native_subhead_notes = ctRegex!(`^(?:abstract|description)$`, "m"); static native_subhead_publisher = ctRegex!(`^(?:name)$`, "m"); - static native_subhead_make = ctRegex!(`^(?:cover_image|home_button_image|home_button_text|footer|headings|num_top|num_depth|breaks|substitute|bold|italics|emphasis|texpdf_font|css)$`, "m"); + static native_subhead_make = ctRegex!(`^(?:cover_image|home_button_image|home_button_text|footer|headings|num_top|auto_num_depth|breaks|substitute|bold|italics|emphasis|texpdf_font|css)$`, "m"); /+ heading & paragraph operators +/ static heading_a = ctRegex!(`^:?[A][~] `, "m"); static heading = ctRegex!(`^:?([A-D1-4])[~]([a-z0-9_.-]*[?]?)\s+`,"i"); @@ -220,6 +220,7 @@ static template SiSUrgxInit() { 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/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