diff options
-rw-r--r-- | .dr/config_local_site_example | 36 | ||||
-rw-r--r-- | .envrc-local_ | 3 | ||||
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | org/config_d_cfte.org | 6 | ||||
-rw-r--r-- | org/config_git.org | 2 | ||||
-rw-r--r-- | org/config_nix.org | 17 | ||||
-rw-r--r-- | org/meta_conf_make_meta.org | 896 | ||||
-rw-r--r-- | org/out_cgi_search_sqlite.org | 4 | ||||
-rw-r--r-- | org/spine.org | 102 | ||||
-rw-r--r-- | src/doc_reform/io_out/cgi_sqlite_search_form.d | 4 | ||||
-rw-r--r-- | src/doc_reform/meta/conf_make_meta_structs.d | 1 | ||||
-rw-r--r-- | src/doc_reform/meta/conf_make_meta_yaml.d | 1868 | ||||
-rw-r--r-- | src/doc_reform/meta/metadoc.d | 6 | ||||
-rwxr-xr-x | src/doc_reform/spine.d | 78 | ||||
-rwxr-xr-x | sundry/spine_search_cgi/shell.nix | 38 | ||||
-rw-r--r-- | sundry/spine_search_cgi/views/configuration_example.txt (renamed from sundry/spine_search_cgi/views/configuration_suggested.txt) | 2 | ||||
-rw-r--r-- | views/configuration_example.txt (renamed from views/configuration_suggested.txt) | 2 |
17 files changed, 1722 insertions, 1345 deletions
diff --git a/.dr/config_local_site_example b/.dr/config_local_site_example new file mode 100644 index 0000000..6e751c1 --- /dev/null +++ b/.dr/config_local_site_example @@ -0,0 +1,36 @@ +# config_local_site +# read from directories ... FIX provide list +flag: + act0: "--html" + act1: "--html --epub" +output: + path: "/srv/www/spine" +default: + language: "en" + papersize: "a4" + text_wrap: "80" + digest: "sha256" +webserv: + http: "https" # "http" + domain: "sisudoc" # "localhost" + data_http: "https" # "http" + data_domain: "sisudoc" # "localhost" + data_root_url: "https://sisudoc.org" # "http://localhost" + data_root_path: "/srv/www/spine" # "/var/www/html" + data_root_part: "" + images_root_part: "image" + cgi_search_form_title: "≅ SiSU Spine search" + cgi_http: "https" # "http" + cgi_domain: "sisudoc.org" # "localhost" + cgi_bin_url: "http://sisudoc.org/cgi-bin" # "http://localhost/cgi-bin" + cgi_bin_part: "cgi-bin" + cgi_bin_path: "/var/www/cgi/cgi-bin" # "/usr/lib/cgi-bin" + cgi_search_script: "spine_search" + cgi_search_script_raw_fn_d: "spine_search.d" + cgi_port: "" + cgi_user: "" + cgi_action: "https://sisudoc.org/spine_search" # "http://localhost/cgi-bin/spine-search" + db_sqlite_filename: "spine.search.db" + db_sqlite_path: "/var/www/sqlite" + db_pg_table: "" + db_pg_user: "" diff --git a/.envrc-local_ b/.envrc-local_ index 8d9f54b..9bc7338 100644 --- a/.envrc-local_ +++ b/.envrc-local_ @@ -188,6 +188,7 @@ $SpineBIN/spine -v --sqlite-update --sqlite-db-filename="spine.search.db" --outp #+BEGIN_SRC sh $SpineBIN/spine -v --html --html-link-search --html-link-curate --curate --sqlite-update --sqlite-db-filename="spine.search.db" --cgi-sqlite-search-filename="spine_search" --sqlite-db-path="$SpineDBpath" --output="$SpineOUT" $SpinePOD/* +$SpineBIN/spine --epub --html --html-link-search --html-link-curate --curate --sqlite-update --sqlite-db-filename="spine.search.db" --cgi-sqlite-search-filename="spine_search" --cgi-url-action="https://sisudoc.org/spine_search" --ouput="$SpineOUT" $SpinePOD/* #+END_SRC *** generate html (linked to search form), sql output, curate COMPOSITE with resource configuration @@ -215,7 +216,7 @@ webserv: data_root_url: "https://sisudoc.org" data_root_path: "/srv/www/spine" images_root_part: "image" - cgi_title: "≅ SiSU Spine search" + cgi_search_form_title: "≅ SiSU Spine search" cgi_http: "https" cgi_domain: "sisudoc.org" cgi_bin_url: "http://sisudoc.org/cgi-bin" @@ -27,6 +27,8 @@ !nix !nix/** !.envrc +!.dr +!.dr/* !src !src/** !data diff --git a/org/config_d_cfte.org b/org/config_d_cfte.org index ae3f9c4..013aff9 100644 --- a/org/config_d_cfte.org +++ b/org/config_d_cfte.org @@ -68,7 +68,7 @@ SEE NOTES on configuration hierarchy in spine.org *** spine: configuration.txt SET -#+HEADER: :tangle "../views/configuration_suggested.txt" +#+HEADER: :tangle "../views/configuration_example.txt" #+BEGIN_SRC d /+ obt - org-mode generated file +/ struct Cfg { @@ -97,7 +97,7 @@ enum _cfg = Cfg(); *** spine_search: configuration.txt SET -#+HEADER: :tangle "../sundry/spine_search_cgi/views/configuration_suggested.txt" +#+HEADER: :tangle "../sundry/spine_search_cgi/views/configuration_example.txt" #+BEGIN_SRC d /+ obt - org-mode generated file +/ struct Cfg { @@ -133,7 +133,7 @@ http://localhost #+NAME: www_doc_root #+BEGIN_SRC sh -/srv/www/spine/static +/srv/www/spine #+END_SRC #+NAME: cgi_bin_root diff --git a/org/config_git.org b/org/config_git.org index 5ec0081..12bc0ce 100644 --- a/org/config_git.org +++ b/org/config_git.org @@ -50,6 +50,8 @@ !nix !nix/** !.envrc +!.dr +!.dr/* !src !src/** !data diff --git a/org/config_nix.org b/org/config_nix.org index cbd5ba6..2fd932c 100644 --- a/org/config_nix.org +++ b/org/config_nix.org @@ -328,6 +328,7 @@ $SpineBIN/spine -v --sqlite-update --sqlite-db-filename="<<spine_search_db>>" -- ,#+BEGIN_SRC sh $SpineBIN/spine -v --html --html-link-search --html-link-curate --curate --sqlite-update --sqlite-db-filename="<<spine_search_db>>" --cgi-sqlite-search-filename="<<spine_search_cgi>>" --sqlite-db-path="$SpineDBpath" --output="$SpineOUT" $SpinePOD/* +$SpineBIN/spine --epub --html --html-link-search --html-link-curate --curate --sqlite-update --sqlite-db-filename="spine.search.db" --cgi-sqlite-search-filename="spine_search" --cgi-url-action="https://sisudoc.org/spine_search" --ouput="$SpineOUT" $SpinePOD/* ,#+END_SRC ,*** generate html (linked to search form), sql output, curate COMPOSITE with resource configuration @@ -355,7 +356,7 @@ webserv: data_root_url: "https://sisudoc.org" data_root_path: "/srv/www/spine" images_root_part: "image" - cgi_title: "≅ SiSU Spine search" + cgi_search_form_title: "≅ SiSU Spine search" cgi_http: "https" cgi_domain: "sisudoc.org" cgi_bin_url: "http://sisudoc.org/cgi-bin" @@ -1093,14 +1094,12 @@ nix flake update #+BEGIN_SRC nix { pkgs ? import <nixpkgs> {} }: pkgs.mkShell { - buildInputs = with pkgs; [( - with pkgs; [ - <<shell_packages_nix_related>> - <<shell_packages_d_build_related>> - <<shell_packages_search_related_sqlite>> - <<shell_packages_candy>> - ] - )]; + buildInputs = with pkgs; [ + <<shell_packages_nix_related>> + <<shell_packages_d_build_related>> + <<shell_packages_search_related_sqlite>> + <<shell_packages_candy>> + ]; shellHook = '' if [[ -e ".envrc" ]]; then source .envrc diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org index cdb7571..118219e 100644 --- a/org/meta_conf_make_meta.org +++ b/org/meta_conf_make_meta.org @@ -20,40 +20,175 @@ * generic ** conf yaml REFERENCE +NOTES on configuration hierarchy: +- compile time program defaults views/configuration.txt in config_d_cfte.org + - config_d_cfte.org (writes views/configuration.txt) + - compile time program defaults, set in views/configuration.txt + - found in: _cfg.* +- run time default configuration administrators config ".dr/config_site_local" + - in_source_files.org readConfigSite (reads administrators site defaults from + yaml config file) + - meta_conf_make_meta.org struct ConfCompositeSiteLocal + - administrator site defaults read from yaml configuration file + ".dr/config_site_local" + - found in: "doc_matters.conf_make_meta.conf." (incorporates _cfg.* as + initial default values that are overridden if set) + - ("conf_make_meta.make" (& "conf_make_meta.meta") also available taken from + document headers) +- command line execution configuration instruction + - spine.org (org heading: initialize settings) (command line overrides) + - command line settings/overrides + - found in: doc_matters.opt.action.* + +** table + +|-----------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| cfg ctfe | config local | cli | cli-run | composite | default | | +|-----------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| _cfg. | ["webserv"] | -- | opt_action. | _struct_composite.conf. | default | ✓ ✗ | +|-----------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| www_doc_root | ["data_root_path"] | output | output_dir_set | output_path | "/srv/www/spine" | ✓ | +| | | | | | "/var/www" | | +| | | | | | "/var/www/html" | | +|-----------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| www_http | ["http"] | www-http | webserver_http | w_srv_http | "http" or "https" | ✓ | +|-----------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| www_host | ["domain"] | www-host | webserver_host_name | CHECK | "localhost" | ✓ | +| | | | | | "sisudoc" | | +|-----------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| www_host_doc_root | [""] | www-host-doc-root | webserver_host_doc_root | w_srv_data_root_path | | ✓ | +|-----------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| www_url_doc_root? | | www-url-doc-root | | | "http://localhost" | | +| CHECK | | | | | "https://sisudoc.org" | | +|-----------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| cgi_http | [""] | cgi-http | | | | ✗ | +|-----------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| cgi_host | [""] | cgi-host | | | | ✗ | +|-----------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| cgi_bin_root | ["cgi_bin_path"] | cgi-bin-root | cgi_bin_root | cgi_bin_root | "/var/www/cgi/cgi-bin" | ✓ | +|-----------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| cgi_filename | ["cgi_search_script"] | cgi-sqlite-search-filename | cgi_sqlite_search_filename | w_srv_cgi_search_script | "spine_search" | ✓ | +|-----------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| cgi_url_root | ["cgi_bin_url"] | cgi-url-root | cgi_url_root | | REMOVE UNUSED | ✓ | +|-----------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| cgi_url_action | ["cgi_action"] | cgi-url-action | cgi_url_action | w_srv_cgi_action | "http://localhost/cgi-bin/spine-search" | ✓ | +| | | | | | "https://sisudoc.org/spine-search" | | +|-----------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| cgi_search_form_title | ["cgi_search_form_title"] | cgi-search-title | cgi_search_title | w_srv_cgi_search_form_title | "≅ SiSU Spine search" | ✓ | +|-----------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| | | config | | | | | +|-----------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| default_language | [""] | lang | languages_set | | "all" or "en" | ✓ | +|-----------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| default_papersize | [""] | set-papersize | latex_papersize | set_papersize | "a4"? | ✓ | +|-----------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| default_text_wrap | [""] | set-textwrap | text_wrap | set_text_wrap | 80 | ✓ | +|-----------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| default_hash_digest | [""] | set-digest | hash_digest_type | | sha258 | ✓ | +|-----------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| db_sqlite_path | [""] | sqlite-db-path | sqliteDB_path | w_srv_db_sqlite_path | "/var/www/sqlite" | ✓ | +|-----------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| db_sqlite_filename | [""] | sqlite-db-filename | sqliteDB_filename | w_srv_db_sqlite_filename | "spine_search.db" | ✓ | +|-----------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| | | | | | | | +|-----------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| + +** cli flag + +#+BEGIN_SRC d +string[string] settings = [ + "output" : "", + "www-http" : "", + "www-host" : "", + "www-host-doc-root" : "", + "www-url-doc-root" : "", + "cgi-http" : "", + "cgi-host" : "", + "cgi-bin-root" : "", + "cgi-sqlite-search-filename" : "", + "cgi-url-root" : "", + "cgi-url-action" : "", + "cgi-search-title" : "", + "config" : "", + "lang" : "all", + "set-papersize" : "", + "set-textwrap" : "", + "set-digest" : "", + "sqlite-db-path" : "", + "sqlite-db-filename" : "", +]; +#+END_SRC + +** conf build - views/configuration.txt REFERENCE + +- see: config_d_cfte.org + for configuration_example.txt + +#+BEGIN_SRC d +struct Cfg { + string www_http = "http"; + string www_host = "localhost"; + string www_url_doc_root = "http://localhost"; + string www_doc_root = "/srv/www/spine"; + string www_host_doc_root = "localhost"; + string cgi_bin_root = "/var/www/cgi/cgi-bin"; + string cgi_bin_subpath = ""; + string cgi_filename = "spine_search"; + string cgi_url_root = "http://localhost/"; + string cgi_port = ""; + string cgi_user = ""; + string cgi_url_action = "http://localhost/spine_search"; + string cgi_search_form_title = "≅ SiSU Spine search"; + string db_sqlite_path = "/var/www/sqlite"; + string db_sqlite_filename = "spine.search.db"; + string default_language = "en"; + string default_papersize = "a4"; + string default_text_wrap = "80"; + string default_hash_digest = "sha256"; +} +enum _cfg = Cfg(); +#+END_SRC + +** conf yaml - .dr/config_site_local REFERENCE + +#+HEADER: :tangle "../.dr/config_local_site_example" #+BEGIN_SRC yaml +# config_local_site +# read from directories ... FIX provide list flag: - act0: "--html" - act1: "--html --epub" + act0: "--html" + act1: "--html --epub" output: - path: "/var/www/html" + path: "/srv/www/spine" default: - language: "en" - papersize: "a4" - text_wrap: "80" - digest: "sha256" + language: "en" + papersize: "a4" + text_wrap: "80" + digest: "sha256" webserv: - http: "http" - host: "localhost" - data_http: "http" - data_host: "localhost" - data_root_url: "http://localhost" - data_root_path: "/var/www/html" - data_root_part: "" - images_root_part: "image" - cgi_http: "http" - cgi_host: "localhost" - cgi_bin_url: "http://localhost/cgi-bin" - cgi_bin_subpath: "cgi-bin" - cgi_bin_path: "/usr/lib/cgi-bin" - cgi_search_form_title: "≅ SiSU Spine search" - cgi_search_script: "spine_search" - cgi_search_script_raw_fn_d: "spine_search.d" - cgi_port: "" - cgi_user: "" - cgi_action: "http://localhost/cgi-bin/spine-search" - db_sqlite: "spine.search.db" - db_pg_table: "" - db_pg_user: "" + http: "https" # "http" + domain: "sisudoc" # "localhost" + data_http: "https" # "http" + data_domain: "sisudoc" # "localhost" + data_root_url: "https://sisudoc.org" # "http://localhost" + data_root_path: "/srv/www/spine" # "/var/www/html" + data_root_part: "" + images_root_part: "image" + cgi_search_form_title: "≅ SiSU Spine search" + cgi_http: "https" # "http" + cgi_domain: "sisudoc.org" # "localhost" + cgi_bin_url: "http://sisudoc.org/cgi-bin" # "http://localhost/cgi-bin" + cgi_bin_part: "cgi-bin" + cgi_bin_path: "/var/www/cgi/cgi-bin" # "/usr/lib/cgi-bin" + cgi_search_script: "spine_search" + cgi_search_script_raw_fn_d: "spine_search.d" + cgi_port: "" + cgi_user: "" + cgi_action: "https://sisudoc.org/spine_search" # "http://localhost/cgi-bin/spine-search" + db_sqlite_filename: "spine.search.db" + db_sqlite_path: "/var/www/sqlite" + db_pg_table: "" + db_pg_user: "" #+END_SRC ** imports @@ -278,7 +413,6 @@ struct ConfCompositeSiteLocal { string w_srv_cgi_host; // if not set same as webserv_host string w_srv_cgi_bin_subpath; string w_srv_cgi_bin_path; - string w_srv_cgi_search_title; string w_srv_cgi_search_script; string w_srv_cgi_search_script_raw_fn_d; string w_srv_cgi_port; @@ -426,244 +560,296 @@ template contentYAMLtoSpineStruct() { doc_reform.meta.defaults, doc_reform.meta.rgx; ConfComposite _struct_composite; - @system auto contentYAMLtoSpineStruct(C,Y,M,O)( - C _struct_composite, - Y _yaml, - M _manifested, - O _opt_action, + @system auto contentYAMLtoSpineStruct(C,Y,M,O,Cfg)( + C _struct_composite, + Y _yaml, + M _manifested, + O _opt_action, + Cfg _cfg, string _identifier ) { mixin spineRgxIn; static auto rgx = RgxI(); confCompositeMakeBuild _mk; - <<yaml_objects_make>> - <<yaml_objects_conf>> - <<yaml_objects_meta>> + if (_identifier != "header") { // called only once per run anyway + <<yaml_objects_conf>> + } else { + <<yaml_objects_make>> + <<yaml_objects_meta>> + } return _struct_composite; } } #+END_SRC -** make +** conf -#+NAME: yaml_objects_make +#+NAME: yaml_objects_conf #+BEGIN_SRC d -/+ make ------------------------------------------------------------------- +/ -if ("make" in _yaml - && _yaml["make"].type.sequence -) { - if (_yaml["make"].type.mapping - && _yaml["make"].tag.match(rgx.yaml_tag_is_map) - ) { - if ("bold" in _yaml["make"] - && _yaml["make"]["bold"].type.string - && _yaml["make"]["bold"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.make_str.bold = _yaml["make"]["bold"].get!string; - } - if ("breaks" in _yaml["make"] - && _yaml["make"]["breaks"].type.string - && _yaml["make"]["breaks"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.make_str.breaks = _yaml["make"]["breaks"].get!string; +/+ conf ------------------------------------------------------------------- +/ +/+ + _cfg. build defaults (else program runtime defaults) + local_site_configuration defaults + command line overrides ++/ +{ + if (_opt_action.webserver_http.length > 0) { + _struct_composite.conf.w_srv_http + = _opt_action.webserver_http; + } else { + _struct_composite.conf.w_srv_http + = (_cfg.www_http.empty) + ? "http" + : _cfg.www_http; + if (("webserv" in _yaml && _yaml["webserv"].type.sequence) + && (_yaml["webserv"].type.mapping + && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + ) { + if ("http" in _yaml["webserv"] + && _yaml["webserv"]["http"].type.string + && _yaml["webserv"]["http"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_http + = _yaml["webserv"]["http"].get!string; + } } - if ("cover_image" in _yaml["make"] - && _yaml["make"]["cover_image"].type.string - && _yaml["make"]["cover_image"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.make_str.cover_image = _yaml["make"]["cover_image"].get!string; + } + if (_opt_action.cgi_search_title.length > 0) { + _struct_composite.conf.w_srv_cgi_search_form_title + = _opt_action.cgi_search_title; + } else { + _struct_composite.conf.w_srv_cgi_search_form_title + = (_cfg.cgi_search_form_title.empty) + ? "≅ SiSU spine search form" + : _cfg.cgi_search_form_title; + if (("webserv" in _yaml && _yaml["webserv"].type.sequence) + && (_yaml["webserv"].type.mapping + && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + ) { + if ("cgi_search_form_title" in _yaml["webserv"] + && _yaml["webserv"]["cgi_search_form_title"].type.string + && _yaml["webserv"]["cgi_search_form_title"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_cgi_search_form_title + = _yaml["webserv"]["cgi_search_form_title"].get!string; + } } - if ("css" in _yaml["make"] - && _yaml["make"]["css"].type.string - && _yaml["make"]["css"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.make_str.css = _yaml["make"]["css"].get!string; + } + if (_opt_action.cgi_sqlite_search_filename.length > 0) { + _struct_composite.conf.w_srv_cgi_search_script + = _opt_action.cgi_sqlite_search_filename; + } else { + _struct_composite.conf.w_srv_cgi_search_script + = (_cfg.cgi_filename.empty) + ? "spine_search" + : _cfg.cgi_filename; + if (("webserv" in _yaml && _yaml["webserv"].type.sequence) + && (_yaml["webserv"].type.mapping + && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + ) { + 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) + ) { + _struct_composite.conf.w_srv_cgi_search_script + = _yaml["webserv"]["cgi_search_script"].get!string; + } } - if ("emphasis" in _yaml["make"] - && _yaml["make"]["emphasis"].type.string - && _yaml["make"]["emphasis"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.make_str.emphasis = _yaml["make"]["emphasis"].get!string; + } + if (_opt_action.sqliteDB_filename.length > 0) { + _struct_composite.conf.w_srv_db_sqlite_filename + = _opt_action.sqliteDB_filename; + } else { + _struct_composite.conf.w_srv_db_sqlite_filename + = (_cfg.db_sqlite_filename.empty) + ? "spine.search.db" + : _cfg.db_sqlite_filename; + if (("webserv" in _yaml && _yaml["webserv"].type.sequence) + && (_yaml["webserv"].type.mapping + && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + ) { + if ("db_sqlite_filename" in _yaml["webserv"] + && _yaml["webserv"]["db_sqlite_filename"].type.string + && _yaml["webserv"]["db_sqlite_filename"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_db_sqlite_filename + = _yaml["webserv"]["db_sqlite_filename"].get!string; + } } - if ("footer" in _yaml["make"] - && _yaml["make"]["footer"].type.string - && _yaml["make"]["footer"].tag.match(rgx.yaml_tag_is_str) - ) { - char[][] __match_footer_array - = (cast(char[]) _yaml["make"]["footer"].get!string) - .split(rgx.make_heading_delimiter); - _struct_composite.make_str.footer = __match_footer_array.to!(string[]); + } + if (_opt_action.sqliteDB_path.length > 0) { + _struct_composite.conf.w_srv_db_sqlite_path + = _opt_action.sqliteDB_path; + } else { + _struct_composite.conf.w_srv_db_sqlite_path + = (_cfg.db_sqlite_path.empty) + ? "/var/www/sqlite" + : _cfg.db_sqlite_path; + if (("webserv" in _yaml && _yaml["webserv"].type.sequence) + && (_yaml["webserv"].type.mapping + && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + ) { + if ("db_sqlite_path" in _yaml["webserv"] + && _yaml["webserv"]["db_sqlite_path"].type.string + && _yaml["webserv"]["db_sqlite_path"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_db_sqlite_path + = _yaml["webserv"]["db_sqlite_path"].get!string; + } } - if ("headings" in _yaml["make"] - && _yaml["make"]["headings"].type.string - && _yaml["make"]["headings"].tag.match(rgx.yaml_tag_is_str) - ) { - char[][] __match_headings_array - = (cast(char[]) _yaml["make"]["headings"].get!string) - .split(rgx.make_heading_delimiter); - _struct_composite.make_str.headings = __match_headings_array.to!(string[]); - } else if ("headings" in _yaml["make"] - && _yaml["make"]["headings"].type.string - && _yaml["make"]["headings"].tag.match(rgx.yaml_tag_is_seq) - ) { - foreach(string identify_heading_level; _yaml["make"]["headings"]) { - _struct_composite.make_str.headings ~= identify_heading_level; + } + if (_opt_action.cgi_url_action.length > 0) { + _struct_composite.conf.w_srv_cgi_action + = _opt_action.cgi_url_action; + } else { + _struct_composite.conf.w_srv_cgi_action + = (_cfg.www_url_doc_root.empty) + ? "http://locahost" // "https://sisudoc.org" + : _cfg.www_url_doc_root; + if (("webserv" in _yaml && _yaml["webserv"].type.sequence) + && (_yaml["webserv"].type.mapping + && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + ) { + 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 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; } } - if ("home_button_image" in _yaml["make"] - && _yaml["make"]["home_button_image"].type.string - && _yaml["make"]["home_button_image"].tag.match(rgx.yaml_tag_is_str) - ) { - char[][] __match_home_button_image_array - = (cast(char[]) _yaml["make"]["home_button_image"].get!string) - .split(rgx.make_heading_delimiter); - _struct_composite.make_str.home_button_image = __match_home_button_image_array.to!(string[]); + } + if (!(_struct_composite.conf.output_path)) { + _struct_composite.conf.output_path = ((_manifested.output.path).asNormalizedPath).array; + } { + if (_opt_action.output_dir_set.length > 0) { + _struct_composite.conf.output_path + = (_opt_action.output_dir_set.asNormalizedPath).array; + } else { + _struct_composite.conf.output_path + = (_cfg.www_doc_root.empty) + ? "/srv/www/spine" + : _cfg.www_doc_root; + if (("webserv" in _yaml && _yaml["webserv"].type.sequence) + && (_yaml["webserv"].type.mapping + && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + ) { + if (_yaml["output"].type.mapping + && _yaml["output"].tag.match(rgx.yaml_tag_is_map) + ) { + if ("path" in _yaml["output"] + && _yaml["output"]["path"].type.string + && _yaml["output"]["path"].tag.match(rgx.yaml_tag_is_str) + ) { + if (_manifested.output.path == _manifested.env.pwd + && _yaml["output"]["path"].get!string.length > 0 + ) { + _struct_composite.conf.output_path = (((_yaml["output"]["path"].get!string).expandTilde).asNormalizedPath).array; + } + } + } + } } - if ("home_button_text" in _yaml["make"] - && _yaml["make"]["home_button_text"].type.string - && _yaml["make"]["home_button_text"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.make_str.home_button_text = _yaml["make"]["home_button_text"].get!string; - } else if ("home_button_text" in _yaml["make"] - && _yaml["make"]["home_button_text"].type.string - && _yaml["make"]["home_button_text"].tag.match(rgx.yaml_tag_is_seq) - ) { - _struct_composite.make_str.home_button_text = ""; - foreach(string hbt; _yaml["make"]["home_button_text"]) { - _struct_composite.make_str.home_button_text ~= hbt ~ "; "; + if (_opt_action.webserver_host_doc_root.length > 0) { // same as output_path immediately above, resolve FIX REMOVE + _struct_composite.conf.w_srv_data_root_path + = _opt_action.webserver_host_doc_root; + } else { + _struct_composite.conf.w_srv_data_root_path + = (_cfg.www_doc_root.empty) + ? "/var/www/spine" + : _cfg.www_doc_root; + if (("webserv" in _yaml && _yaml["webserv"].type.sequence) + && (_yaml["webserv"].type.mapping + && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + ) { + if ("data_root_path" in _yaml["webserv"] + && _yaml["webserv"]["data_root_path"].type.string + && _yaml["webserv"]["data_root_path"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_data_root_path + = _yaml["webserv"]["data_root_path"].get!string; + } } } - if ("italics" in _yaml["make"] - && _yaml["make"]["italics"].type.string - && _yaml["make"]["italics"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.make_str.italics = _yaml["make"]["italics"].get!string; + } + if (_opt_action.cgi_bin_root.length > 0) { + _struct_composite.conf.w_srv_cgi_bin_path + = _opt_action.cgi_bin_root; + } else { + _struct_composite.conf.w_srv_cgi_bin_path + = (_cfg.cgi_bin_root.empty) + ? "/var/www/cgi/cgi-bin" + : _cfg.cgi_bin_root; + if (("webserv" in _yaml && _yaml["webserv"].type.sequence) + && (_yaml["webserv"].type.mapping + && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + ) { + if ("cgi_bin_path" in _yaml["webserv"] + && _yaml["webserv"]["cgi_bin_path"].type.string + && _yaml["webserv"]["cgi_bin_path"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_cgi_bin_path + = _yaml["webserv"]["cgi_bin_path"].get!string; + } } - if ("auto_num_top_at_level" in _yaml["make"] - && _yaml["make"]["auto_num_top_at_level"].type.string - && _yaml["make"]["auto_num_top_at_level"].tag.match(rgx.yaml_tag_is_str) + } + { _struct_composite.conf.w_srv_data_root_part + = ""; + if (("webserv" in _yaml && _yaml["webserv"].type.sequence) + && (_yaml["webserv"].type.mapping + && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) ) { - _struct_composite.make_str.auto_num_top_at_level = _yaml["make"]["auto_num_top_at_level"].get!string; - switch (_yaml["make"]["auto_num_top_at_level"].get!string) { - case "A": - break; - case "B": _struct_composite.make_str.auto_num_top_lv = 1; - break; - case "C": _struct_composite.make_str.auto_num_top_lv = 2; - break; - case "D": _struct_composite.make_str.auto_num_top_lv = 3; - break; - case "1": _struct_composite.make_str.auto_num_top_lv = 4; - break; - case "2": _struct_composite.make_str.auto_num_top_lv = 5; - break; - case "3": _struct_composite.make_str.auto_num_top_lv = 6; - break; - case "4": _struct_composite.make_str.auto_num_top_lv = 7; - break; - default: - break; + if ("data_root_part" in _yaml["webserv"] + && _yaml["webserv"]["data_root_part"].type.string + && _yaml["webserv"]["data_root_part"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_data_root_part = _yaml["webserv"]["data_root_part"].get!string; } } - if ("auto_num_depth" in _yaml["make"] - && _yaml["make"]["auto_num_depth"].type.string - && _yaml["make"]["auto_num_depth"].tag.match(rgx.yaml_tag_is_int) - ) { // not sure implemented for documents - _struct_composite.make_str.auto_num_depth = _yaml["make"]["auto_num_depth"].get!int; - } else if ("auto_num_depth" in _yaml["make"] - && _yaml["make"]["auto_num_depth"].type.string - && _yaml["make"]["auto_num_depth"].tag.match(rgx.yaml_tag_is_str) - ) { // not sure implemented for documents - _struct_composite.make_str.auto_num_depth = _yaml["make"]["auto_num_depth"].get!int; - } - if ("texpdf_font" in _yaml["make"] - && _yaml["make"]["texpdf_font"].type.string + } + { _struct_composite.conf.w_srv_images_root_part + = "image"; + if (("webserv" in _yaml && _yaml["webserv"].type.sequence) + && (_yaml["webserv"].type.mapping + && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) ) { - _struct_composite.make_str.texpdf_font = _yaml["make"]["texpdf_font"].get!string; + if ("images_root_part" in _yaml["webserv"] + && _yaml["webserv"]["images_root_part"].type.string + && _yaml["webserv"]["images_root_part"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_images_root_part = _yaml["webserv"]["images_root_part"].get!string; + } } } - _struct_composite.make.bold = _mk.bold(_struct_composite.make_str.bold); - _struct_composite.make.breaks = _mk.breaks(_struct_composite.make_str.breaks); - _struct_composite.make.cover_image = _mk.cover_image(_struct_composite.make_str.cover_image); - _struct_composite.make.css = _mk.css(_struct_composite.make_str.css); - _struct_composite.make.emphasis = _mk.emphasis(_struct_composite.make_str.emphasis); - _struct_composite.make.footer = _mk.footer(_struct_composite.make_str.footer); - _struct_composite.make.headings = _mk.headings(_struct_composite.make_str.headings); - _struct_composite.make.home_button_image = _mk.home_button_image(_struct_composite.make_str.home_button_image); - _struct_composite.make.home_button_text = _mk.home_button_text(_struct_composite.make_str.home_button_text); - _struct_composite.make.italics = _mk.italics(_struct_composite.make_str.italics); - _struct_composite.make.auto_num_top_at_level = _mk.auto_num_top_at_level(_struct_composite.make_str.auto_num_top_at_level); - _struct_composite.make.auto_num_top_lv = _mk.auto_num_top_lv(_struct_composite.make_str.auto_num_top_lv); - _struct_composite.make.auto_num_depth = _mk.auto_num_depth(_struct_composite.make_str.auto_num_depth); - _struct_composite.make.substitute = _mk.substitute(_struct_composite.make_str.substitute); - _struct_composite.make.texpdf_font = _mk.texpdf_font(_struct_composite.make_str.texpdf_font); } - -#+END_SRC - -** conf - -#+NAME: yaml_objects_conf -#+BEGIN_SRC d -/+ conf ------------------------------------------------------------------- +/ -if ("webserv" in _yaml - && _yaml["webserv"].type.sequence -) { - if (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map) - ) { - if ("http" in _yaml["webserv"] - && _yaml["webserv"]["http"].type.string - && _yaml["webserv"]["http"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_http = _yaml["webserv"]["http"].get!string; - } // else { set default? } +if (("webserv" in _yaml + && _yaml["webserv"].type.sequence) + && (_yaml["webserv"].type.mapping + && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) +) { // cannot be used as is with opt_action FIX look at remaining, decide what to do later if ("data_http" in _yaml["webserv"] && _yaml["webserv"]["data_http"].type.string && _yaml["webserv"]["data_http"].tag.match(rgx.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_data_http = _yaml["webserv"]["data_http"].get!string; } + // if (_opt_action.*.length > 0) { if ("cgi_http" in _yaml["webserv"] && _yaml["webserv"]["cgi_http"].type.string && _yaml["webserv"]["cgi_http"].tag.match(rgx.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_cgi_http = _yaml["webserv"]["cgi_http"].get!string; } + // if (_opt_action.*.length > 0) { if ("host" in _yaml["webserv"] && _yaml["webserv"]["host"].type.string && _yaml["webserv"]["host"].tag.match(rgx.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_host = _yaml["webserv"]["host"].get!string; } - // if ("data_root_url" in _yaml["webserv"] - // && _yaml["webserv"]["data_root_url"].type.string - // && _yaml["webserv"]["data_root_url"].tag.match(rgx.yaml_tag_is_str) - // ) { - // _struct_composite.conf.w_srv_data_root_url = _yaml["webserv"]["data_root_url"].get!string; - // if (auto m = _struct_composite.conf.w_srv_data_root_url.match(rgx.webserv_url_doc_root)) { - // _struct_composite.conf.w_srv_url_host = m.captures[2].to!string; - // _struct_composite.conf.w_srv_url_doc_path = m.captures[3].to!string; - // } - // } - if ("data_root_path" in _yaml["webserv"] - && _yaml["webserv"]["data_root_path"].type.string - && _yaml["webserv"]["data_root_path"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_data_root_path = _yaml["webserv"]["data_root_path"].get!string; - } - if ("data_root_part" in _yaml["webserv"] - && _yaml["webserv"]["data_root_part"].type.string - && _yaml["webserv"]["data_root_part"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_data_root_part = _yaml["webserv"]["data_root_part"].get!string; - } - if ("images_root_part" in _yaml["webserv"] - && _yaml["webserv"]["images_root_part"].type.string - && _yaml["webserv"]["images_root_part"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_images_root_part = _yaml["webserv"]["images_root_part"].get!string; - } if ("data_root_url" in _yaml["webserv"] && _yaml["webserv"]["data_root_url"].type.string && _yaml["webserv"]["data_root_url"].tag.match(rgx.yaml_tag_is_str) @@ -688,59 +874,12 @@ if ("webserv" in _yaml } else { // composite construct _struct_composite.conf.w_srv_cgi_host = _struct_composite.conf.w_srv_host; } - if ("cgi_search_form_title" in _yaml["webserv"] - && _yaml["webserv"]["cgi_search_form_title"].type.string - && _yaml["webserv"]["cgi_search_form_title"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_cgi_search_form_title = _yaml["webserv"]["cgi_search_form_title"].get!string; - } if ("cgi_bin_subpath" in _yaml["webserv"] && _yaml["webserv"]["cgi_bin_subpath"].type.string && _yaml["webserv"]["cgi_bin_subpath"].tag.match(rgx.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_cgi_bin_subpath = _yaml["webserv"]["cgi_bin_subpath"].get!string; } - if ("cgi_bin_path" in _yaml["webserv"] - && _yaml["webserv"]["cgi_bin_path"].type.string - && _yaml["webserv"]["cgi_bin_path"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_cgi_bin_path = _yaml["webserv"]["cgi_bin_path"].get!string; - } - if (_opt_action.cgi_search_title.length > 0) { - _struct_composite.conf.w_srv_cgi_search_title = _opt_action.cgi_search_title; - } else if ("cgi_search_title" in _yaml["webserv"] - && _yaml["webserv"]["cgi_search_title"].type.string - && _yaml["webserv"]["cgi_search_title"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_cgi_search_title = _yaml["webserv"]["cgi_search_title"].get!string; - } else { - _struct_composite.conf.w_srv_cgi_search_title = "≅ SiSU spine search form"; - } - 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) - ) { - _struct_composite.conf.w_srv_cgi_search_script = _yaml["webserv"]["cgi_search_script"].get!string; - } else { - _struct_composite.conf.w_srv_cgi_search_script = "spine_search"; - } - 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) - ) { - _struct_composite.conf.w_srv_cgi_search_script_raw_fn_d = _yaml["webserv"]["cgi_search_script_raw_fn_d"].get!string; - } 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) - ) { - _struct_composite.conf.w_srv_cgi_search_script_raw_fn_d = (_yaml["webserv"]["cgi_search_script"].get!string).translate(['-' : "_"]) ~ ".d"; - } else { - _struct_composite.conf.w_srv_cgi_search_script_raw_fn_d = "spine_search.d"; - } if ("cgi_port" in _yaml["webserv"] && _yaml["webserv"]["cgi_port"].type.string && _yaml["webserv"]["cgi_port"].tag.match(rgx.yaml_tag_is_str) @@ -769,66 +908,14 @@ if ("webserv" in _yaml : _struct_composite.conf.w_srv_host ~ _struct_composite.conf.w_srv_cgi_bin_subpath; } - if (_opt_action.cgi_url_action.length > 0) { - _struct_composite.conf.w_srv_cgi_action = _opt_action.cgi_url_action; - } 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 if (_opt_action.cgi_sqlite_search_filename.length > 0) { // WORKON - _struct_composite.conf.w_srv_cgi_action = _struct_composite.conf.w_srv_cgi_bin_url ~ "/" ~ _opt_action.cgi_sqlite_search_filename; - } 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 (_opt_action.sqliteDB_filename.length > 0) { - _struct_composite.conf.w_srv_db_sqlite_filename = _opt_action.sqliteDB_filename; - } else if ("db_sqlite_filename" in _yaml["webserv"] - && _yaml["webserv"]["db_sqlite_filename"].type.string - && _yaml["webserv"]["db_sqlite_filename"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_db_sqlite_filename = _yaml["webserv"]["db_sqlite_filename"].get!string; - } else { // set default ? - } - if (_opt_action.sqliteDB_path.length > 0) { - _struct_composite.conf.w_srv_db_sqlite_path = _opt_action.sqliteDB_path; - } else if ("db_sqlite_path" in _yaml["webserv"] - && _yaml["webserv"]["db_sqlite_path"].type.string - && _yaml["webserv"]["db_sqlite_path"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_db_sqlite_path = _yaml["webserv"]["db_sqlite_path"].get!string; - } else { // set default ? - } - } -} -if (!(_struct_composite.conf.output_path)) { - _struct_composite.conf.output_path = ((_manifested.output.path).asNormalizedPath).array; -} -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 - && _yaml["output"].tag.match(rgx.yaml_tag_is_map) - ) { - if ("path" in _yaml["output"] - && _yaml["output"]["path"].type.string - && _yaml["output"]["path"].tag.match(rgx.yaml_tag_is_str) - ) { - if (_manifested.output.path == _manifested.env.pwd - && _yaml["output"]["path"].get!string.length > 0 - ) { - _struct_composite.conf.output_path = (((_yaml["output"]["path"].get!string).expandTilde).asNormalizedPath).array; - } - } - } } +// make (in: conf, make, meta)? if ("processing" in _yaml && _yaml["processing"].type.sequence ) { @@ -1054,6 +1141,163 @@ if ("search" in _yaml } #+END_SRC +** make + +#+NAME: yaml_objects_make +#+BEGIN_SRC d +/+ make ------------------------------------------------------------------- +/ +if ("make" in _yaml + && _yaml["make"].type.sequence +) { + if (_yaml["make"].type.mapping + && _yaml["make"].tag.match(rgx.yaml_tag_is_map) + ) { + if ("bold" in _yaml["make"] + && _yaml["make"]["bold"].type.string + && _yaml["make"]["bold"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.make_str.bold = _yaml["make"]["bold"].get!string; + } + if ("breaks" in _yaml["make"] + && _yaml["make"]["breaks"].type.string + && _yaml["make"]["breaks"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.make_str.breaks = _yaml["make"]["breaks"].get!string; + } + if ("cover_image" in _yaml["make"] + && _yaml["make"]["cover_image"].type.string + && _yaml["make"]["cover_image"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.make_str.cover_image = _yaml["make"]["cover_image"].get!string; + } + if ("css" in _yaml["make"] + && _yaml["make"]["css"].type.string + && _yaml["make"]["css"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.make_str.css = _yaml["make"]["css"].get!string; + } + if ("emphasis" in _yaml["make"] + && _yaml["make"]["emphasis"].type.string + && _yaml["make"]["emphasis"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.make_str.emphasis = _yaml["make"]["emphasis"].get!string; + } + if ("footer" in _yaml["make"] + && _yaml["make"]["footer"].type.string + && _yaml["make"]["footer"].tag.match(rgx.yaml_tag_is_str) + ) { + char[][] __match_footer_array + = (cast(char[]) _yaml["make"]["footer"].get!string) + .split(rgx.make_heading_delimiter); + _struct_composite.make_str.footer = __match_footer_array.to!(string[]); + } + if ("headings" in _yaml["make"] + && _yaml["make"]["headings"].type.string + && _yaml["make"]["headings"].tag.match(rgx.yaml_tag_is_str) + ) { + char[][] __match_headings_array + = (cast(char[]) _yaml["make"]["headings"].get!string) + .split(rgx.make_heading_delimiter); + _struct_composite.make_str.headings = __match_headings_array.to!(string[]); + } else if ("headings" in _yaml["make"] + && _yaml["make"]["headings"].type.string + && _yaml["make"]["headings"].tag.match(rgx.yaml_tag_is_seq) + ) { + foreach(string identify_heading_level; _yaml["make"]["headings"]) { + _struct_composite.make_str.headings ~= identify_heading_level; + } + } + if ("home_button_image" in _yaml["make"] + && _yaml["make"]["home_button_image"].type.string + && _yaml["make"]["home_button_image"].tag.match(rgx.yaml_tag_is_str) + ) { + char[][] __match_home_button_image_array + = (cast(char[]) _yaml["make"]["home_button_image"].get!string) + .split(rgx.make_heading_delimiter); + _struct_composite.make_str.home_button_image = __match_home_button_image_array.to!(string[]); + } + if ("home_button_text" in _yaml["make"] + && _yaml["make"]["home_button_text"].type.string + && _yaml["make"]["home_button_text"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.make_str.home_button_text = _yaml["make"]["home_button_text"].get!string; + } else if ("home_button_text" in _yaml["make"] + && _yaml["make"]["home_button_text"].type.string + && _yaml["make"]["home_button_text"].tag.match(rgx.yaml_tag_is_seq) + ) { + _struct_composite.make_str.home_button_text = ""; + foreach(string hbt; _yaml["make"]["home_button_text"]) { + _struct_composite.make_str.home_button_text ~= hbt ~ "; "; + } + } + if ("italics" in _yaml["make"] + && _yaml["make"]["italics"].type.string + && _yaml["make"]["italics"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.make_str.italics = _yaml["make"]["italics"].get!string; + } + if ("auto_num_top_at_level" in _yaml["make"] + && _yaml["make"]["auto_num_top_at_level"].type.string + && _yaml["make"]["auto_num_top_at_level"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.make_str.auto_num_top_at_level = _yaml["make"]["auto_num_top_at_level"].get!string; + switch (_yaml["make"]["auto_num_top_at_level"].get!string) { + case "A": + break; + case "B": _struct_composite.make_str.auto_num_top_lv = 1; + break; + case "C": _struct_composite.make_str.auto_num_top_lv = 2; + break; + case "D": _struct_composite.make_str.auto_num_top_lv = 3; + break; + case "1": _struct_composite.make_str.auto_num_top_lv = 4; + break; + case "2": _struct_composite.make_str.auto_num_top_lv = 5; + break; + case "3": _struct_composite.make_str.auto_num_top_lv = 6; + break; + case "4": _struct_composite.make_str.auto_num_top_lv = 7; + break; + default: + break; + } + } + if ("auto_num_depth" in _yaml["make"] + && _yaml["make"]["auto_num_depth"].type.string + && _yaml["make"]["auto_num_depth"].tag.match(rgx.yaml_tag_is_int) + ) { // not sure implemented for documents + _struct_composite.make_str.auto_num_depth = _yaml["make"]["auto_num_depth"].get!int; + } else if ("auto_num_depth" in _yaml["make"] + && _yaml["make"]["auto_num_depth"].type.string + && _yaml["make"]["auto_num_depth"].tag.match(rgx.yaml_tag_is_str) + ) { // not sure implemented for documents + _struct_composite.make_str.auto_num_depth = _yaml["make"]["auto_num_depth"].get!int; + } + if ("texpdf_font" in _yaml["make"] + && _yaml["make"]["texpdf_font"].type.string + ) { + _struct_composite.make_str.texpdf_font = _yaml["make"]["texpdf_font"].get!string; + } + } + _struct_composite.make.bold = _mk.bold(_struct_composite.make_str.bold); + _struct_composite.make.breaks = _mk.breaks(_struct_composite.make_str.breaks); + _struct_composite.make.cover_image = _mk.cover_image(_struct_composite.make_str.cover_image); + _struct_composite.make.css = _mk.css(_struct_composite.make_str.css); + _struct_composite.make.emphasis = _mk.emphasis(_struct_composite.make_str.emphasis); + _struct_composite.make.footer = _mk.footer(_struct_composite.make_str.footer); + _struct_composite.make.headings = _mk.headings(_struct_composite.make_str.headings); + _struct_composite.make.home_button_image = _mk.home_button_image(_struct_composite.make_str.home_button_image); + _struct_composite.make.home_button_text = _mk.home_button_text(_struct_composite.make_str.home_button_text); + _struct_composite.make.italics = _mk.italics(_struct_composite.make_str.italics); + _struct_composite.make.auto_num_top_at_level = _mk.auto_num_top_at_level(_struct_composite.make_str.auto_num_top_at_level); + _struct_composite.make.auto_num_top_lv = _mk.auto_num_top_lv(_struct_composite.make_str.auto_num_top_lv); + _struct_composite.make.auto_num_depth = _mk.auto_num_depth(_struct_composite.make_str.auto_num_depth); + _struct_composite.make.substitute = _mk.substitute(_struct_composite.make_str.substitute); + _struct_composite.make.texpdf_font = _mk.texpdf_font(_struct_composite.make_str.texpdf_font); +} + +#+END_SRC + ** meta #+NAME: yaml_objects_meta @@ -2112,11 +2356,12 @@ template configParseYAMLreturnSpineStruct() { doc_reform.meta.conf_make_meta_structs, doc_reform.meta.conf_make_meta_json; mixin contentYAMLtoSpineStruct; - @system auto configParseYAMLreturnSpineStruct(T,CCm,M,O)( + @system auto configParseYAMLreturnSpineStruct(T,CCm,M,O,Cfg)( T _document_struct, CCm _make_and_meta_struct, M _manifested, - O _opt_action + O _opt_action, + Cfg _cfg ){ Node _yaml; if (_document_struct.content.length > 0) { @@ -2129,7 +2374,7 @@ template configParseYAMLreturnSpineStruct() { } try { _make_and_meta_struct - = contentYAMLtoSpineStruct!()(_make_and_meta_struct, _yaml, _manifested, _opt_action, _document_struct.filename); + = contentYAMLtoSpineStruct!()(_make_and_meta_struct, _yaml, _manifested, _opt_action, _cfg, _document_struct.filename); } catch (Throwable) { import std.stdio; writeln("ERROR failed to convert yaml to struct: ", _document_struct.filename); @@ -2163,11 +2408,12 @@ template docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct() { mixin spineRgxIn; mixin contentJSONtoSpineStruct; static auto rgx = RgxI(); - @system auto docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct(CCm,Src,M,O)( + @system auto docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct(CCm,Src,M,O,Cfg)( Src header_src, CCm _make_and_meta_struct, M _manifested, O _opt_action, + Cfg _cfg, ) { Node _yaml; try { @@ -2175,7 +2421,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, _opt_action, "header"); + return contentYAMLtoSpineStruct!()(_make_and_meta_struct, _yaml, _manifested, _opt_action, _cfg, "header"); } catch (Throwable) { writeln("ERROR failed to read document header, header not parsed as yaml: ", _manifested.src.filename); return _make_and_meta_struct; diff --git a/org/out_cgi_search_sqlite.org b/org/out_cgi_search_sqlite.org index 6b41da8..f65b1b7 100644 --- a/org/out_cgi_search_sqlite.org +++ b/org/out_cgi_search_sqlite.org @@ -140,7 +140,7 @@ mixin GenericMain!cgi_function_intro; make_and_meta_struct.conf.output_path ~ "/sqlite/", _sqlite_db_fn, (opt_action.cgi_search_title.empty) - ? make_and_meta_struct.conf.w_srv_cgi_search_title + ? make_and_meta_struct.conf.w_srv_cgi_search_form_title : opt_action.cgi_search_title, (opt_action.css_theme_default) ? "FFFFFF" : "000000", (opt_action.css_theme_default) ? "000000" : "CCCCCC", @@ -160,7 +160,7 @@ mixin GenericMain!cgi_function_intro; (opt_action.css_theme_default) ? "000000" : "FFFF48", (opt_action.css_theme_default) ? "FFFF48" : "777748", (opt_action.cgi_search_title.empty) - ? make_and_meta_struct.conf.w_srv_cgi_search_title + ? make_and_meta_struct.conf.w_srv_cgi_search_form_title : opt_action.cgi_search_title, (opt_action.css_theme_default) ? "222222" : "AAAAAA", _cgi_search_script, diff --git a/org/spine.org b/org/spine.org index 805524d..fa246b9 100644 --- a/org/spine.org +++ b/org/spine.org @@ -393,48 +393,30 @@ bool[string] opts = [ ***** initialize settings -NOTES on configuration hierarchy: -- compile time program defaults views/configuration.txt in config_d_cfte.org - - config_d_cfte.org (writes views/configuration.txt) - - compile time program defaults, set in views/configuration.txt - - found in: _cfg.* -- run time default configuration administrators config ".dr/config_site_local" - - in_source_files.org readConfigSite (reads administrators site defaults from - yaml config file) - - meta_conf_make_meta.org struct ConfCompositeSiteLocal - - administrator site defaults read from yaml configuration file - ".dr/config_site_local" - - found in: "doc_matters.conf_make_meta.conf." (incorporates _cfg.* as - initial default values that are overridden if set) - - ("conf_make_meta.make" (& "conf_make_meta.meta") also available taken from - document headers) -- command line execution configuration instruction - - spine.org (org heading: initialize settings) (command line overrides) - - command line settings/overrides - - found in: doc_matters.opt.action.* +NOTES on configuration hierarchy: see meta_conf_make_meta.org #+NAME: spine_args_init_settings #+BEGIN_SRC d string[string] settings = [ - "output" : "", //_cfg.www_doc_root, // "/srv/www/spine/static" or "/var/www/html" - "www-http" : "", //_cfg.www_http, // "http" or "https" - "www-host" : "", //_cfg.www_host, // start with "localhost" ? - "www-host-doc-root" : "", //_cfg.www_host_doc_root, // start with "localhost" ? - "www-url-doc-root" : "", //_cfg.www_url_doc_root, // start with "http://localhost" ? - "cgi-http" : "", //_cfg.cgi_http, // suggest - "cgi-host" : "", //_cfg.cgi_host, // suggest - "cgi-bin-root" : "", //_cfg.cgi_bin_root, // suggest "/var/www/cgi/cgi-bin" - "cgi-sqlite-search-filename" : "", //_cfg.cgi_filename, // suggest "spine_search" (though "spine-search" would have been preferable?) - "cgi-url-root" : "", //_cfg.cgi_url_root, // start with "http://localhost/cgi-bin" ? - "cgi-url-action" : "", //_cfg.cgi_url_action, // start with "http://localhost/cgi-bin/spine-search" - "cgi-search-title" : "", //_cfg.cgi_search_form_title, // e.g. "≅ SiSU Spine search" + "output" : "", + "www-http" : "", + "www-host" : "", + "www-host-doc-root" : "", + "www-url-doc-root" : "", + "cgi-http" : "", + "cgi-host" : "", + "cgi-bin-root" : "", + "cgi-sqlite-search-filename" : "", + "cgi-url-root" : "", + "cgi-url-action" : "", + "cgi-search-title" : "", "config" : "", - "lang" : "all", //_cfg.default_language, // suggest "all" or "en" (default which language to process) - "set-papersize" : "", //_cfg.default_papersize, // suggest: a4 - "set-textwrap" : "", //_cfg.default_text_wrap, // suggest: 80 - "set-digest" : "", //_cfg.default_hash_digest, // suggest: sha256 - "sqlite-db-path" : "", //_cfg.db_sqlite_path, // suggest: "/var/www/sqlite" - "sqlite-db-filename" : "", //_cfg.db_sqlite_filename, // suggest: "spine-search.db" + "lang" : "all", + "set-papersize" : "", + "set-textwrap" : "", + "set-digest" : "", + "sqlite-db-path" : "", + "sqlite-db-filename" : "", ]; #+END_SRC @@ -449,10 +431,10 @@ auto helpInfo = getopt(args, "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-bin-root", "path to cgi-bin directory", &settings["cgi-bin-root"], - "cgi-sqlite-search-filename", "cgi-bin sqlite search form name", &settings["cgi-sqlite-search-filename"], "cgi-url-root", "url to cgi-bin (to find cgi-bin)", &settings["cgi-url-root"], "cgi-url-action", "url to post to cgi-bin search form", &settings["cgi-url-action"], - "cgi-search-title", "title for cgi-bin search form", &settings["cgi-search-title"], + "cgi-search-title", "if generating a cgi search form the title to use for it", &settings["cgi-search-title"], + "cgi-sqlite-search-filename", "=[filename] default is spine-search", &settings["cgi-sqlite-search-filename"], "concordance", "file for document", &opts["concordance"], "curate", "extract info on authors & topics from document header metadata", &opts["curate"], "curate-authors", "extract info on authors from document header metadata", &opts["curate-authors"], @@ -467,6 +449,7 @@ 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"], @@ -474,6 +457,7 @@ 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"], @@ -501,6 +485,8 @@ auto helpInfo = getopt(args, "sqlite-discrete", "process discrete sqlite output", &opts["sqlite-discrete"], "sqlite-db-create", "create db, create tables", &opts["sqlite-db-create"], "sqlite-db-drop", "drop tables & db", &opts["sqlite-db-drop"], + "sqlite-db-filename", "sqlite db to create, populate & make available for search", &settings["sqlite-db-filename"], + "sqlite-db-path", "sqlite db path", &settings["sqlite-db-path"], "sqlite-db-recreate", "create db, create tables", &opts["sqlite-db-recreate"], "sqlite-delete", "sqlite output", &opts["sqlite-delete"], "sqlite-insert", "sqlite output", &opts["sqlite-insert"], @@ -517,13 +503,7 @@ 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-search-title", "if generating a cgi search form the title to use for it", &settings["cgi-search-title"], - "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"], - "sqlite-db-path", "sqlite db path", &settings["sqlite-db-path"], - "sqlite-db-filename", "sqlite db to create, populate & make available for search", &settings["sqlite-db-filename"], // "sqlite-db-filename", "=[filename].sql.db", &settings["sqlite-db-filename"], ); if (helpInfo.helpWanted) { @@ -723,12 +703,6 @@ struct OptActions { @trusted string cgi_bin_root() { return settings["cgi-bin-root"]; } - @trusted string cgi_url_root() { - return settings["cgi-url-root"]; - } - @trusted string cgi_url_action() { - return settings["cgi-url-action"]; - } @trusted string cgi_search_title() { return settings["cgi-search-title"]; } @@ -740,6 +714,12 @@ struct OptActions { ? (settings["cgi-sqlite-search-filename"].translate(['-' : "_"]) ~ ".d") : ""; } + @trusted string cgi_url_root() { + return settings["cgi-url-root"]; + } + @trusted string cgi_url_action() { + return settings["cgi-url-action"]; + } @trusted string hash_digest_type() { return settings["set-digest"]; } @@ -749,16 +729,16 @@ struct OptActions { @trusted string latex_papersize() { return settings["set-papersize"]; } - @trusted string webserver_host_name() { + @trusted string webserver_host_name() { return settings["www-host"]; } - @trusted string webserver_host_doc_root() { + @trusted string webserver_host_doc_root() { return settings["www-host-doc-root"]; } - @trusted string webserver_url_doc_root() { + @trusted string webserver_url_doc_root() { return settings["www-url-doc-root"]; } - @trusted string webserver_http() { + @trusted string webserver_http() { return settings["www-http"]; } @trusted bool parallelise() { @@ -932,7 +912,7 @@ if ( _conf_file_details = configFilePaths!()(_manifested, _env, _opt_action.config_path_set); auto _config_local_site_struct = readConfigSite!()(_conf_file_details, _opt_action, _cfg); import doc_reform.meta.conf_make_meta_yaml; - _siteConfig = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_siteConfig, _manifested, _opt_action); // - get local site config + _siteConfig = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_siteConfig, _manifested, _opt_action, _cfg); // - get local site config break; } } @@ -940,7 +920,7 @@ if ( } else { /+ local site config +/ auto _config_local_site_struct = readConfigSite!()(_conf_file_details, _opt_action, _cfg); import doc_reform.meta.conf_make_meta_yaml; - _siteConfig = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_siteConfig, _manifested, _opt_action); // - get local site config + _siteConfig = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_siteConfig, _manifested, _opt_action, _cfg); // - get local site config } if (_opt_action.show_config) { import doc_reform.meta.metadoc_show_config; @@ -1143,7 +1123,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, _opt_action); + _make_and_meta_struct = _config_document_struct.configParseYAMLreturnSpineStruct!()(_make_and_meta_struct, _manifest, _opt_action, _cfg); } #+END_SRC @@ -1190,7 +1170,7 @@ if ((_opt_action.debug_do) ) { writeln("--->\nstepX commence → (document abstraction)"); } -auto t = spineAbstraction!()(_env, program_info, _opt_action, manifest, _make_and_meta_struct); +auto t = spineAbstraction!()(_env, program_info, _opt_action, _cfg, manifest, _make_and_meta_struct); static assert(t.length==2); auto doc_abstraction = t[dAM.abstraction]; auto doc_matters = t[dAM.matters]; @@ -1357,10 +1337,11 @@ template spineAbstraction() { enum makeMeta { make, meta } enum docAbst { doc_abstract_obj, doc_has } static auto rgx = RgxI(); - @system auto spineAbstraction(E,P,O,M,S)( + @system auto spineAbstraction(E,P,O,Cfg,M,S)( E _env, P program_info, O _opt_action, + Cfg _cfg, M _manifest, S _make_and_meta_struct ){ @@ -1463,6 +1444,7 @@ _make_and_meta_struct = _make_and_meta_struct, _manifest, _opt_action, + _cfg, ); if ((_opt_action.debug_do) || (_opt_action.very_verbose) diff --git a/src/doc_reform/io_out/cgi_sqlite_search_form.d b/src/doc_reform/io_out/cgi_sqlite_search_form.d index 092e882..fb3febb 100644 --- a/src/doc_reform/io_out/cgi_sqlite_search_form.d +++ b/src/doc_reform/io_out/cgi_sqlite_search_form.d @@ -1848,7 +1848,7 @@ mixin GenericMain!cgi_function_intro; make_and_meta_struct.conf.output_path ~ "/sqlite/", _sqlite_db_fn, (opt_action.cgi_search_title.empty) - ? make_and_meta_struct.conf.w_srv_cgi_search_title + ? make_and_meta_struct.conf.w_srv_cgi_search_form_title : opt_action.cgi_search_title, (opt_action.css_theme_default) ? "FFFFFF" : "000000", (opt_action.css_theme_default) ? "000000" : "CCCCCC", @@ -1868,7 +1868,7 @@ mixin GenericMain!cgi_function_intro; (opt_action.css_theme_default) ? "000000" : "FFFF48", (opt_action.css_theme_default) ? "FFFF48" : "777748", (opt_action.cgi_search_title.empty) - ? make_and_meta_struct.conf.w_srv_cgi_search_title + ? make_and_meta_struct.conf.w_srv_cgi_search_form_title : opt_action.cgi_search_title, (opt_action.css_theme_default) ? "222222" : "AAAAAA", _cgi_search_script, diff --git a/src/doc_reform/meta/conf_make_meta_structs.d b/src/doc_reform/meta/conf_make_meta_structs.d index 2a95379..dc9d635 100644 --- a/src/doc_reform/meta/conf_make_meta_structs.d +++ b/src/doc_reform/meta/conf_make_meta_structs.d @@ -206,7 +206,6 @@ struct ConfCompositeSiteLocal { string w_srv_cgi_host; // if not set same as webserv_host string w_srv_cgi_bin_subpath; string w_srv_cgi_bin_path; - string w_srv_cgi_search_title; string w_srv_cgi_search_script; string w_srv_cgi_search_script_raw_fn_d; string w_srv_cgi_port; diff --git a/src/doc_reform/meta/conf_make_meta_yaml.d b/src/doc_reform/meta/conf_make_meta_yaml.d index 6d4a2b1..ef40a09 100644 --- a/src/doc_reform/meta/conf_make_meta_yaml.d +++ b/src/doc_reform/meta/conf_make_meta_yaml.d @@ -70,982 +70,1092 @@ template contentYAMLtoSpineStruct() { doc_reform.meta.defaults, doc_reform.meta.rgx; ConfComposite _struct_composite; - @system auto contentYAMLtoSpineStruct(C,Y,M,O)( - C _struct_composite, - Y _yaml, - M _manifested, - O _opt_action, + @system auto contentYAMLtoSpineStruct(C,Y,M,O,Cfg)( + C _struct_composite, + Y _yaml, + M _manifested, + O _opt_action, + Cfg _cfg, string _identifier ) { mixin spineRgxIn; static auto rgx = RgxI(); confCompositeMakeBuild _mk; - /+ make ------------------------------------------------------------------- +/ - if ("make" in _yaml - && _yaml["make"].type.sequence - ) { - if (_yaml["make"].type.mapping - && _yaml["make"].tag.match(rgx.yaml_tag_is_map) - ) { - if ("bold" in _yaml["make"] - && _yaml["make"]["bold"].type.string - && _yaml["make"]["bold"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.make_str.bold = _yaml["make"]["bold"].get!string; - } - if ("breaks" in _yaml["make"] - && _yaml["make"]["breaks"].type.string - && _yaml["make"]["breaks"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.make_str.breaks = _yaml["make"]["breaks"].get!string; - } - if ("cover_image" in _yaml["make"] - && _yaml["make"]["cover_image"].type.string - && _yaml["make"]["cover_image"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.make_str.cover_image = _yaml["make"]["cover_image"].get!string; - } - if ("css" in _yaml["make"] - && _yaml["make"]["css"].type.string - && _yaml["make"]["css"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.make_str.css = _yaml["make"]["css"].get!string; - } - if ("emphasis" in _yaml["make"] - && _yaml["make"]["emphasis"].type.string - && _yaml["make"]["emphasis"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.make_str.emphasis = _yaml["make"]["emphasis"].get!string; - } - if ("footer" in _yaml["make"] - && _yaml["make"]["footer"].type.string - && _yaml["make"]["footer"].tag.match(rgx.yaml_tag_is_str) - ) { - char[][] __match_footer_array - = (cast(char[]) _yaml["make"]["footer"].get!string) - .split(rgx.make_heading_delimiter); - _struct_composite.make_str.footer = __match_footer_array.to!(string[]); - } - if ("headings" in _yaml["make"] - && _yaml["make"]["headings"].type.string - && _yaml["make"]["headings"].tag.match(rgx.yaml_tag_is_str) - ) { - char[][] __match_headings_array - = (cast(char[]) _yaml["make"]["headings"].get!string) - .split(rgx.make_heading_delimiter); - _struct_composite.make_str.headings = __match_headings_array.to!(string[]); - } else if ("headings" in _yaml["make"] - && _yaml["make"]["headings"].type.string - && _yaml["make"]["headings"].tag.match(rgx.yaml_tag_is_seq) - ) { - foreach(string identify_heading_level; _yaml["make"]["headings"]) { - _struct_composite.make_str.headings ~= identify_heading_level; - } - } - if ("home_button_image" in _yaml["make"] - && _yaml["make"]["home_button_image"].type.string - && _yaml["make"]["home_button_image"].tag.match(rgx.yaml_tag_is_str) - ) { - char[][] __match_home_button_image_array - = (cast(char[]) _yaml["make"]["home_button_image"].get!string) - .split(rgx.make_heading_delimiter); - _struct_composite.make_str.home_button_image = __match_home_button_image_array.to!(string[]); - } - if ("home_button_text" in _yaml["make"] - && _yaml["make"]["home_button_text"].type.string - && _yaml["make"]["home_button_text"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.make_str.home_button_text = _yaml["make"]["home_button_text"].get!string; - } else if ("home_button_text" in _yaml["make"] - && _yaml["make"]["home_button_text"].type.string - && _yaml["make"]["home_button_text"].tag.match(rgx.yaml_tag_is_seq) - ) { - _struct_composite.make_str.home_button_text = ""; - foreach(string hbt; _yaml["make"]["home_button_text"]) { - _struct_composite.make_str.home_button_text ~= hbt ~ "; "; + if (_identifier != "header") { // called only once per run anyway + /+ conf ------------------------------------------------------------------- +/ + /+ + _cfg. build defaults (else program runtime defaults) + local_site_configuration defaults + command line overrides + +/ + { + if (_opt_action.webserver_http.length > 0) { + _struct_composite.conf.w_srv_http + = _opt_action.webserver_http; + } else { + _struct_composite.conf.w_srv_http + = (_cfg.www_http.empty) + ? "http" + : _cfg.www_http; + if (("webserv" in _yaml && _yaml["webserv"].type.sequence) + && (_yaml["webserv"].type.mapping + && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + ) { + if ("http" in _yaml["webserv"] + && _yaml["webserv"]["http"].type.string + && _yaml["webserv"]["http"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_http + = _yaml["webserv"]["http"].get!string; + } } } - if ("italics" in _yaml["make"] - && _yaml["make"]["italics"].type.string - && _yaml["make"]["italics"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.make_str.italics = _yaml["make"]["italics"].get!string; - } - if ("auto_num_top_at_level" in _yaml["make"] - && _yaml["make"]["auto_num_top_at_level"].type.string - && _yaml["make"]["auto_num_top_at_level"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.make_str.auto_num_top_at_level = _yaml["make"]["auto_num_top_at_level"].get!string; - switch (_yaml["make"]["auto_num_top_at_level"].get!string) { - case "A": - break; - case "B": _struct_composite.make_str.auto_num_top_lv = 1; - break; - case "C": _struct_composite.make_str.auto_num_top_lv = 2; - break; - case "D": _struct_composite.make_str.auto_num_top_lv = 3; - break; - case "1": _struct_composite.make_str.auto_num_top_lv = 4; - break; - case "2": _struct_composite.make_str.auto_num_top_lv = 5; - break; - case "3": _struct_composite.make_str.auto_num_top_lv = 6; - break; - case "4": _struct_composite.make_str.auto_num_top_lv = 7; - break; - default: - break; + if (_opt_action.cgi_search_title.length > 0) { + _struct_composite.conf.w_srv_cgi_search_form_title + = _opt_action.cgi_search_title; + } else { + _struct_composite.conf.w_srv_cgi_search_form_title + = (_cfg.cgi_search_form_title.empty) + ? "≅ SiSU spine search form" + : _cfg.cgi_search_form_title; + if (("webserv" in _yaml && _yaml["webserv"].type.sequence) + && (_yaml["webserv"].type.mapping + && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + ) { + if ("cgi_search_form_title" in _yaml["webserv"] + && _yaml["webserv"]["cgi_search_form_title"].type.string + && _yaml["webserv"]["cgi_search_form_title"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_cgi_search_form_title + = _yaml["webserv"]["cgi_search_form_title"].get!string; + } } } - if ("auto_num_depth" in _yaml["make"] - && _yaml["make"]["auto_num_depth"].type.string - && _yaml["make"]["auto_num_depth"].tag.match(rgx.yaml_tag_is_int) - ) { // not sure implemented for documents - _struct_composite.make_str.auto_num_depth = _yaml["make"]["auto_num_depth"].get!int; - } else if ("auto_num_depth" in _yaml["make"] - && _yaml["make"]["auto_num_depth"].type.string - && _yaml["make"]["auto_num_depth"].tag.match(rgx.yaml_tag_is_str) - ) { // not sure implemented for documents - _struct_composite.make_str.auto_num_depth = _yaml["make"]["auto_num_depth"].get!int; - } - if ("texpdf_font" in _yaml["make"] - && _yaml["make"]["texpdf_font"].type.string - ) { - _struct_composite.make_str.texpdf_font = _yaml["make"]["texpdf_font"].get!string; - } - } - _struct_composite.make.bold = _mk.bold(_struct_composite.make_str.bold); - _struct_composite.make.breaks = _mk.breaks(_struct_composite.make_str.breaks); - _struct_composite.make.cover_image = _mk.cover_image(_struct_composite.make_str.cover_image); - _struct_composite.make.css = _mk.css(_struct_composite.make_str.css); - _struct_composite.make.emphasis = _mk.emphasis(_struct_composite.make_str.emphasis); - _struct_composite.make.footer = _mk.footer(_struct_composite.make_str.footer); - _struct_composite.make.headings = _mk.headings(_struct_composite.make_str.headings); - _struct_composite.make.home_button_image = _mk.home_button_image(_struct_composite.make_str.home_button_image); - _struct_composite.make.home_button_text = _mk.home_button_text(_struct_composite.make_str.home_button_text); - _struct_composite.make.italics = _mk.italics(_struct_composite.make_str.italics); - _struct_composite.make.auto_num_top_at_level = _mk.auto_num_top_at_level(_struct_composite.make_str.auto_num_top_at_level); - _struct_composite.make.auto_num_top_lv = _mk.auto_num_top_lv(_struct_composite.make_str.auto_num_top_lv); - _struct_composite.make.auto_num_depth = _mk.auto_num_depth(_struct_composite.make_str.auto_num_depth); - _struct_composite.make.substitute = _mk.substitute(_struct_composite.make_str.substitute); - _struct_composite.make.texpdf_font = _mk.texpdf_font(_struct_composite.make_str.texpdf_font); - } - - /+ conf ------------------------------------------------------------------- +/ - if ("webserv" in _yaml - && _yaml["webserv"].type.sequence - ) { - if (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map) - ) { - if ("http" in _yaml["webserv"] - && _yaml["webserv"]["http"].type.string - && _yaml["webserv"]["http"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_http = _yaml["webserv"]["http"].get!string; - } // else { set default? } - if ("data_http" in _yaml["webserv"] - && _yaml["webserv"]["data_http"].type.string - && _yaml["webserv"]["data_http"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_data_http = _yaml["webserv"]["data_http"].get!string; - } - if ("cgi_http" in _yaml["webserv"] - && _yaml["webserv"]["cgi_http"].type.string - && _yaml["webserv"]["cgi_http"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_cgi_http = _yaml["webserv"]["cgi_http"].get!string; - } - if ("host" in _yaml["webserv"] - && _yaml["webserv"]["host"].type.string - && _yaml["webserv"]["host"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_host = _yaml["webserv"]["host"].get!string; - } - // if ("data_root_url" in _yaml["webserv"] - // && _yaml["webserv"]["data_root_url"].type.string - // && _yaml["webserv"]["data_root_url"].tag.match(rgx.yaml_tag_is_str) - // ) { - // _struct_composite.conf.w_srv_data_root_url = _yaml["webserv"]["data_root_url"].get!string; - // if (auto m = _struct_composite.conf.w_srv_data_root_url.match(rgx.webserv_url_doc_root)) { - // _struct_composite.conf.w_srv_url_host = m.captures[2].to!string; - // _struct_composite.conf.w_srv_url_doc_path = m.captures[3].to!string; - // } - // } - if ("data_root_path" in _yaml["webserv"] - && _yaml["webserv"]["data_root_path"].type.string - && _yaml["webserv"]["data_root_path"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_data_root_path = _yaml["webserv"]["data_root_path"].get!string; - } - if ("data_root_part" in _yaml["webserv"] - && _yaml["webserv"]["data_root_part"].type.string - && _yaml["webserv"]["data_root_part"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_data_root_part = _yaml["webserv"]["data_root_part"].get!string; - } - if ("images_root_part" in _yaml["webserv"] - && _yaml["webserv"]["images_root_part"].type.string - && _yaml["webserv"]["images_root_part"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_images_root_part = _yaml["webserv"]["images_root_part"].get!string; - } - if ("data_root_url" in _yaml["webserv"] - && _yaml["webserv"]["data_root_url"].type.string - && _yaml["webserv"]["data_root_url"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_data_root_url = _yaml["webserv"]["data_root_url"].get!string; - _struct_composite.conf.w_srv_data_root_url_html = - _yaml["webserv"]["data_root_url"].get!string ~ "/" - ~ _manifested.src.language ~ "/" - ~ "html"; + if (_opt_action.cgi_sqlite_search_filename.length > 0) { + _struct_composite.conf.w_srv_cgi_search_script + = _opt_action.cgi_sqlite_search_filename; } else { - _struct_composite.conf.w_srv_data_root_url = _struct_composite.conf.w_srv_data_root_part; - _struct_composite.conf.w_srv_data_root_url_html = - _struct_composite.conf.w_srv_data_root_part ~ "/" - ~ _manifested.src.language ~ "/" - ~ "html"; - } - if ("cgi_host" in _yaml["webserv"] - && _yaml["webserv"]["cgi_host"].type.string - && _yaml["webserv"]["cgi_host"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_cgi_host = _yaml["webserv"]["cgi_host"].get!string; - } else { // composite construct - _struct_composite.conf.w_srv_cgi_host = _struct_composite.conf.w_srv_host; - } - if ("cgi_search_form_title" in _yaml["webserv"] - && _yaml["webserv"]["cgi_search_form_title"].type.string - && _yaml["webserv"]["cgi_search_form_title"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_cgi_search_form_title = _yaml["webserv"]["cgi_search_form_title"].get!string; - } - if ("cgi_bin_subpath" in _yaml["webserv"] - && _yaml["webserv"]["cgi_bin_subpath"].type.string - && _yaml["webserv"]["cgi_bin_subpath"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_cgi_bin_subpath = _yaml["webserv"]["cgi_bin_subpath"].get!string; - } - if ("cgi_bin_path" in _yaml["webserv"] - && _yaml["webserv"]["cgi_bin_path"].type.string - && _yaml["webserv"]["cgi_bin_path"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_cgi_bin_path = _yaml["webserv"]["cgi_bin_path"].get!string; + _struct_composite.conf.w_srv_cgi_search_script + = (_cfg.cgi_filename.empty) + ? "spine_search" + : _cfg.cgi_filename; + if (("webserv" in _yaml && _yaml["webserv"].type.sequence) + && (_yaml["webserv"].type.mapping + && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + ) { + 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) + ) { + _struct_composite.conf.w_srv_cgi_search_script + = _yaml["webserv"]["cgi_search_script"].get!string; + } + } } - if (_opt_action.cgi_search_title.length > 0) { - _struct_composite.conf.w_srv_cgi_search_title = _opt_action.cgi_search_title; - } else if ("cgi_search_title" in _yaml["webserv"] - && _yaml["webserv"]["cgi_search_title"].type.string - && _yaml["webserv"]["cgi_search_title"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_cgi_search_title = _yaml["webserv"]["cgi_search_title"].get!string; + if (_opt_action.sqliteDB_filename.length > 0) { + _struct_composite.conf.w_srv_db_sqlite_filename + = _opt_action.sqliteDB_filename; } else { - _struct_composite.conf.w_srv_cgi_search_title = "≅ SiSU spine search form"; + _struct_composite.conf.w_srv_db_sqlite_filename + = (_cfg.db_sqlite_filename.empty) + ? "spine.search.db" + : _cfg.db_sqlite_filename; + if (("webserv" in _yaml && _yaml["webserv"].type.sequence) + && (_yaml["webserv"].type.mapping + && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + ) { + if ("db_sqlite_filename" in _yaml["webserv"] + && _yaml["webserv"]["db_sqlite_filename"].type.string + && _yaml["webserv"]["db_sqlite_filename"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_db_sqlite_filename + = _yaml["webserv"]["db_sqlite_filename"].get!string; + } + } } - 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) - ) { - _struct_composite.conf.w_srv_cgi_search_script = _yaml["webserv"]["cgi_search_script"].get!string; + if (_opt_action.sqliteDB_path.length > 0) { + _struct_composite.conf.w_srv_db_sqlite_path + = _opt_action.sqliteDB_path; } else { - _struct_composite.conf.w_srv_cgi_search_script = "spine_search"; + _struct_composite.conf.w_srv_db_sqlite_path + = (_cfg.db_sqlite_path.empty) + ? "/var/www/sqlite" + : _cfg.db_sqlite_path; + if (("webserv" in _yaml && _yaml["webserv"].type.sequence) + && (_yaml["webserv"].type.mapping + && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + ) { + if ("db_sqlite_path" in _yaml["webserv"] + && _yaml["webserv"]["db_sqlite_path"].type.string + && _yaml["webserv"]["db_sqlite_path"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_db_sqlite_path + = _yaml["webserv"]["db_sqlite_path"].get!string; + } + } } - 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) - ) { - _struct_composite.conf.w_srv_cgi_search_script_raw_fn_d = _yaml["webserv"]["cgi_search_script_raw_fn_d"].get!string; - } 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) - ) { - _struct_composite.conf.w_srv_cgi_search_script_raw_fn_d = (_yaml["webserv"]["cgi_search_script"].get!string).translate(['-' : "_"]) ~ ".d"; + if (_opt_action.cgi_url_action.length > 0) { + _struct_composite.conf.w_srv_cgi_action + = _opt_action.cgi_url_action; } else { - _struct_composite.conf.w_srv_cgi_search_script_raw_fn_d = "spine_search.d"; - } - if ("cgi_port" in _yaml["webserv"] - && _yaml["webserv"]["cgi_port"].type.string - && _yaml["webserv"]["cgi_port"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_cgi_port = _yaml["webserv"]["cgi_port"].get!string; + _struct_composite.conf.w_srv_cgi_action + = (_cfg.www_url_doc_root.empty) + ? "http://locahost" // "https://sisudoc.org" + : _cfg.www_url_doc_root; + if (("webserv" in _yaml && _yaml["webserv"].type.sequence) + && (_yaml["webserv"].type.mapping + && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + ) { + 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 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; + } + } } - if ("cgi_user" in _yaml["webserv"] - && _yaml["webserv"]["cgi_user"].type.string - && _yaml["webserv"]["cgi_user"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_cgi_user = _yaml["webserv"]["cgi_user"].get!string; + if (!(_struct_composite.conf.output_path)) { + _struct_composite.conf.output_path = ((_manifested.output.path).asNormalizedPath).array; + } { + if (_opt_action.output_dir_set.length > 0) { + _struct_composite.conf.output_path + = (_opt_action.output_dir_set.asNormalizedPath).array; + } else { + _struct_composite.conf.output_path + = (_cfg.www_doc_root.empty) + ? "/srv/www/spine" + : _cfg.www_doc_root; + if (("webserv" in _yaml && _yaml["webserv"].type.sequence) + && (_yaml["webserv"].type.mapping + && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + ) { + if (_yaml["output"].type.mapping + && _yaml["output"].tag.match(rgx.yaml_tag_is_map) + ) { + if ("path" in _yaml["output"] + && _yaml["output"]["path"].type.string + && _yaml["output"]["path"].tag.match(rgx.yaml_tag_is_str) + ) { + if (_manifested.output.path == _manifested.env.pwd + && _yaml["output"]["path"].get!string.length > 0 + ) { + _struct_composite.conf.output_path = (((_yaml["output"]["path"].get!string).expandTilde).asNormalizedPath).array; + } + } + } + } + } + if (_opt_action.webserver_host_doc_root.length > 0) { // same as output_path immediately above, resolve FIX REMOVE + _struct_composite.conf.w_srv_data_root_path + = _opt_action.webserver_host_doc_root; + } else { + _struct_composite.conf.w_srv_data_root_path + = (_cfg.www_doc_root.empty) + ? "/var/www/spine" + : _cfg.www_doc_root; + if (("webserv" in _yaml && _yaml["webserv"].type.sequence) + && (_yaml["webserv"].type.mapping + && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + ) { + if ("data_root_path" in _yaml["webserv"] + && _yaml["webserv"]["data_root_path"].type.string + && _yaml["webserv"]["data_root_path"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_data_root_path + = _yaml["webserv"]["data_root_path"].get!string; + } + } + } } - 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) - ) { - _struct_composite.conf.w_srv_cgi_bin_url = _yaml["webserv"]["cgi_bin_url"].get!string; + if (_opt_action.cgi_bin_root.length > 0) { + _struct_composite.conf.w_srv_cgi_bin_path + = _opt_action.cgi_bin_root; } else { - _struct_composite.conf.w_srv_cgi_bin_url = - (_struct_composite.conf.w_srv_cgi_http.empty) - ? _struct_composite.conf.w_srv_http - :_struct_composite.conf.w_srv_cgi_http - ~ "://" - ~ (_struct_composite.conf.w_srv_cgi_host.empty) - ? _struct_composite.conf.w_srv_cgi_host - : _struct_composite.conf.w_srv_host - ~ _struct_composite.conf.w_srv_cgi_bin_subpath; - } - if (_opt_action.cgi_url_action.length > 0) { - _struct_composite.conf.w_srv_cgi_action = _opt_action.cgi_url_action; - } 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 if (_opt_action.cgi_sqlite_search_filename.length > 0) { // WORKON - _struct_composite.conf.w_srv_cgi_action = _struct_composite.conf.w_srv_cgi_bin_url ~ "/" ~ _opt_action.cgi_sqlite_search_filename; - } else { // action is composite, build + _struct_composite.conf.w_srv_cgi_bin_path + = (_cfg.cgi_bin_root.empty) + ? "/var/www/cgi/cgi-bin" + : _cfg.cgi_bin_root; + if (("webserv" in _yaml && _yaml["webserv"].type.sequence) + && (_yaml["webserv"].type.mapping + && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + ) { + if ("cgi_bin_path" in _yaml["webserv"] + && _yaml["webserv"]["cgi_bin_path"].type.string + && _yaml["webserv"]["cgi_bin_path"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_cgi_bin_path + = _yaml["webserv"]["cgi_bin_path"].get!string; + } + } } - // 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 (_opt_action.sqliteDB_filename.length > 0) { - _struct_composite.conf.w_srv_db_sqlite_filename = _opt_action.sqliteDB_filename; - } else if ("db_sqlite_filename" in _yaml["webserv"] - && _yaml["webserv"]["db_sqlite_filename"].type.string - && _yaml["webserv"]["db_sqlite_filename"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_db_sqlite_filename = _yaml["webserv"]["db_sqlite_filename"].get!string; - } else { // set default ? + { _struct_composite.conf.w_srv_data_root_part + = ""; + if (("webserv" in _yaml && _yaml["webserv"].type.sequence) + && (_yaml["webserv"].type.mapping + && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + ) { + if ("data_root_part" in _yaml["webserv"] + && _yaml["webserv"]["data_root_part"].type.string + && _yaml["webserv"]["data_root_part"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_data_root_part = _yaml["webserv"]["data_root_part"].get!string; + } + } } - if (_opt_action.sqliteDB_path.length > 0) { - _struct_composite.conf.w_srv_db_sqlite_path = _opt_action.sqliteDB_path; - } else if ("db_sqlite_path" in _yaml["webserv"] - && _yaml["webserv"]["db_sqlite_path"].type.string - && _yaml["webserv"]["db_sqlite_path"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.w_srv_db_sqlite_path = _yaml["webserv"]["db_sqlite_path"].get!string; - } else { // set default ? + { _struct_composite.conf.w_srv_images_root_part + = "image"; + if (("webserv" in _yaml && _yaml["webserv"].type.sequence) + && (_yaml["webserv"].type.mapping + && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + ) { + if ("images_root_part" in _yaml["webserv"] + && _yaml["webserv"]["images_root_part"].type.string + && _yaml["webserv"]["images_root_part"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_images_root_part = _yaml["webserv"]["images_root_part"].get!string; + } + } } } - } - if (!(_struct_composite.conf.output_path)) { - _struct_composite.conf.output_path = ((_manifested.output.path).asNormalizedPath).array; - } - 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 - && _yaml["output"].tag.match(rgx.yaml_tag_is_map) - ) { - if ("path" in _yaml["output"] - && _yaml["output"]["path"].type.string - && _yaml["output"]["path"].tag.match(rgx.yaml_tag_is_str) - ) { - if (_manifested.output.path == _manifested.env.pwd - && _yaml["output"]["path"].get!string.length > 0 + if (("webserv" in _yaml + && _yaml["webserv"].type.sequence) + && (_yaml["webserv"].type.mapping + && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + ) { // cannot be used as is with opt_action FIX look at remaining, decide what to do later + if ("data_http" in _yaml["webserv"] + && _yaml["webserv"]["data_http"].type.string + && _yaml["webserv"]["data_http"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.conf.output_path = (((_yaml["output"]["path"].get!string).expandTilde).asNormalizedPath).array; + _struct_composite.conf.w_srv_data_http = _yaml["webserv"]["data_http"].get!string; } - } + // if (_opt_action.*.length > 0) { + if ("cgi_http" in _yaml["webserv"] + && _yaml["webserv"]["cgi_http"].type.string + && _yaml["webserv"]["cgi_http"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_cgi_http = _yaml["webserv"]["cgi_http"].get!string; + } + // if (_opt_action.*.length > 0) { + if ("host" in _yaml["webserv"] + && _yaml["webserv"]["host"].type.string + && _yaml["webserv"]["host"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_host = _yaml["webserv"]["host"].get!string; + } + if ("data_root_url" in _yaml["webserv"] + && _yaml["webserv"]["data_root_url"].type.string + && _yaml["webserv"]["data_root_url"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_data_root_url = _yaml["webserv"]["data_root_url"].get!string; + _struct_composite.conf.w_srv_data_root_url_html = + _yaml["webserv"]["data_root_url"].get!string ~ "/" + ~ _manifested.src.language ~ "/" + ~ "html"; + } else { + _struct_composite.conf.w_srv_data_root_url = _struct_composite.conf.w_srv_data_root_part; + _struct_composite.conf.w_srv_data_root_url_html = + _struct_composite.conf.w_srv_data_root_part ~ "/" + ~ _manifested.src.language ~ "/" + ~ "html"; + } + if ("cgi_host" in _yaml["webserv"] + && _yaml["webserv"]["cgi_host"].type.string + && _yaml["webserv"]["cgi_host"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_cgi_host = _yaml["webserv"]["cgi_host"].get!string; + } else { // composite construct + _struct_composite.conf.w_srv_cgi_host = _struct_composite.conf.w_srv_host; + } + if ("cgi_bin_subpath" in _yaml["webserv"] + && _yaml["webserv"]["cgi_bin_subpath"].type.string + && _yaml["webserv"]["cgi_bin_subpath"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_cgi_bin_subpath = _yaml["webserv"]["cgi_bin_subpath"].get!string; + } + if ("cgi_port" in _yaml["webserv"] + && _yaml["webserv"]["cgi_port"].type.string + && _yaml["webserv"]["cgi_port"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_cgi_port = _yaml["webserv"]["cgi_port"].get!string; + } + if ("cgi_user" in _yaml["webserv"] + && _yaml["webserv"]["cgi_user"].type.string + && _yaml["webserv"]["cgi_user"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_cgi_user = _yaml["webserv"]["cgi_user"].get!string; + } + 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) + ) { + _struct_composite.conf.w_srv_cgi_bin_url = _yaml["webserv"]["cgi_bin_url"].get!string; + } else { + _struct_composite.conf.w_srv_cgi_bin_url = + (_struct_composite.conf.w_srv_cgi_http.empty) + ? _struct_composite.conf.w_srv_http + :_struct_composite.conf.w_srv_cgi_http + ~ "://" + ~ (_struct_composite.conf.w_srv_cgi_host.empty) + ? _struct_composite.conf.w_srv_cgi_host + : _struct_composite.conf.w_srv_host + ~ _struct_composite.conf.w_srv_cgi_bin_subpath; + } + // 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 ("processing" in _yaml - && _yaml["processing"].type.sequence - ) { - if (_yaml["processing"].type.mapping - && _yaml["processing"].tag.match(rgx.yaml_tag_is_map) + // make (in: conf, make, meta)? + if ("processing" in _yaml + && _yaml["processing"].type.sequence ) { - if ("concord_max" in _yaml["processing"] - && _yaml["processing"]["concord_max"].type.string - && _yaml["processing"]["concord_max"].tag.match(rgx.yaml_tag_is_str) + if (_yaml["processing"].type.mapping + && _yaml["processing"].tag.match(rgx.yaml_tag_is_map) ) { - _struct_composite.conf.processing_concord_max = _yaml["processing"]["concord_max"].get!string; + if ("concord_max" in _yaml["processing"] + && _yaml["processing"]["concord_max"].type.string + && _yaml["processing"]["concord_max"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.processing_concord_max = _yaml["processing"]["concord_max"].get!string; + } } } - } - if ("flag" in _yaml - && _yaml["flag"].type.sequence - ) { - if (_yaml["flag"].type.mapping - && _yaml["flag"].tag.match(rgx.yaml_tag_is_map) + if ("flag" in _yaml + && _yaml["flag"].type.sequence ) { - if ("act0" in _yaml["flag"] - && _yaml["flag"]["act0"].type.string - && _yaml["flag"]["act0"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.flag_act0 = _yaml["flag"]["act0"].get!string; - } - if ("act1" in _yaml["flag"] - && _yaml["flag"]["act1"].type.string - && _yaml["flag"]["act1"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.flag_act1 = _yaml["flag"]["act1"].get!string; - } - if ("act2" in _yaml["flag"] - && _yaml["flag"]["act2"].type.string - && _yaml["flag"]["act2"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.flag_act2 = _yaml["flag"]["act2"].get!string; - } - if ("act3" in _yaml["flag"] - && _yaml["flag"]["act3"].type.string - && _yaml["flag"]["act3"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.flag_act3 = _yaml["flag"]["act3"].get!string; - } - if ("act4" in _yaml["flag"] - && _yaml["flag"]["act4"].type.string - && _yaml["flag"]["act4"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.flag_act4 = _yaml["flag"]["act4"].get!string; - } - if ("act5" in _yaml["flag"] - && _yaml["flag"]["act5"].type.string - && _yaml["flag"]["act5"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.flag_act5 = _yaml["flag"]["act5"].get!string; - } - if ("act6" in _yaml["flag"] - && _yaml["flag"]["act6"].type.string - && _yaml["flag"]["act6"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.flag_act6 = _yaml["flag"]["act6"].get!string; - } - if ("act7" in _yaml["flag"] - && _yaml["flag"]["act7"].type.string - && _yaml["flag"]["act7"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.flag_act7 = _yaml["flag"]["act7"].get!string; - } - if ("act8" in _yaml["flag"] - && _yaml["flag"]["act8"].type.string - && _yaml["flag"]["act8"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.conf.flag_act8 = _yaml["flag"]["act8"].get!string; - } - if ("act9" in _yaml["flag"] - && _yaml["flag"]["act9"].type.string - && _yaml["flag"]["act9"].tag.match(rgx.yaml_tag_is_str) + if (_yaml["flag"].type.mapping + && _yaml["flag"].tag.match(rgx.yaml_tag_is_map) ) { - _struct_composite.conf.flag_act9 = _yaml["flag"]["act9"].get!string; + if ("act0" in _yaml["flag"] + && _yaml["flag"]["act0"].type.string + && _yaml["flag"]["act0"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.flag_act0 = _yaml["flag"]["act0"].get!string; + } + if ("act1" in _yaml["flag"] + && _yaml["flag"]["act1"].type.string + && _yaml["flag"]["act1"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.flag_act1 = _yaml["flag"]["act1"].get!string; + } + if ("act2" in _yaml["flag"] + && _yaml["flag"]["act2"].type.string + && _yaml["flag"]["act2"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.flag_act2 = _yaml["flag"]["act2"].get!string; + } + if ("act3" in _yaml["flag"] + && _yaml["flag"]["act3"].type.string + && _yaml["flag"]["act3"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.flag_act3 = _yaml["flag"]["act3"].get!string; + } + if ("act4" in _yaml["flag"] + && _yaml["flag"]["act4"].type.string + && _yaml["flag"]["act4"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.flag_act4 = _yaml["flag"]["act4"].get!string; + } + if ("act5" in _yaml["flag"] + && _yaml["flag"]["act5"].type.string + && _yaml["flag"]["act5"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.flag_act5 = _yaml["flag"]["act5"].get!string; + } + if ("act6" in _yaml["flag"] + && _yaml["flag"]["act6"].type.string + && _yaml["flag"]["act6"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.flag_act6 = _yaml["flag"]["act6"].get!string; + } + if ("act7" in _yaml["flag"] + && _yaml["flag"]["act7"].type.string + && _yaml["flag"]["act7"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.flag_act7 = _yaml["flag"]["act7"].get!string; + } + if ("act8" in _yaml["flag"] + && _yaml["flag"]["act8"].type.string + && _yaml["flag"]["act8"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.flag_act8 = _yaml["flag"]["act8"].get!string; + } + if ("act9" in _yaml["flag"] + && _yaml["flag"]["act9"].type.string + && _yaml["flag"]["act9"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.flag_act9 = _yaml["flag"]["act9"].get!string; + } } } - } - 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; + 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; } - 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 ("papersize" in _yaml["default"] - && _yaml["default"]["papersize"].type.string - && _yaml["default"]["papersize"].tag.match(rgx.yaml_tag_is_str) - ) { - _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) + 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) ) { - _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 ("papersize" in _yaml["default"] + && _yaml["default"]["papersize"].type.string + && _yaml["default"]["papersize"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.set_papersize = selected_papersize(_yaml["default"]["papersize"].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 (_struct_composite.conf.set_papersize.length == 0) { + _struct_composite.conf.set_papersize = ["a4.portrait", "a4.landscape"]; } - } - if ("search" in _yaml - && _yaml["search"].type.sequence - ) { - if (_yaml["search"].type.mapping - && _yaml["search"].tag.match(rgx.yaml_tag_is_map) + if ( + "default" in _yaml + && _yaml["default"].type.sequence + && _yaml["default"].type.mapping + && _yaml["default"].tag.match(rgx.yaml_tag_is_map) ) { - if ("flag" in _yaml["search"] - && _yaml["search"]["flag"].type.string - && _yaml["search"]["flag"].tag.match(rgx.yaml_tag_is_str) + 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.search_flag = _yaml["search"]["flag"].get!string; + _struct_composite.conf.set_text_wrap = _yaml["default"]["text_wrap"].get!string; } - if ("action" in _yaml["search"] - && _yaml["search"]["action"].type.string - && _yaml["search"]["action"].tag.match(rgx.yaml_tag_is_str) + if ("emphasis" in _yaml["default"] + && _yaml["default"]["emphasis"].type.string + && _yaml["default"]["emphasis"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.conf.search_action = _yaml["search"]["action"].get!string; + _struct_composite.conf.set_emphasis = _yaml["default"]["emphasis"].get!string; } - if ("db" in _yaml["search"] - && _yaml["search"]["db"].type.string - && _yaml["search"]["db"].tag.match(rgx.yaml_tag_is_str) + if ("language" in _yaml["default"] + && _yaml["default"]["language"].type.string + && _yaml["default"]["language"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.conf.search_db = _yaml["search"]["db"].get!string; + _struct_composite.conf.set_language = _yaml["default"]["language"].get!string; } - if ("title" in _yaml["search"] - && _yaml["search"]["title"].type.string - && _yaml["search"]["title"].tag.match(rgx.yaml_tag_is_str) + if ("digest" in _yaml["default"] + && _yaml["default"]["digest"].type.string + && _yaml["default"]["digest"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.conf.search_title = _yaml["search"]["title"].get!string; + _struct_composite.conf.set_digest = _yaml["default"]["digest"].get!string; } } - } - /+ meta ------------------------------------------------------------------- +/ - if (_struct_composite.meta.creator_author.empty) { - if ("creator" in _yaml - && _yaml["creator"].type.sequence + if ("search" in _yaml + && _yaml["search"].type.sequence ) { - if (_yaml["creator"].type.mapping - && _yaml["creator"].tag.match(rgx.yaml_tag_is_map) + if (_yaml["search"].type.mapping + && _yaml["search"].tag.match(rgx.yaml_tag_is_map) ) { - if ("author" in _yaml["creator"] - && _yaml["creator"]["author"].type.string - && _yaml["creator"]["author"].tag.match(rgx.yaml_tag_is_str) + if ("flag" in _yaml["search"] + && _yaml["search"]["flag"].type.string + && _yaml["search"]["flag"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.meta.creator_author = _yaml["creator"]["author"].get!string; + _struct_composite.conf.search_flag = _yaml["search"]["flag"].get!string; } - if ("email" in _yaml["creator"] - && _yaml["creator"]["email"].type.string - && _yaml["creator"]["email"].tag.match(rgx.yaml_tag_is_str) + if ("action" in _yaml["search"] + && _yaml["search"]["action"].type.string + && _yaml["search"]["action"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.meta.creator_author_email = _yaml["creator"]["email"].get!string; + _struct_composite.conf.search_action = _yaml["search"]["action"].get!string; } - if ("illustrator" in _yaml["creator"] - && _yaml["creator"]["illustrator"].type.string - && _yaml["creator"]["illustrator"].tag.match(rgx.yaml_tag_is_str) + if ("db" in _yaml["search"] + && _yaml["search"]["db"].type.string + && _yaml["search"]["db"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.meta.creator_illustrator = _yaml["creator"]["illustrator"].get!string; + _struct_composite.conf.search_db = _yaml["search"]["db"].get!string; } - if ("translator" in _yaml["creator"] - && _yaml["creator"]["translator"].type.string - && _yaml["creator"]["translator"].tag.match(rgx.yaml_tag_is_str) + if ("title" in _yaml["search"] + && _yaml["search"]["title"].type.string + && _yaml["search"]["title"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.meta.creator_translator = _yaml["creator"]["translator"].get!string; + _struct_composite.conf.search_title = _yaml["search"]["title"].get!string; } - } else if (_yaml["creator"].type.string - && _yaml["creator"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.meta.creator_author = _yaml["creator"].get!string; - } - } - string[] author_arr; - string[][string] authors_hash_arr = [ "first" : [], "last" : [], "full" : [], "last_first" : [], "as_input" : [] ]; - string[] authors_raw_arr - = _struct_composite.meta.creator_author.split(rgx.arr_delimiter); - auto _lastname = appender!(char[])(); - foreach (author_raw; authors_raw_arr) { - if (auto m = author_raw.match(rgx.raw_author_munge)) { - author_arr ~= author_raw.replace(rgx.raw_author_munge, "$2 $1"); - authors_hash_arr["first"] ~= author_raw.replace(rgx.raw_author_munge, "$2"); - authors_hash_arr["last"] ~= author_raw.replace(rgx.raw_author_munge, "$1"); - authors_hash_arr["full"] ~= author_raw.replace(rgx.raw_author_munge, "$2 $1"); - (m.captures[1]).map!toUpper.copy(_lastname); - authors_hash_arr["last_first"] ~= _lastname.data.to!string ~ ", " ~ m.captures[2]; - _lastname = appender!(char[])(); - } else { - author_arr ~= author_raw; - authors_hash_arr["last"] ~= author_raw; - authors_hash_arr["full"] ~= author_raw; - authors_hash_arr["last_first"] ~= author_raw; } - authors_hash_arr["as_input"] ~= author_raw; } - _struct_composite.meta.creator_author_arr = author_arr; - _struct_composite.meta.creator_author = author_arr.join(", ").chomp.chomp; - _struct_composite.meta.creator_author_surname = (authors_hash_arr["last"].length > 0) ? authors_hash_arr["last"][0] : ""; - string _author_name_last_first = authors_hash_arr["last_first"].join("; ").chomp.chomp; - _struct_composite.meta.creator_author_surname_fn = (_author_name_last_first.length > 0) - ? _author_name_last_first - : authors_hash_arr["as_input"].join("; ").chomp.chomp; - } - if (_struct_composite.meta.title_main.empty) { - if ("title" in _yaml - && _yaml["title"].type.sequence + } else { + /+ make ------------------------------------------------------------------- +/ + if ("make" in _yaml + && _yaml["make"].type.sequence ) { - if (_yaml["title"].type.mapping - && _yaml["title"].tag.match(rgx.yaml_tag_is_map) + if (_yaml["make"].type.mapping + && _yaml["make"].tag.match(rgx.yaml_tag_is_map) ) { - if ("main" in _yaml["title"] - && _yaml["title"]["main"].type.string - && _yaml["title"]["main"].tag.match(rgx.yaml_tag_is_str) + if ("bold" in _yaml["make"] + && _yaml["make"]["bold"].type.string + && _yaml["make"]["bold"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.meta.title_main = _yaml["title"]["main"].get!string; - } else if ("title" in _yaml["title"] - && _yaml["title"]["title"].type.string - && _yaml["title"]["title"].tag.match(rgx.yaml_tag_is_str) + _struct_composite.make_str.bold = _yaml["make"]["bold"].get!string; + } + if ("breaks" in _yaml["make"] + && _yaml["make"]["breaks"].type.string + && _yaml["make"]["breaks"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.meta.title_main = _yaml["title"]["title"].get!string; + _struct_composite.make_str.breaks = _yaml["make"]["breaks"].get!string; } - if ("edition" in _yaml["title"] - && _yaml["title"]["edition"].type.string - && _yaml["title"]["edition"].tag.match(rgx.yaml_tag_is_str) + if ("cover_image" in _yaml["make"] + && _yaml["make"]["cover_image"].type.string + && _yaml["make"]["cover_image"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.meta.title_edition = _yaml["title"]["edition"].get!string; + _struct_composite.make_str.cover_image = _yaml["make"]["cover_image"].get!string; } - if ("full" in _yaml["title"] - && _yaml["title"]["full"].type.string - && _yaml["title"]["full"].tag.match(rgx.yaml_tag_is_str) + if ("css" in _yaml["make"] + && _yaml["make"]["css"].type.string + && _yaml["make"]["css"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.meta.title_full = _yaml["title"]["full"].get!string; + _struct_composite.make_str.css = _yaml["make"]["css"].get!string; } - if ("language" in _yaml["title"] - && _yaml["title"]["language"].type.string - && _yaml["title"]["language"].tag.match(rgx.yaml_tag_is_str) + if ("emphasis" in _yaml["make"] + && _yaml["make"]["emphasis"].type.string + && _yaml["make"]["emphasis"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.meta.title_language = _yaml["title"]["language"].get!string; + _struct_composite.make_str.emphasis = _yaml["make"]["emphasis"].get!string; } - if ("note" in _yaml["title"] - && _yaml["title"]["note"].type.string - && _yaml["title"]["note"].tag.match(rgx.yaml_tag_is_str) + if ("footer" in _yaml["make"] + && _yaml["make"]["footer"].type.string + && _yaml["make"]["footer"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.meta.title_note = _yaml["title"]["note"].get!string; + char[][] __match_footer_array + = (cast(char[]) _yaml["make"]["footer"].get!string) + .split(rgx.make_heading_delimiter); + _struct_composite.make_str.footer = __match_footer_array.to!(string[]); } - if ("subtitle" in _yaml["title"] - && _yaml["title"]["subtitle"].type.string - && _yaml["title"]["subtitle"].tag.match(rgx.yaml_tag_is_str) + if ("headings" in _yaml["make"] + && _yaml["make"]["headings"].type.string + && _yaml["make"]["headings"].tag.match(rgx.yaml_tag_is_str) + ) { + char[][] __match_headings_array + = (cast(char[]) _yaml["make"]["headings"].get!string) + .split(rgx.make_heading_delimiter); + _struct_composite.make_str.headings = __match_headings_array.to!(string[]); + } else if ("headings" in _yaml["make"] + && _yaml["make"]["headings"].type.string + && _yaml["make"]["headings"].tag.match(rgx.yaml_tag_is_seq) ) { - _struct_composite.meta.title_subtitle = _yaml["title"]["subtitle"].get!string; - } else if ("sub" in _yaml["title"] - && _yaml["title"]["sub"].type.string - && _yaml["title"]["sub"].tag.match(rgx.yaml_tag_is_str) + foreach(string identify_heading_level; _yaml["make"]["headings"]) { + _struct_composite.make_str.headings ~= identify_heading_level; + } + } + if ("home_button_image" in _yaml["make"] + && _yaml["make"]["home_button_image"].type.string + && _yaml["make"]["home_button_image"].tag.match(rgx.yaml_tag_is_str) ) { - _struct_composite.meta.title_subtitle = _yaml["title"]["sub"].get!string; + char[][] __match_home_button_image_array + = (cast(char[]) _yaml["make"]["home_button_image"].get!string) + .split(rgx.make_heading_delimiter); + _struct_composite.make_str.home_button_image = __match_home_button_image_array.to!(string[]); + } + if ("home_button_text" in _yaml["make"] + && _yaml["make"]["home_button_text"].type.string + && _yaml["make"]["home_button_text"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.make_str.home_button_text = _yaml["make"]["home_button_text"].get!string; + } else if ("home_button_text" in _yaml["make"] + && _yaml["make"]["home_button_text"].type.string + && _yaml["make"]["home_button_text"].tag.match(rgx.yaml_tag_is_seq) + ) { + _struct_composite.make_str.home_button_text = ""; + foreach(string hbt; _yaml["make"]["home_button_text"]) { + _struct_composite.make_str.home_button_text ~= hbt ~ "; "; + } + } + if ("italics" in _yaml["make"] + && _yaml["make"]["italics"].type.string + && _yaml["make"]["italics"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.make_str.italics = _yaml["make"]["italics"].get!string; + } + if ("auto_num_top_at_level" in _yaml["make"] + && _yaml["make"]["auto_num_top_at_level"].type.string + && _yaml["make"]["auto_num_top_at_level"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.make_str.auto_num_top_at_level = _yaml["make"]["auto_num_top_at_level"].get!string; + switch (_yaml["make"]["auto_num_top_at_level"].get!string) { + case "A": + break; + case "B": _struct_composite.make_str.auto_num_top_lv = 1; + break; + case "C": _struct_composite.make_str.auto_num_top_lv = 2; + break; + case "D": _struct_composite.make_str.auto_num_top_lv = 3; + break; + case "1": _struct_composite.make_str.auto_num_top_lv = 4; + break; + case "2": _struct_composite.make_str.auto_num_top_lv = 5; + break; + case "3": _struct_composite.make_str.auto_num_top_lv = 6; + break; + case "4": _struct_composite.make_str.auto_num_top_lv = 7; + break; + default: + break; + } + } + if ("auto_num_depth" in _yaml["make"] + && _yaml["make"]["auto_num_depth"].type.string + && _yaml["make"]["auto_num_depth"].tag.match(rgx.yaml_tag_is_int) + ) { // not sure implemented for documents + _struct_composite.make_str.auto_num_depth = _yaml["make"]["auto_num_depth"].get!int; + } else if ("auto_num_depth" in _yaml["make"] + && _yaml["make"]["auto_num_depth"].type.string + && _yaml["make"]["auto_num_depth"].tag.match(rgx.yaml_tag_is_str) + ) { // not sure implemented for documents + _struct_composite.make_str.auto_num_depth = _yaml["make"]["auto_num_depth"].get!int; + } + if ("texpdf_font" in _yaml["make"] + && _yaml["make"]["texpdf_font"].type.string + ) { + _struct_composite.make_str.texpdf_font = _yaml["make"]["texpdf_font"].get!string; } - } else if ( - _yaml["title"].type.string - && _yaml["title"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.meta.title_main = _yaml["title"].get!string; } + _struct_composite.make.bold = _mk.bold(_struct_composite.make_str.bold); + _struct_composite.make.breaks = _mk.breaks(_struct_composite.make_str.breaks); + _struct_composite.make.cover_image = _mk.cover_image(_struct_composite.make_str.cover_image); + _struct_composite.make.css = _mk.css(_struct_composite.make_str.css); + _struct_composite.make.emphasis = _mk.emphasis(_struct_composite.make_str.emphasis); + _struct_composite.make.footer = _mk.footer(_struct_composite.make_str.footer); + _struct_composite.make.headings = _mk.headings(_struct_composite.make_str.headings); + _struct_composite.make.home_button_image = _mk.home_button_image(_struct_composite.make_str.home_button_image); + _struct_composite.make.home_button_text = _mk.home_button_text(_struct_composite.make_str.home_button_text); + _struct_composite.make.italics = _mk.italics(_struct_composite.make_str.italics); + _struct_composite.make.auto_num_top_at_level = _mk.auto_num_top_at_level(_struct_composite.make_str.auto_num_top_at_level); + _struct_composite.make.auto_num_top_lv = _mk.auto_num_top_lv(_struct_composite.make_str.auto_num_top_lv); + _struct_composite.make.auto_num_depth = _mk.auto_num_depth(_struct_composite.make_str.auto_num_depth); + _struct_composite.make.substitute = _mk.substitute(_struct_composite.make_str.substitute); + _struct_composite.make.texpdf_font = _mk.texpdf_font(_struct_composite.make_str.texpdf_font); } - _struct_composite.meta.title_sub = _struct_composite.meta.title_subtitle; - if ((!(_struct_composite.meta.title_subtitle.empty)) - && (_struct_composite.meta.title_sub.empty)) { - _struct_composite.meta.title_sub = _struct_composite.meta.title_subtitle; - } - _struct_composite.meta.title_full = (_struct_composite.meta.title_subtitle.empty) - ? _struct_composite.meta.title_main - : format( - "%s - %s", - _struct_composite.meta.title_main, - _struct_composite.meta.title_subtitle, - ); - } - if ("classify" in _yaml - && _yaml["classify"].type.sequence - ) { - if (_yaml["classify"].type.mapping - && _yaml["classify"].tag.match(rgx.yaml_tag_is_map) - ) { - if ("dewey" in _yaml["classify"] - && _yaml["classify"]["dewey"].type.string - && _yaml["classify"]["dewey"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.meta.classify_dewey = _yaml["classify"]["dewey"].get!string; - } - if ("loc" in _yaml["classify"] - && _yaml["classify"]["loc"].type.string - && _yaml["classify"]["loc"].tag.match(rgx.yaml_tag_is_str) + + /+ meta ------------------------------------------------------------------- +/ + if (_struct_composite.meta.creator_author.empty) { + if ("creator" in _yaml + && _yaml["creator"].type.sequence ) { - _struct_composite.meta.classify_loc = _yaml["classify"]["loc"].get!string; + if (_yaml["creator"].type.mapping + && _yaml["creator"].tag.match(rgx.yaml_tag_is_map) + ) { + if ("author" in _yaml["creator"] + && _yaml["creator"]["author"].type.string + && _yaml["creator"]["author"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.creator_author = _yaml["creator"]["author"].get!string; + } + if ("email" in _yaml["creator"] + && _yaml["creator"]["email"].type.string + && _yaml["creator"]["email"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.creator_author_email = _yaml["creator"]["email"].get!string; + } + if ("illustrator" in _yaml["creator"] + && _yaml["creator"]["illustrator"].type.string + && _yaml["creator"]["illustrator"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.creator_illustrator = _yaml["creator"]["illustrator"].get!string; + } + if ("translator" in _yaml["creator"] + && _yaml["creator"]["translator"].type.string + && _yaml["creator"]["translator"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.creator_translator = _yaml["creator"]["translator"].get!string; + } + } else if (_yaml["creator"].type.string + && _yaml["creator"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.creator_author = _yaml["creator"].get!string; + } } - if ("keywords" in _yaml["classify"] - && _yaml["classify"]["keywords"].type.string - && _yaml["classify"]["keywords"].tag.match(rgx.yaml_tag_is_str) + string[] author_arr; + string[][string] authors_hash_arr = [ "first" : [], "last" : [], "full" : [], "last_first" : [], "as_input" : [] ]; + string[] authors_raw_arr + = _struct_composite.meta.creator_author.split(rgx.arr_delimiter); + auto _lastname = appender!(char[])(); + foreach (author_raw; authors_raw_arr) { + if (auto m = author_raw.match(rgx.raw_author_munge)) { + author_arr ~= author_raw.replace(rgx.raw_author_munge, "$2 $1"); + authors_hash_arr["first"] ~= author_raw.replace(rgx.raw_author_munge, "$2"); + authors_hash_arr["last"] ~= author_raw.replace(rgx.raw_author_munge, "$1"); + authors_hash_arr["full"] ~= author_raw.replace(rgx.raw_author_munge, "$2 $1"); + (m.captures[1]).map!toUpper.copy(_lastname); + authors_hash_arr["last_first"] ~= _lastname.data.to!string ~ ", " ~ m.captures[2]; + _lastname = appender!(char[])(); + } else { + author_arr ~= author_raw; + authors_hash_arr["last"] ~= author_raw; + authors_hash_arr["full"] ~= author_raw; + authors_hash_arr["last_first"] ~= author_raw; + } + authors_hash_arr["as_input"] ~= author_raw; + } + _struct_composite.meta.creator_author_arr = author_arr; + _struct_composite.meta.creator_author = author_arr.join(", ").chomp.chomp; + _struct_composite.meta.creator_author_surname = (authors_hash_arr["last"].length > 0) ? authors_hash_arr["last"][0] : ""; + string _author_name_last_first = authors_hash_arr["last_first"].join("; ").chomp.chomp; + _struct_composite.meta.creator_author_surname_fn = (_author_name_last_first.length > 0) + ? _author_name_last_first + : authors_hash_arr["as_input"].join("; ").chomp.chomp; + } + if (_struct_composite.meta.title_main.empty) { + if ("title" in _yaml + && _yaml["title"].type.sequence ) { - _struct_composite.meta.classify_keywords = _yaml["classify"]["keywords"].get!string; + if (_yaml["title"].type.mapping + && _yaml["title"].tag.match(rgx.yaml_tag_is_map) + ) { + if ("main" in _yaml["title"] + && _yaml["title"]["main"].type.string + && _yaml["title"]["main"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.title_main = _yaml["title"]["main"].get!string; + } else if ("title" in _yaml["title"] + && _yaml["title"]["title"].type.string + && _yaml["title"]["title"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.title_main = _yaml["title"]["title"].get!string; + } + if ("edition" in _yaml["title"] + && _yaml["title"]["edition"].type.string + && _yaml["title"]["edition"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.title_edition = _yaml["title"]["edition"].get!string; + } + if ("full" in _yaml["title"] + && _yaml["title"]["full"].type.string + && _yaml["title"]["full"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.title_full = _yaml["title"]["full"].get!string; + } + if ("language" in _yaml["title"] + && _yaml["title"]["language"].type.string + && _yaml["title"]["language"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.title_language = _yaml["title"]["language"].get!string; + } + if ("note" in _yaml["title"] + && _yaml["title"]["note"].type.string + && _yaml["title"]["note"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.title_note = _yaml["title"]["note"].get!string; + } + if ("subtitle" in _yaml["title"] + && _yaml["title"]["subtitle"].type.string + && _yaml["title"]["subtitle"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.title_subtitle = _yaml["title"]["subtitle"].get!string; + } else if ("sub" in _yaml["title"] + && _yaml["title"]["sub"].type.string + && _yaml["title"]["sub"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.title_subtitle = _yaml["title"]["sub"].get!string; + } + } else if ( + _yaml["title"].type.string + && _yaml["title"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.title_main = _yaml["title"].get!string; + } } - if ("topic_register" in _yaml["classify"] - && _yaml["classify"]["topic_register"].type.string - && _yaml["classify"]["topic_register"].tag.match(rgx.yaml_tag_is_str) + _struct_composite.meta.title_sub = _struct_composite.meta.title_subtitle; + if ((!(_struct_composite.meta.title_subtitle.empty)) + && (_struct_composite.meta.title_sub.empty)) { + _struct_composite.meta.title_sub = _struct_composite.meta.title_subtitle; + } + _struct_composite.meta.title_full = (_struct_composite.meta.title_subtitle.empty) + ? _struct_composite.meta.title_main + : format( + "%s - %s", + _struct_composite.meta.title_main, + _struct_composite.meta.title_subtitle, + ); + } + if ("classify" in _yaml + && _yaml["classify"].type.sequence + ) { + if (_yaml["classify"].type.mapping + && _yaml["classify"].tag.match(rgx.yaml_tag_is_map) ) { - _struct_composite.meta.classify_topic_register = _yaml["classify"]["topic_register"].get!string; - string[] main_topics_ = _struct_composite.meta.classify_topic_register.strip.split(rgx.topic_register_main_terms_split); - string[] topics; - string topics_tmp; - string[] multiple_sub_terms; - foreach (mt; main_topics_) { - topics_tmp = mt.replaceAll(rgx.topic_register_main_term_plus_rest_split, mkup.sep); - if (auto m = topics_tmp.match(rgx.topic_register_multiple_sub_terms_split)) { - multiple_sub_terms = m.captures[1].split(rgx.topic_register_sub_terms_split); - foreach (subterm; multiple_sub_terms) { - topics ~= m.captures.pre ~ mkup.sep ~ subterm; + if ("dewey" in _yaml["classify"] + && _yaml["classify"]["dewey"].type.string + && _yaml["classify"]["dewey"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.classify_dewey = _yaml["classify"]["dewey"].get!string; + } + if ("loc" in _yaml["classify"] + && _yaml["classify"]["loc"].type.string + && _yaml["classify"]["loc"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.classify_loc = _yaml["classify"]["loc"].get!string; + } + if ("keywords" in _yaml["classify"] + && _yaml["classify"]["keywords"].type.string + && _yaml["classify"]["keywords"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.classify_keywords = _yaml["classify"]["keywords"].get!string; + } + if ("topic_register" in _yaml["classify"] + && _yaml["classify"]["topic_register"].type.string + && _yaml["classify"]["topic_register"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.classify_topic_register = _yaml["classify"]["topic_register"].get!string; + string[] main_topics_ = _struct_composite.meta.classify_topic_register.strip.split(rgx.topic_register_main_terms_split); + string[] topics; + string topics_tmp; + string[] multiple_sub_terms; + foreach (mt; main_topics_) { + topics_tmp = mt.replaceAll(rgx.topic_register_main_term_plus_rest_split, mkup.sep); + if (auto m = topics_tmp.match(rgx.topic_register_multiple_sub_terms_split)) { + multiple_sub_terms = m.captures[1].split(rgx.topic_register_sub_terms_split); + foreach (subterm; multiple_sub_terms) { + topics ~= m.captures.pre ~ mkup.sep ~ subterm; + } + } else { + topics ~= topics_tmp; } - } else { - topics ~= topics_tmp; } + // writeln("--> ", topics); + _struct_composite.meta.classify_topic_register_arr = topics; } - // writeln("--> ", topics); - _struct_composite.meta.classify_topic_register_arr = topics; } } - } - if ("date" in _yaml - && _yaml["date"].type.sequence - ) { - if (_yaml["date"].type.mapping - && _yaml["date"].tag.match(rgx.yaml_tag_is_map) + if ("date" in _yaml + && _yaml["date"].type.sequence ) { - if ("added_to_site" in _yaml["date"] - && _yaml["date"]["added_to_site"].type.string - && _yaml["date"]["added_to_site"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.meta.date_added_to_site = _yaml["date"]["added_to_site"].get!string; - } - if ("available" in _yaml["date"] - && _yaml["date"]["available"].type.string - && _yaml["date"]["available"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.meta.date_available = _yaml["date"]["available"].get!string; - } - if ("created" in _yaml["date"] - && _yaml["date"]["created"].type.string - && _yaml["date"]["created"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.meta.date_created = _yaml["date"]["created"].get!string; - } - if ("issued" in _yaml["date"] - && _yaml["date"]["issued"].type.string - && _yaml["date"]["issued"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.meta.date_issued = _yaml["date"]["issued"].get!string; - } - if ("modified" in _yaml["date"] - && _yaml["date"]["modified"].type.string - && _yaml["date"]["modified"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.meta.date_modified = _yaml["date"]["modified"].get!string; - } - if ("published" in _yaml["date"] - && _yaml["date"]["published"].type.string - && _yaml["date"]["published"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.meta.date_published = _yaml["date"]["published"].get!string; - } - if ("valid" in _yaml["date"] - && _yaml["date"]["valid"].type.string - && _yaml["date"]["valid"].tag.match(rgx.yaml_tag_is_str) + if (_yaml["date"].type.mapping + && _yaml["date"].tag.match(rgx.yaml_tag_is_map) ) { - _struct_composite.meta.date_valid = _yaml["date"]["valid"].get!string; + if ("added_to_site" in _yaml["date"] + && _yaml["date"]["added_to_site"].type.string + && _yaml["date"]["added_to_site"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.date_added_to_site = _yaml["date"]["added_to_site"].get!string; + } + if ("available" in _yaml["date"] + && _yaml["date"]["available"].type.string + && _yaml["date"]["available"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.date_available = _yaml["date"]["available"].get!string; + } + if ("created" in _yaml["date"] + && _yaml["date"]["created"].type.string + && _yaml["date"]["created"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.date_created = _yaml["date"]["created"].get!string; + } + if ("issued" in _yaml["date"] + && _yaml["date"]["issued"].type.string + && _yaml["date"]["issued"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.date_issued = _yaml["date"]["issued"].get!string; + } + if ("modified" in _yaml["date"] + && _yaml["date"]["modified"].type.string + && _yaml["date"]["modified"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.date_modified = _yaml["date"]["modified"].get!string; + } + if ("published" in _yaml["date"] + && _yaml["date"]["published"].type.string + && _yaml["date"]["published"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.date_published = _yaml["date"]["published"].get!string; + } + if ("valid" in _yaml["date"] + && _yaml["date"]["valid"].type.string + && _yaml["date"]["valid"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.date_valid = _yaml["date"]["valid"].get!string; + } } } - } - _struct_composite.meta.language_document_char = _manifested.src.language; // move - if ("links" in _yaml) { - // if ("" in _yaml["links"]) { - // _struct_composite.meta.links_ = _yaml["links"][""].str; - // } - } - if ("notes" in _yaml - && _yaml["notes"].type.sequence - ) { - if (_yaml["notes"].type.mapping - && _yaml["notes"].tag.match(rgx.yaml_tag_is_map) + _struct_composite.meta.language_document_char = _manifested.src.language; // move + if ("links" in _yaml) { + // if ("" in _yaml["links"]) { + // _struct_composite.meta.links_ = _yaml["links"][""].str; + // } + } + if ("notes" in _yaml + && _yaml["notes"].type.sequence ) { - if ("abstract" in _yaml["notes"] - && _yaml["notes"]["abstract"].type.string - && _yaml["notes"]["abstract"].tag.match(rgx.yaml_tag_is_str) + if (_yaml["notes"].type.mapping + && _yaml["notes"].tag.match(rgx.yaml_tag_is_map) ) { - _struct_composite.meta.notes_abstract = _yaml["notes"]["abstract"].get!string; - } - if ("description" in _yaml["notes"] - && _yaml["notes"]["description"].type.string - && _yaml["notes"]["description"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.meta.notes_description = _yaml["notes"]["description"].get!string; - } - if ("summary" in _yaml["notes"] - && _yaml["notes"]["summary"].type.string - && _yaml["notes"]["summary"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.meta.notes_summary = _yaml["notes"]["summary"].get!string; + if ("abstract" in _yaml["notes"] + && _yaml["notes"]["abstract"].type.string + && _yaml["notes"]["abstract"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.notes_abstract = _yaml["notes"]["abstract"].get!string; + } + if ("description" in _yaml["notes"] + && _yaml["notes"]["description"].type.string + && _yaml["notes"]["description"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.notes_description = _yaml["notes"]["description"].get!string; + } + if ("summary" in _yaml["notes"] + && _yaml["notes"]["summary"].type.string + && _yaml["notes"]["summary"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.notes_summary = _yaml["notes"]["summary"].get!string; + } } } - } - if ("original" in _yaml - && _yaml["original"].type.sequence - ) { - if (_yaml["original"].type.mapping - && _yaml["original"].tag.match(rgx.yaml_tag_is_map) + if ("original" in _yaml + && _yaml["original"].type.sequence ) { - if ("language" in _yaml["original"] - && _yaml["original"]["language"].type.string - && _yaml["original"]["language"].tag.match(rgx.yaml_tag_is_str) + if (_yaml["original"].type.mapping + && _yaml["original"].tag.match(rgx.yaml_tag_is_map) ) { - _struct_composite.meta.original_language = _yaml["original"]["language"].get!string; - } - if ("language_char" in _yaml["original"] - && _yaml["original"]["language_char"].type.string - && _yaml["original"]["language_char"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.meta.original_language_char = _yaml["original"]["language_char"].get!string; - } - if ("source" in _yaml["original"] - && _yaml["original"]["source"].type.string - && _yaml["original"]["source"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.meta.original_source = _yaml["original"]["source"].get!string; - } - if ("title" in _yaml["original"] - && _yaml["original"]["title"].type.string - && _yaml["original"]["title"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.meta.original_title = _yaml["original"]["title"].get!string; + if ("language" in _yaml["original"] + && _yaml["original"]["language"].type.string + && _yaml["original"]["language"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.original_language = _yaml["original"]["language"].get!string; + } + if ("language_char" in _yaml["original"] + && _yaml["original"]["language_char"].type.string + && _yaml["original"]["language_char"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.original_language_char = _yaml["original"]["language_char"].get!string; + } + if ("source" in _yaml["original"] + && _yaml["original"]["source"].type.string + && _yaml["original"]["source"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.original_source = _yaml["original"]["source"].get!string; + } + if ("title" in _yaml["original"] + && _yaml["original"]["title"].type.string + && _yaml["original"]["title"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.original_title = _yaml["original"]["title"].get!string; + } } } - } - if ("publisher" in _yaml) { - // if ("" in _yaml["publisher"]) { - // _struct_composite.meta.publisher = _yaml["publisher"][""].str; - // } - } - if ("rights" in _yaml - && _yaml["rights"].type.sequence - ) { - if (_yaml["rights"].type.mapping - && _yaml["rights"].tag.match(rgx.yaml_tag_is_map) + if ("publisher" in _yaml) { + // if ("" in _yaml["publisher"]) { + // _struct_composite.meta.publisher = _yaml["publisher"][""].str; + // } + } + if ("rights" in _yaml + && _yaml["rights"].type.sequence ) { - if ("copyright" in _yaml["rights"] - && _yaml["rights"]["copyright"].type.string - && _yaml["rights"]["copyright"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.meta.rights_copyright = _yaml["rights"]["copyright"].get!string; - } - if ("copyright_text" in _yaml["rights"] - && _yaml["rights"]["copyright_text"].type.string - && _yaml["rights"]["copyright_text"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.meta.rights_copyright_text = _yaml["rights"]["copyright_text"].get!string; - } - if ("copyright_audio" in _yaml["rights"] - && _yaml["rights"]["copyright_audio"].type.string - && _yaml["rights"]["copyright_audio"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.meta.rights_copyright_audio = _yaml["rights"]["copyright_audio"].get!string; - } - if ("copyright_cover" in _yaml["rights"] - && _yaml["rights"]["copyright_cover"].type.string - && _yaml["rights"]["copyright_cover"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.meta.rights_copyright_cover = _yaml["rights"]["copyright_cover"].get!string; - } - if ("copyright_illustrations" in _yaml["rights"] - && _yaml["rights"]["copyright_illustrations"].type.string - && _yaml["rights"]["copyright_illustrations"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.meta.rights_copyright_illustrations = _yaml["rights"]["copyright_illustrations"].get!string; - } - if ("copyright_photographs" in _yaml["rights"] - && _yaml["rights"]["copyright_photographs"].type.string - && _yaml["rights"]["copyright_photographs"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.meta.rights_copyright_photographs = _yaml["rights"]["copyright_photographs"].get!string; - } - if ("copyright_translation" in _yaml["rights"] - && _yaml["rights"]["copyright_translation"].type.string - && _yaml["rights"]["copyright_translation"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.meta.rights_copyright_translation = _yaml["rights"]["copyright_translation"].get!string; - } - if ("copyright_video" in _yaml["rights"] - && _yaml["rights"]["copyright_video"].type.string - && _yaml["rights"]["copyright_video"].tag.match(rgx.yaml_tag_is_str) + if (_yaml["rights"].type.mapping + && _yaml["rights"].tag.match(rgx.yaml_tag_is_map) ) { - _struct_composite.meta.rights_copyright_video = _yaml["rights"]["copyright_video"].get!string; - } - if ("license" in _yaml["rights"] - && _yaml["rights"]["license"].type.string - && _yaml["rights"]["license"].tag.match(rgx.yaml_tag_is_str) - ) { - _struct_composite.meta.rights_license = _yaml["rights"]["license"].get!string; + if ("copyright" in _yaml["rights"] + && _yaml["rights"]["copyright"].type.string + && _yaml["rights"]["copyright"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.rights_copyright = _yaml["rights"]["copyright"].get!string; + } + if ("copyright_text" in _yaml["rights"] + && _yaml["rights"]["copyright_text"].type.string + && _yaml["rights"]["copyright_text"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.rights_copyright_text = _yaml["rights"]["copyright_text"].get!string; + } + if ("copyright_audio" in _yaml["rights"] + && _yaml["rights"]["copyright_audio"].type.string + && _yaml["rights"]["copyright_audio"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.rights_copyright_audio = _yaml["rights"]["copyright_audio"].get!string; + } + if ("copyright_cover" in _yaml["rights"] + && _yaml["rights"]["copyright_cover"].type.string + && _yaml["rights"]["copyright_cover"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.rights_copyright_cover = _yaml["rights"]["copyright_cover"].get!string; + } + if ("copyright_illustrations" in _yaml["rights"] + && _yaml["rights"]["copyright_illustrations"].type.string + && _yaml["rights"]["copyright_illustrations"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.rights_copyright_illustrations = _yaml["rights"]["copyright_illustrations"].get!string; + } + if ("copyright_photographs" in _yaml["rights"] + && _yaml["rights"]["copyright_photographs"].type.string + && _yaml["rights"]["copyright_photographs"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.rights_copyright_photographs = _yaml["rights"]["copyright_photographs"].get!string; + } + if ("copyright_translation" in _yaml["rights"] + && _yaml["rights"]["copyright_translation"].type.string + && _yaml["rights"]["copyright_translation"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.rights_copyright_translation = _yaml["rights"]["copyright_translation"].get!string; + } + if ("copyright_video" in _yaml["rights"] + && _yaml["rights"]["copyright_video"].type.string + && _yaml["rights"]["copyright_video"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.rights_copyright_video = _yaml["rights"]["copyright_video"].get!string; + } + if ("license" in _yaml["rights"] + && _yaml["rights"]["license"].type.string + && _yaml["rights"]["license"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.meta.rights_license = _yaml["rights"]["license"].get!string; + } } } } @@ -1108,11 +1218,12 @@ template configParseYAMLreturnSpineStruct() { doc_reform.meta.conf_make_meta_structs, doc_reform.meta.conf_make_meta_json; mixin contentYAMLtoSpineStruct; - @system auto configParseYAMLreturnSpineStruct(T,CCm,M,O)( + @system auto configParseYAMLreturnSpineStruct(T,CCm,M,O,Cfg)( T _document_struct, CCm _make_and_meta_struct, M _manifested, - O _opt_action + O _opt_action, + Cfg _cfg ){ Node _yaml; if (_document_struct.content.length > 0) { @@ -1125,7 +1236,7 @@ template configParseYAMLreturnSpineStruct() { } try { _make_and_meta_struct - = contentYAMLtoSpineStruct!()(_make_and_meta_struct, _yaml, _manifested, _opt_action, _document_struct.filename); + = contentYAMLtoSpineStruct!()(_make_and_meta_struct, _yaml, _manifested, _opt_action, _cfg, _document_struct.filename); } catch (Throwable) { import std.stdio; writeln("ERROR failed to convert yaml to struct: ", _document_struct.filename); @@ -1202,11 +1313,12 @@ template docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct() { mixin spineRgxIn; mixin contentJSONtoSpineStruct; static auto rgx = RgxI(); - @system auto docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct(CCm,Src,M,O)( + @system auto docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct(CCm,Src,M,O,Cfg)( Src header_src, CCm _make_and_meta_struct, M _manifested, O _opt_action, + Cfg _cfg, ) { Node _yaml; try { @@ -1214,7 +1326,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, _opt_action, "header"); + return contentYAMLtoSpineStruct!()(_make_and_meta_struct, _yaml, _manifested, _opt_action, _cfg, "header"); } catch (Throwable) { writeln("ERROR failed to read document header, header not parsed as yaml: ", _manifested.src.filename); return _make_and_meta_struct; diff --git a/src/doc_reform/meta/metadoc.d b/src/doc_reform/meta/metadoc.d index fdec126..3d04236 100644 --- a/src/doc_reform/meta/metadoc.d +++ b/src/doc_reform/meta/metadoc.d @@ -20,17 +20,18 @@ template spineAbstraction() { enum makeMeta { make, meta } enum docAbst { doc_abstract_obj, doc_has } static auto rgx = RgxI(); - @system auto spineAbstraction(E,P,O,M,S)( + @system auto spineAbstraction(E,P,O,Cfg,M,S)( E _env, P program_info, O _opt_action, + Cfg _cfg, M _manifest, S _make_and_meta_struct ){ { /+ 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, _opt_action); + _make_and_meta_struct = _config_document_struct.configParseYAMLreturnSpineStruct!()(_make_and_meta_struct, _manifest, _opt_action, _cfg); } /+ ↓ read file (filename with path) +/ /+ ↓ file tuple of header and content +/ @@ -66,6 +67,7 @@ template spineAbstraction() { _make_and_meta_struct, _manifest, _opt_action, + _cfg, ); if ((_opt_action.debug_do) || (_opt_action.very_verbose) diff --git a/src/doc_reform/spine.d b/src/doc_reform/spine.d index 006ea1b..2ebdae2 100755 --- a/src/doc_reform/spine.d +++ b/src/doc_reform/spine.d @@ -172,25 +172,25 @@ string program_name = "spine"; "workon" : false, ]; string[string] settings = [ - "output" : "", //_cfg.www_doc_root, // "/srv/www/spine/static" or "/var/www/html" - "www-http" : "", //_cfg.www_http, // "http" or "https" - "www-host" : "", //_cfg.www_host, // start with "localhost" ? - "www-host-doc-root" : "", //_cfg.www_host_doc_root, // start with "localhost" ? - "www-url-doc-root" : "", //_cfg.www_url_doc_root, // start with "http://localhost" ? - "cgi-http" : "", //_cfg.cgi_http, // suggest - "cgi-host" : "", //_cfg.cgi_host, // suggest - "cgi-bin-root" : "", //_cfg.cgi_bin_root, // suggest "/var/www/cgi/cgi-bin" - "cgi-sqlite-search-filename" : "", //_cfg.cgi_filename, // suggest "spine_search" (though "spine-search" would have been preferable?) - "cgi-url-root" : "", //_cfg.cgi_url_root, // start with "http://localhost/cgi-bin" ? - "cgi-url-action" : "", //_cfg.cgi_url_action, // start with "http://localhost/cgi-bin/spine-search" - "cgi-search-title" : "", //_cfg.cgi_search_form_title, // e.g. "≅ SiSU Spine search" + "output" : "", + "www-http" : "", + "www-host" : "", + "www-host-doc-root" : "", + "www-url-doc-root" : "", + "cgi-http" : "", + "cgi-host" : "", + "cgi-bin-root" : "", + "cgi-sqlite-search-filename" : "", + "cgi-url-root" : "", + "cgi-url-action" : "", + "cgi-search-title" : "", "config" : "", - "lang" : "all", //_cfg.default_language, // suggest "all" or "en" (default which language to process) - "set-papersize" : "", //_cfg.default_papersize, // suggest: a4 - "set-textwrap" : "", //_cfg.default_text_wrap, // suggest: 80 - "set-digest" : "", //_cfg.default_hash_digest, // suggest: sha256 - "sqlite-db-path" : "", //_cfg.db_sqlite_path, // suggest: "/var/www/sqlite" - "sqlite-db-filename" : "", //_cfg.db_sqlite_filename, // suggest: "spine-search.db" + "lang" : "all", + "set-papersize" : "", + "set-textwrap" : "", + "set-digest" : "", + "sqlite-db-path" : "", + "sqlite-db-filename" : "", ]; auto helpInfo = getopt(args, std.getopt.config.passThrough, @@ -199,10 +199,10 @@ string program_name = "spine"; "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-bin-root", "path to cgi-bin directory", &settings["cgi-bin-root"], - "cgi-sqlite-search-filename", "cgi-bin sqlite search form name", &settings["cgi-sqlite-search-filename"], "cgi-url-root", "url to cgi-bin (to find cgi-bin)", &settings["cgi-url-root"], "cgi-url-action", "url to post to cgi-bin search form", &settings["cgi-url-action"], - "cgi-search-title", "title for cgi-bin search form", &settings["cgi-search-title"], + "cgi-search-title", "if generating a cgi search form the title to use for it", &settings["cgi-search-title"], + "cgi-sqlite-search-filename", "=[filename] default is spine-search", &settings["cgi-sqlite-search-filename"], "concordance", "file for document", &opts["concordance"], "curate", "extract info on authors & topics from document header metadata", &opts["curate"], "curate-authors", "extract info on authors from document header metadata", &opts["curate-authors"], @@ -217,6 +217,7 @@ 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"], @@ -224,6 +225,7 @@ 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"], @@ -251,6 +253,8 @@ string program_name = "spine"; "sqlite-discrete", "process discrete sqlite output", &opts["sqlite-discrete"], "sqlite-db-create", "create db, create tables", &opts["sqlite-db-create"], "sqlite-db-drop", "drop tables & db", &opts["sqlite-db-drop"], + "sqlite-db-filename", "sqlite db to create, populate & make available for search", &settings["sqlite-db-filename"], + "sqlite-db-path", "sqlite db path", &settings["sqlite-db-path"], "sqlite-db-recreate", "create db, create tables", &opts["sqlite-db-recreate"], "sqlite-delete", "sqlite output", &opts["sqlite-delete"], "sqlite-insert", "sqlite output", &opts["sqlite-insert"], @@ -267,13 +271,7 @@ 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-search-title", "if generating a cgi search form the title to use for it", &settings["cgi-search-title"], - "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"], - "sqlite-db-path", "sqlite db path", &settings["sqlite-db-path"], - "sqlite-db-filename", "sqlite db to create, populate & make available for search", &settings["sqlite-db-filename"], // "sqlite-db-filename", "=[filename].sql.db", &settings["sqlite-db-filename"], ); if (helpInfo.helpWanted) { @@ -466,12 +464,6 @@ string program_name = "spine"; @trusted string cgi_bin_root() { return settings["cgi-bin-root"]; } - @trusted string cgi_url_root() { - return settings["cgi-url-root"]; - } - @trusted string cgi_url_action() { - return settings["cgi-url-action"]; - } @trusted string cgi_search_title() { return settings["cgi-search-title"]; } @@ -483,6 +475,12 @@ string program_name = "spine"; ? (settings["cgi-sqlite-search-filename"].translate(['-' : "_"]) ~ ".d") : ""; } + @trusted string cgi_url_root() { + return settings["cgi-url-root"]; + } + @trusted string cgi_url_action() { + return settings["cgi-url-action"]; + } @trusted string hash_digest_type() { return settings["set-digest"]; } @@ -492,16 +490,16 @@ string program_name = "spine"; @trusted string latex_papersize() { return settings["set-papersize"]; } - @trusted string webserver_host_name() { + @trusted string webserver_host_name() { return settings["www-host"]; } - @trusted string webserver_host_doc_root() { + @trusted string webserver_host_doc_root() { return settings["www-host-doc-root"]; } - @trusted string webserver_url_doc_root() { + @trusted string webserver_url_doc_root() { return settings["www-url-doc-root"]; } - @trusted string webserver_http() { + @trusted string webserver_http() { return settings["www-http"]; } @trusted bool parallelise() { @@ -662,7 +660,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, _cfg); import doc_reform.meta.conf_make_meta_yaml; - _siteConfig = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_siteConfig, _manifested, _opt_action); // - get local site config + _siteConfig = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_siteConfig, _manifested, _opt_action, _cfg); // - get local site config break; } } @@ -670,7 +668,7 @@ string program_name = "spine"; } else { /+ local site config +/ auto _config_local_site_struct = readConfigSite!()(_conf_file_details, _opt_action, _cfg); import doc_reform.meta.conf_make_meta_yaml; - _siteConfig = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_siteConfig, _manifested, _opt_action); // - get local site config + _siteConfig = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_siteConfig, _manifested, _opt_action, _cfg); // - get local site config } if (_opt_action.show_config) { import doc_reform.meta.metadoc_show_config; @@ -886,7 +884,7 @@ string program_name = "spine"; ) { writeln("--->\nstepX commence → (document abstraction)"); } - auto t = spineAbstraction!()(_env, program_info, _opt_action, manifest, _make_and_meta_struct); + auto t = spineAbstraction!()(_env, program_info, _opt_action, _cfg, manifest, _make_and_meta_struct); static assert(t.length==2); auto doc_abstraction = t[dAM.abstraction]; auto doc_matters = t[dAM.matters]; @@ -1000,7 +998,7 @@ string program_name = "spine"; ) { writeln("--->\nstepX commence → (document abstraction)"); } - auto t = spineAbstraction!()(_env, program_info, _opt_action, manifest, _make_and_meta_struct); + auto t = spineAbstraction!()(_env, program_info, _opt_action, _cfg, manifest, _make_and_meta_struct); static assert(t.length==2); auto doc_abstraction = t[dAM.abstraction]; auto doc_matters = t[dAM.matters]; diff --git a/sundry/spine_search_cgi/shell.nix b/sundry/spine_search_cgi/shell.nix index 5926e62..55ca4ae 100755 --- a/sundry/spine_search_cgi/shell.nix +++ b/sundry/spine_search_cgi/shell.nix @@ -1,26 +1,24 @@ #!/usr/bin/env -S nix-shell --pure { pkgs ? import <nixpkgs> {} }: pkgs.mkShell { - buildInputs = with pkgs; [( - with pkgs; [ - # nix_related - nixFlakes - nix-prefetch-git - validatePkgConfig - jq - git - # d_build_related - rund - dub - ldc - #meson - # search_sqlite_related - # search related - sqlite - # candy - starship - ] - )]; + buildInputs = with pkgs; [ + # nix_related + nixFlakes + nix-prefetch-git + validatePkgConfig + jq + git + # d_build_related + rund + dub + ldc + #meson + # search_sqlite_related + # search related + sqlite + # candy + starship + ]; shellHook = '' if [[ -e ".envrc" ]]; then source .envrc diff --git a/sundry/spine_search_cgi/views/configuration_suggested.txt b/sundry/spine_search_cgi/views/configuration_example.txt index 5ba5175..3552861 100644 --- a/sundry/spine_search_cgi/views/configuration_suggested.txt +++ b/sundry/spine_search_cgi/views/configuration_example.txt @@ -3,7 +3,7 @@ struct Cfg { string http_request_type = "http"; string http_host = "localhost"; string www_url_doc_root = "http://localhost"; - string www_doc_root = "/srv/www/spine/static"; + string www_doc_root = "/srv/www/spine"; string cgi_bin_subpath = "/cgi-bin"; string cgi_filename = "spine_search"; // "spine-search" string cgi_search_form_title = "≅ SiSU Spine search"; diff --git a/views/configuration_suggested.txt b/views/configuration_example.txt index 4b109e7..02154de 100644 --- a/views/configuration_suggested.txt +++ b/views/configuration_example.txt @@ -3,7 +3,7 @@ struct Cfg { string www_http = "http"; string www_host = "localhost"; string www_url_doc_root = "http://localhost"; - string www_doc_root = "/srv/www/spine/static"; + string www_doc_root = "/srv/www/spine"; string www_host_doc_root = "localhost"; string cgi_bin_root = "/var/www/cgi/cgi-bin"; string cgi_bin_subpath = "/cgi-bin"; |