From 0b484b0a1a6405a53616416aaaa6512a602b6072 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 15 Apr 2020 20:05:56 -0400 Subject: cli precedence over config file settings - cli precedence over config file settings - latex papersize settings sorted --- org/meta_conf_make_meta.org | 294 +++++++++++++++++---------- org/out_latex.org | 13 +- org/output_show.org | 20 +- org/spine.org | 33 +-- src/doc_reform/io_out/latex.d | 13 +- src/doc_reform/meta/conf_make_meta_json.d | 10 +- src/doc_reform/meta/conf_make_meta_structs.d | 100 ++++----- src/doc_reform/meta/conf_make_meta_yaml.d | 184 ++++++++++++----- src/doc_reform/meta/metadoc.d | 6 +- src/doc_reform/meta/metadoc_show_config.d | 20 +- src/doc_reform/spine.d | 28 +-- 11 files changed, 438 insertions(+), 283 deletions(-) diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org index 4a5e610..d80a270 100644 --- a/org/meta_conf_make_meta.org +++ b/org/meta_conf_make_meta.org @@ -251,56 +251,56 @@ struct ConfCompositeMakeInit { #+NAME: meta_defaults_template_structs #+BEGIN_SRC d struct ConfCompositeSiteLocal { - string w_srv_http; - string w_srv_domain; - string w_srv_data_http; // if not set same as webserv_http - string w_srv_data_domain; // if not set same as webserv_domain - string w_srv_data_root_part; - string w_srv_data_root_url; - string w_srv_data_root_url_html; - string w_srv_data_root_path; - string w_srv_images_root_part; - // string w_srv_url_doc_path; - string w_srv_cgi_title; - string w_srv_cgi_http; // if not set same as webserv_http - string w_srv_cgi_domain; // if not set same as webserv_domain - string w_srv_cgi_bin_part; - string w_srv_cgi_bin_path; - string w_srv_cgi_search_script; - string w_srv_cgi_search_script_raw_fn_d; - string w_srv_cgi_port; - string w_srv_cgi_user; - string w_srv_cgi_action; - string w_srv_cgi_bin_url; - string w_srv_db_sqlite; - // string w_srv_db_pg; - string w_srv_db_pg_table; - string w_srv_db_pg_user; - // string webserv_cgi_file_links; - string output_path; - 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; + string w_srv_http; + string w_srv_domain; + string w_srv_data_http; // if not set same as webserv_http + string w_srv_data_domain; // if not set same as webserv_domain + string w_srv_data_root_part; + string w_srv_data_root_url; + string w_srv_data_root_url_html; + string w_srv_data_root_path; + string w_srv_images_root_part; + // string w_srv_url_doc_path; + string w_srv_cgi_title; + string w_srv_cgi_http; // if not set same as webserv_http + string w_srv_cgi_domain; // if not set same as webserv_domain + string w_srv_cgi_bin_part; + string w_srv_cgi_bin_path; + string w_srv_cgi_search_script; + string w_srv_cgi_search_script_raw_fn_d; + string w_srv_cgi_port; + string w_srv_cgi_user; + string w_srv_cgi_action; + string w_srv_cgi_bin_url; + string w_srv_db_sqlite; + // string w_srv_db_pg; + string w_srv_db_pg_table; + string w_srv_db_pg_user; + // string webserv_cgi_file_links; + string output_path; + 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[] set_papersize; + string set_text_wrap; + string set_emphasis; + string set_language; + string set_digest; + string permission_share_source; + string search_flag; + string search_action; + string search_db; + string search_title; } #+END_SRC @@ -410,10 +410,11 @@ template contentYAMLtoSpineStruct() { doc_reform.meta.defaults, doc_reform.meta.rgx; ConfComposite _struct_composite; - @system auto contentYAMLtoSpineStruct(C,Y,M)( + @system auto contentYAMLtoSpineStruct(C,Y,M,O)( C _struct_composite, Y _yaml, M _manifested, + O _opt_action, string _identifier ) { mixin spineRgxIn; @@ -689,7 +690,9 @@ if ("webserv" in _yaml ) { _struct_composite.conf.w_srv_cgi_bin_path = _yaml["webserv"]["cgi_bin_path"].get!string; } - if ("cgi_search_script" in _yaml["webserv"] + if (_opt_action.cgi_sqlite_search_filename.length > 0) { + _struct_composite.conf.w_srv_cgi_search_script = _opt_action.cgi_sqlite_search_filename; + } else if ("cgi_search_script" in _yaml["webserv"] && _yaml["webserv"]["cgi_search_script"].type.string && _yaml["webserv"]["cgi_search_script"].tag.match(rgx.yaml_tag_is_str) ) { @@ -697,7 +700,9 @@ if ("webserv" in _yaml } else { _struct_composite.conf.w_srv_cgi_search_script = "spine-search"; } - if ("cgi_search_script_raw_fn_d" in _yaml["webserv"] + if (_opt_action.cgi_sqlite_search_filename_d.length > 0) { + _struct_composite.conf.w_srv_cgi_search_script_raw_fn_d = _opt_action.cgi_sqlite_search_filename_d; + } else if ("cgi_search_script_raw_fn_d" in _yaml["webserv"] && _yaml["webserv"]["cgi_search_script_raw_fn_d"].type.string && _yaml["webserv"]["cgi_search_script_raw_fn_d"].tag.match(rgx.yaml_tag_is_str) ) { @@ -722,13 +727,6 @@ if ("webserv" in _yaml ) { _struct_composite.conf.w_srv_cgi_user = _yaml["webserv"]["cgi_user"].get!string; } - if ("cgi_action" in _yaml["webserv"] - && _yaml["webserv"]["cgi_action"].type.string - && _yaml["webserv"]["cgi_action"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_cgi_action = _yaml["webserv"]["cgi_action"].get!string; - } else { // action is composite, build - } if ("cgi_bin_url" in _yaml["webserv"] && _yaml["webserv"]["cgi_bin_url"].type.string && _yaml["webserv"]["cgi_bin_url"].tag.match(rgx.yaml_tag_is_str) @@ -746,13 +744,24 @@ if ("webserv" in _yaml ~ "/" ~ _struct_composite.conf.w_srv_cgi_bin_part; } + if (_opt_action.cgi_sqlite_search_filename.length > 0) { + _struct_composite.conf.w_srv_cgi_action = _struct_composite.conf.w_srv_cgi_bin_url ~ "/" ~ _opt_action.cgi_sqlite_search_filename; + } else if ("cgi_action" in _yaml["webserv"] + && _yaml["webserv"]["cgi_action"].type.string + && _yaml["webserv"]["cgi_action"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_cgi_action = _yaml["webserv"]["cgi_action"].get!string; + } else { // action is composite, build + } // if ("cgi_file_links" in _yaml["webserv"] // && _yaml["webserv"]["cgi_file_links"].type.string // && _yaml["webserv"]["cgi_file_links"].tag.match(rgx.yaml_tag_is_str) // ) { // _struct_composite.conf.w_srv_cgi_file_links = _yaml["webserv"]["cgi_file_links"].get!string; // } - if ("db_sqlite" in _yaml["webserv"] + if (_opt_action.sqlite_filename.length > 0) { + _struct_composite.conf.w_srv_db_sqlite = _opt_action.sqlite_filename; + } else if ("db_sqlite" in _yaml["webserv"] && _yaml["webserv"]["db_sqlite"].type.string && _yaml["webserv"]["db_sqlite"].tag.match(rgx.yaml_tag_is_str) ) { @@ -764,7 +773,9 @@ if ("webserv" in _yaml if (!(_struct_composite.conf.output_path)) { _struct_composite.conf.output_path = ((_manifested.output.path).asNormalizedPath).array; } -if ("output" in _yaml +if (_opt_action.output_dir_set.length > 0) { + _struct_composite.conf.output_path = (_opt_action.output_dir_set.asNormalizedPath).array; +} else if ("output" in _yaml && _yaml["output"].type.sequence ) { if (_yaml["output"].type.mapping @@ -864,42 +875,113 @@ if ("flag" in _yaml } } } -if ("default" in _yaml +string[] selected_papersize(string _sizes_str) { + string[] _sizes = _sizes_str.split(regex(r"\s*,\s*")); + string[] _selected_sizes; + foreach (_size; _sizes) { + switch (_size) { + case "a4": + _selected_sizes ~= "a4.portrait"; + _selected_sizes ~= "a4.landscape"; + break; + case "a4.portrait": + _selected_sizes ~= _size; + break; + case "a4.landscape": + _selected_sizes ~= _size; + break; + case "a5": + _selected_sizes ~= "a5.portrait"; + _selected_sizes ~= "a5.landscape"; + break; + case "a5.portrait": + _selected_sizes ~= _size; + break; + case "a5.landscape": + _selected_sizes ~= _size; + break; + case "b4": + _selected_sizes ~= "b4.portrait"; + _selected_sizes ~= "b4.landscape"; + break; + case "b4.portrait": + _selected_sizes ~= _size; + break; + case "b4.landscape": + _selected_sizes ~= _size; + break; + case "letter": + _selected_sizes ~= "letter.portrait"; + _selected_sizes ~= "letter.landscape"; + break; + case "letter.portrait": + _selected_sizes ~= _size; + break; + case "letter.landscape": + _selected_sizes ~= _size; + break; + case "legal": + _selected_sizes ~= "legal.portrait"; + _selected_sizes ~= "legal.landscape"; + break; + case "legal.portrait": + _selected_sizes ~= _size; + break; + case "legal.landscape": + _selected_sizes ~= _size; + break; + default: break; + } + } + return _selected_sizes; +} +if (_opt_action.latex_papersize.length > 0) { + _struct_composite.conf.set_papersize = selected_papersize(_opt_action.latex_papersize); +} else if ( + "default" in _yaml && _yaml["default"].type.sequence + && _yaml["default"].type.mapping + && _yaml["default"].tag.match(rgx.yaml_tag_is_map) ) { - if (_yaml["default"].type.mapping - && _yaml["default"].tag.match(rgx.yaml_tag_is_map) + if ("papersize" in _yaml["default"] + && _yaml["default"]["papersize"].type.string + && _yaml["default"]["papersize"].tag.match(rgx.yaml_tag_is_str) ) { - if ("papersize" in _yaml["default"] - && _yaml["default"]["papersize"].type.string - && _yaml["default"]["papersize"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.default_papersize = _yaml["default"]["papersize"].get!string; - } - if ("text_wrap" in _yaml["default"] - && _yaml["default"]["text_wrap"].type.string - && _yaml["default"]["text_wrap"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.default_text_wrap = _yaml["default"]["text_wrap"].get!string; - } - if ("emphasis" in _yaml["default"] - && _yaml["default"]["emphasis"].type.string - && _yaml["default"]["emphasis"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.default_emphasis = _yaml["default"]["emphasis"].get!string; - } - if ("language" in _yaml["default"] - && _yaml["default"]["language"].type.string - && _yaml["default"]["language"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.default_language = _yaml["default"]["language"].get!string; - } - if ("digest" in _yaml["default"] - && _yaml["default"]["digest"].type.string - && _yaml["default"]["digest"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.default_digest = _yaml["default"]["digest"].get!string; - } + _struct_composite.conf.set_papersize = selected_papersize(_yaml["default"]["papersize"].get!string); + } +} +if (_struct_composite.conf.set_papersize.length == 0) { + _struct_composite.conf.set_papersize = ["a4.portrait", "a4.landscape"]; +} +if ( + "default" in _yaml + && _yaml["default"].type.sequence + && _yaml["default"].type.mapping + && _yaml["default"].tag.match(rgx.yaml_tag_is_map) +) { + if ("text_wrap" in _yaml["default"] + && _yaml["default"]["text_wrap"].type.string + && _yaml["default"]["text_wrap"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.set_text_wrap = _yaml["default"]["text_wrap"].get!string; + } + if ("emphasis" in _yaml["default"] + && _yaml["default"]["emphasis"].type.string + && _yaml["default"]["emphasis"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.set_emphasis = _yaml["default"]["emphasis"].get!string; + } + if ("language" in _yaml["default"] + && _yaml["default"]["language"].type.string + && _yaml["default"]["language"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.set_language = _yaml["default"]["language"].get!string; + } + if ("digest" in _yaml["default"] + && _yaml["default"]["digest"].type.string + && _yaml["default"]["digest"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.set_digest = _yaml["default"]["digest"].get!string; } } if ("search" in _yaml @@ -1652,27 +1734,27 @@ if ("default" in _json.object) { if ("papersize" in _json.object["default"] && (_json.object["default"]["papersize"].type().to!string == "string") ) { - _struct_composite.conf.default_papersize = _json.object["default"]["papersize"].str; + _struct_composite.conf.set_papersize = _json.object["default"]["papersize"].str; } if ("text_wrap" in _json.object["default"] && (_json.object["default"]["text_wrap"].type().to!string == "string") ) { - _struct_composite.conf.default_text_wrap = _json.object["default"]["text_wrap"].str; + _struct_composite.conf.set_text_wrap = _json.object["default"]["text_wrap"].str; } if ("emphasis" in _json.object["default"] && (_json.object["default"]["emphasis"].type().to!string == "string") ) { - _struct_composite.conf.default_emphasis = _json.object["default"]["emphasis"].str; + _struct_composite.conf.set_emphasis = _json.object["default"]["emphasis"].str; } if ("language" in _json.object["default"] && (_json.object["default"]["language"].type().to!string == "string") ) { - _struct_composite.conf.default_language = _json.object["default"]["language"].str; + _struct_composite.conf.set_language = _json.object["default"]["language"].str; } if ("digest" in _json.object["default"] && (_json.object["default"]["digest"].type().to!string == "string") ) { - _struct_composite.conf.default_digest = _json.object["default"]["digest"].str; + _struct_composite.conf.set_digest = _json.object["default"]["digest"].str; } } if ("search" in _json.object) { @@ -1988,17 +2070,18 @@ template configParseYAMLreturnSpineStruct() { doc_reform.meta.conf_make_meta_structs, doc_reform.meta.conf_make_meta_json; mixin contentYAMLtoSpineStruct; - @system auto configParseYAMLreturnSpineStruct(T,CCm,M)( + @system auto configParseYAMLreturnSpineStruct(T,CCm,M,O)( T _document_struct, CCm _make_and_meta_struct, - M _manifested + M _manifested, + O _opt_action ){ Node _yaml; if (_document_struct.content.length > 0) { try { _yaml = Loader.fromString(_document_struct.content).load(); _make_and_meta_struct - = contentYAMLtoSpineStruct!()(_make_and_meta_struct, _yaml, _manifested, _document_struct.filename); // struct from yaml + = contentYAMLtoSpineStruct!()(_make_and_meta_struct, _yaml, _manifested, _opt_action, _document_struct.filename); } catch { import std.stdio; writeln("ERROR failed to parse content as yaml: ", _document_struct.filename); @@ -2031,10 +2114,11 @@ template docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct() { mixin spineRgxIn; mixin contentJSONtoSpineStruct; static auto rgx = RgxI(); - @system auto docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct(CCm,Src,M)( + @system auto docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct(CCm,Src,M,O)( Src header_src, CCm _make_and_meta_struct, M _manifested, + O _opt_action, ) { Node _yaml; try { @@ -2042,7 +2126,7 @@ template docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct() { if (("title" in _yaml) && ("creator" in _yaml)) {} else { // need test for _yaml content (does not work) writeln("ERROR failed to read document header, yaml header does not contain essential information related to title and author"); } - return contentYAMLtoSpineStruct!()(_make_and_meta_struct, _yaml, _manifested, "header"); + return contentYAMLtoSpineStruct!()(_make_and_meta_struct, _yaml, _manifested, _opt_action, "header"); } catch { import std.stdio; writeln("ERROR failed to read document header, header not parsed as yaml: ", _manifested.src.filename); diff --git a/org/out_latex.org b/org/out_latex.org index 0955687..d1ad211 100644 --- a/org/out_latex.org +++ b/org/out_latex.org @@ -102,18 +102,7 @@ void outputLaTeX(D,M)( string tail; } auto latex = LaTeX(); - foreach (paper_size_orientation; [ - "a4.portrait", - "a4.landscape", - "letter.portrait", - "letter.landscape", - "a5.portrait", - "a5.landscape", - "b4.portrait", - "b4.landscape", - // "legal.portrait", - // "legal.landscape", - ]) { + foreach (paper_size_orientation; doc_matters.conf_make_meta.conf.set_papersize) { latex.head = latex_head(doc_matters, paper_size_orientation); latex.content = latex_body(doc_abstraction, doc_matters, paper_size_orientation); latex.tail = latex_tail(doc_matters, paper_size_orientation); diff --git a/org/output_show.org b/org/output_show.org index 0030b63..17b361a 100644 --- a/org/output_show.org +++ b/org/output_show.org @@ -199,15 +199,15 @@ writefln( // "- flag act0:", // config.conf.flag_act0, "- default papersize:", - config.conf.default_papersize, + config.conf.set_papersize, "- default text wrap:", - config.conf.default_text_wrap, + config.conf.set_text_wrap, "- default emphasis markup symbol:", - config.conf.default_emphasis, + config.conf.set_emphasis, "- default language:", - config.conf.default_language, + config.conf.set_language, "- default hash digest:", - config.conf.default_digest, + config.conf.set_digest, "- search flag:", config.conf.search_flag, "- search action:", @@ -292,15 +292,15 @@ writefln( // "- flag act0:", // doc_matters.conf_make_meta.conf.flag_act0, "- default papersize:", - doc_matters.conf_make_meta.conf.default_papersize, + doc_matters.conf_make_meta.conf.set_papersize, "- default text wrap:", - doc_matters.conf_make_meta.conf.default_text_wrap, + doc_matters.conf_make_meta.conf.set_text_wrap, "- default emphasis markup symbol:", - doc_matters.conf_make_meta.conf.default_emphasis, + doc_matters.conf_make_meta.conf.set_emphasis, "- default language:", - doc_matters.conf_make_meta.conf.default_language, + doc_matters.conf_make_meta.conf.set_language, "- default hash digest:", - doc_matters.conf_make_meta.conf.default_digest, + doc_matters.conf_make_meta.conf.set_digest, "- search flag:", doc_matters.conf_make_meta.conf.search_flag, "- search action:", diff --git a/org/spine.org b/org/spine.org index bd8437a..e5752ca 100644 --- a/org/spine.org +++ b/org/spine.org @@ -301,7 +301,6 @@ mixin CompileTimeInfo; #+NAME: spine_mixin #+BEGIN_SRC d mixin spineRgxIn; -mixin contentJSONtoSpineStruct; mixin spineBiblio; mixin spineRgxDocStructFlags; mixin outputHub; @@ -355,6 +354,7 @@ scope(failure) { #+BEGIN_SRC d bool[string] opts = [ "abstraction" : false, + "allow-downloads" : false, "assertions" : false, "cgi-search-form-codegen" : false, "concordance" : false, @@ -415,11 +415,13 @@ bool[string] opts = [ "workon" : false, ]; string[string] settings = [ - "cgi-sqlite-search-filename" : "", // "spine-search" + "cgi-sqlite-search-filename" : "", // config default: "spine-search" "config" : "", "output" : "", - "lang" : "all", - "sqlite-db-filename" : "", // "spine-search.db" + "lang" : "all", // which language to process + "set-papersize" : "", // config default: a4 + "sqlite-db-filename" : "", // config default: "spine-search.db" + "webserv-domain" : "", // config default: localhost ]; #+END_SRC @@ -433,9 +435,7 @@ auto helpInfo = getopt(args, "allow-downloads", "allow downloads (includes cgi.d from github)", &opts["allow-downloads"], "assert", "set optional assertions on", &opts["assertions"], "cgi-search-form-codegen", "generates (pre-compiled) d code for search of specified db", &opts["cgi-search-form-codegen"], - "cgi-sqlite-search-filename", "=[filename]", &settings["cgi-sqlite-search-filename"], "concordance", "file for document", &opts["concordance"], - "config", "=/path/to/config/file/including/filename", &settings["config"], "dark", "alternative dark theme", &opts["dark"], "debug", "debug", &opts["debug"], "digest", "hash digest for each object", &opts["digest"], @@ -449,7 +449,6 @@ auto helpInfo = getopt(args, "html-link-search", "html embedded search submission", &opts["html-link-search"], "html-seg", "process html output", &opts["html-seg"], "html-scroll", "process html output", &opts["html-scroll"], - "lang", "=[lang code e.g. =en or =en,es]", &settings["lang"], "latex", "output for pdfs", &opts["latex"], "latex-color-links", "mono or color links for pdfs", &opts["latex-color-links"], "light", "default light theme", &opts["light"], @@ -457,14 +456,13 @@ auto helpInfo = getopt(args, "ocn-off", "object cite numbers", &opts["ocn-off"], "odf", "open document format text (--odt)", &opts["odf"], "odt", "open document format text", &opts["odt"], - "output", "=/path/to/output/dir specify where to place output", &settings["output"], "parallel", "parallelisation", &opts["parallel"], "parallel-subprocesses", "nested parallelisation", &opts["parallel-subprocesses"], "pdf", "latex output for pdfs", &opts["pdf"], "pdf-color-links", "mono or color links for pdfs", &opts["pdf-color-links"], "pod", "spine (doc reform) pod source content bundled", &opts["pod"], "quiet|q", "output to terminal", &opts["quiet"], - "section-backmatter", "document backmatter (default)", &opts["backmatter"], + "section-backmatter", "document backmatter (default)" , &opts["backmatter"], "section-biblio", "document biblio (default)", &opts["section_biblio"], "section-blurb", "document blurb (default)", &opts["section_blurb"], "section-body", "document body (default)", &opts["section_body"], @@ -484,7 +482,6 @@ auto helpInfo = getopt(args, "sqlite-db-drop", "drop tables & db", &opts["sqlite-db-drop"], "sqlite-db-recreate", "create db, create tables", &opts["sqlite-db-recreate"], "sqlite-delete", "sqlite output", &opts["sqlite-delete"], - "sqlite-db-filename", "=[filename].sql.db", &settings["sqlite-db-filename"], "sqlite-insert", "sqlite output", &opts["sqlite-insert"], "sqlite-update", "sqlite output", &opts["sqlite-update"], "text", "text output", &opts["text"], @@ -495,6 +492,13 @@ auto helpInfo = getopt(args, "very-verbose", "output to terminal", &opts["very-verbose"], "workon", "(reserved for some matters under development & testing)", &opts["workon"], "xhtml", "xhtml output", &opts["xhtml"], + "cgi-sqlite-search-filename", "=[filename] default is spine-search", &settings["cgi-sqlite-search-filename"], + "config", "=/path/to/config/file/including/filename", &settings["config"], + "lang", "=[lang code e.g. =en or =en,es]", &settings["lang"], + "output", "=/path/to/output/dir specify where to place output", &settings["output"], + "set-papersize", "=\"a4,a5,b4,letter\"", &settings["set-papersize"], + "sqlite-db-filename", "=[filename].sql.db", &settings["sqlite-db-filename"], + "webserv-domain", "=[web-server.domain.name]", &settings["webserv-domain"], ); if (helpInfo.helpWanted) { defaultGetoptPrinter("Some information about the program.", helpInfo.options); @@ -871,7 +875,7 @@ if ( _conf_file_details = configFilePaths!()(_manifested, _env, _opt_action.config_path_set); auto _config_local_site_struct = readConfigSite!()(_conf_file_details, _opt_action); import doc_reform.meta.conf_make_meta_yaml; - _config = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_config, _manifested); // - get local site config + _config = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_config, _manifested, _opt_action); // - get local site config break; } } @@ -879,7 +883,7 @@ if ( } else { /+ local site config +/ auto _config_local_site_struct = readConfigSite!()(_conf_file_details, _opt_action); import doc_reform.meta.conf_make_meta_yaml; - _config = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_config, _manifested); // - get local site config + _config = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_config, _manifested, _opt_action); // - get local site config } if (_opt_action.show_config) { import doc_reform.meta.metadoc_show_config; @@ -1074,7 +1078,7 @@ foreach(arg; args[1..$]) { { /+ document config/make file +/ auto _config_document_struct = readConfigDoc!()(_manifest, _env); import doc_reform.meta.conf_make_meta_yaml; - _make_and_meta_struct = _config_document_struct.configParseYAMLreturnSpineStruct!()(_make_and_meta_struct, _manifest); + _make_and_meta_struct = _config_document_struct.configParseYAMLreturnSpineStruct!()(_make_and_meta_struct, _manifest, _opt_action); } #+END_SRC @@ -1373,6 +1377,7 @@ _make_and_meta_struct = _header_body_insertfilelist_imagelist[headBody.header], _make_and_meta_struct, _manifest, + _opt_action, ); if ((_opt_action.debug_do) || (_opt_action.very_verbose) @@ -1529,7 +1534,7 @@ struct DocumentMatters { @safe auto action() { /+ getopt options, commandline instructions, raw - processing instructions --epub --html etc. - - command line config instructions --output-path + - command line config instructions --output +/ return _opt_action; } diff --git a/src/doc_reform/io_out/latex.d b/src/doc_reform/io_out/latex.d index a021ee2..38dd486 100644 --- a/src/doc_reform/io_out/latex.d +++ b/src/doc_reform/io_out/latex.d @@ -1297,18 +1297,7 @@ string table(O,M)( string tail; } auto latex = LaTeX(); - foreach (paper_size_orientation; [ - "a4.portrait", - "a4.landscape", - "letter.portrait", - "letter.landscape", - "a5.portrait", - "a5.landscape", - "b4.portrait", - "b4.landscape", - // "legal.portrait", - // "legal.landscape", - ]) { + foreach (paper_size_orientation; doc_matters.conf_make_meta.conf.set_papersize) { latex.head = latex_head(doc_matters, paper_size_orientation); latex.content = latex_body(doc_abstraction, doc_matters, paper_size_orientation); latex.tail = latex_tail(doc_matters, paper_size_orientation); diff --git a/src/doc_reform/meta/conf_make_meta_json.d b/src/doc_reform/meta/conf_make_meta_json.d index 23b9631..5f36fb1 100644 --- a/src/doc_reform/meta/conf_make_meta_json.d +++ b/src/doc_reform/meta/conf_make_meta_json.d @@ -317,27 +317,27 @@ static template contentJSONtoSpineStruct() { if ("papersize" in _json.object["default"] && (_json.object["default"]["papersize"].type().to!string == "string") ) { - _struct_composite.conf.default_papersize = _json.object["default"]["papersize"].str; + _struct_composite.conf.set_papersize = _json.object["default"]["papersize"].str; } if ("text_wrap" in _json.object["default"] && (_json.object["default"]["text_wrap"].type().to!string == "string") ) { - _struct_composite.conf.default_text_wrap = _json.object["default"]["text_wrap"].str; + _struct_composite.conf.set_text_wrap = _json.object["default"]["text_wrap"].str; } if ("emphasis" in _json.object["default"] && (_json.object["default"]["emphasis"].type().to!string == "string") ) { - _struct_composite.conf.default_emphasis = _json.object["default"]["emphasis"].str; + _struct_composite.conf.set_emphasis = _json.object["default"]["emphasis"].str; } if ("language" in _json.object["default"] && (_json.object["default"]["language"].type().to!string == "string") ) { - _struct_composite.conf.default_language = _json.object["default"]["language"].str; + _struct_composite.conf.set_language = _json.object["default"]["language"].str; } if ("digest" in _json.object["default"] && (_json.object["default"]["digest"].type().to!string == "string") ) { - _struct_composite.conf.default_digest = _json.object["default"]["digest"].str; + _struct_composite.conf.set_digest = _json.object["default"]["digest"].str; } } if ("search" in _json.object) { diff --git a/src/doc_reform/meta/conf_make_meta_structs.d b/src/doc_reform/meta/conf_make_meta_structs.d index 3bab7d0..34b30a3 100644 --- a/src/doc_reform/meta/conf_make_meta_structs.d +++ b/src/doc_reform/meta/conf_make_meta_structs.d @@ -141,56 +141,56 @@ struct ConfCompositeMakeInit { string texpdf_font; } struct ConfCompositeSiteLocal { - string w_srv_http; - string w_srv_domain; - string w_srv_data_http; // if not set same as webserv_http - string w_srv_data_domain; // if not set same as webserv_domain - string w_srv_data_root_part; - string w_srv_data_root_url; - string w_srv_data_root_url_html; - string w_srv_data_root_path; - string w_srv_images_root_part; - // string w_srv_url_doc_path; - string w_srv_cgi_title; - string w_srv_cgi_http; // if not set same as webserv_http - string w_srv_cgi_domain; // if not set same as webserv_domain - string w_srv_cgi_bin_part; - string w_srv_cgi_bin_path; - string w_srv_cgi_search_script; - string w_srv_cgi_search_script_raw_fn_d; - string w_srv_cgi_port; - string w_srv_cgi_user; - string w_srv_cgi_action; - string w_srv_cgi_bin_url; - string w_srv_db_sqlite; - // string w_srv_db_pg; - string w_srv_db_pg_table; - string w_srv_db_pg_user; - // string webserv_cgi_file_links; - string output_path; - 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; + string w_srv_http; + string w_srv_domain; + string w_srv_data_http; // if not set same as webserv_http + string w_srv_data_domain; // if not set same as webserv_domain + string w_srv_data_root_part; + string w_srv_data_root_url; + string w_srv_data_root_url_html; + string w_srv_data_root_path; + string w_srv_images_root_part; + // string w_srv_url_doc_path; + string w_srv_cgi_title; + string w_srv_cgi_http; // if not set same as webserv_http + string w_srv_cgi_domain; // if not set same as webserv_domain + string w_srv_cgi_bin_part; + string w_srv_cgi_bin_path; + string w_srv_cgi_search_script; + string w_srv_cgi_search_script_raw_fn_d; + string w_srv_cgi_port; + string w_srv_cgi_user; + string w_srv_cgi_action; + string w_srv_cgi_bin_url; + string w_srv_db_sqlite; + // string w_srv_db_pg; + string w_srv_db_pg_table; + string w_srv_db_pg_user; + // string webserv_cgi_file_links; + string output_path; + 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[] set_papersize; + string set_text_wrap; + string set_emphasis; + string set_language; + string set_digest; + string permission_share_source; + string search_flag; + string search_action; + string search_db; + string search_title; } struct MetaComposite { string classify_dewey; diff --git a/src/doc_reform/meta/conf_make_meta_yaml.d b/src/doc_reform/meta/conf_make_meta_yaml.d index c33b04a..d6f9e22 100644 --- a/src/doc_reform/meta/conf_make_meta_yaml.d +++ b/src/doc_reform/meta/conf_make_meta_yaml.d @@ -20,10 +20,11 @@ template contentYAMLtoSpineStruct() { doc_reform.meta.defaults, doc_reform.meta.rgx; ConfComposite _struct_composite; - @system auto contentYAMLtoSpineStruct(C,Y,M)( + @system auto contentYAMLtoSpineStruct(C,Y,M,O)( C _struct_composite, Y _yaml, M _manifested, + O _opt_action, string _identifier ) { mixin spineRgxIn; @@ -281,7 +282,9 @@ template contentYAMLtoSpineStruct() { ) { _struct_composite.conf.w_srv_cgi_bin_path = _yaml["webserv"]["cgi_bin_path"].get!string; } - if ("cgi_search_script" in _yaml["webserv"] + if (_opt_action.cgi_sqlite_search_filename.length > 0) { + _struct_composite.conf.w_srv_cgi_search_script = _opt_action.cgi_sqlite_search_filename; + } else if ("cgi_search_script" in _yaml["webserv"] && _yaml["webserv"]["cgi_search_script"].type.string && _yaml["webserv"]["cgi_search_script"].tag.match(rgx.yaml_tag_is_str) ) { @@ -289,7 +292,9 @@ template contentYAMLtoSpineStruct() { } else { _struct_composite.conf.w_srv_cgi_search_script = "spine-search"; } - if ("cgi_search_script_raw_fn_d" in _yaml["webserv"] + if (_opt_action.cgi_sqlite_search_filename_d.length > 0) { + _struct_composite.conf.w_srv_cgi_search_script_raw_fn_d = _opt_action.cgi_sqlite_search_filename_d; + } else if ("cgi_search_script_raw_fn_d" in _yaml["webserv"] && _yaml["webserv"]["cgi_search_script_raw_fn_d"].type.string && _yaml["webserv"]["cgi_search_script_raw_fn_d"].tag.match(rgx.yaml_tag_is_str) ) { @@ -314,13 +319,6 @@ template contentYAMLtoSpineStruct() { ) { _struct_composite.conf.w_srv_cgi_user = _yaml["webserv"]["cgi_user"].get!string; } - if ("cgi_action" in _yaml["webserv"] - && _yaml["webserv"]["cgi_action"].type.string - && _yaml["webserv"]["cgi_action"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_cgi_action = _yaml["webserv"]["cgi_action"].get!string; - } else { // action is composite, build - } if ("cgi_bin_url" in _yaml["webserv"] && _yaml["webserv"]["cgi_bin_url"].type.string && _yaml["webserv"]["cgi_bin_url"].tag.match(rgx.yaml_tag_is_str) @@ -338,13 +336,24 @@ template contentYAMLtoSpineStruct() { ~ "/" ~ _struct_composite.conf.w_srv_cgi_bin_part; } + if (_opt_action.cgi_sqlite_search_filename.length > 0) { + _struct_composite.conf.w_srv_cgi_action = _struct_composite.conf.w_srv_cgi_bin_url ~ "/" ~ _opt_action.cgi_sqlite_search_filename; + } else if ("cgi_action" in _yaml["webserv"] + && _yaml["webserv"]["cgi_action"].type.string + && _yaml["webserv"]["cgi_action"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_cgi_action = _yaml["webserv"]["cgi_action"].get!string; + } else { // action is composite, build + } // if ("cgi_file_links" in _yaml["webserv"] // && _yaml["webserv"]["cgi_file_links"].type.string // && _yaml["webserv"]["cgi_file_links"].tag.match(rgx.yaml_tag_is_str) // ) { // _struct_composite.conf.w_srv_cgi_file_links = _yaml["webserv"]["cgi_file_links"].get!string; // } - if ("db_sqlite" in _yaml["webserv"] + if (_opt_action.sqlite_filename.length > 0) { + _struct_composite.conf.w_srv_db_sqlite = _opt_action.sqlite_filename; + } else if ("db_sqlite" in _yaml["webserv"] && _yaml["webserv"]["db_sqlite"].type.string && _yaml["webserv"]["db_sqlite"].tag.match(rgx.yaml_tag_is_str) ) { @@ -356,7 +365,9 @@ template contentYAMLtoSpineStruct() { if (!(_struct_composite.conf.output_path)) { _struct_composite.conf.output_path = ((_manifested.output.path).asNormalizedPath).array; } - if ("output" in _yaml + if (_opt_action.output_dir_set.length > 0) { + _struct_composite.conf.output_path = (_opt_action.output_dir_set.asNormalizedPath).array; + } else if ("output" in _yaml && _yaml["output"].type.sequence ) { if (_yaml["output"].type.mapping @@ -456,42 +467,113 @@ template contentYAMLtoSpineStruct() { } } } - if ("default" in _yaml + string[] selected_papersize(string _sizes_str) { + string[] _sizes = _sizes_str.split(regex(r"\s*,\s*")); + string[] _selected_sizes; + foreach (_size; _sizes) { + switch (_size) { + case "a4": + _selected_sizes ~= "a4.portrait"; + _selected_sizes ~= "a4.landscape"; + break; + case "a4.portrait": + _selected_sizes ~= _size; + break; + case "a4.landscape": + _selected_sizes ~= _size; + break; + case "a5": + _selected_sizes ~= "a5.portrait"; + _selected_sizes ~= "a5.landscape"; + break; + case "a5.portrait": + _selected_sizes ~= _size; + break; + case "a5.landscape": + _selected_sizes ~= _size; + break; + case "b4": + _selected_sizes ~= "b4.portrait"; + _selected_sizes ~= "b4.landscape"; + break; + case "b4.portrait": + _selected_sizes ~= _size; + break; + case "b4.landscape": + _selected_sizes ~= _size; + break; + case "letter": + _selected_sizes ~= "letter.portrait"; + _selected_sizes ~= "letter.landscape"; + break; + case "letter.portrait": + _selected_sizes ~= _size; + break; + case "letter.landscape": + _selected_sizes ~= _size; + break; + case "legal": + _selected_sizes ~= "legal.portrait"; + _selected_sizes ~= "legal.landscape"; + break; + case "legal.portrait": + _selected_sizes ~= _size; + break; + case "legal.landscape": + _selected_sizes ~= _size; + break; + default: break; + } + } + return _selected_sizes; + } + if (_opt_action.latex_papersize.length > 0) { + _struct_composite.conf.set_papersize = selected_papersize(_opt_action.latex_papersize); + } else if ( + "default" in _yaml && _yaml["default"].type.sequence + && _yaml["default"].type.mapping + && _yaml["default"].tag.match(rgx.yaml_tag_is_map) ) { - if (_yaml["default"].type.mapping - && _yaml["default"].tag.match(rgx.yaml_tag_is_map) + if ("papersize" in _yaml["default"] + && _yaml["default"]["papersize"].type.string + && _yaml["default"]["papersize"].tag.match(rgx.yaml_tag_is_str) ) { - if ("papersize" in _yaml["default"] - && _yaml["default"]["papersize"].type.string - && _yaml["default"]["papersize"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.default_papersize = _yaml["default"]["papersize"].get!string; - } - if ("text_wrap" in _yaml["default"] - && _yaml["default"]["text_wrap"].type.string - && _yaml["default"]["text_wrap"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.default_text_wrap = _yaml["default"]["text_wrap"].get!string; - } - if ("emphasis" in _yaml["default"] - && _yaml["default"]["emphasis"].type.string - && _yaml["default"]["emphasis"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.default_emphasis = _yaml["default"]["emphasis"].get!string; - } - if ("language" in _yaml["default"] - && _yaml["default"]["language"].type.string - && _yaml["default"]["language"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.default_language = _yaml["default"]["language"].get!string; - } - if ("digest" in _yaml["default"] - && _yaml["default"]["digest"].type.string - && _yaml["default"]["digest"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.default_digest = _yaml["default"]["digest"].get!string; - } + _struct_composite.conf.set_papersize = selected_papersize(_yaml["default"]["papersize"].get!string); + } + } + if (_struct_composite.conf.set_papersize.length == 0) { + _struct_composite.conf.set_papersize = ["a4.portrait", "a4.landscape"]; + } + if ( + "default" in _yaml + && _yaml["default"].type.sequence + && _yaml["default"].type.mapping + && _yaml["default"].tag.match(rgx.yaml_tag_is_map) + ) { + if ("text_wrap" in _yaml["default"] + && _yaml["default"]["text_wrap"].type.string + && _yaml["default"]["text_wrap"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.set_text_wrap = _yaml["default"]["text_wrap"].get!string; + } + if ("emphasis" in _yaml["default"] + && _yaml["default"]["emphasis"].type.string + && _yaml["default"]["emphasis"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.set_emphasis = _yaml["default"]["emphasis"].get!string; + } + if ("language" in _yaml["default"] + && _yaml["default"]["language"].type.string + && _yaml["default"]["language"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.set_language = _yaml["default"]["language"].get!string; + } + if ("digest" in _yaml["default"] + && _yaml["default"]["digest"].type.string + && _yaml["default"]["digest"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.set_digest = _yaml["default"]["digest"].get!string; } } if ("search" in _yaml @@ -906,17 +988,18 @@ template configParseYAMLreturnSpineStruct() { doc_reform.meta.conf_make_meta_structs, doc_reform.meta.conf_make_meta_json; mixin contentYAMLtoSpineStruct; - @system auto configParseYAMLreturnSpineStruct(T,CCm,M)( + @system auto configParseYAMLreturnSpineStruct(T,CCm,M,O)( T _document_struct, CCm _make_and_meta_struct, - M _manifested + M _manifested, + O _opt_action ){ Node _yaml; if (_document_struct.content.length > 0) { try { _yaml = Loader.fromString(_document_struct.content).load(); _make_and_meta_struct - = contentYAMLtoSpineStruct!()(_make_and_meta_struct, _yaml, _manifested, _document_struct.filename); // struct from yaml + = contentYAMLtoSpineStruct!()(_make_and_meta_struct, _yaml, _manifested, _opt_action, _document_struct.filename); } catch { import std.stdio; writeln("ERROR failed to parse content as yaml: ", _document_struct.filename); @@ -944,10 +1027,11 @@ template docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct() { mixin spineRgxIn; mixin contentJSONtoSpineStruct; static auto rgx = RgxI(); - @system auto docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct(CCm,Src,M)( + @system auto docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct(CCm,Src,M,O)( Src header_src, CCm _make_and_meta_struct, M _manifested, + O _opt_action, ) { Node _yaml; try { @@ -955,7 +1039,7 @@ template docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct() { if (("title" in _yaml) && ("creator" in _yaml)) {} else { // need test for _yaml content (does not work) writeln("ERROR failed to read document header, yaml header does not contain essential information related to title and author"); } - return contentYAMLtoSpineStruct!()(_make_and_meta_struct, _yaml, _manifested, "header"); + return contentYAMLtoSpineStruct!()(_make_and_meta_struct, _yaml, _manifested, _opt_action, "header"); } catch { import std.stdio; writeln("ERROR failed to read document header, header not parsed as yaml: ", _manifested.src.filename); diff --git a/src/doc_reform/meta/metadoc.d b/src/doc_reform/meta/metadoc.d index 8432073..ebc5344 100644 --- a/src/doc_reform/meta/metadoc.d +++ b/src/doc_reform/meta/metadoc.d @@ -14,7 +14,6 @@ template spineAbstraction() { doc_reform.io_in.read_source_files, doc_reform.io_out.hub; mixin spineRgxIn; - mixin contentJSONtoSpineStruct; mixin spineBiblio; mixin spineRgxDocStructFlags; mixin outputHub; @@ -32,7 +31,7 @@ template spineAbstraction() { { /+ document config/make file +/ auto _config_document_struct = readConfigDoc!()(_manifest, _env); import doc_reform.meta.conf_make_meta_yaml; - _make_and_meta_struct = _config_document_struct.configParseYAMLreturnSpineStruct!()(_make_and_meta_struct, _manifest); + _make_and_meta_struct = _config_document_struct.configParseYAMLreturnSpineStruct!()(_make_and_meta_struct, _manifest, _opt_action); } /+ ↓ read file (filename with path) +/ /+ ↓ file tuple of header and content +/ @@ -67,6 +66,7 @@ template spineAbstraction() { _header_body_insertfilelist_imagelist[headBody.header], _make_and_meta_struct, _manifest, + _opt_action, ); if ((_opt_action.debug_do) || (_opt_action.very_verbose) @@ -165,7 +165,7 @@ template spineAbstraction() { @safe auto action() { /+ getopt options, commandline instructions, raw - processing instructions --epub --html etc. - - command line config instructions --output-path + - command line config instructions --output +/ return _opt_action; } diff --git a/src/doc_reform/meta/metadoc_show_config.d b/src/doc_reform/meta/metadoc_show_config.d index c642cb9..4c2b976 100644 --- a/src/doc_reform/meta/metadoc_show_config.d +++ b/src/doc_reform/meta/metadoc_show_config.d @@ -63,15 +63,15 @@ template spineShowSiteConfig() { // "- flag act0:", // config.conf.flag_act0, "- default papersize:", - config.conf.default_papersize, + config.conf.set_papersize, "- default text wrap:", - config.conf.default_text_wrap, + config.conf.set_text_wrap, "- default emphasis markup symbol:", - config.conf.default_emphasis, + config.conf.set_emphasis, "- default language:", - config.conf.default_language, + config.conf.set_language, "- default hash digest:", - config.conf.default_digest, + config.conf.set_digest, "- search flag:", config.conf.search_flag, "- search action:", @@ -161,15 +161,15 @@ template spineShowConfig() { // "- flag act0:", // doc_matters.conf_make_meta.conf.flag_act0, "- default papersize:", - doc_matters.conf_make_meta.conf.default_papersize, + doc_matters.conf_make_meta.conf.set_papersize, "- default text wrap:", - doc_matters.conf_make_meta.conf.default_text_wrap, + doc_matters.conf_make_meta.conf.set_text_wrap, "- default emphasis markup symbol:", - doc_matters.conf_make_meta.conf.default_emphasis, + doc_matters.conf_make_meta.conf.set_emphasis, "- default language:", - doc_matters.conf_make_meta.conf.default_language, + doc_matters.conf_make_meta.conf.set_language, "- default hash digest:", - doc_matters.conf_make_meta.conf.default_digest, + doc_matters.conf_make_meta.conf.set_digest, "- search flag:", doc_matters.conf_make_meta.conf.search_flag, "- search action:", diff --git a/src/doc_reform/spine.d b/src/doc_reform/spine.d index 6d6d543..1ddfca1 100755 --- a/src/doc_reform/spine.d +++ b/src/doc_reform/spine.d @@ -86,7 +86,6 @@ string project_name = "spine"; string program_name = "spine"; @system void main(string[] args) { mixin spineRgxIn; - mixin contentJSONtoSpineStruct; mixin spineBiblio; mixin spineRgxDocStructFlags; mixin outputHub; @@ -113,6 +112,7 @@ string program_name = "spine"; } bool[string] opts = [ "abstraction" : false, + "allow-downloads" : false, "assertions" : false, "cgi-search-form-codegen" : false, "concordance" : false, @@ -173,11 +173,13 @@ string program_name = "spine"; "workon" : false, ]; string[string] settings = [ - "cgi-sqlite-search-filename" : "", // "spine-search" + "cgi-sqlite-search-filename" : "", // config default: "spine-search" "config" : "", "output" : "", - "lang" : "all", - "sqlite-db-filename" : "", // "spine-search.db" + "lang" : "all", // which language to process + "set-papersize" : "", // config default: a4 + "sqlite-db-filename" : "", // config default: "spine-search.db" + "webserv-domain" : "", // config default: localhost ]; auto helpInfo = getopt(args, std.getopt.config.passThrough, @@ -185,9 +187,7 @@ string program_name = "spine"; "allow-downloads", "allow downloads (includes cgi.d from github)", &opts["allow-downloads"], "assert", "set optional assertions on", &opts["assertions"], "cgi-search-form-codegen", "generates (pre-compiled) d code for search of specified db", &opts["cgi-search-form-codegen"], - "cgi-sqlite-search-filename", "=[filename]", &settings["cgi-sqlite-search-filename"], "concordance", "file for document", &opts["concordance"], - "config", "=/path/to/config/file/including/filename", &settings["config"], "dark", "alternative dark theme", &opts["dark"], "debug", "debug", &opts["debug"], "digest", "hash digest for each object", &opts["digest"], @@ -201,7 +201,6 @@ string program_name = "spine"; "html-link-search", "html embedded search submission", &opts["html-link-search"], "html-seg", "process html output", &opts["html-seg"], "html-scroll", "process html output", &opts["html-scroll"], - "lang", "=[lang code e.g. =en or =en,es]", &settings["lang"], "latex", "output for pdfs", &opts["latex"], "latex-color-links", "mono or color links for pdfs", &opts["latex-color-links"], "light", "default light theme", &opts["light"], @@ -209,14 +208,13 @@ string program_name = "spine"; "ocn-off", "object cite numbers", &opts["ocn-off"], "odf", "open document format text (--odt)", &opts["odf"], "odt", "open document format text", &opts["odt"], - "output", "=/path/to/output/dir specify where to place output", &settings["output"], "parallel", "parallelisation", &opts["parallel"], "parallel-subprocesses", "nested parallelisation", &opts["parallel-subprocesses"], "pdf", "latex output for pdfs", &opts["pdf"], "pdf-color-links", "mono or color links for pdfs", &opts["pdf-color-links"], "pod", "spine (doc reform) pod source content bundled", &opts["pod"], "quiet|q", "output to terminal", &opts["quiet"], - "section-backmatter", "document backmatter (default)", &opts["backmatter"], + "section-backmatter", "document backmatter (default)" , &opts["backmatter"], "section-biblio", "document biblio (default)", &opts["section_biblio"], "section-blurb", "document blurb (default)", &opts["section_blurb"], "section-body", "document body (default)", &opts["section_body"], @@ -236,7 +234,6 @@ string program_name = "spine"; "sqlite-db-drop", "drop tables & db", &opts["sqlite-db-drop"], "sqlite-db-recreate", "create db, create tables", &opts["sqlite-db-recreate"], "sqlite-delete", "sqlite output", &opts["sqlite-delete"], - "sqlite-db-filename", "=[filename].sql.db", &settings["sqlite-db-filename"], "sqlite-insert", "sqlite output", &opts["sqlite-insert"], "sqlite-update", "sqlite output", &opts["sqlite-update"], "text", "text output", &opts["text"], @@ -247,6 +244,13 @@ string program_name = "spine"; "very-verbose", "output to terminal", &opts["very-verbose"], "workon", "(reserved for some matters under development & testing)", &opts["workon"], "xhtml", "xhtml output", &opts["xhtml"], + "cgi-sqlite-search-filename", "=[filename] default is spine-search", &settings["cgi-sqlite-search-filename"], + "config", "=/path/to/config/file/including/filename", &settings["config"], + "lang", "=[lang code e.g. =en or =en,es]", &settings["lang"], + "output", "=/path/to/output/dir specify where to place output", &settings["output"], + "set-papersize", "=\"a4,a5,b4,letter\"", &settings["set-papersize"], + "sqlite-db-filename", "=[filename].sql.db", &settings["sqlite-db-filename"], + "webserv-domain", "=[web-server.domain.name]", &settings["webserv-domain"], ); if (helpInfo.helpWanted) { defaultGetoptPrinter("Some information about the program.", helpInfo.options); @@ -603,7 +607,7 @@ string program_name = "spine"; _conf_file_details = configFilePaths!()(_manifested, _env, _opt_action.config_path_set); auto _config_local_site_struct = readConfigSite!()(_conf_file_details, _opt_action); import doc_reform.meta.conf_make_meta_yaml; - _config = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_config, _manifested); // - get local site config + _config = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_config, _manifested, _opt_action); // - get local site config break; } } @@ -611,7 +615,7 @@ string program_name = "spine"; } else { /+ local site config +/ auto _config_local_site_struct = readConfigSite!()(_conf_file_details, _opt_action); import doc_reform.meta.conf_make_meta_yaml; - _config = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_config, _manifested); // - get local site config + _config = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_config, _manifested, _opt_action); // - get local site config } if (_opt_action.show_config) { import doc_reform.meta.metadoc_show_config; -- cgit v1.2.3