From 4ff01a81f048c0b496cc03627324b69b7aebd368 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 7 Sep 2017 16:54:23 -0400 Subject: 0.19.0 conf make meta, composite struct, instead of associative array * remove conf make meta associative arrays, including native doc header (which revisit) --- src/sdp/meta/composite_make.d | 109 ----------- src/sdp/meta/conf_make_meta.d | 21 +- src/sdp/meta/conf_make_meta_composite.d | 45 +++++ src/sdp/meta/conf_make_meta_native.d | 330 -------------------------------- src/sdp/meta/conf_make_meta_sdlang.d | 213 ++++++++++++++------- src/sdp/meta/defaults.d | 279 ++++++++++++++------------- src/sdp/meta/doc_debugs.d | 44 ++--- src/sdp/meta/metadoc.d | 40 ++-- src/sdp/meta/metadoc_from_src.d | 132 ++++++------- src/sdp/meta/metadoc_summary.d | 8 +- src/sdp/meta/read_config_files.d | 23 ++- src/sdp/meta/read_source_files.d | 2 +- src/sdp/output/epub3.d | 40 ++-- src/sdp/output/sqlite.d | 151 ++++++++------- src/sdp/output/xmls.d | 18 +- src/sdp/sdp.d | 10 +- 16 files changed, 565 insertions(+), 900 deletions(-) delete mode 100644 src/sdp/meta/composite_make.d create mode 100644 src/sdp/meta/conf_make_meta_composite.d delete mode 100644 src/sdp/meta/conf_make_meta_native.d (limited to 'src') diff --git a/src/sdp/meta/composite_make.d b/src/sdp/meta/composite_make.d deleted file mode 100644 index bcbe20c..0000000 --- a/src/sdp/meta/composite_make.d +++ /dev/null @@ -1,109 +0,0 @@ -/++ - output hub
- check & generate output types requested -+/ -module sdp.meta.composite_make; -template compositeMkCnf() { - import sdp.meta; - import std.array; - mixin SiSUrgxInit; - string[] _substitutions; - string[string][] _sub; - string _bold; - string _italics; - string _emphasis; - auto compositeMkCnf(Mks...)(Mks makes) { - static auto rgx = Rgx(); - foreach (make; makes) { - if (auto z = "make" in make) { - if (auto x = "substitute" in *z) { - foreach (m; (*x).matchAll(rgx.make_simple_substitutions_d)) { - _sub ~= ["match": (m["match"]), "replace": (m["replace"])]; - _substitutions ~= format("`%s`,\"%s\"", - m["match"], - m["replace"], - ); - } - foreach (m; (*x).matchAll(rgx.make_simple_substitutions_rb)) { - _sub ~= ["match": (m["match"]), "replace": (m["replace"])]; - _substitutions ~= format("`%s`,\"%s\"", - m["match"], - m["replace"], - ); - } - } - if (auto x = "bold" in *z) { - _bold = (*x).to!string; - } - if (auto x = "italics" in *z) { - _italics = (*x).to!string; - } - if (auto x = "emphasis" in *z) { - _emphasis = (*x).to!string; - } - } - } - struct _composite_make { - auto substitutions() { - auto _k = _sub; - return _k; - } - auto substitute() { - auto _k = _substitutions; - return _k; - } - auto italics() { - auto _k = _italics; - return _k; - } - auto bold() { - auto _k = _bold; - return _k; - } - auto emphasis() { - auto _k = _emphasis; - return _k; - } - } - return _composite_make(); - } -} -/++ - output hub
- check & generate output types requested -+/ -template compositeMkCnfAA() { - import sdp.meta; - import std.array; - mixin SiSUrgxInit; - string[] _substitutions; - string[string][] _sub; - static auto rgx = Rgx(); - auto compositeMkCnfAA(Mks...)(Mks makes) { - /+ - - skip.first_make which is the "composite make output" - - pass config files as associative arrays, - - skip.last_make which is getopt, treat separately - +/ - auto _composite_make = makes[0]; - auto _opts = makes[$-1]; - foreach (make; makes[1..$-1]) { - if (auto z = "make" in make) { // document head: make (part of individual document) - if (auto x = "substitute" in *z) { - _composite_make["make"]["substitute"] = *x; - } - if (auto x = "italics" in *z) { - _composite_make["make"]["italics"] = *x; - } - if (auto x = "bold" in *z) { - _composite_make["make"]["bold"] = *x; - } - if (auto x = "emphasis" in *z) { - _composite_make["make"]["emphasis"] = *x; - } - } - } - /+ logic for adding _opts make instructions to _composite make +/ - return _composite_make; - } -} diff --git a/src/sdp/meta/conf_make_meta.d b/src/sdp/meta/conf_make_meta.d index 140b6ba..27c03bb 100644 --- a/src/sdp/meta/conf_make_meta.d +++ b/src/sdp/meta/conf_make_meta.d @@ -9,7 +9,7 @@ program internally. Moved to associative array. +/ module sdp.meta.conf_make_meta; -template docHeaderMakeAndMetaTupExtractAndConvertToAA() { +static template docHeaderMakeAndMetaTupExtractAndConvertToStruct() { import std.exception, std.regex, @@ -20,30 +20,19 @@ template docHeaderMakeAndMetaTupExtractAndConvertToAA() { std.conv : to; import sdlang; import - sdp.meta.conf_make_meta_native, sdp.meta.conf_make_meta_sdlang, sdp.meta.rgx; mixin SiSUrgxInit; - mixin SiSUheaderExtractNative; mixin SiSUextractSDLang; static auto rgx = Rgx(); - auto docHeaderMakeAndMetaTupExtractAndConvertToAA(DocMake, Src)( - DocMake conf_doc_make_aa, + auto docHeaderMakeAndMetaTupExtractAndConvertToStruct(CCm, Src)( + CCm conf_composite_make, Src header_src, ) { - debug(asserts){ - static assert(is(typeof(header_src) == char[])); - static assert(is(typeof(conf_doc_make_aa) == string[string][string])); - } - auto head_native = HeaderDocMetadataAndMakeNativeToAA(); auto header_sdlang_tag = (!(header_src.match(rgx.native_header_meta_title))) ? extractSDL().docHeaderSDLtagGet(header_src) // sdlang.ast.Tag : null; - auto header_make_and_meta_tuple = (header_src.match(rgx.native_header_meta_title)) - ? (head_native.headerNativeToAA(header_src)) - : (extractSDL().docHeaderSDLtoAA(conf_doc_make_aa, header_sdlang_tag)); - static assert(!isTypeTuple!(header_make_and_meta_tuple)); - static assert(header_make_and_meta_tuple.length==2); - return header_make_and_meta_tuple; + auto header_make_and_meta_struct = extractSDL().docSDLtoStruct(conf_composite_make, header_sdlang_tag); + return header_make_and_meta_struct; } } diff --git a/src/sdp/meta/conf_make_meta_composite.d b/src/sdp/meta/conf_make_meta_composite.d new file mode 100644 index 0000000..51e81ec --- /dev/null +++ b/src/sdp/meta/conf_make_meta_composite.d @@ -0,0 +1,45 @@ +/++ + return composite make from config files ++/ +module sdp.meta.conf_make_meta_composite; + +template confFilesSDLtoStruct() { + import + std.exception, + std.regex, + std.stdio, + std.string, + std.traits, + std.typecons, + std.utf, + std.conv : to; + import + sdp.meta.defaults, + sdp.meta.rgx; + auto confFilesSDLtoStruct(S,L)( + S sdl_root_config_share, + L sdl_root_config_local, + ){ + mixin SiSUregisters; + ConfCompositePlus _conf_composite; + foreach (conf_sdlang; [sdl_root_config_share, sdl_root_config_local]) { + if ("make" in conf_sdlang.maybe.tags) { + _conf_composite.make_str.bold = _conf_composite.make.bold = extractSDLangTabOrAttrib(conf_sdlang, "make", "bold"); + _conf_composite.make_str.breaks = _conf_composite.make.breaks = extractSDLangTabOrAttrib(conf_sdlang, "make", "breaks"); + _conf_composite.make_str.cover_image = _conf_composite.make.cover_image = extractSDLangTabOrAttrib(conf_sdlang, "make", "cover_image"); + _conf_composite.make_str.css = _conf_composite.make.css = extractSDLangTabOrAttrib(conf_sdlang, "make", "css"); + _conf_composite.make_str.emphasis = _conf_composite.make.emphasis = extractSDLangTabOrAttrib(conf_sdlang, "make", "emphasis"); + _conf_composite.make_str.footer = _conf_composite.make.footer = extractSDLangTabOrAttrib(conf_sdlang, "make", "footer"); + _conf_composite.make_str.headings = _conf_composite.make.headings = extractSDLangTabOrAttrib(conf_sdlang, "make", "headings"); + _conf_composite.make_str.home_button_image = _conf_composite.make.home_button_image = extractSDLangTabOrAttrib(conf_sdlang, "make", "home_button_image"); + _conf_composite.make_str.home_button_text = _conf_composite.make.home_button_text = extractSDLangTabOrAttrib(conf_sdlang, "make", "home_button_text"); + _conf_composite.make_str.italics = _conf_composite.make.italics = extractSDLangTabOrAttrib(conf_sdlang, "make", "italics"); + _conf_composite.make_str.num_top = _conf_composite.make.num_top = extractSDLangTabOrAttrib(conf_sdlang, "make", "num_top"); + _conf_composite.make_str.num_depth = _conf_composite.make.num_depth = extractSDLangTabOrAttrib(conf_sdlang, "make", "num_depth"); + _conf_composite.make_str.substitute = _conf_composite.make.substitute = extractSDLangTabOrAttrib(conf_sdlang, "make", "substitute"); + _conf_composite.make_str.texpdf_font = _conf_composite.make.texpdf_font = extractSDLangTabOrAttrib(conf_sdlang, "make", "texpdf_font"); + } + } + return _conf_composite; + } +} diff --git a/src/sdp/meta/conf_make_meta_native.d b/src/sdp/meta/conf_make_meta_native.d deleted file mode 100644 index 39e40b0..0000000 --- a/src/sdp/meta/conf_make_meta_native.d +++ /dev/null @@ -1,330 +0,0 @@ -/++ - native headers using
@title:
:subtitle:
type tags
- extract native/orig header return associative array -+/ -module sdp.meta.conf_make_meta_native; -template SiSUheaderExtractNative() { - import - std.exception, - std.regex, - std.stdio, - std.string, - std.traits, - std.typecons, - std.utf, - std.conv : to; - import - sdp.meta.defaults, - sdp.meta.rgx; - struct HeaderDocMetadataAndMakeNativeToAA { - mixin SiSUregisters; - mixin SiSUrgxInitFlags; - mixin SiSUrgxInit; - static auto rgx = Rgx(); - enum State { off, on } - string hm, hs; - auto header_metadata_and_make_aa(H,Me,Ma)( - H header, - Me dochead_meta, - Ma dochead_make - ) - in { - debug(asserts){ - static assert(is(typeof(header) == string)); - static assert(is(typeof(dochead_meta) == string[string][string])); - static assert(is(typeof(dochead_make) == string[string][string])); - } - } - body { - scope(exit) { - destroy(header); - destroy(dochead_meta); - destroy(dochead_make); - } - if (auto t = header.match(rgx.native_header_main)) { - char[][] header_obj_spl = - (cast(char[]) header).split(rgx.line_delimiter_ws_strip); - auto hm = to!string(t.captures[1]); - if (hm.match(rgx.main_headers)) { - foreach (line; header_obj_spl) { - if (auto m = line.match(rgx.native_header_main)) { - if (!empty(m.captures[2])) { - if (hm == "creator") { - dochead_meta[hm]["author"] = - to!string(m.captures[2]); - } else if (hm == "title") { - dochead_meta[hm]["main"] = - to!string(m.captures[2]); - } else if (hm == "publisher") { - dochead_meta[hm]["name"] = - to!string(m.captures[2]); - } - } - } else if (auto s = match(line, rgx.native_header_sub)) { - if (!empty(s.captures[2])) { - auto hs = to!string(s.captures[1]); - if ((hm == "make" ) - && (dochead_make[hm])) { - switch (hm) { - case "make": - if (hs.match(rgx.native_subhead_make)) { - if (dochead_make[hm][hs]) { - dochead_make[hm][hs] = to!string(s.captures[2]); - } - } else { - writeln("not a valid header type:", hm, ":", hs); - destroy(hm); - destroy(hs); - } - break; - default: - break; - } - } else if (dochead_meta[hm]) { - switch (hm) { - case "creator": - if (hs.match(rgx.native_subhead_creator)) { - if (dochead_meta[hm][hs]) { - dochead_meta[hm][hs] = - to!string(s.captures[2]); - } - } else { - writeln("not a valid header type:", hm, ":", hs); - destroy(hm); - destroy(hs); - } - break; - case "title": - if (hs.match(rgx.native_subhead_title)) { - if ((hs == "subtitle") - && (dochead_meta[hm]["sub"])) { - dochead_meta[hm]["sub"] = - to!string(s.captures[2]); - } else if (dochead_meta[hm][hs]) { - dochead_meta[hm][hs] = - to!string(s.captures[2]); - } - } else { - writeln("not a valid header type:", hm, ":", hs); - destroy(hm); - destroy(hs); - } - break; - case "rights": - if (hs.match(rgx.native_subhead_rights)) { - if (dochead_meta[hm][hs]) { - dochead_meta[hm][hs] = - to!string(s.captures[2]); - } - } else { - writeln("not a valid header type:", hm, ":", hs); - destroy(hm); - destroy(hs); - } - break; - case "date": - if (hs.match(rgx.native_subhead_date)) { - if (dochead_meta[hm][hs]) { - dochead_meta[hm][hs] = - to!string(s.captures[2]); - } - } else { - writeln("not a valid header type:", hm, ":", hs); - destroy(hm); - destroy(hs); - } - break; - case "original": - if (hs.match(rgx.native_subhead_original)) { - if (dochead_meta[hm][hs]) { - dochead_meta[hm][hs] = - to!string(s.captures[2]); - } - } else { - writeln("not a valid header type:", hm, ":", hs); - destroy(hm); - destroy(hs); - } - break; - case "classify": - if (hs.match(rgx.native_subhead_classify)) { - if (dochead_meta[hm][hs]) { - dochead_meta[hm][hs] = - to!string(s.captures[2]); - } - } else { - writeln("not a valid header type:", hm, ":", hs); - destroy(hm); - destroy(hs); - } - break; - case "identifier": - if (hs.match(rgx.native_subhead_identifier)) { - if (dochead_meta[hm][hs]) { - dochead_meta[hm][hs] = - to!string(s.captures[2]); - } - } else { - writeln("not a valid header type:", hm, ":", hs); - destroy(hm); - destroy(hs); - } - break; - case "notes": - if (hs.match(rgx.native_subhead_notes)) { - if (dochead_meta[hm][hs]) { - dochead_meta[hm][hs] = - to!string(s.captures[2]); - } - } else { - writeln("not a valid header type:", hm, ":", hs); - destroy(hm); - destroy(hs); - } - break; - case "publisher": - if (hs.match(rgx.native_subhead_publisher)) { - if (dochead_meta[hm][hs]) { - dochead_meta[hm][hs] = - to!string(s.captures[2]); - } - } else { - writeln("not a valid header type:", hm, ":", hs); - destroy(hm); - destroy(hs); - } - break; - case "links": - destroy(hm); - destroy(hs); - break; - default: - break; - } - } - } - } - } - } else { - writeln("not a valid header type:", hm); - } - } - auto t = tuple(dochead_meta, dochead_make); - static assert(t.length==2); - return t; - } - private auto native_header_extract(L,Lo,O,T)( - L line, - return ref Lo line_occur, - return ref O an_object, - return ref T type - ) { - debug(asserts){ - static assert(is(typeof(line) == char[])); - static assert(is(typeof(line_occur) == int[string])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(type) == int[string])); - } - if (line.matchFirst(rgx.native_header_make)) { /+ matched header_make +/ - debug(header1) { /+ writeln(line); +/ } - type["header"] = State.on; - type["header_make"] = State.on; - type["header_meta"] = State.off; - ++line_occur["header_make"]; - an_object["body_nugget"] ~= line ~= "\n"; - } else if (line.matchFirst(rgx.native_header)) { /+ matched header_metadata +/ - /+ (generic header match and not previously caught by header_make) +/ - debug(header1) { /+ writeln(line); +/ } - type["header"] = State.on; - type["header_make"] = State.off; - type["header_meta"] = State.on; - ++line_occur["header_meta"]; - an_object["body_nugget"] ~= line ~= "\n"; - } else if (type["header_make"] == State.on - && (line_occur["header_make"] > State.off)) { /+ header_make flag set +/ - if (line.matchFirst(rgx.native_header_sub)) { /+ sub-header +/ - debug(header1) { /+ writeln(line); +/ } - ++line_occur["header_make"]; - an_object["body_nugget"] ~= line ~= "\n"; - } - } else if (type["header_meta"] == State.on - && (line_occur["header_meta"] > State.off)) { /+ header_metadata flag set +/ - if (line.matchFirst(rgx.native_header_sub)) { /+ sub-header +/ - debug(header1) { /+ writeln(line); +/ } - ++line_occur["header_meta"]; - an_object["body_nugget"] ~= line ~= "\n"; - } - } - return an_object; - } - auto header_reset_states_common(Lo,O,T)( - return ref Lo line_occur, - return ref O an_object, - return ref T type - ) { - debug(asserts){ - static assert(is(typeof(line_occur) == int[string])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(type) == int[string])); - } - line_occur["header_make"] = State.off; - line_occur["header_meta"] = State.off; - type["header"] = State.off; - an_object.remove("body_nugget"); - an_object.remove("is"); - an_object.remove("attrib"); - } - private auto headerNativeToAA(Hn)(Hn src_header) { - debug(asserts){ - static assert(is(typeof(src_header) == char[])); - } - auto type = flags_type_init; - type = [ - "header" : State.off, - "header_make" : State.off, - "header_meta" : State.off, - ]; - string[string] an_object; - int[string] line_occur; - auto dochead_make = conf_aa_empty; - auto dochead_meta = meta_aa_empty; - auto set_header = HeaderDocMetadataAndMakeNativeToAA(); - char[][] source_header_arr = - (cast(char[]) src_header).split(rgx.newline_eol_delimiter); - foreach(header_line; source_header_arr) { - if (auto m = header_line.matchFirst(rgx.comment)) { - /+ matched comment +/ - debug(comment) { - } - header_reset_states_common(line_occur, an_object, type); - } else if ((header_line.matchFirst(rgx.native_header)) - || (type["header_make"] == State.on - && (line_occur["header_make"] > State.off)) - || (type["header_meta"] == State.on - && (line_occur["header_meta"] > State.off))) { - if (header_line.length == 0) { - /+ header_make instructions (current line empty) +/ - auto dochead_metadata_and_make = - set_header.header_metadata_and_make_aa(strip(an_object["body_nugget"]), dochead_meta, dochead_make); - static assert(!isTypeTuple!(dochead_metadata_and_make)); - dochead_meta = dochead_metadata_and_make[0]; - dochead_make = dochead_metadata_and_make[1]; - header_reset_states_common(line_occur, an_object, type); - type["header_make"] = State.off; - type["header_meta"] = State.off; - debug(headersdlang) { - writeln(dochead_metadata_and_make); - } - } else { - an_object = native_header_extract(header_line, line_occur, an_object, type); - } - } - } - auto t = tuple( - dochead_make, - dochead_meta, - ); - return t; - } - } -} diff --git a/src/sdp/meta/conf_make_meta_sdlang.d b/src/sdp/meta/conf_make_meta_sdlang.d index 480a8fe..2bded69 100644 --- a/src/sdp/meta/conf_make_meta_sdlang.d +++ b/src/sdp/meta/conf_make_meta_sdlang.d @@ -3,7 +3,7 @@ extract sdlang header return sdlang +/ module sdp.meta.conf_make_meta_sdlang; -template SiSUextractSDLang() { +static template SiSUextractSDLang() { import std.exception, std.regex, @@ -69,87 +69,162 @@ template SiSUextractSDLang() { } return sdl_root_header; // sdlang.ast.Tag } - private auto sdlangToAA(C,Tag)(C conf, Tag conf_sdlang) { - debug(asserts){ - static assert(is(typeof(conf) == string[string][string])); - } - foreach (maintag, subtags; conf) { - /+ writeln(__LINE__, ": ", maintag, ":- ", subtags); +/ - foreach (subtag, content; subtags) { - if (maintag in conf_sdlang.maybe.tags) { - Tag _maintag = conf_sdlang.getTag(maintag); - if ((subtag in _maintag.maybe.tags) - && (_maintag.getTagValues(subtag).length > 0)) { - debug(headersdlang) { - writeln(__LINE__, ": ", maintag, ":", subtag, ": ", _maintag.getTagValues(subtag)[0]); - } - if (_maintag.getTagValues(subtag).length == 1) { - conf[maintag][subtag] = - (_maintag.getTagValues(subtag)[0]).to!string; - } else if (_maintag.getTagValues(subtag).length > 1) { - foreach (st; _maintag.getTagValues(subtag)) { - conf[maintag][subtag] ~= - st.to!string ~ ";"; - } - } - } else if ((subtag in _maintag.maybe.attributes) - && (_maintag.maybe.attributes[subtag][0].value.length > 0)) { - debug(headersdlang) { - writeln(__LINE__, ": ", maintag, ":", subtag, ": ", conf_sdlang.tags[maintag][0].attributes[subtag][0].value); - } - conf[maintag][subtag] = - (conf_sdlang.tags[maintag][0].attributes[subtag][0].value).to!string; - } - } - } + private auto docSDLtoStruct(C,Tag)(C _conf_composite, Tag header_sdlang) { + mixin SiSUregisters; + /+ make +/ + if ("make" in header_sdlang.maybe.tags) { + _conf_composite.make_str.bold = _conf_composite.make.bold = extractSDLangTabOrAttrib(header_sdlang, "make", "bold"); + _conf_composite.make_str.breaks = _conf_composite.make.breaks = extractSDLangTabOrAttrib(header_sdlang, "make", "breaks"); + _conf_composite.make_str.cover_image = _conf_composite.make.cover_image = extractSDLangTabOrAttrib(header_sdlang, "make", "cover_image"); + _conf_composite.make_str.css = _conf_composite.make.css = extractSDLangTabOrAttrib(header_sdlang, "make", "css"); + _conf_composite.make_str.emphasis = _conf_composite.make.emphasis = extractSDLangTabOrAttrib(header_sdlang, "make", "emphasis"); + _conf_composite.make_str.footer = _conf_composite.make.footer = extractSDLangTabOrAttrib(header_sdlang, "make", "footer"); + _conf_composite.make_str.headings = _conf_composite.make.headings = extractSDLangTabOrAttrib(header_sdlang, "make", "headings"); + _conf_composite.make_str.home_button_image = _conf_composite.make.home_button_image = extractSDLangTabOrAttrib(header_sdlang, "make", "home_button_image"); + _conf_composite.make_str.home_button_text = _conf_composite.make.home_button_text = extractSDLangTabOrAttrib(header_sdlang, "make", "home_button_text"); + _conf_composite.make_str.italics = _conf_composite.make.italics = extractSDLangTabOrAttrib(header_sdlang, "make", "italics"); + _conf_composite.make_str.num_top = _conf_composite.make.num_top = extractSDLangTabOrAttrib(header_sdlang, "make", "num_top"); + _conf_composite.make_str.num_depth = _conf_composite.make.num_depth = extractSDLangTabOrAttrib(header_sdlang, "make", "num_depth"); + _conf_composite.make_str.substitute = _conf_composite.make.substitute = extractSDLangTabOrAttrib(header_sdlang, "make", "substitute"); + _conf_composite.make_str.texpdf_font = _conf_composite.make.texpdf_font = extractSDLangTabOrAttrib(header_sdlang, "make", "texpdf_font"); } - return conf; - } - private auto docHeaderSDLtoAA(Ma, Tag)(Ma dochead_make, Tag header_sdlang) { - debug(asserts){ - static assert(is(typeof(dochead_make) == string[string][string])); + /+ conf +/ + if ("webserv" in header_sdlang.maybe.tags) { + _conf_composite.conf.webserv_url_root = extractSDLangTabOrAttrib(header_sdlang, "webserv", "url_root"); + _conf_composite.conf.webserv_path = extractSDLangTabOrAttrib(header_sdlang, "webserv", "path"); + _conf_composite.conf.webserv_images = extractSDLangTabOrAttrib(header_sdlang, "webserv", "images"); + _conf_composite.conf.webserv_cgi = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi"); + _conf_composite.conf.webserv_cgi_host = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi_host"); + _conf_composite.conf.webserv_cgi_host_path = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi_host_path"); + _conf_composite.conf.webserv_cgi_port = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi_port"); + _conf_composite.conf.webserv_cgi_user = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi_user"); + _conf_composite.conf.webserv_cgi_file_links = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi_file_links"); + } + if ("processing" in header_sdlang.maybe.tags) { + _conf_composite.conf.processing_path = extractSDLangTabOrAttrib(header_sdlang, "webserv", "processing_path"); + _conf_composite.conf.processing_dir = extractSDLangTabOrAttrib(header_sdlang, "webserv", "processing_dir"); + _conf_composite.conf.processing_concord_max = extractSDLangTabOrAttrib(header_sdlang, "webserv", "processing_concord_max"); + } + if("flag" in header_sdlang.maybe.tags) { + _conf_composite.conf.flag_act0 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act0"); + _conf_composite.conf.flag_act1 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act1"); + _conf_composite.conf.flag_act2 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act2"); + _conf_composite.conf.flag_act3 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act3"); + _conf_composite.conf.flag_act4 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act4"); + _conf_composite.conf.flag_act5 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act5"); + _conf_composite.conf.flag_act6 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act6"); + _conf_composite.conf.flag_act7 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act7"); + _conf_composite.conf.flag_act8 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act8"); + _conf_composite.conf.flag_act9 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act9"); + } + if ("default" in header_sdlang.maybe.tags) { + _conf_composite.conf.default_papersize = extractSDLangTabOrAttrib(header_sdlang, "default", "papersize"); + _conf_composite.conf.default_text_wrap = extractSDLangTabOrAttrib(header_sdlang, "default", "text_wrap"); + _conf_composite.conf.default_emphasis = extractSDLangTabOrAttrib(header_sdlang, "default", "emphasis"); + _conf_composite.conf.default_language = extractSDLangTabOrAttrib(header_sdlang, "default", "language"); + _conf_composite.conf.default_digest = extractSDLangTabOrAttrib(header_sdlang, "default", "digest"); + } + if ("search" in header_sdlang.maybe.tags) { + _conf_composite.conf.search_flag = extractSDLangTabOrAttrib(header_sdlang, "search", "flag"); + _conf_composite.conf.search_action = extractSDLangTabOrAttrib(header_sdlang, "search", "action"); + _conf_composite.conf.search_db = extractSDLangTabOrAttrib(header_sdlang, "search", "db"); + _conf_composite.conf.search_title = extractSDLangTabOrAttrib(header_sdlang, "search", "title"); + } + /+ meta +/ + if ("classify" in header_sdlang.maybe.tags) { + _conf_composite.meta.classify_dewey = extractSDLangTabOrAttrib(header_sdlang, "classify", "dewey"); + _conf_composite.meta.classify_keywords = extractSDLangTabOrAttrib(header_sdlang, "classify", "keywords"); + _conf_composite.meta.classify_loc = extractSDLangTabOrAttrib(header_sdlang, "classify", "loc"); + _conf_composite.meta.classify_subject = extractSDLangTabOrAttrib(header_sdlang, "classify", "subject"); + _conf_composite.meta.classify_topic_register = extractSDLangTabOrAttrib(header_sdlang, "classify", "topic_register"); + } + if ("date" in header_sdlang.maybe.tags) { + _conf_composite.meta.date_added_to_site = extractSDLangTabOrAttrib(header_sdlang, "date", "added_to_site"); + _conf_composite.meta.date_available = extractSDLangTabOrAttrib(header_sdlang, "date", "available"); + _conf_composite.meta.date_created = extractSDLangTabOrAttrib(header_sdlang, "date", "created"); + _conf_composite.meta.date_issued = extractSDLangTabOrAttrib(header_sdlang, "date", "issued"); + _conf_composite.meta.date_modified = extractSDLangTabOrAttrib(header_sdlang, "date", "modified"); + _conf_composite.meta.date_published = extractSDLangTabOrAttrib(header_sdlang, "date", "published"); + _conf_composite.meta.date_valid = extractSDLangTabOrAttrib(header_sdlang, "date", "valid"); + } + if("identifier" in header_sdlang.maybe.tags) { + _conf_composite.meta.identifier_isbn = extractSDLangTabOrAttrib(header_sdlang, "identifier", "isbn"); + _conf_composite.meta.identifier_oclc = extractSDLangTabOrAttrib(header_sdlang, "identifier", "oclc"); + _conf_composite.meta.identifier_pg = extractSDLangTabOrAttrib(header_sdlang, "identifier", "pg"); + } + if ("links" in header_sdlang.maybe.tags) { + // _conf_composite.meta.links = extractSDLangTabOrAttrib(header_sdlang, "links", ""); } - dochead_make = sdlangToAA(dochead_make, header_sdlang); - auto dochead_meta = sdlangToAA(meta_aa_empty, header_sdlang); - if (dochead_meta["title"]["main"].empty) { - { + if ("notes" in header_sdlang.maybe.tags) { + _conf_composite.meta.notes_abstract = extractSDLangTabOrAttrib(header_sdlang, "notes", "abstract"); + _conf_composite.meta.notes_description = extractSDLangTabOrAttrib(header_sdlang, "notes", "description"); + } + if ("original" in header_sdlang.maybe.tags) { + _conf_composite.meta.original_language = extractSDLangTabOrAttrib(header_sdlang, "original", "language"); + _conf_composite.meta.original_source = extractSDLangTabOrAttrib(header_sdlang, "original", "source"); + _conf_composite.meta.original_title = extractSDLangTabOrAttrib(header_sdlang, "original", "title"); + } + if ("publisher" in header_sdlang.maybe.tags) { + // _conf_composite.meta.publisher = extractSDLangTabOrAttrib(header_sdlang, "publisher", ""); + } + if ("rights" in header_sdlang.maybe.tags) { + _conf_composite.meta.rights_copyright = extractSDLangTabOrAttrib(header_sdlang, "rights", "copyright"); + _conf_composite.meta.rights_cover = extractSDLangTabOrAttrib(header_sdlang, "rights", "cover"); + _conf_composite.meta.rights_illustrations = extractSDLangTabOrAttrib(header_sdlang, "rights", "illustrations"); + _conf_composite.meta.rights_license = extractSDLangTabOrAttrib(header_sdlang, "rights", "license"); + } + if (_conf_composite.meta.creator_author.empty) { + if ("creator" in header_sdlang.maybe.tags) { + _conf_composite.meta.creator_author = extractSDLangTabOrAttrib(header_sdlang, "creator", "author"); + _conf_composite.meta.creator_author_email = extractSDLangTabOrAttrib(header_sdlang, "creator", "author_email"); + _conf_composite.meta.creator_illustrator = extractSDLangTabOrAttrib(header_sdlang, "creator", "illustrator"); + _conf_composite.meta.creator_translator = extractSDLangTabOrAttrib(header_sdlang, "creator", "translator"); + } + // dochead_meta["creator"]["author_raw"] = dochead_meta["creator"]["author"]; + string[] authors_arr; + auto authors_raw_arr = _conf_composite.meta.creator_author.split(rgx.arr_delimiter); + foreach (author_raw; authors_raw_arr) { + authors_arr ~= author_raw.replace(rgx.raw_author_munge, "$2 $1"); + } + _conf_composite.meta.creator_author = join(authors_arr, ", ").chomp.chomp; + } + if (_conf_composite.meta.title_main.empty) { + if ("title" in header_sdlang.maybe.tags) { + _conf_composite.meta.title_edition = extractSDLangTabOrAttrib(header_sdlang, "title", "edition"); + _conf_composite.meta.title_language = extractSDLangTabOrAttrib(header_sdlang, "title", "language"); + _conf_composite.meta.title_main = extractSDLangTabOrAttrib(header_sdlang, "title", "main"); + _conf_composite.meta.title_note = extractSDLangTabOrAttrib(header_sdlang, "title", "note"); + _conf_composite.meta.title_sub = extractSDLangTabOrAttrib(header_sdlang, "title", "sub"); + _conf_composite.meta.title_subtitle = extractSDLangTabOrAttrib(header_sdlang, "title", "subtitle"); + } + if (_conf_composite.meta.title_main.empty) { Tag _maintag = header_sdlang.getTag("title"); if (_maintag !is null) { if ("main" in _maintag.maybe.tags) { - dochead_meta["title"]["main"] = + _conf_composite.meta.title_main = to!string(_maintag.getTagValues("main")); } else if ("main" !in _maintag.maybe.attributes) { writeln(__LINE__, ": ", _maintag.values[0]); - dochead_meta["title"]["main"] = + _conf_composite.meta.title_main = (_maintag.values[0]).to!string; // test that this exists } } } + if ((!(_conf_composite.meta.title_subtitle.empty)) + && (_conf_composite.meta.title_sub.empty)) { + _conf_composite.meta.title_sub = _conf_composite.meta.title_subtitle; + } + if (_conf_composite.meta.title_sub.empty) { + _conf_composite.meta.title_full = _conf_composite.meta.title_main; + } else { + _conf_composite.meta.title_full = format( + "%s - %s", + _conf_composite.meta.title_main, + _conf_composite.meta.title_sub, + ); + } } - if (!(dochead_meta["title"]["subtitle"].empty) - && (dochead_meta["title"]["sub"].empty)) { - dochead_meta["title"]["sub"] ~= dochead_meta["title"]["subtitle"]; - } - dochead_meta["title"].remove("subtitle"); - if (dochead_meta["title"]["sub"].empty) { - dochead_meta["title"]["full"] ~= dochead_meta["title"]["main"]; - } else { - dochead_meta["title"]["full"] ~= format( - "%s - %s", - dochead_meta["title"]["main"], - dochead_meta["title"]["sub"], - ); - } - dochead_meta["creator"]["author_raw"] = dochead_meta["creator"]["author"]; - string[] authors_arr; - auto authors_raw_arr = dochead_meta["creator"]["author"].split(rgx.arr_delimiter); - foreach (author_raw; authors_raw_arr) { - authors_arr ~= author_raw.replace(rgx.raw_author_munge, "$2 $1"); - } - dochead_meta["creator"]["author"] = join(authors_arr, ", ").chomp.chomp; - auto t = tuple(dochead_make, dochead_meta); - static assert(t.length==2); - return t; + return _conf_composite; } } } diff --git a/src/sdp/meta/defaults.d b/src/sdp/meta/defaults.d index 4880f5b..ede1523 100644 --- a/src/sdp/meta/defaults.d +++ b/src/sdp/meta/defaults.d @@ -22,142 +22,151 @@ template SiSUregisters() { std.uni, std.utf, std.conv : to; - static string[string][string] conf_aa_empty() { - auto conf_ = [ - "webserv": [ - "url_root" : "", - "path" : "~/sdp_www" , - "images" : "" , - "cgi" : "/usr/local/lib/sdp-cgi" - ], - "webserv_cgi": [ - "host" : "localhost", - "base_path" : "", - "port" : "8081", - "user" : "", - "file_links" : "www.sisudoc.org" - ], - "processing": [ - "path" : "~", - "dir" : "_sisu_processing", - "concord_max" : "400000" - ], - "flag": [ - "act0" : "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite --manifest --verbose", - "act1" : "--digest --text --html --manifest", - "act2" : "--digest --text --html --epub --pdf --manifest", - "act3" : "--digest --qrcode --text --html --epub --concordance --pdf --manifest", - "act4" : "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --manifest", - "act5" : "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --sqlite --manifest", - "act6" : "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite --manifest", - "act7" : "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite --source --sisupod --manifest", - "act8" : "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --pg --update --manifest", - "act9" : "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --pg --update --source --sisupod --manifest" - ], - "default": [ - "papersize" : "a4,letter", - "text_wrap" : "78", - "emphasis" : "bold", - "language" : "en", - "digest" : "sha256" - ], - "permission": [ - "share_source" : "" - ], - "program_select": [ - "editor" : "vim", - "epub_viewer" : "ebook-viewer", - "html_viewer" : "xombrero", - "odf_viewer" : "lowriter", - "pdf_viewer" : "evince", - "xml_viewer" : "xml-viewer" - ], - "search": [ - "flag" : "", - "action" : "", - "db" : "", - "title" : "" - ], - "make": [ - "bold" : "", - "breaks" : "", - "cover_image" : "", - "css" : "", - "emphasis" : "", - "footer" : "", - "headings" : "", - "home_button_image" : "", - "home_button_text" : "", - "italics" : "", - "num_top" : "", - "num_depth" : "", - "substitute" : "", - "texpdf_font" : "" - ], - ]; - return conf_; + struct ConfCompositeMake { + string bold = ""; + string breaks = ""; + string cover_image = ""; + string css = ""; + string emphasis = ""; + string footer = ""; + string headings = ""; + string home_button_image = ""; + string home_button_text = ""; + string italics = ""; + string num_top = ""; + string num_depth = ""; + string substitute = ""; + string texpdf_font = ""; } - static string[string][string] meta_aa_empty() { - auto meta_ = [ - "classify": [ - "dewey" : "", - "keywords" : "", - "loc" : "", - "subject" : "", - "topic_register" : "" - ], - "creator": [ - "author" : "", - "author_email" : "", - "illustrator" : "", - "translator" : "" - ], - "date": [ - "added_to_site" : "", - "available" : "", - "created" : "", - "issued" : "", - "modified" : "", - "published" : "", - "valid" : "" - ], - "identifier": [ - "isbn" : "", - "oclc" : "", - "pg" : "" - ], - "links": [ - "link" : "" - ], - "notes": [ - "abstract" : "", - "description" : "" - ], - "original": [ - "language" : "", - "source" : "", - "title" : "" - ], - "publisher": [ - "name" : "" - ], - "rights": [ - "copyright" : "", - "cover" : "", - "illustrations" : "", - "license" : "" - ], - "title": [ - "edition" : "", - "full" : "", - "language" : "", - "main" : "", - "note" : "", - "sub" : "", - "subtitle" : "" - ] - ]; - return meta_; + struct ConfCompositeMakeStr { + string bold = ""; + string breaks = ""; + string cover_image = ""; + string css = ""; + string emphasis = ""; + string footer = ""; + string headings = ""; + string home_button_image = ""; + string home_button_text = ""; + string italics = ""; + string num_top = ""; + string num_depth = ""; + string substitute = ""; + string texpdf_font = ""; + } + struct ConfCompositeSiteLocal { + string webserv_url_root = ""; + string webserv_path = ""; + string webserv_images = ""; + string webserv_cgi = ""; + string webserv_cgi_host = ""; + string webserv_cgi_host_path = ""; + string webserv_cgi_port = ""; + string webserv_cgi_user = ""; + string webserv_cgi_file_links = ""; + string processing_path = ""; + string processing_dir = ""; + string processing_concord_max = ""; + string flag_act0 = ""; + string flag_act1 = ""; + string flag_act2 = ""; + string flag_act3 = ""; + string flag_act4 = ""; + string flag_act5 = ""; + string flag_act6 = ""; + string flag_act7 = ""; + string flag_act8 = ""; + string flag_act9 = ""; + string default_papersize = ""; + string default_text_wrap = ""; + string default_emphasis = ""; + string default_language = ""; + string default_digest = ""; + string permission_share_source = ""; + string search_flag = ""; + string search_action = ""; + string search_db = ""; + string search_title = ""; + } + struct MetaComposite { + string classify_dewey = ""; + string classify_keywords = ""; + string classify_loc = ""; + string classify_subject = ""; + string classify_topic_register = ""; + string creator_author = ""; + string creator_author_email = ""; + string creator_illustrator = ""; + string creator_translator = ""; + string date_added_to_site = ""; + string date_available = ""; + string date_created = ""; + string date_issued = ""; + string date_modified = ""; + string date_published = ""; + string date_valid = ""; + string identifier_isbn = ""; + string identifier_oclc = ""; + string identifier_pg = ""; + string links = ""; + string notes_abstract = ""; + string notes_description = ""; + string original_language = ""; + string original_source = ""; + string original_title = ""; + string publisher = ""; + string rights_copyright = ""; + string rights_cover = ""; + string rights_illustrations = ""; + string rights_license = ""; + string title_edition = ""; + string title_full = ""; + string title_language = ""; + string title_main = ""; + string title_note = ""; + string title_sub = ""; + string title_subtitle = ""; + } + struct ConfComposite { + MetaComposite meta; + ConfCompositeMake make; + ConfCompositeSiteLocal conf; + } + struct ConfCompositePlus { + MetaComposite meta; + ConfCompositeMake make; + ConfCompositeMakeStr make_str; + ConfCompositeSiteLocal conf; + } + string extractSDLangTabOrAttrib(S)(S conf_sdlang, string maintab, string atab) { + string _conf_composite_string = ""; + if (maintab in conf_sdlang.maybe.tags) { + auto _maintag = conf_sdlang.getTag(maintab); + if ((atab in _maintag.maybe.tags) + && (_maintag.getTagValues(atab).length > 0)) { + debug(configsdlang) { + writeln(__LINE__, ": make:", atab, ": ", _maintag.getTagValues(atab)[0]); + } + if (_maintag.getTagValues(atab).length == 1) { + writeln((_maintag.getTagValues(atab)[0]).to!string); + _conf_composite_string = (_maintag.getTagValues(atab)[0]).to!string; + } else if (_maintag.getTagValues(atab).length > 1) { + string _tmp = ""; + foreach (st; _maintag.getTagValues(atab)) { + writeln(st.to!string, ";"); + _tmp ~= st.to!string ~ ";"; + } + _conf_composite_string = _tmp; + } + } else if ((atab in _maintag.maybe.attributes) + && (_maintag.maybe.attributes[atab][0].value.length > 0)) { + debug(configsdlang) { + writeln(__LINE__, ": make:", atab, ": ", conf_sdlang.tags[maintag][0].attributes[atab][0].value); + } + _conf_composite_string = (_maintag.attributes[atab][0].value).to!string; + } + } + return _conf_composite_string; } static auto ptr_head_main = [ diff --git a/src/sdp/meta/doc_debugs.d b/src/sdp/meta/doc_debugs.d index ae9d94d..e8ed3e3 100644 --- a/src/sdp/meta/doc_debugs.d +++ b/src/sdp/meta/doc_debugs.d @@ -250,19 +250,19 @@ template SiSUdebugs() { writefln( "%s\n%s\n%s", "document header, metadata & make instructions:", - doc_matters.dochead_meta, + doc_matters.conf_make_meta.meta, ptr_head_main, ); foreach (main_header; ptr_head_main) { switch (main_header) { case "make": foreach (sub_header; ptr_head_sub_make) { - if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { + if (doc_matters.conf_make_meta.meta.title_full.to!string.length > 2) { writefln( "%s:%s: %s", main_header, sub_header, - doc_matters.dochead_meta[main_header][sub_header] + doc_matters.conf_make_meta.meta.title_full ); } } @@ -276,115 +276,115 @@ template SiSUdebugs() { writefln( "%s\n%s\n%s", "document header, metadata & make instructions:", - doc_matters.dochead_meta, + doc_matters.conf_make_meta.meta, ptr_head_main, ); foreach (main_header; ptr_head_main) { switch (main_header) { case "creator": foreach (sub_header; ptr_head_sub_creator) { - if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { + if (doc_matters.conf_make_meta.meta.title_full.to!string.length > 2) { writefln( "%s:%s: %s", main_header, sub_header, - doc_matters.dochead_meta[main_header][sub_header] + doc_matters.conf_make_meta.meta.title_full, ); } } break; case "title": foreach (sub_header; ptr_head_sub_title) { - if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { + if (doc_matters.conf_make_meta.meta.title_full.to!string.length > 2) { writefln( "%s:%s: %s", main_header, sub_header, - doc_matters.dochead_meta[main_header][sub_header] + doc_matters.conf_make_meta.meta.title_full ); } } break; case "rights": foreach (sub_header; ptr_head_sub_rights) { - if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { + if (doc_matters.conf_make_meta.meta.title_full.to!string.length > 2) { writefln( "%s:%s: %s", main_header, sub_header, - doc_matters.dochead_meta[main_header][sub_header] + doc_matters.conf_make_meta.meta.title_full ); } } break; case "date": foreach (sub_header; ptr_head_sub_date) { - if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { + if (doc_matters.conf_make_meta.meta.title_full.to!string.length > 2) { writefln( "%s:%s: %s", main_header, sub_header, - doc_matters.dochead_meta[main_header][sub_header] + doc_matters.conf_make_meta.meta.title_full ); } } break; case "original": foreach (sub_header; ptr_head_sub_original) { - if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { + if (doc_matters.conf_make_meta.meta.title_full.to!string.length > 2) { writefln( "%s:%s: %s", main_header, sub_header, - doc_matters.dochead_meta[main_header][sub_header] + doc_matters.conf_make_meta.meta.title_full ); } } break; case "classify": foreach (sub_header; ptr_head_sub_classify) { - if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { + if (doc_matters.conf_make_meta.meta.title_full.to!string.length > 2) { writefln( "%s:%s: %s", main_header, sub_header, - doc_matters.dochead_meta[main_header][sub_header] + doc_matters.conf_make_meta.meta.title_full ); } } break; case "identifier": foreach (sub_header; ptr_head_sub_identifier) { - if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { + if (doc_matters.conf_make_meta.meta.title_full.to!string.length > 2) { writefln( "%s:%s: %s", main_header, sub_header, - doc_matters.dochead_meta[main_header][sub_header] + doc_matters.conf_make_meta.meta.title_full ); } } break; case "notes": foreach (sub_header; ptr_head_sub_notes) { - if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { + if (doc_matters.conf_make_meta.meta.title_full.to!string.length > 2) { writefln( "%s:%s: %s", main_header, sub_header, - doc_matters.dochead_meta[main_header][sub_header] + doc_matters.conf_make_meta.meta.title_full ); } } break; case "publisher": foreach (sub_header; ptr_head_sub_publisher) { - if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { + if (doc_matters.conf_make_meta.meta.title_full.to!string.length > 2) { writefln( "%s:%s: %s", main_header, sub_header, - doc_matters.dochead_meta[main_header][sub_header] + doc_matters.conf_make_meta.meta.title_full ); } } diff --git a/src/sdp/meta/metadoc.d b/src/sdp/meta/metadoc.d index d563dfc..e302db8 100644 --- a/src/sdp/meta/metadoc.d +++ b/src/sdp/meta/metadoc.d @@ -1,6 +1,5 @@ module sdp.meta.metadoc; template SiSUabstraction() { - /+ sdp: sisu document parser, see http://sisudoc.org +/ import sdp.meta; import std.getopt, @@ -8,10 +7,10 @@ template SiSUabstraction() { import sdp.meta.metadoc_summary, sdp.meta.metadoc_from_src, - sdp.meta.composite_make, sdp.meta.conf_make_meta, // sdp.meta.conf_make_meta_native, sdp.meta.conf_make_meta_sdlang, + sdp.meta.conf_make_meta_composite, sdp.meta.defaults, sdp.meta.doc_debugs, sdp.meta.read_config_files, @@ -30,11 +29,14 @@ template SiSUabstraction() { enum makeMeta { make, meta } enum docAbst { doc_abstraction, section_keys, segnames, segnames_0_4, images } static auto rgx = Rgx(); - auto SiSUabstraction(Fn,O,E)(Fn fn_src, O opts, E env){ + auto SiSUabstraction(Fn,O,E)( + Fn fn_src, + O opts, + E env, + ){ auto sdl_root_config_share = configRead!()("config_share", env); auto sdl_root_config_local = configRead!()("config_local", env); - auto conf_composite_static_aa = extractSDL().sdlangToAA(conf_aa_empty, sdl_root_config_share); - conf_composite_static_aa = extractSDL().sdlangToAA(conf_composite_static_aa, sdl_root_config_local); + auto conf_files_composite_make = confFilesSDLtoStruct!()(sdl_root_config_share, sdl_root_config_local); /+ ↓ read file (filename with path) +/ /+ ↓ file tuple of header and content +/ auto _header_body_inserts = @@ -47,26 +49,12 @@ template SiSUabstraction() { writeln(_header_body_inserts.length[headBody.body_content][0]); } /+ ↓ split header into make and meta +/ - auto _make_and_meta_tup = - docHeaderMakeAndMetaTupExtractAndConvertToAA!()(conf_composite_static_aa, _header_body_inserts[headBody.header]); - static assert(!isTypeTuple!(_make_and_meta_tup)); - static assert(_make_and_meta_tup.length==2); - auto _make_config = compositeMkCnf!()( - conf_composite_static_aa, - _make_and_meta_tup[makeMeta.make], - // opts, - ); - auto _make_and_conf_composite_static_plus_docheader_aa = compositeMkCnfAA!()( - conf_aa_empty, - conf_composite_static_aa, - _make_and_meta_tup[makeMeta.make], - opts, - ); + auto _make_and_meta_struct = + docHeaderMakeAndMetaTupExtractAndConvertToStruct!()(conf_files_composite_make, _header_body_inserts[headBody.header]); // breakage ... /+ ↓ document abstraction: process document, return abstraction as tuple +/ auto da = SiSUdocAbstraction!()( _header_body_inserts[headBody.body_content], - _make_and_meta_tup[makeMeta.make], - _make_and_meta_tup[makeMeta.meta], + _make_and_meta_struct, opts ); static assert(!isTypeTuple!(da)); @@ -90,12 +78,8 @@ template SiSUabstraction() { string[] _k = _doc_epub_segnames_0_4; return _k; } - auto dochead_meta() { - string[string][string] _k = _make_and_meta_tup[makeMeta.meta]; - return _k; - } - auto dochead_make() { - string[string][string] _k = _make_and_meta_tup[makeMeta.make]; + auto conf_make_meta() { + auto _k = _make_and_meta_struct; return _k; } auto source_filename() { diff --git a/src/sdp/meta/metadoc_from_src.d b/src/sdp/meta/metadoc_from_src.d index 732dbd0..b164a64 100644 --- a/src/sdp/meta/metadoc_from_src.d +++ b/src/sdp/meta/metadoc_from_src.d @@ -236,17 +236,14 @@ template SiSUdocAbstraction() { auto node_construct = NodeStructureMetadata(); enum sObj { content, anchor_tags, notes_reg, notes_star, links } /+ ↓ abstract marked up document +/ - auto SiSUdocAbstraction(Src,Make,Meta,Opt)( + auto SiSUdocAbstraction(Src,CMM,Opt)( Src markup_sourcefile_content, - Make dochead_make_aa, - Meta dochead_meta_aa, + CMM conf_make_meta, Opt opt_action, ) { static auto rgx = Rgx(); debug(asserts) { static assert(is(typeof(markup_sourcefile_content) == char[][])); - static assert(is(typeof(dochead_make_aa) == string[string][string])); - static assert(is(typeof(dochead_meta_aa) == string[string][string])); static assert(is(typeof(opt_action) == bool[string])); } /+ ↓ abstraction init +/ @@ -629,11 +626,11 @@ template SiSUdocAbstraction() { continue; } else if (obj_type_status["poem"] == TriState.on) { /+ within block object: poem +/ - _poem_block_(line, an_object, obj_type_status, cntr, obj_cite_number_poem, dochead_make_aa); + _poem_block_(line, an_object, obj_type_status, cntr, obj_cite_number_poem, conf_make_meta); continue; } else if (obj_type_status["table"] == TriState.on) { /+ within block object: table +/ - _table_block_(line, an_object, obj_type_status, dochead_make_aa); + _table_block_(line, an_object, obj_type_status, conf_make_meta); continue; } else { /+ not within a block group +/ @@ -706,10 +703,10 @@ template SiSUdocAbstraction() { && ((obj_type_status["para"] == State.off) && (obj_type_status["heading"] == State.off))) { /+ heading or para but neither flag nor line exists +/ - if ((dochead_make_aa["make"]["headings"].length > 2) + if ((conf_make_meta.make.headings.length > 2) && (obj_type_status["make_headings"] == State.off)) { /+ heading found +/ - _heading_found_(line, dochead_make_aa["make"]["headings"], heading_match_str, heading_match_rgx, obj_type_status); + _heading_found_(line, conf_make_meta.make.headings, heading_match_str, heading_match_rgx, obj_type_status); } if ((obj_type_status["make_headings"] == State.on) && ((line_occur["para"] == State.off) @@ -727,7 +724,7 @@ template SiSUdocAbstraction() { +/ if (line.matchFirst(rgx.heading)) { /+ heading match +/ - _heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, obj_type_status, dochead_meta_aa); + _heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, obj_type_status, conf_make_meta); } else if (line_occur["para"] == State.off) { /+ para match +/ an_object_key="body_nugget"; @@ -762,7 +759,7 @@ template SiSUdocAbstraction() { cntr, obj_type_status, obj_cite_number_poem, - dochead_make_aa + conf_make_meta, ); } else { /+ line.empty, post contents, empty variables: +/ @@ -784,7 +781,7 @@ template SiSUdocAbstraction() { an_object["is"] = "heading"; an_object_key="body_nugget"; auto substantive_object_and_anchor_tags_tuple = - obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[sObj.content]; anchor_tags = substantive_object_and_anchor_tags_tuple[sObj.anchor_tags]; if (an_object["lev_markup_number"].to!int == 4) { @@ -826,7 +823,7 @@ template SiSUdocAbstraction() { _anchor_tag=to!string(obj_cite_digits.on); the_table_of_contents_section = obj_im.table_of_contents_gather_headings( an_object, - dochead_make_aa, + conf_make_meta, segment_anchor_tag_that_object_belongs_to, _anchor_tag, lev4_subtoc, @@ -887,7 +884,7 @@ template SiSUdocAbstraction() { an_object["is"], ); auto substantive_obj_misc_tuple = - obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_para = comp_obj_para.init; @@ -2193,13 +2190,13 @@ template SiSUdocAbstraction() { } } } - void _poem_block_(L,O,T,C,N,Ma)( - L line, - return ref O an_object, - return ref T obj_type_status, - return ref C cntr, - N obj_cite_number_poem, - Ma dochead_make_aa, + void _poem_block_(L,O,T,C,N,CMM)( + L line, + return ref O an_object, + return ref T obj_type_status, + return ref C cntr, + N obj_cite_number_poem, + CMM conf_make_meta, ) { debug(asserts) { static assert(is(typeof(line) == char[])); @@ -2207,7 +2204,6 @@ template SiSUdocAbstraction() { static assert(is(typeof(obj_type_status) == int[string])); static assert(is(typeof(cntr) == int)); static assert(is(typeof(obj_cite_number_poem) == string[string])); - static assert(is(typeof(dochead_make_aa) == string[string][string])); } static auto rgx = Rgx(); if (obj_type_status["curly_poem"] == TriState.on) { @@ -2241,7 +2237,7 @@ template SiSUdocAbstraction() { } an_object["is"] = "verse"; auto substantive_obj_misc_tuple = - obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; @@ -2299,7 +2295,7 @@ template SiSUdocAbstraction() { an_object["is"] ); auto substantive_obj_misc_tuple = - obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; @@ -2342,7 +2338,7 @@ template SiSUdocAbstraction() { processing.remove("verse"); an_object["is"] = "verse"; auto substantive_obj_misc_tuple = - obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; @@ -2400,7 +2396,7 @@ template SiSUdocAbstraction() { an_object["is"] ); auto substantive_obj_misc_tuple = - obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; @@ -2472,11 +2468,11 @@ template SiSUdocAbstraction() { } } } - void _table_block_(L,O,T,Ma)( + void _table_block_(L,O,T,CMM)( L line, return ref O an_object, - return ref T obj_type_status, - return ref Ma dochead_make_aa + return ref T obj_type_status, + return ref CMM conf_make_meta, ) { debug(asserts) { static assert(is(typeof(line) == char[])); @@ -2511,7 +2507,7 @@ template SiSUdocAbstraction() { comp_obj_heading, cntr, obj_type_status, - dochead_make_aa + conf_make_meta, ); } else { debug(table) { @@ -2679,7 +2675,7 @@ template SiSUdocAbstraction() { header_tag_value=""; } } - void _table_closed_make_special_notation_table_(N)( + void _table_closed_make_special_notation_table_(N,CMM)( char[] line, return ref string[string] an_object, return ref ObjGenericComposite[] the_document_body_section, @@ -2687,7 +2683,7 @@ template SiSUdocAbstraction() { return ref ObjGenericComposite _comp_obj_heading, return ref int cntr, return ref int[string] obj_type_status, - string[string][string] dochead_make_aa, + CMM conf_make_meta ) { comp_obj_block = comp_obj_block.init; obj_cite_digits = ocn_emit(OCNstatus.on); @@ -2702,7 +2698,7 @@ template SiSUdocAbstraction() { ); an_object["is"] = "table"; auto substantive_obj_misc_tuple = - obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, "body_nugget", dochead_make_aa); + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, "body_nugget", conf_make_meta); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; comp_obj_block.ocn = obj_cite_digits.on; comp_obj_block.obj_cite_number = (obj_cite_digits.on==0) ? "" : obj_cite_digits.on.to!string; @@ -2716,7 +2712,7 @@ template SiSUdocAbstraction() { processing.remove("verse"); ++cntr; } - void _block_flag_line_empty_(B,N)( + void _block_flag_line_empty_(B,N,CMM)( B bookindex_extract_hash, char[] line, return ref string[string] an_object, @@ -2727,7 +2723,7 @@ template SiSUdocAbstraction() { return ref int cntr, return ref int[string] obj_type_status, string[string] obj_cite_number_poem, - string[string][string] dochead_make_aa, + CMM conf_make_meta, ) { assert( line.empty, @@ -2760,7 +2756,7 @@ template SiSUdocAbstraction() { an_object["is"] ); auto substantive_obj_misc_tuple = - obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; @@ -2804,7 +2800,7 @@ template SiSUdocAbstraction() { an_object["is"] ); auto substantive_obj_misc_tuple = - obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_block = comp_obj_block.init; @@ -2848,7 +2844,7 @@ template SiSUdocAbstraction() { an_object["is"] ); auto substantive_obj_misc_tuple = - obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; comp_obj_block = comp_obj_block.init; comp_obj_block.of_part = "body"; @@ -2926,7 +2922,7 @@ template SiSUdocAbstraction() { an_object["is"] ); auto substantive_obj_misc_tuple = - obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; comp_obj_code = comp_obj_code.init; @@ -2971,7 +2967,7 @@ template SiSUdocAbstraction() { an_object["is"] ); auto substantive_obj_misc_tuple = - obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); + obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; comp_obj_block = comp_obj_block.init; comp_obj_block.ocn = obj_cite_digits.on; @@ -3202,15 +3198,15 @@ template SiSUdocAbstraction() { } return line; } - auto _heading_matched_(L,C,O,K,Lv,Lc,T,Me)( - L line, - return ref C line_occur, - return ref O an_object, - return ref K an_object_key, - return ref Lv lv, - return ref Lc collapsed_lev, - return ref T obj_type_status, - return ref Me dochead_meta_aa, + auto _heading_matched_(L,C,O,K,Lv,Lc,T,CMM)( + L line, + return ref C line_occur, + return ref O an_object, + return ref K an_object_key, + return ref Lv lv, + return ref Lc collapsed_lev, + return ref T obj_type_status, + return ref CMM conf_make_meta, ) { debug(asserts) { static assert(is(typeof(line) == char[])); @@ -3220,7 +3216,6 @@ template SiSUdocAbstraction() { static assert(is(typeof(lv) == int[string])); static assert(is(typeof(collapsed_lev) == int[string])); static assert(is(typeof(obj_type_status) == int[string])); - static assert(is(typeof(dochead_meta_aa) == string[string][string])); } static auto rgx = Rgx(); if (auto m = line.match(rgx.heading)) { @@ -3240,9 +3235,9 @@ template SiSUdocAbstraction() { case "A": // Title set an_object[an_object_key]=(an_object[an_object_key]) .replaceFirst(rgx.variable_doc_title, - (dochead_meta_aa["title"]["full"] ~ ",")) + (conf_make_meta.meta.title_full ~ ",")) .replaceFirst(rgx.variable_doc_author, - dochead_meta_aa["creator"]["author"]); + conf_make_meta.meta.creator_author); collapsed_lev["h0"] = 0; an_object["lev_collapsed_number"] = collapsed_lev["h0"].to!string; @@ -3979,16 +3974,15 @@ template SiSUdocAbstraction() { static auto rgx = Rgx(); static auto munge = ObjInlineMarkupMunge(); string[string] obj_txt; - auto obj_inline_markup_and_anchor_tags_and_misc(O,K,Ma)( - O obj_, - K obj_key_, - Ma dochead_make_aa + auto obj_inline_markup_and_anchor_tags_and_misc(O,K,CMM)( + O obj_, + K obj_key_, + CMM conf_make_meta, ) in { debug(asserts) { static assert(is(typeof(obj_) == string[string])); static assert(is(typeof(obj_key_) == string)); - static assert(is(typeof(dochead_make_aa) == string[string][string])); } } body { @@ -4005,7 +3999,7 @@ template SiSUdocAbstraction() { switch (obj_["is"]) { case "heading": static __gshared string anchor_tag = ""; - obj_txt["munge"]=_configured_auto_heading_numbering_and_segment_anchor_tags(obj_txt["munge"], obj_, dochead_make_aa); + obj_txt["munge"]=_configured_auto_heading_numbering_and_segment_anchor_tags(obj_txt["munge"], obj_, conf_make_meta); obj_txt["munge"]=_make_segment_anchor_tags_if_none_provided(obj_txt["munge"], obj_["lev"]); if (auto m = obj_txt["munge"].match(rgx.heading_anchor_tag)) { anchor_tag = m.captures[1]; @@ -4075,9 +4069,9 @@ template SiSUdocAbstraction() { ""); return heading_toc_; }; - auto table_of_contents_gather_headings(O,Ma,Ts,Ta,X,Toc)( + auto table_of_contents_gather_headings(O,CMM,Ts,Ta,X,Toc)( O obj_, - Ma dochead_make_aa, + CMM conf_make_meta, Ts segment_anchor_tag_that_object_belongs_to, Ta _anchor_tag, return ref X lev4_subtoc, @@ -4086,7 +4080,6 @@ template SiSUdocAbstraction() { in { debug(asserts) { static assert(is(typeof(obj_) == string[string])); - static assert(is(typeof(dochead_make_aa) == string[string][string])); static assert(is(typeof(segment_anchor_tag_that_object_belongs_to) == string)); static assert(is(typeof(_anchor_tag) == string)); static assert(is(typeof(lev4_subtoc) == string[][string])); @@ -4247,17 +4240,16 @@ template SiSUdocAbstraction() { invariant() { } private: - static string _configured_auto_heading_numbering_and_segment_anchor_tags(M,O,Ma)( - M munge_, - O obj_, - Ma dochead_make_aa + static string _configured_auto_heading_numbering_and_segment_anchor_tags(M,O,CMM)( + M munge_, + O obj_, + CMM conf_make_meta, ) { debug(asserts) { static assert(is(typeof(munge_) == string)); static assert(is(typeof(obj_) == string[string])); - static assert(is(typeof(dochead_make_aa) == string[string][string])); } - if (dochead_make_aa["make"]["num_top"].length > 0) { + if (conf_make_meta.make.num_top.length > 0) { static __gshared int heading_num_top_level=9; static __gshared int heading_num_depth=2; static __gshared int heading_num_0 = 0; @@ -4266,10 +4258,10 @@ template SiSUdocAbstraction() { static __gshared int heading_num_3 = 0; static __gshared string heading_number_auto_composite = ""; if (heading_num_top_level==9) { - if (dochead_make_aa["make"]["num_depth"].length > 0) { - heading_num_depth = dochead_make_aa["make"]["num_depth"].to!uint; + if (conf_make_meta.make.num_depth.length > 0) { + heading_num_depth = conf_make_meta.make.num_depth.to!uint; } - switch (dochead_make_aa["make"]["num_top"]) { + switch (conf_make_meta.make.num_top) { case "A": break; case "B": diff --git a/src/sdp/meta/metadoc_summary.d b/src/sdp/meta/metadoc_summary.d index a415387..526c492 100644 --- a/src/sdp/meta/metadoc_summary.d +++ b/src/sdp/meta/metadoc_summary.d @@ -46,16 +46,16 @@ template SiSUabstractionSummary() { } } auto min_repeat_number = 66; - auto char_repeat_number = (doc_matters.dochead_meta["title"]["full"].length - + doc_matters.dochead_meta["creator"]["author"].length + 4); + auto char_repeat_number = (doc_matters.conf_make_meta.meta.title_full.length + + doc_matters.conf_make_meta.meta.creator_author.length + 4); char_repeat_number = (char_repeat_number > min_repeat_number) ? char_repeat_number : min_repeat_number; writefln( "%s\n\"%s\", %s\n%s\n%s\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n(%s: %s)\n%s", markup.repeat_character_by_number_provided("-", char_repeat_number), - doc_matters.dochead_meta["title"]["full"], - doc_matters.dochead_meta["creator"]["author"], + doc_matters.conf_make_meta.meta.title_full, + doc_matters.conf_make_meta.meta.creator_author, doc_matters.source_filename, markup.repeat_character_by_number_provided("-", char_repeat_number), "length toc arr:", diff --git a/src/sdp/meta/read_config_files.d b/src/sdp/meta/read_config_files.d index 2410316..012ccb6 100644 --- a/src/sdp/meta/read_config_files.d +++ b/src/sdp/meta/read_config_files.d @@ -4,16 +4,30 @@ meta_config_files.d +/ module sdp.meta.read_config_files; -template configIn() { +static template configIn() { import sdp.meta, std.file, std.path; final string configIn(C,E)(C conf_sdl, E env) { + /+ FIX clean up conf paths ↓ +/ + string sisudoc_conf_pwd = chainPath(to!string(env["pwd"]), "sisudoc/conf").array; + string sisudoc_conf_pwd_a = chainPath(to!string(env["pwd"]), "conf").array; + string sisudoc_conf_pwd_b = chainPath(to!string(env["pwd"]), "../conf").array; + string sisudoc_conf_pwd_c = chainPath(to!string(env["pwd"]), "../../conf").array; + string sisudoc_conf_pwd_d = chainPath(to!string(env["pwd"]), "../../../conf").array; + /+ FIX clean up conf paths ↑ + (compare pwd to doc path location, and build config path) + +/ string dot_pwd = chainPath(to!string(env["pwd"]), ".sisu").array; string underscore_pwd = chainPath(to!string(env["pwd"]), "_sisu").array; string dot_home = chainPath(to!string(env["home"]), ".sisu").array; string[] possible_config_path_locations = [ + sisudoc_conf_pwd, + sisudoc_conf_pwd_a, + sisudoc_conf_pwd_b, + sisudoc_conf_pwd_c, + sisudoc_conf_pwd_d, dot_pwd, underscore_pwd, dot_home, @@ -26,6 +40,9 @@ template configIn() { pth, conf_sdl, ); + if (config_file_str.length > 0) { + break; + } try { if (exists(conf_file)) { debug(configfile) { @@ -46,7 +63,7 @@ template configIn() { /+ +/ -template ConfigSDLang() { +static template ConfigSDLang() { import sdlang; import sdp.meta, @@ -66,7 +83,7 @@ template ConfigSDLang() { } /+ +/ -template configRead() { +static template configRead() { import sdp.meta, std.file, diff --git a/src/sdp/meta/read_source_files.d b/src/sdp/meta/read_source_files.d index 482b587..9700cb6 100644 --- a/src/sdp/meta/read_source_files.d +++ b/src/sdp/meta/read_source_files.d @@ -4,7 +4,7 @@ - if master file scan for addional files to import/insert +/ module sdp.meta.read_source_files; -template SiSUrawMarkupContent() { +static template SiSUrawMarkupContent() { import sdp.meta.rgx; import diff --git a/src/sdp/output/epub3.d b/src/sdp/output/epub3.d index abe8503..7851c09 100644 --- a/src/sdp/output/epub3.d +++ b/src/sdp/output/epub3.d @@ -62,19 +62,19 @@ template outputEPub3() { ¶", uuid, - xhtml_format.special_characters_text(doc_matters.dochead_meta["title"]["full"]), - xhtml_format.special_characters_text(doc_matters.dochead_meta["title"]["main"]), - (doc_matters.dochead_meta["title"]["sub"].empty) - ? "" : xhtml_format.special_characters_text(doc_matters.dochead_meta["title"]["sub"]), - (doc_matters.dochead_meta["creator"]["author"].empty) - ? "" : xhtml_format.special_characters_text(doc_matters.dochead_meta["creator"]["author"]), - (doc_matters.dochead_meta["creator"]["author"].empty) - ? "" : xhtml_format.special_characters_text(doc_matters.dochead_meta["creator"]["author"]), - doc_matters.language, - (doc_matters.dochead_meta["date"]["published"].empty) - ? "" : xhtml_format.special_characters_text(doc_matters.dochead_meta["date"]["published"]), - (doc_matters.dochead_meta["rights"]["copyright"].empty) - ? "" : xhtml_format.special_characters_text(doc_matters.dochead_meta["rights"]["copyright"]), + xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.title_full), + xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.title_main), + (doc_matters.conf_make_meta.meta.title_sub.empty) + ? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.title_sub), + (doc_matters.conf_make_meta.meta.creator_author.empty) + ? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.creator_author), + (doc_matters.conf_make_meta.meta.creator_author.empty) + ? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.creator_author), + doc_matters.language, // language, fix (needed in dochead metadata) + (doc_matters.conf_make_meta.meta.date_published.empty) + ? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.date_published), + (doc_matters.conf_make_meta.meta.rights_copyright.empty) + ? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright), uuid, uuid, uuid, @@ -142,7 +142,7 @@ template outputEPub3() {

Contents