aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--org/in_source_files.org47
-rw-r--r--org/meta_conf_make_meta.org2
-rw-r--r--org/spine.org113
-rw-r--r--org/spine_build_scaffold.org28
-rw-r--r--src/doc_reform/io_in/read_config_files.d47
-rwxr-xr-xsrc/doc_reform/spine.d73
-rw-r--r--views/configuration.txt22
-rw-r--r--views/configuration_suggested.txt23
9 files changed, 283 insertions, 74 deletions
diff --git a/.gitignore b/.gitignore
index b6917dd..8cb0a7c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@
!CHANGELOG
!makefile
!version.txt
+!configuration.txt
!*.json
!*.sdl
!meson.build
@@ -13,6 +14,7 @@
!*.org
!*.d
!*.rb
+!*.txt
!conf.sdl
!doc
!doc/**
diff --git a/org/in_source_files.org b/org/in_source_files.org
index 32ed288..6658358 100644
--- a/org/in_source_files.org
+++ b/org/in_source_files.org
@@ -62,7 +62,7 @@ import
#+NAME: meta_config_file_hub_read_site_config
#+BEGIN_SRC d
template readConfigSite() {
- @system final auto readConfigSite(C,O)(C _conf_file_details, O _opt_action) {
+ @system final auto readConfigSite(Cf,O,Cfg)(Cf _conf_file_details, O _opt_action, Cfg _cfg) {
mixin spineRgxIn;
static auto rgx = RgxI();
string conf_filename = "NONE";
@@ -79,28 +79,43 @@ default:
text_wrap: "80"
digest: "sha256"
webserv:
- http: "http"
- domain: "localhost"
- data_http: "http"
- data_domain: "localhost"
- data_root_url: "http://localhost"
- data_root_path: "/var/www/html"
+ http: "%s"
+ domain: "%s"
+ data_http: "%s"
+ data_domain: "%s"
+ data_root_url: "%s"
+ data_root_path: "%s"
data_root_part: ""
images_root_part: "image"
- cgi_title: "≅ SiSU Spine search"
- cgi_http: "http"
- cgi_domain: "localhost"
- cgi_bin_url: "http://localhost/cgi-bin"
+ cgi_title: "%s"
+ cgi_http: "%s"
+ cgi_domain: "%s"
+ cgi_bin_url: "%s"
cgi_bin_part: "cgi-bin"
- cgi_bin_path: "/usr/lib/cgi-bin"
- cgi_search_script: "spine-search"
+ cgi_bin_path: "%s"
+ cgi_search_script: "%s"
cgi_port: ""
cgi_user: ""
- cgi_action: "http://localhost/cgi-bin/spine-search"
- db_sqlite: "spine.search.db"
+ cgi_action: "%s"
+ db_sqlite: "%s"
db_pg_table: ""
db_pg_user: ""
-┃");
+┃",
+ _cfg.www_http, // http
+ _cfg.www_domain, // domain
+ _cfg.www_http, // data http
+ _cfg.www_domain, // data domain
+ _cfg.www_url_doc_root, // data root url
+ _cfg.www_doc_root, // data root path
+ _cfg.cgi_title, // cgi title
+ _cfg.www_http, // cgi http
+ _cfg.www_domain, // cgi domain
+ _cfg.cgi_url_root, // cgi bin url
+ _cfg.cgi_bin_root, // cgi bin path
+ _cfg.cgi_filename, // cgi filename
+ _cfg.cgi_url_action, // cgi action
+ _cfg.db_sqlite_filename, // db filename
+);
foreach(conf_fn; [_conf_file_details.config_filename_site]) {
foreach(pth; _conf_file_details.possible_config_path_locations.config_local_site) {
char[] conf_file;
diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org
index 7c0d9ac..676d395 100644
--- a/org/meta_conf_make_meta.org
+++ b/org/meta_conf_make_meta.org
@@ -18,7 +18,7 @@
[[./spine.org][spine]] [[./][org/]]
* generic
-** conf yaml ref
+** conf yaml REFERENCE
#+BEGIN_SRC yaml
flag:
diff --git a/org/spine.org b/org/spine.org
index aa928b0..ad2cf86 100644
--- a/org/spine.org
+++ b/org/spine.org
@@ -19,8 +19,8 @@
[[./spine_info.org][spine_info.org]] [[./][org/]]
[[./spine_build_scaffold.org][make/build]] VERSION
-* 0. version.txt (set version) :version:
-** 0. set program tangle
+* 0. version.txt configuration.txt (set version & configuration)
+** 0. set program version tangle SET :version:
#+HEADER: :tangle "../views/version.txt"
#+BEGIN_SRC txt
@@ -29,6 +29,35 @@
<<spine_compiler_restrictions>>
#+END_SRC
+** 0. set configuration tangle SET :configuration:
+
+#+HEADER: :tangle "../views/configuration_suggested.txt"
+#+BEGIN_SRC d
+/+ obt - org-mode generated file +/
+struct Cfg {
+ string www_http = "http";
+ string www_doc_root = "/srv/www/spine/static"; // "/var/www/html"
+ string www_domain = "localhost";
+ string www_domain_doc_root = "localhost";
+ string www_url_doc_root = "http://localhost";
+ string cgi_bin_root = "/var/www/cgi/cgi-bin/"; // "/usr/lib/cgi-bin"
+ string cgi_bin_part = "cgi-bin";
+ string cgi_filename = "spine_search"; // "spine-search"
+ string cgi_url_root = "http://localhost/cgi-bin";
+ string cgi_port = "";
+ string cgi_user = "";
+ string cgi_url_action = "http://localhost/cgi-bin/spine_search";
+ string cgi_title = "≅ SiSU Spine search";
+ string db_sqlite_doc_root = "/srv/www/spine/static/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
+
** program version struct
#+NAME: spine_version_struct
@@ -97,6 +126,7 @@ homepage "https://sisudoc.org"
+/
<<imports_spine>>
<<mixin_spine_version>>
+<<mixin_spine_configuration>>
<<mixin_pre_main>>
string project_name = "spine";
string program_name = "spine";
@@ -313,6 +343,13 @@ keep up to date, configuration in
mixin(import("version.txt"));
#+END_SRC
+***** configuration.txt :configuration:
+
+#+NAME: mixin_spine_configuration
+#+BEGIN_SRC d
+mixin(import("configuration.txt"));
+#+END_SRC
+
***** pre main mixins
#+NAME: mixin_pre_main
@@ -438,14 +475,22 @@ bool[string] opts = [
"workon" : false,
];
string[string] settings = [
- "cgi-search-title" : "", // config default: "spine-search"
- "cgi-sqlite-search-filename" : "", // config default: "spine-search"
+ "output" : "", //_cfg.www_doc_root, // "/srv/www/spine/static" or "/var/www/html"
+ "www-http" : "", //_cfg.www_http, // "http" or "https"
+ "www-domain" : "", //_cfg.www_domain, // start with "localhost" ?
+ "www-domain-doc-root" : "", //_cfg.www_domain_doc_root, // start with "localhost" ?
+ "www-url-doc-root" : "", //_cfg.www_url_doc_root, // start with "http://localhost" ?
+ "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_title, // e.g. "≅ SiSU Spine search"
"config" : "",
- "output" : "",
- "lang" : "all", // which language to process
- "set-papersize" : "", // config default: a4
- "sqlite-db-filename" : "", // config default: "spine-search.db"
- "webserv-domain" : "", // config default: localhost
+ "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-filename" : "", //_cfg.db_sqlite_filename, // suggest: "spine-search.db"
];
#+END_SRC
@@ -459,6 +504,11 @@ auto helpInfo = getopt(args,
"allow-downloads", "allow downloads (includes cgi.d from github)", &opts["allow-downloads"],
"assert", "set optional assertions on", &opts["assertions"],
"cgi-search-form-codegen", "generates (pre-compiled) d code for search of specified db", &opts["cgi-search-form-codegen"],
+ "cgi-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"],
"concordance", "file for document", &opts["concordance"],
"dark", "alternative dark theme", &opts["dark"],
"debug", "debug", &opts["debug"],
@@ -501,6 +551,9 @@ auto helpInfo = getopt(args,
"show-metadata", "show metadata", &opts["show-metadata"],
"show-summary", "show summary", &opts["show-summary"],
"source", "document markup source", &opts["source"],
+ "set-digest", "default hash digest type (e.g. sha256)", &settings["set-digest"],
+ "set-papersize", "default papersize (latex pdf eg. a4 or a5 or b4 or letter)", &settings["set-papersize"],
+ "set-textwrap", "default textwrap (e.g. 80 (characters)", &settings["set-textwrap"],
"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"],
@@ -508,6 +561,10 @@ auto helpInfo = getopt(args,
"sqlite-delete", "sqlite output", &opts["sqlite-delete"],
"sqlite-insert", "sqlite output", &opts["sqlite-insert"],
"sqlite-update", "sqlite output", &opts["sqlite-update"],
+ "www-http", "http or https", &settings["www-http"],
+ "www-domain", "web server domain name", &settings["www-domain"],
+ "www-domain-doc-root", "web host domain name with path to doc root", &settings["www-domain-doc-root"],
+ "www-url-doc-root", "e.g. http://localhost", &settings["www-url-doc-root"],
"text", "text output", &opts["text"],
"theme-dark", "alternative dark theme", &opts["theme-dark"],
"theme-light", "default light theme", &opts["theme-light"],
@@ -521,9 +578,8 @@ auto helpInfo = getopt(args,
"config", "=/path/to/config/file/including/filename", &settings["config"],
"lang", "=[lang code e.g. =en or =en,es]", &settings["lang"],
"output", "=/path/to/output/dir specify where to place output", &settings["output"],
- "set-papersize", "=\"a4,a5,b4,letter\"", &settings["set-papersize"],
- "sqlite-db-filename", "=[filename].sql.db", &settings["sqlite-db-filename"],
- "webserv-domain", "=[web-server.domain.name]", &settings["webserv-domain"],
+ "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) {
defaultGetoptPrinter("Some information about the program.", helpInfo.options);
@@ -641,6 +697,9 @@ struct OptActions {
@trusted bool source_or_pod() {
return (opts["pod"] || opts["source"]) ? true : false;
}
+ @trusted string sqlite_db_filename() {
+ return settings["sqlite-db-filename"];
+ }
@trusted bool sqlite_discrete() {
return opts["sqlite-discrete"];
}
@@ -716,6 +775,15 @@ struct OptActions {
@trusted string sqlite_filename() {
return settings["sqlite-db-filename"];
}
+ @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"];
}
@@ -727,11 +795,26 @@ struct OptActions {
? (settings["cgi-sqlite-search-filename"].translate(['-' : "_"]) ~ ".d")
: "";
}
+ @trusted string hash_digest_type() {
+ return settings["set-digest"];
+ }
+ @trusted string text_wrap() {
+ return settings["set-textwrap"];
+ }
@trusted string latex_papersize() {
return settings["set-papersize"];
}
@trusted string webserver_domain_name() {
- return settings["webserv-domain"];
+ return settings["www-domain"];
+ }
+ @trusted string webserver_domain_doc_root() {
+ return settings["www-domain-doc-root"];
+ }
+ @trusted string webserver_url_doc_root() {
+ return settings["www-url-root"];
+ }
+ @trusted string webserver_http() {
+ return settings["www-http"];
}
@trusted bool parallelise() {
bool _is;
@@ -902,7 +985,7 @@ if (
_manifested = PathMatters!()(_opt_action, _env, arg);
{ /+ local site config +/
_conf_file_details = configFilePaths!()(_manifested, _env, _opt_action.config_path_set);
- auto _config_local_site_struct = readConfigSite!()(_conf_file_details, _opt_action);
+ auto _config_local_site_struct = readConfigSite!()(_conf_file_details, _opt_action, _cfg);
import doc_reform.meta.conf_make_meta_yaml;
_config = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_config, _manifested, _opt_action); // - get local site config
break;
@@ -910,7 +993,7 @@ if (
}
}
} else { /+ local site config +/
- auto _config_local_site_struct = readConfigSite!()(_conf_file_details, _opt_action);
+ auto _config_local_site_struct = readConfigSite!()(_conf_file_details, _opt_action, _cfg);
import doc_reform.meta.conf_make_meta_yaml;
_config = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_config, _manifested, _opt_action); // - get local site config
}
diff --git a/org/spine_build_scaffold.org b/org/spine_build_scaffold.org
index 6cc4c6d..5089e15 100644
--- a/org/spine_build_scaffold.org
+++ b/org/spine_build_scaffold.org
@@ -2239,12 +2239,12 @@ echo '* spine run instruction examples
$SpineBIN/spine --html $SpineDOC/markup/pod/*
- $SpineBIN/spine -v --sqlite-db-create --sqlite-filename="spine.search.db" --output="$SpineOUTstatic" $SpineDOC/markup/pod/*
+ $SpineBIN/spine -v --sqlite-db-create --sqlite-db-filename="spine.search.db" --output="$SpineOUTstatic" $SpineDOC/markup/pod/*
- $SpineBIN/spine -v --sqlite-db-create --sqlite-filename="spine.search.db" --cgi-sqlite-search-filename="spine-search" --output=$SpineOUTstatic $SpineDOC/markup/pod/*
- $SpineBIN/spine -v --sqlite-db-recreate --sqlite-filename="spine.search.db" --cgi-sqlite-search-filename="spine-search" --output=$SpineOUTstatic $SpineDOC/markup/pod/*
+ $SpineBIN/spine -v --sqlite-db-create --sqlite-db-filename="spine.search.db" --cgi-sqlite-search-filename="spine-search" --output=$SpineOUTstatic $SpineDOC/markup/pod/*
+ $SpineBIN/spine -v --sqlite-db-recreate --sqlite-db-filename="spine.search.db" --cgi-sqlite-search-filename="spine-search" --output=$SpineOUTstatic $SpineDOC/markup/pod/*
- $SpineBIN/spine -v --sqlite-update --sqlite-filename="spine.search.db" --output=$SpineOUTstatic $SpineDOC/markup/pod/*
+ $SpineBIN/spine -v --sqlite-update --sqlite-db-filename="spine.search.db" --output=$SpineOUTstatic $SpineDOC/markup/pod/*
$SpineBIN/spine -v --cgi-search-form-codegen --config=$SpineDOC/markup/pod/.dr/config_local_site
@@ -2252,7 +2252,7 @@ echo '* spine run instruction examples
$SpineBIN/spine -v --html --html-link-search --html-link-harvest --harvest --output=$SpineOUTstatic $SpineDOC/markup/pod/*
- populate sqlite db
- $SpineBIN/spine -v --sqlite-db-recreate --sqlite-filename="spine.search.db" --cgi-sqlite-search-filename="spine-search" --sqlite-update --output=$SpineOUTstatic $SpineDOC/markup/pod/*
+ $SpineBIN/spine -v --sqlite-db-recreate --sqlite-db-filename="spine.search.db" --cgi-sqlite-search-filename="spine-search" --sqlite-update --output=$SpineOUTstatic $SpineDOC/markup/pod/*
- make search form
$SpineBIN/spine -v --cgi-search-form-codegen --config=$SpineDOC/markup/pod/.dr/config_local_site --output=$SpineOUTstatic
@@ -2801,6 +2801,7 @@ git
!CHANGELOG
!makefile
!version.txt
+!configuration.txt
!*.json
!*.sdl
!meson.build
@@ -2808,6 +2809,7 @@ git
!*.org
!*.d
!*.rb
+!*.txt
!conf.sdl
!doc
!doc/**
@@ -5276,10 +5278,10 @@ find data/sisudir/media/text -name *.ss[tm] | sort | xargs
*** sort
#+BEGIN_SRC sh
-~dr/bin/spine-ldc -v --sqlite-db-create --sqlite-filename="spine.search.db" --cgi-sqlite-search-filename="spine-search" --output=/var/www/html \
+~dr/bin/spine-ldc -v --sqlite-db-create --sqlite-db-filename="spine.search.db" --cgi-sqlite-search-filename="spine-search" --output=/var/www/html \
~grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod/*
-~dr/bin/spine-ldc -v --sqlite-update --sqlite-filename="spine.search.db" --output=/var/www/html \
+~dr/bin/spine-ldc -v --sqlite-update --sqlite-db-filename="spine.search.db" --output=/var/www/html \
~grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod/*
~dr/bin/spine-ldc -v --html --harvest-link --output=/var/www/html \
@@ -5291,9 +5293,9 @@ find data/sisudir/media/text -name *.ss[tm] | sort | xargs
~dr/result/bin/spine --html --output=/var/www/html /grotto-ra/repo/git.repo/projects/project-spine/doc-reform-markup/markup_samples/markup/pod/*
-~dr/result/bin/spine --very-verbose --sqlite-db-create --sqlite-filename="spine.search.db" --cgi-sqlite-search-filename="spine-search" --output=/var/www /grotto-ra/repo/git.repo/projects/project-spine/doc-reform-markup/markup_samples/markup/pod/*
+~dr/result/bin/spine --very-verbose --sqlite-db-create --sqlite-db-filename="spine.search.db" --cgi-sqlite-search-filename="spine-search" --output=/var/www /grotto-ra/repo/git.repo/projects/project-spine/doc-reform-markup/markup_samples/markup/pod/*
-~dr/result/bin/spine --very-verbose --sqlite-update --sqlite-filename="spine.search.db" --cgi-sqlite-search-filename="spine-search" --output=/var/www /grotto-ra/repo/git.repo/projects/project-spine/doc-reform-markup/markup_samples/markup/pod/*
+~dr/result/bin/spine --very-verbose --sqlite-update --sqlite-db-filename="spine.search.db" --cgi-sqlite-search-filename="spine-search" --output=/var/www /grotto-ra/repo/git.repo/projects/project-spine/doc-reform-markup/markup_samples/markup/pod/*
#+END_SRC
- produces:
@@ -5610,11 +5612,11 @@ for i in org/spine_build_scaffold.org; do; sed -i "0,/\(version:\)\s\+['][0-9]\+
~dr/bin/spine-ldc -v --show-config --config=/grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod/.dr
~dr/bin/spine-ldc --show-config --html ~grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod/*
-~dr/bin/spine-ldc -v --sqlite-db-create --sqlite-filename="spine.search.db" --output=/var/www/html ~grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod
-~dr/bin/spine-ldc -v --sqlite-db-create --sqlite-filename="spine.search.db" --cgi-sqlite-search-filename="spine-search" --output=/var/www/html ~grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod
-~dr/bin/spine-ldc -v --sqlite-db-recreate --sqlite-filename="spine.search.db" --cgi-sqlite-search-filename="spine-search" --output=/var/www/html ~grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod
+~dr/bin/spine-ldc -v --sqlite-db-create --sqlite-db-filename="spine.search.db" --output=/var/www/html ~grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod
+~dr/bin/spine-ldc -v --sqlite-db-create --sqlite-db-filename="spine.search.db" --cgi-sqlite-search-filename="spine-search" --output=/var/www/html ~grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod
+~dr/bin/spine-ldc -v --sqlite-db-recreate --sqlite-db-filename="spine.search.db" --cgi-sqlite-search-filename="spine-search" --output=/var/www/html ~grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod
-~dr/bin/spine-ldc -v --sqlite-update --sqlite-filename="spine.search.db" --output=/var/www/html ~grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod/*
+~dr/bin/spine-ldc -v --sqlite-update --sqlite-db-filename="spine.search.db" --output=/var/www/html ~grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod/*
~dr/bin/spine-ldc -v --cgi-search-form-codegen --config=/grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod/.dr/config_local_site
diff --git a/src/doc_reform/io_in/read_config_files.d b/src/doc_reform/io_in/read_config_files.d
index 44f93ec..005a436 100644
--- a/src/doc_reform/io_in/read_config_files.d
+++ b/src/doc_reform/io_in/read_config_files.d
@@ -62,7 +62,7 @@ import
doc_reform.meta.rgx;
template readConfigSite() {
- @system final auto readConfigSite(C,O)(C _conf_file_details, O _opt_action) {
+ @system final auto readConfigSite(Cf,O,Cfg)(Cf _conf_file_details, O _opt_action, Cfg _cfg) {
mixin spineRgxIn;
static auto rgx = RgxI();
string conf_filename = "NONE";
@@ -79,28 +79,43 @@ default:
text_wrap: "80"
digest: "sha256"
webserv:
- http: "http"
- domain: "localhost"
- data_http: "http"
- data_domain: "localhost"
- data_root_url: "http://localhost"
- data_root_path: "/var/www/html"
+ http: "%s"
+ domain: "%s"
+ data_http: "%s"
+ data_domain: "%s"
+ data_root_url: "%s"
+ data_root_path: "%s"
data_root_part: ""
images_root_part: "image"
- cgi_title: "≅ SiSU Spine search"
- cgi_http: "http"
- cgi_domain: "localhost"
- cgi_bin_url: "http://localhost/cgi-bin"
+ cgi_title: "%s"
+ cgi_http: "%s"
+ cgi_domain: "%s"
+ cgi_bin_url: "%s"
cgi_bin_part: "cgi-bin"
- cgi_bin_path: "/usr/lib/cgi-bin"
- cgi_search_script: "spine-search"
+ cgi_bin_path: "%s"
+ cgi_search_script: "%s"
cgi_port: ""
cgi_user: ""
- cgi_action: "http://localhost/cgi-bin/spine-search"
- db_sqlite: "spine.search.db"
+ cgi_action: "%s"
+ db_sqlite: "%s"
db_pg_table: ""
db_pg_user: ""
-┃");
+┃",
+ _cfg.www_http, // http
+ _cfg.www_domain, // domain
+ _cfg.www_http, // data http
+ _cfg.www_domain, // data domain
+ _cfg.www_url_doc_root, // data root url
+ _cfg.www_doc_root, // data root path
+ _cfg.cgi_title, // cgi title
+ _cfg.www_http, // cgi http
+ _cfg.www_domain, // cgi domain
+ _cfg.cgi_url_root, // cgi bin url
+ _cfg.cgi_bin_root, // cgi bin path
+ _cfg.cgi_filename, // cgi filename
+ _cfg.cgi_url_action, // cgi action
+ _cfg.db_sqlite_filename, // db filename
+);
foreach(conf_fn; [_conf_file_details.config_filename_site]) {
foreach(pth; _conf_file_details.possible_config_path_locations.config_local_site) {
char[] conf_file;
diff --git a/src/doc_reform/spine.d b/src/doc_reform/spine.d
index aff29b1..418177c 100755
--- a/src/doc_reform/spine.d
+++ b/src/doc_reform/spine.d
@@ -80,6 +80,7 @@ import
doc_reform.io_in.read_source_files,
doc_reform.io_out.hub;
mixin(import("version.txt"));
+mixin(import("configuration.txt"));
mixin CompileTimeInfo;
string project_name = "spine";
string program_name = "spine";
@@ -171,14 +172,22 @@ string program_name = "spine";
"workon" : false,
];
string[string] settings = [
- "cgi-search-title" : "", // config default: "spine-search"
- "cgi-sqlite-search-filename" : "", // config default: "spine-search"
+ "output" : "", //_cfg.www_doc_root, // "/srv/www/spine/static" or "/var/www/html"
+ "www-http" : "", //_cfg.www_http, // "http" or "https"
+ "www-domain" : "", //_cfg.www_domain, // start with "localhost" ?
+ "www-domain-doc-root" : "", //_cfg.www_domain_doc_root, // start with "localhost" ?
+ "www-url-doc-root" : "", //_cfg.www_url_doc_root, // start with "http://localhost" ?
+ "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_title, // e.g. "≅ SiSU Spine search"
"config" : "",
- "output" : "",
- "lang" : "all", // which language to process
- "set-papersize" : "", // config default: a4
- "sqlite-db-filename" : "", // config default: "spine-search.db"
- "webserv-domain" : "", // config default: localhost
+ "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-filename" : "", //_cfg.db_sqlite_filename, // suggest: "spine-search.db"
];
auto helpInfo = getopt(args,
std.getopt.config.passThrough,
@@ -186,6 +195,11 @@ string program_name = "spine";
"allow-downloads", "allow downloads (includes cgi.d from github)", &opts["allow-downloads"],
"assert", "set optional assertions on", &opts["assertions"],
"cgi-search-form-codegen", "generates (pre-compiled) d code for search of specified db", &opts["cgi-search-form-codegen"],
+ "cgi-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"],
"concordance", "file for document", &opts["concordance"],
"dark", "alternative dark theme", &opts["dark"],
"debug", "debug", &opts["debug"],
@@ -228,6 +242,9 @@ string program_name = "spine";
"show-metadata", "show metadata", &opts["show-metadata"],
"show-summary", "show summary", &opts["show-summary"],
"source", "document markup source", &opts["source"],
+ "set-digest", "default hash digest type (e.g. sha256)", &settings["set-digest"],
+ "set-papersize", "default papersize (latex pdf eg. a4 or a5 or b4 or letter)", &settings["set-papersize"],
+ "set-textwrap", "default textwrap (e.g. 80 (characters)", &settings["set-textwrap"],
"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"],
@@ -235,6 +252,10 @@ string program_name = "spine";
"sqlite-delete", "sqlite output", &opts["sqlite-delete"],
"sqlite-insert", "sqlite output", &opts["sqlite-insert"],
"sqlite-update", "sqlite output", &opts["sqlite-update"],
+ "www-http", "http or https", &settings["www-http"],
+ "www-domain", "web server domain name", &settings["www-domain"],
+ "www-domain-doc-root", "web host domain name with path to doc root", &settings["www-domain-doc-root"],
+ "www-url-doc-root", "e.g. http://localhost", &settings["www-url-doc-root"],
"text", "text output", &opts["text"],
"theme-dark", "alternative dark theme", &opts["theme-dark"],
"theme-light", "default light theme", &opts["theme-light"],
@@ -248,9 +269,8 @@ string program_name = "spine";
"config", "=/path/to/config/file/including/filename", &settings["config"],
"lang", "=[lang code e.g. =en or =en,es]", &settings["lang"],
"output", "=/path/to/output/dir specify where to place output", &settings["output"],
- "set-papersize", "=\"a4,a5,b4,letter\"", &settings["set-papersize"],
- "sqlite-db-filename", "=[filename].sql.db", &settings["sqlite-db-filename"],
- "webserv-domain", "=[web-server.domain.name]", &settings["webserv-domain"],
+ "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) {
defaultGetoptPrinter("Some information about the program.", helpInfo.options);
@@ -361,6 +381,9 @@ string program_name = "spine";
@trusted bool source_or_pod() {
return (opts["pod"] || opts["source"]) ? true : false;
}
+ @trusted string sqlite_db_filename() {
+ return settings["sqlite-db-filename"];
+ }
@trusted bool sqlite_discrete() {
return opts["sqlite-discrete"];
}
@@ -436,6 +459,15 @@ string program_name = "spine";
@trusted string sqlite_filename() {
return settings["sqlite-db-filename"];
}
+ @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"];
}
@@ -447,11 +479,26 @@ string program_name = "spine";
? (settings["cgi-sqlite-search-filename"].translate(['-' : "_"]) ~ ".d")
: "";
}
+ @trusted string hash_digest_type() {
+ return settings["set-digest"];
+ }
+ @trusted string text_wrap() {
+ return settings["set-textwrap"];
+ }
@trusted string latex_papersize() {
return settings["set-papersize"];
}
@trusted string webserver_domain_name() {
- return settings["webserv-domain"];
+ return settings["www-domain"];
+ }
+ @trusted string webserver_domain_doc_root() {
+ return settings["www-domain-doc-root"];
+ }
+ @trusted string webserver_url_doc_root() {
+ return settings["www-url-root"];
+ }
+ @trusted string webserver_http() {
+ return settings["www-http"];
}
@trusted bool parallelise() {
bool _is;
@@ -609,7 +656,7 @@ string program_name = "spine";
_manifested = PathMatters!()(_opt_action, _env, arg);
{ /+ local site config +/
_conf_file_details = configFilePaths!()(_manifested, _env, _opt_action.config_path_set);
- auto _config_local_site_struct = readConfigSite!()(_conf_file_details, _opt_action);
+ auto _config_local_site_struct = readConfigSite!()(_conf_file_details, _opt_action, _cfg);
import doc_reform.meta.conf_make_meta_yaml;
_config = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_config, _manifested, _opt_action); // - get local site config
break;
@@ -617,7 +664,7 @@ string program_name = "spine";
}
}
} else { /+ local site config +/
- auto _config_local_site_struct = readConfigSite!()(_conf_file_details, _opt_action);
+ auto _config_local_site_struct = readConfigSite!()(_conf_file_details, _opt_action, _cfg);
import doc_reform.meta.conf_make_meta_yaml;
_config = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_config, _manifested, _opt_action); // - get local site config
}
diff --git a/views/configuration.txt b/views/configuration.txt
new file mode 100644
index 0000000..226631d
--- /dev/null
+++ b/views/configuration.txt
@@ -0,0 +1,22 @@
+struct Cfg {
+ string www_http = "http";
+ string www_doc_root = "/srv/www/spine/static";
+ string www_domain = "localhost";
+ string www_domain_doc_root = "localhost";
+ string www_url_doc_root = "http://localhost";
+ string cgi_bin_root = "/var/www/cgi/cgi-bin/";
+ string cgi_bin_part = "cgi-bin";
+ string cgi_filename = "spine_search";
+ string cgi_url_root = "http://localhost/cgi-bin";
+ string cgi_port = "";
+ string cgi_user = "";
+ string cgi_url_action = "http://localhost/cgi-bin/spine_search";
+ string cgi_title = "≅ SiSU Spine search";
+ string db_sqlite_doc_root = "/srv/www/spine/static/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();
diff --git a/views/configuration_suggested.txt b/views/configuration_suggested.txt
new file mode 100644
index 0000000..3bdf8b4
--- /dev/null
+++ b/views/configuration_suggested.txt
@@ -0,0 +1,23 @@
+/+ obt - org-mode generated file +/
+struct Cfg {
+ string www_http = "http";
+ string www_doc_root = "/srv/www/spine/static"; // "/var/www/html"
+ string www_domain = "localhost";
+ string www_domain_doc_root = "localhost";
+ string www_url_doc_root = "http://localhost";
+ string cgi_bin_root = "/var/www/cgi/cgi-bin/"; // "/usr/lib/cgi-bin"
+ string cgi_bin_part = "cgi-bin";
+ string cgi_filename = "spine_search"; // "spine-search"
+ string cgi_url_root = "http://localhost/cgi-bin";
+ string cgi_port = "";
+ string cgi_user = "";
+ string cgi_url_action = "http://localhost/cgi-bin/spine_search";
+ string cgi_title = "≅ SiSU Spine search";
+ string db_sqlite_doc_root = "/srv/www/spine/static/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();