diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2022-01-28 10:38:10 -0500 | 
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2022-01-29 00:50:49 -0500 | 
| commit | d39da3f07036b22892ffb0b05737e8ba7e1ff954 (patch) | |
| tree | 7d4a5cca9563faa1f9f15057b2ad0116149775b3 | |
| parent | cgi sqlite_search, heading matches fix, cleanup (diff) | |
config & sqlite search output, some changes
| -rw-r--r-- | .dr/config_local_site_example | 18 | ||||
| -rw-r--r-- | org/cgi_spine_search.org | 63 | ||||
| -rw-r--r-- | org/config_d_cfte.org | 55 | ||||
| -rw-r--r-- | org/in_source_files.org | 34 | ||||
| -rw-r--r-- | org/meta_conf_make_meta.org | 173 | ||||
| -rw-r--r-- | org/out_cgi_search_sqlite.org | 18 | ||||
| -rw-r--r-- | org/out_sqlite.org | 11 | ||||
| -rw-r--r-- | src/doc_reform/io_in/read_config_files.d | 34 | ||||
| -rw-r--r-- | src/doc_reform/io_out/cgi_sqlite_search_form.d | 18 | ||||
| -rw-r--r-- | src/doc_reform/io_out/sqlite.d | 11 | ||||
| -rw-r--r-- | src/doc_reform/meta/conf_make_meta_yaml.d | 15 | ||||
| -rw-r--r-- | sundry/spine_search_cgi/src/spine_search.d | 63 | ||||
| -rwxr-xr-x | sundry/spine_search_cgi/src/spine_search.d_ | 63 | ||||
| -rw-r--r-- | sundry/spine_search_cgi/views/configuration.txt | 2 | ||||
| -rw-r--r-- | sundry/spine_search_cgi/views/configuration_example.txt | 2 | ||||
| -rw-r--r-- | views/configuration.txt | 38 | ||||
| -rw-r--r-- | views/configuration_example.txt | 38 | 
17 files changed, 411 insertions, 245 deletions
| diff --git a/.dr/config_local_site_example b/.dr/config_local_site_example index 6e751c1..2ddbfac 100644 --- a/.dr/config_local_site_example +++ b/.dr/config_local_site_example @@ -11,25 +11,25 @@ default:    text_wrap:                   "80"    digest:                      "sha256"  webserv: -  http:                        "https"                            # "http" -  domain:                      "sisudoc"                          # "localhost" +  http:                        "http"                             # "https" +  domain:                      "localhost"                        # "mysite"    data_http:                   "https"                            # "http" -  data_domain:                 "sisudoc"                          # "localhost" -  data_root_url:               "https://sisudoc.org"              # "http://localhost" +  data_domain:                 "localhost"                        # "mysite" +  data_root_url:               "http://localhost"                 # "https://mysite.org"    data_root_path:              "/srv/www/spine"                   # "/var/www/html" -  data_root_part:              "" +  data_root_part:              ""                                 # "/spine"    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_http:                    "http"                             # "https" +  cgi_domain:                  "localhost"                        # "mysite.org" +  cgi_bin_url:                 "http://localhost/cgi-bin"         # "https://mysite.org/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" +  cgi_action:                  "http://localhost/cgi-bin/spine-search" # "https://mysite.org/spine_search"    db_sqlite_filename:          "spine.search.db"    db_sqlite_path:              "/var/www/sqlite"    db_pg_table:                 "" diff --git a/org/cgi_spine_search.org b/org/cgi_spine_search.org index b1e9a5a..311b497 100644 --- a/org/cgi_spine_search.org +++ b/org/cgi_spine_search.org @@ -274,7 +274,7 @@ auto conf = Config();  conf.http_request_type          = environment.get("REQUEST_SCHEME",        _cfg.http_request_type);  conf.http_host                  = environment.get("SERVER_NAME",           _cfg.http_host);  // conf.http_host                  = environment.get("HTTP_HOST",             _cfg.http_host); -conf.doc_collection_subroot     = _cfg.www_doc_subroot; +conf.doc_collection_subroot     = _cfg.www_url_doc_subroot;  conf.cgi_script_name            = environment.get("SCRIPT_NAME",           _cfg.cgi_filename);  conf.cgi_search_form_title      = _cfg.cgi_search_form_title; // ≅ SiSU spine search form  conf.cgi_search_form_html_title = "<a href=\"" @@ -1090,6 +1090,7 @@ SELECT    doc_objects.seg_name,    doc_objects.ocn,    doc_objects.lev, +  doc_objects.is_a,    metadata_and_text.uid  FROM    doc_objects, @@ -1163,8 +1164,19 @@ if (!select_query_results.empty) {        );      }      if (cv.results_type == "txt") { +      string _sfn, _id;        if ((row["lev"].as!int < 4)        || (row["ocn"].as!string == "0")) { +        if (row["is_a"].as!string == "bookindex") { +          _sfn = "bookindex"; +          _id = "idx"; +        } else if (row["is_a"].as!string == "blurb") { +          _sfn = "blurb"; +          _id = "bm"; +        } else { +          _sfn = "toc"; +          _id = row["ocn"].as!string; +        }          cgi.write(            "<div class=\"flex-container\">"            ~ "<div class=\"textview_ocn\" style=\"flex: 0 0 1.2em\">" @@ -1172,9 +1184,10 @@ if (!select_query_results.empty) {                ~ conf.http_request_type ~ "://"                ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"                ~ row["language_document_char"].as!string ~ "/html/" -              ~ row["src_filename_base"].as!string ~ "/toc.html" +              ~ row["src_filename_base"].as!string ~ "/" +              ~ _sfn ~ ".html"              ~ "\">" -              ~ row["ocn"].as!string +              ~ _id              ~ "</a>:</p>"            ~ "</div>"            ~ "<div class=\"textview_found\">" @@ -1183,6 +1196,16 @@ if (!select_query_results.empty) {            ~ "</div>"          );        } else { +        if (row["is_a"].as!string == "bibliography") { +          _id = row["ocn"].as!string ~ "b"; +          _sfn = "bibliography"; +        } else if (row["is_a"].as!string == "glossary") { +          _id = row["ocn"].as!string ~ "g"; +          _sfn = "glossary"; +        } else { +          _id = row["ocn"].as!string; +          _sfn = row["seg_name"].as!string; +        }          cgi.write(            "<div class=\"flex-container\">"            ~ "<div class=\"textview_ocn\" style=\"flex: 0 0 1.2em\">" @@ -1191,9 +1214,9 @@ if (!select_query_results.empty) {                ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"                ~ row["language_document_char"].as!string ~ "/html/"                ~ row["src_filename_base"].as!string ~ "/" -              ~ row["seg_name"].as!string ~ ".html#" ~ row["ocn"].as!string +              ~ _sfn ~ ".html#" ~ row["ocn"].as!string              ~ "\">" -              ~ row["ocn"].as!string +              ~  _id              ~ "</a>:</p>"            ~ "</div>"            ~ "<div class=\"textview_found\">" @@ -1203,20 +1226,42 @@ if (!select_query_results.empty) {          );        }      } else { +      string _sfn, _id;        if ((row["lev"].as!int < 4)        || (row["ocn"].as!string == "0")) { +        if (row["is_a"].as!string == "bookindex") { +          _sfn = "bookindex"; +          _id = "i"; +        } else if (row["is_a"].as!string == "blurb") { +          _sfn = "blurb"; +          _id = "bm"; +        } else { +          _sfn = "toc"; +          _id = row["ocn"].as!string; +        }          cgi.write(            _matched_ocn_open            ~ "<a href=\""              ~ conf.http_request_type ~ "://"              ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"              ~ row["language_document_char"].as!string ~ "/html/" -            ~ row["src_filename_base"].as!string ~ "/toc.html" +            ~ row["src_filename_base"].as!string ~ "/" +            ~ _sfn ~ ".html"            ~ "\">" -            ~ row["ocn"].as!string +            ~ _id            ~ "</a>, "          );        } else { +        if (row["is_a"].as!string == "bibliography") { +          _id = row["ocn"].as!string ~ "b"; +          _sfn = "bibliography"; +        } else if (row["is_a"].as!string == "glossary") { +          _id = row["ocn"].as!string ~ "g"; +          _sfn = "glossary"; +        } else { +          _id = row["ocn"].as!string; +          _sfn = row["seg_name"].as!string; +        }          cgi.write(            _matched_ocn_open            ~ "<a href=\"" @@ -1224,9 +1269,9 @@ if (!select_query_results.empty) {              ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"              ~ row["language_document_char"].as!string ~ "/html/"              ~ row["src_filename_base"].as!string ~ "/" -            ~ row["seg_name"].as!string ~ ".html#" ~ row["ocn"].as!string +            ~ _sfn ~ ".html#" ~ row["ocn"].as!string            ~ "\">" -            ~ row["ocn"].as!string +            ~  _id            ~ "</a>, "          );        } diff --git a/org/config_d_cfte.org b/org/config_d_cfte.org index ebc164b..00ba703 100644 --- a/org/config_d_cfte.org +++ b/org/config_d_cfte.org @@ -72,25 +72,25 @@ SEE NOTES on configuration hierarchy in spine.org  #+BEGIN_SRC d  /+ obt - org-mode generated file +/  struct Cfg { -  string www_http              = "<<www_http>>"; -  string www_host              = "<<www_host>>"; -  string www_url_doc_root      = "<<www_url_doc_root>>"; -  string www_doc_root          = "<<www_doc_root>>"; -  string www_host_doc_root     = "localhost"; -  string cgi_bin_root          = "<<cgi_bin_root>>"; -  string cgi_bin_subpath       = "<<cgi_bin_subpath>>"; -  string cgi_filename          = "<<cgi_filename>>"; -  string cgi_url_root          = "<<www_http>>://<<www_host>><<cgi_bin_subpath>>"; -  string cgi_port              = ""; -  string cgi_user              = ""; -  string cgi_url_action        = "<<www_http>>://<<www_host>><<cgi_bin_subpath>>/<<cgi_filename>>"; -  string cgi_search_form_title = "<<cgi_search_form_title>>"; -  string db_sqlite_path        = "<<db_sqlite_path>>"; -  string db_sqlite_filename    = "<<db_sqlite_filename>>"; -  string default_language      = "en"; -  string default_papersize     = "a4"; -  string default_text_wrap     = "80"; -  string default_hash_digest   = "sha256"; +  string http_request_type        = "<<http_request_type>>"; +  string http_host                = "<<http_host>>"; +  string www_url_doc_root         = "<<www_url_doc_root>>"; +  string www_url_doc_subroot      = "<<www_url_doc_subroot>>"; +  string processing_path_doc_root = "<<processing_path_doc_root>>"; +  string cgi_bin_root             = "<<cgi_bin_root>>"; +  string cgi_bin_subpath          = "<<cgi_bin_subpath>>"; +  string cgi_filename             = "<<cgi_filename>>"; +  string cgi_url_root             = "<<http_request_type>>://<<http_host>><<cgi_bin_subpath>>"; +  string cgi_port                 = ""; +  string cgi_user                 = ""; +  string cgi_url_action           = "<<http_request_type>>://<<http_host>><<cgi_bin_subpath>>/<<cgi_filename>>"; +  string cgi_search_form_title    = "<<cgi_search_form_title>>"; +  string db_sqlite_path           = "<<db_sqlite_path>>"; +  string db_sqlite_filename       = "<<db_sqlite_filename>>"; +  string default_language         = "en"; +  string default_papersize        = "a4"; +  string default_text_wrap        = "80"; +  string default_hash_digest      = "sha256";  }  enum _cfg = Cfg();  #+END_SRC @@ -101,9 +101,9 @@ enum _cfg = Cfg();  #+BEGIN_SRC d  /+ obt - org-mode generated file +/  struct Cfg { -  string http_request_type     = "<<www_http>>"; -  string http_host             = "<<www_host>>"; -  string www_doc_subroot       = "<<www_doc_subroot>>"; +  string http_request_type     = "<<http_request_type>>"; +  string http_host             = "<<http_host>>"; +  string www_url_doc_subroot   = "<<www_doc_subroot>>";    string cgi_filename          = "<<cgi_filename>>";    string cgi_search_form_title = "<<cgi_search_form_title>>";    string db_sqlite_path        = "<<db_sqlite_path>>"; @@ -114,12 +114,12 @@ enum _cfg = Cfg();  *** shared settings SET defaults -#+NAME: www_http +#+NAME: http_request_type  #+BEGIN_SRC sh  http  #+END_SRC -#+NAME: www_host +#+NAME: http_host  #+BEGIN_SRC sh  localhost  #+END_SRC @@ -129,7 +129,12 @@ localhost  http://localhost  #+END_SRC -#+NAME: www_doc_root +#+NAME: www_url_doc_subroot +#+BEGIN_SRC sh +/spine +#+END_SRC + +#+NAME: processing_path_doc_root  #+BEGIN_SRC sh  /srv/www/spine  #+END_SRC diff --git a/org/in_source_files.org b/org/in_source_files.org index a436734..ef4cafd 100644 --- a/org/in_source_files.org +++ b/org/in_source_files.org @@ -104,23 +104,23 @@ webserv:    db_pg_table:           ""    db_pg_user:            ""  ┃", -  _cfg.www_doc_root,          // doc root -  _cfg.www_http,              // http -  _cfg.www_host,              // host / domain -  _cfg.www_http,              // data "http" or "https" -  _cfg.www_host,              // data domain "localhost" -  _cfg.www_url_doc_root,      // data root url "http://locahost" "https://sisudoc.org" -  _cfg.www_doc_root,          // data root path -  _cfg.cgi_search_form_title, // cgi title // e.g. "≅ SiSU Spine search" -  _cfg.www_http,              // cgi http -  _cfg.www_host,              // cgi host -  _cfg.cgi_url_root,          // cgi bin url -  _cfg.cgi_bin_subpath,       // cgi bin path -  _cfg.cgi_bin_root,          // cgi bin path -  _cfg.cgi_filename,          // cgi filename -  _cfg.cgi_url_action,        // cgi action -  _cfg.db_sqlite_path,        // sqlite db path -  _cfg.db_sqlite_filename,    // sqlite db filename +  _cfg.processing_path_doc_root, // doc root +  _cfg.http_request_type,        // http +  _cfg.http_host,                // host / domain +  _cfg.http_request_type,        // data "http" or "https" +  _cfg.http_host,                // data domain "localhost" +  _cfg.www_url_doc_root,         // data root url "http://locahost" "https://sisudoc.org" +  _cfg.processing_path_doc_root, // data root path +  _cfg.cgi_search_form_title,    // cgi title // e.g. "≅ SiSU Spine search" +  _cfg.http_request_type,        // cgi http +  _cfg.http_host,                // cgi host +  _cfg.cgi_url_root,             // cgi bin url +  _cfg.cgi_bin_subpath,          // cgi bin path +  _cfg.cgi_bin_root,             // cgi bin path +  _cfg.cgi_filename,             // cgi filename +  _cfg.cgi_url_action,           // cgi action +  _cfg.db_sqlite_path,           // sqlite db path +  _cfg.db_sqlite_filename,       // sqlite db filename  );      foreach(conf_fn; [_conf_file_details.config_filename_site]) {        foreach(pth; _conf_file_details.possible_config_path_locations.config_local_site) { diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org index 737b309..f91a615 100644 --- a/org/meta_conf_make_meta.org +++ b/org/meta_conf_make_meta.org @@ -42,56 +42,56 @@ NOTES on configuration hierarchy:  ** 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"                       | ✓   | -|-----------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| -|                       |                           |                            |                            |                             |                                         |     | -|-----------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +|--------------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| cfg ctfe                 | config local              | cli                        | cli-run                    | composite                   | default                                 |     | +|--------------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| _cfg.                    | ["webserv"]               | --                         | opt_action.                | _struct_composite.conf.     | default                                 | ✓ ✗ | +|--------------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| processing_path_doc_root | ["data_root_path"]        | output                     | output_dir_set             | output_path                 | "/srv/www/spine"                        | ✓   | +|                          |                           |                            |                            |                             | "/var/www"                              |     | +|                          |                           |                            |                            |                             | "/var/www/html"                         |     | +|--------------------------+---------------------------+----------------------------+----------------------------+-----------------------------+-----------------------------------------+-----| +| http_request_type        | ["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 @@ -124,27 +124,29 @@ string[string] settings = [  - see: config_d_cfte.org    for configuration_example.txt +#+HEADER: :NO-tangle "../views/configuration.txt"  #+BEGIN_SRC d +/+ obt - org-mode generated file +/  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"; +  string http_request_type        = "http"; +  string http_host                = "localhost"; +  string www_url_doc_root         = "http://localhost"; +  string www_url_doc_subroot      = "/spine"; +  string processing_path_doc_root = "/srv/www/spine"; +  string cgi_bin_root             = "/var/www/cgi/cgi-bin"; +  string cgi_bin_subpath          = "/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_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 @@ -166,25 +168,25 @@ default:    text_wrap:                   "80"    digest:                      "sha256"  webserv: -  http:                        "https"                            # "http" -  domain:                      "sisudoc"                          # "localhost" +  http:                        "http"                             # "https" +  domain:                      "localhost"                        # "mysite"    data_http:                   "https"                            # "http" -  data_domain:                 "sisudoc"                          # "localhost" -  data_root_url:               "https://sisudoc.org"              # "http://localhost" +  data_domain:                 "localhost"                        # "mysite" +  data_root_url:               "http://localhost"                 # "https://mysite.org"    data_root_path:              "/srv/www/spine"                   # "/var/www/html" -  data_root_part:              "" +  data_root_part:              ""                                 # "/spine"    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_http:                    "http"                             # "https" +  cgi_domain:                  "localhost"                        # "mysite.org" +  cgi_bin_url:                 "http://localhost/cgi-bin"         # "https://mysite.org/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" +  cgi_action:                  "http://localhost/cgi-bin/spine-search" # "https://mysite.org/spine_search"    db_sqlite_filename:          "spine.search.db"    db_sqlite_path:              "/var/www/sqlite"    db_pg_table:                 "" @@ -601,9 +603,9 @@ template contentYAMLtoSpineStruct() {        = _opt_action.webserver_http;    } else {      _struct_composite.conf.w_srv_http -      = (_cfg.www_http.empty) +      = (_cfg.http_request_type.empty)          ? "http" -        : _cfg.www_http; +        : _cfg.http_request_type;      if (("webserv" in _yaml && _yaml["webserv"].type.sequence)        && (_yaml["webserv"].type.mapping          && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) @@ -733,9 +735,9 @@ template contentYAMLtoSpineStruct() {          = (_opt_action.output_dir_set.asNormalizedPath).array;      } else {        _struct_composite.conf.output_path -        = (_cfg.www_doc_root.empty) +        = (_cfg.processing_path_doc_root.empty)            ?  "/srv/www/spine" -          : _cfg.www_doc_root; +          : _cfg.processing_path_doc_root;        if (("webserv" in _yaml && _yaml["webserv"].type.sequence)          && (_yaml["webserv"].type.mapping            && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) @@ -761,9 +763,9 @@ template contentYAMLtoSpineStruct() {          = _opt_action.webserver_host_doc_root;      } else {        _struct_composite.conf.w_srv_data_root_path -        = (_cfg.www_doc_root.empty) +        = (_cfg.processing_path_doc_root.empty)            ? "/var/www/spine" -          : _cfg.www_doc_root; +          : _cfg.processing_path_doc_root;        if (("webserv" in _yaml && _yaml["webserv"].type.sequence)          && (_yaml["webserv"].type.mapping            && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) @@ -859,7 +861,8 @@ if (("webserv" in _yaml      ) {        _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 ~ "/" +        _yaml["webserv"]["data_root_url"].get!string +        ~ _struct_composite.conf.w_srv_data_root_part ~ "/"          ~ _manifested.src.language ~ "/"          ~ "html";      } else { diff --git a/org/out_cgi_search_sqlite.org b/org/out_cgi_search_sqlite.org index 7f17bc9..fc54d1d 100644 --- a/org/out_cgi_search_sqlite.org +++ b/org/out_cgi_search_sqlite.org @@ -88,7 +88,7 @@ template CGIsearchSQLite() {      string _cgi_search_script_raw_fn_d = (opt_action.cgi_sqlite_search_filename_d.empty)        ? make_and_meta_struct.conf.w_srv_cgi_search_script_raw_fn_d        : opt_action.cgi_sqlite_search_filename_d; -    string get_doc_collection_sub_root(string output_path) { +    string get_doc_collection_subroot(string output_path) {        string web_doc_root_path = environment.get("DOCUMENT_ROOT", "/var/www/html");        auto m = output_path.matchFirst(regex("^(" ~ web_doc_root_path ~ ")"));        return m.post; @@ -136,7 +136,7 @@ void cgi_function_intro(Cgi cgi) {  }  mixin GenericMain!cgi_function_intro;  ≓", -  get_doc_collection_sub_root(make_and_meta_struct.conf.output_path), +  get_doc_collection_subroot(make_and_meta_struct.conf.output_path),    make_and_meta_struct.conf.output_path ~ "/sqlite/",    _sqlite_db_fn,    (opt_action.cgi_search_title.empty) @@ -277,7 +277,7 @@ struct Config {    string http_host;    // string server_name;    string web_doc_root_path; -  string doc_collection_sub_root; +  string doc_collection_subroot;    string cgi_root;    string cgi_script;    string data_path_html; @@ -291,7 +291,7 @@ conf.http_request_type       = environment.get("REQUEST_SCHEME",        "http");  conf.http_host               = environment.get("HTTP_HOST",             "localhost");  // conf.server_name             = environment.get("SERVER_NAME",           "localhost");  conf.web_doc_root_path       = environment.get("DOCUMENT_ROOT",         "/var/www/html"); -conf.doc_collection_sub_root = "%s"; // (output_path - web_doc_root_path) +conf.doc_collection_subroot = "%s"; // (output_path - web_doc_root_path)  conf.cgi_root                = environment.get("CONTEXT_DOCUMENT_ROOT", "/usr/lib/cgi-bin/");  // conf.cgi_script              = environment.get("SCRIPT_NAME",           "/cgi-bin/spine-search");  conf.query_string            = environment.get("QUERY_STRING",          ""); @@ -2097,7 +2097,7 @@ if (!select_query_results.empty) {          _close_para          ~ "<hr><div class=\"publication\">"            ~ "<p class=\"publication\"><a href=\"" -            ~ "https://" ~ conf.http_host ~ conf.doc_collection_sub_root ~ "/" +            ~ "https://" ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"              ~ row["language_document_char"].as!string ~ "/html/"              ~ row["src_filename_base"].as!string ~ "/"              ~ "toc.html" @@ -2125,7 +2125,7 @@ if (cv.results_type == "txt") {        "<div class=\"flex-container\">"        ~ "<div class=\"textview_ocn\" style=\"flex: 0 0 1.2em\">"          ~ "<p class=\"ocn_is\"><a href=\"" -          ~ "https://" ~ conf.http_host ~ conf.doc_collection_sub_root ~ "/" +          ~ "https://" ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"            ~ row["language_document_char"].as!string ~ "/html/"            ~ row["src_filename_base"].as!string ~ "/"            ~ row["seg_name"].as!string ~ ".html#" ~ row["ocn"].as!string @@ -2143,7 +2143,7 @@ if (cv.results_type == "txt") {        "<div class=\"flex-container\">"        ~ "<div class=\"textview_ocn\" style=\"flex: 0 0 1.2em\">"          ~ "<p class=\"ocn_is\"><a href=\"" -          ~ "https://" ~ conf.http_host ~ conf.doc_collection_sub_root ~ "/" +          ~ "https://" ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"            ~ row["language_document_char"].as!string ~ "/html/"            ~ row["src_filename_base"].as!string ~ "/toc.html"          ~ "\">" @@ -2167,7 +2167,7 @@ if (cv.results_type == "txt") {      cgi.write(        _matched_ocn_open        ~ "<a href=\"" -        ~ "https://" ~ conf.http_host ~ conf.doc_collection_sub_root ~ "/" +        ~ "https://" ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"          ~ row["language_document_char"].as!string ~ "/html/"          ~ row["src_filename_base"].as!string ~ "/"          ~ row["seg_name"].as!string ~ ".html#" ~ row["ocn"].as!string @@ -2179,7 +2179,7 @@ if (cv.results_type == "txt") {      cgi.write(        _matched_ocn_open        ~ "<a href=\"" -        ~ "https://" ~ conf.http_host ~ conf.doc_collection_sub_root ~ "/" +        ~ "https://" ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"          ~ row["language_document_char"].as!string ~ "/html/"          ~ row["src_filename_base"].as!string ~ "/toc.html"        ~ "\">" diff --git a/org/out_sqlite.org b/org/out_sqlite.org index 772604b..4cea09a 100644 --- a/org/out_sqlite.org +++ b/org/out_sqlite.org @@ -817,6 +817,17 @@ string inline_links(M,O)(          obj.text        );      } +    // if (obj.metainfo.is_a == "bookindex") { // DEBUG LINE +    //   if (_txt.match(regex(r"<a href"))) { +    //     writeln(__LINE__, " ", +    //       doc_matters.conf_make_meta.conf.w_srv_data_root_url_html, +    //       "/", +    //       doc_matters.src.filename_base, +    //       "\n", +    //       _txt +    //     ); +    //   } +    // }    }    debug(markup) {      if (_txt.match(rgx.inline_link)) { diff --git a/src/doc_reform/io_in/read_config_files.d b/src/doc_reform/io_in/read_config_files.d index 0d50be3..c112d1e 100644 --- a/src/doc_reform/io_in/read_config_files.d +++ b/src/doc_reform/io_in/read_config_files.d @@ -102,23 +102,23 @@ webserv:    db_pg_table:           ""    db_pg_user:            ""  ┃", -  _cfg.www_doc_root,          // doc root -  _cfg.www_http,              // http -  _cfg.www_host,              // host / domain -  _cfg.www_http,              // data "http" or "https" -  _cfg.www_host,              // data domain "localhost" -  _cfg.www_url_doc_root,      // data root url "http://locahost" "https://sisudoc.org" -  _cfg.www_doc_root,          // data root path -  _cfg.cgi_search_form_title, // cgi title // e.g. "≅ SiSU Spine search" -  _cfg.www_http,              // cgi http -  _cfg.www_host,              // cgi host -  _cfg.cgi_url_root,          // cgi bin url -  _cfg.cgi_bin_subpath,       // cgi bin path -  _cfg.cgi_bin_root,          // cgi bin path -  _cfg.cgi_filename,          // cgi filename -  _cfg.cgi_url_action,        // cgi action -  _cfg.db_sqlite_path,        // sqlite db path -  _cfg.db_sqlite_filename,    // sqlite db filename +  _cfg.processing_path_doc_root, // doc root +  _cfg.http_request_type,        // http +  _cfg.http_host,                // host / domain +  _cfg.http_request_type,        // data "http" or "https" +  _cfg.http_host,                // data domain "localhost" +  _cfg.www_url_doc_root,         // data root url "http://locahost" "https://sisudoc.org" +  _cfg.processing_path_doc_root, // data root path +  _cfg.cgi_search_form_title,    // cgi title // e.g. "≅ SiSU Spine search" +  _cfg.http_request_type,        // cgi http +  _cfg.http_host,                // cgi host +  _cfg.cgi_url_root,             // cgi bin url +  _cfg.cgi_bin_subpath,          // cgi bin path +  _cfg.cgi_bin_root,             // cgi bin path +  _cfg.cgi_filename,             // cgi filename +  _cfg.cgi_url_action,           // cgi action +  _cfg.db_sqlite_path,           // sqlite db path +  _cfg.db_sqlite_filename,       // sqlite db filename  );      foreach(conf_fn; [_conf_file_details.config_filename_site]) {        foreach(pth; _conf_file_details.possible_config_path_locations.config_local_site) { 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 091c77f..e835b07 100644 --- a/src/doc_reform/io_out/cgi_sqlite_search_form.d +++ b/src/doc_reform/io_out/cgi_sqlite_search_form.d @@ -64,7 +64,7 @@ template CGIsearchSQLite() {      string _cgi_search_script_raw_fn_d = (opt_action.cgi_sqlite_search_filename_d.empty)        ? make_and_meta_struct.conf.w_srv_cgi_search_script_raw_fn_d        : opt_action.cgi_sqlite_search_filename_d; -    string get_doc_collection_sub_root(string output_path) { +    string get_doc_collection_subroot(string output_path) {        string web_doc_root_path = environment.get("DOCUMENT_ROOT", "/var/www/html");        auto m = output_path.matchFirst(regex("^(" ~ web_doc_root_path ~ ")"));        return m.post; @@ -89,7 +89,7 @@ void cgi_function_intro(Cgi cgi) {      string http_host;      // string server_name;      string web_doc_root_path; -    string doc_collection_sub_root; +    string doc_collection_subroot;      string cgi_root;      string cgi_script;      string data_path_html; @@ -103,7 +103,7 @@ void cgi_function_intro(Cgi cgi) {    conf.http_host               = environment.get("HTTP_HOST",             "localhost");    // conf.server_name             = environment.get("SERVER_NAME",           "localhost");    conf.web_doc_root_path       = environment.get("DOCUMENT_ROOT",         "/var/www/html"); -  conf.doc_collection_sub_root = "%s"; // (output_path - web_doc_root_path) +  conf.doc_collection_subroot = "%s"; // (output_path - web_doc_root_path)    conf.cgi_root                = environment.get("CONTEXT_DOCUMENT_ROOT", "/usr/lib/cgi-bin/");    // conf.cgi_script              = environment.get("SCRIPT_NAME",           "/cgi-bin/spine-search");    conf.query_string            = environment.get("QUERY_STRING",          ""); @@ -1736,7 +1736,7 @@ LIMIT %%s OFFSET %%s                _close_para                ~ "<hr><div class=\"publication\">"                  ~ "<p class=\"publication\"><a href=\"" -                  ~ "https://" ~ conf.http_host ~ conf.doc_collection_sub_root ~ "/" +                  ~ "https://" ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"                    ~ row["language_document_char"].as!string ~ "/html/"                    ~ row["src_filename_base"].as!string ~ "/"                    ~ "toc.html" @@ -1758,7 +1758,7 @@ LIMIT %%s OFFSET %%s                  "<div class=\"flex-container\">"                  ~ "<div class=\"textview_ocn\" style=\"flex: 0 0 1.2em\">"                    ~ "<p class=\"ocn_is\"><a href=\"" -                    ~ "https://" ~ conf.http_host ~ conf.doc_collection_sub_root ~ "/" +                    ~ "https://" ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"                      ~ row["language_document_char"].as!string ~ "/html/"                      ~ row["src_filename_base"].as!string ~ "/"                      ~ row["seg_name"].as!string ~ ".html#" ~ row["ocn"].as!string @@ -1776,7 +1776,7 @@ LIMIT %%s OFFSET %%s                  "<div class=\"flex-container\">"                  ~ "<div class=\"textview_ocn\" style=\"flex: 0 0 1.2em\">"                    ~ "<p class=\"ocn_is\"><a href=\"" -                    ~ "https://" ~ conf.http_host ~ conf.doc_collection_sub_root ~ "/" +                    ~ "https://" ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"                      ~ row["language_document_char"].as!string ~ "/html/"                      ~ row["src_filename_base"].as!string ~ "/toc.html"                    ~ "\">" @@ -1794,7 +1794,7 @@ LIMIT %%s OFFSET %%s                cgi.write(                  _matched_ocn_open                  ~ "<a href=\"" -                  ~ "https://" ~ conf.http_host ~ conf.doc_collection_sub_root ~ "/" +                  ~ "https://" ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"                    ~ row["language_document_char"].as!string ~ "/html/"                    ~ row["src_filename_base"].as!string ~ "/"                    ~ row["seg_name"].as!string ~ ".html#" ~ row["ocn"].as!string @@ -1806,7 +1806,7 @@ LIMIT %%s OFFSET %%s                cgi.write(                  _matched_ocn_open                  ~ "<a href=\"" -                  ~ "https://" ~ conf.http_host ~ conf.doc_collection_sub_root ~ "/" +                  ~ "https://" ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"                    ~ row["language_document_char"].as!string ~ "/html/"                    ~ row["src_filename_base"].as!string ~ "/toc.html"                  ~ "\">" @@ -1844,7 +1844,7 @@ LIMIT %%s OFFSET %%s  }  mixin GenericMain!cgi_function_intro;  ≓", -  get_doc_collection_sub_root(make_and_meta_struct.conf.output_path), +  get_doc_collection_subroot(make_and_meta_struct.conf.output_path),    make_and_meta_struct.conf.output_path ~ "/sqlite/",    _sqlite_db_fn,    (opt_action.cgi_search_title.empty) diff --git a/src/doc_reform/io_out/sqlite.d b/src/doc_reform/io_out/sqlite.d index 60f6569..4281609 100644 --- a/src/doc_reform/io_out/sqlite.d +++ b/src/doc_reform/io_out/sqlite.d @@ -468,6 +468,17 @@ template SQLiteFormatAndLoadObject() {                obj.text              );            } +          // if (obj.metainfo.is_a == "bookindex") { // DEBUG LINE +          //   if (_txt.match(regex(r"<a href"))) { +          //     writeln(__LINE__, " ", +          //       doc_matters.conf_make_meta.conf.w_srv_data_root_url_html, +          //       "/", +          //       doc_matters.src.filename_base, +          //       "\n", +          //       _txt +          //     ); +          //   } +          // }          }          debug(markup) {            if (_txt.match(rgx.inline_link)) { diff --git a/src/doc_reform/meta/conf_make_meta_yaml.d b/src/doc_reform/meta/conf_make_meta_yaml.d index e2f4c43..af6096a 100644 --- a/src/doc_reform/meta/conf_make_meta_yaml.d +++ b/src/doc_reform/meta/conf_make_meta_yaml.d @@ -94,9 +94,9 @@ template contentYAMLtoSpineStruct() {              = _opt_action.webserver_http;          } else {            _struct_composite.conf.w_srv_http -            = (_cfg.www_http.empty) +            = (_cfg.http_request_type.empty)                ? "http" -              : _cfg.www_http; +              : _cfg.http_request_type;            if (("webserv" in _yaml && _yaml["webserv"].type.sequence)              && (_yaml["webserv"].type.mapping                && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) @@ -226,9 +226,9 @@ template contentYAMLtoSpineStruct() {                = (_opt_action.output_dir_set.asNormalizedPath).array;            } else {              _struct_composite.conf.output_path -              = (_cfg.www_doc_root.empty) +              = (_cfg.processing_path_doc_root.empty)                  ?  "/srv/www/spine" -                : _cfg.www_doc_root; +                : _cfg.processing_path_doc_root;              if (("webserv" in _yaml && _yaml["webserv"].type.sequence)                && (_yaml["webserv"].type.mapping                  && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) @@ -254,9 +254,9 @@ template contentYAMLtoSpineStruct() {                = _opt_action.webserver_host_doc_root;            } else {              _struct_composite.conf.w_srv_data_root_path -              = (_cfg.www_doc_root.empty) +              = (_cfg.processing_path_doc_root.empty)                  ? "/var/www/spine" -                : _cfg.www_doc_root; +                : _cfg.processing_path_doc_root;              if (("webserv" in _yaml && _yaml["webserv"].type.sequence)                && (_yaml["webserv"].type.mapping                  && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) @@ -352,7 +352,8 @@ template contentYAMLtoSpineStruct() {            ) {              _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 ~ "/" +              _yaml["webserv"]["data_root_url"].get!string +              ~ _struct_composite.conf.w_srv_data_root_part ~ "/"                ~ _manifested.src.language ~ "/"                ~ "html";            } else { diff --git a/sundry/spine_search_cgi/src/spine_search.d b/sundry/spine_search_cgi/src/spine_search.d index e1e0c93..07a824d 100644 --- a/sundry/spine_search_cgi/src/spine_search.d +++ b/sundry/spine_search_cgi/src/spine_search.d @@ -82,7 +82,7 @@ void cgi_function_intro(Cgi cgi) {    auto conf = Config();    conf.http_request_type          = environment.get("REQUEST_SCHEME",        _cfg.http_request_type);    conf.http_host                  = environment.get("SERVER_NAME",           _cfg.http_host); -  conf.doc_collection_subroot     = _cfg.www_doc_subroot; +  conf.doc_collection_subroot     = _cfg.www_url_doc_subroot;    conf.cgi_script_name            = environment.get("SCRIPT_NAME",           _cfg.cgi_filename);    conf.cgi_search_form_title      = _cfg.cgi_search_form_title; // ≅ SiSU spine search form    conf.cgi_search_form_html_title = "<a href=\"" @@ -1681,6 +1681,7 @@ SELECT    doc_objects.seg_name,    doc_objects.ocn,    doc_objects.lev, +  doc_objects.is_a,    metadata_and_text.uid  FROM    doc_objects, @@ -1748,8 +1749,19 @@ LIMIT %s OFFSET %s              );            }            if (cv.results_type == "txt") { +            string _sfn, _id;              if ((row["lev"].as!int < 4)              || (row["ocn"].as!string == "0")) { +              if (row["is_a"].as!string == "bookindex") { +                _sfn = "bookindex"; +                _id = "idx"; +              } else if (row["is_a"].as!string == "blurb") { +                _sfn = "blurb"; +                _id = "bm"; +              } else { +                _sfn = "toc"; +                _id = row["ocn"].as!string; +              }                cgi.write(                  "<div class=\"flex-container\">"                  ~ "<div class=\"textview_ocn\" style=\"flex: 0 0 1.2em\">" @@ -1757,9 +1769,10 @@ LIMIT %s OFFSET %s                      ~ conf.http_request_type ~ "://"                      ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"                      ~ row["language_document_char"].as!string ~ "/html/" -                    ~ row["src_filename_base"].as!string ~ "/toc.html" +                    ~ row["src_filename_base"].as!string ~ "/" +                    ~ _sfn ~ ".html"                    ~ "\">" -                    ~ row["ocn"].as!string +                    ~ _id                    ~ "</a>:</p>"                  ~ "</div>"                  ~ "<div class=\"textview_found\">" @@ -1768,6 +1781,16 @@ LIMIT %s OFFSET %s                  ~ "</div>"                );              } else { +              if (row["is_a"].as!string == "bibliography") { +                _id = row["ocn"].as!string ~ "b"; +                _sfn = "bibliography"; +              } else if (row["is_a"].as!string == "glossary") { +                _id = row["ocn"].as!string ~ "g"; +                _sfn = "glossary"; +              } else { +                _id = row["ocn"].as!string; +                _sfn = row["seg_name"].as!string; +              }                cgi.write(                  "<div class=\"flex-container\">"                  ~ "<div class=\"textview_ocn\" style=\"flex: 0 0 1.2em\">" @@ -1776,9 +1799,9 @@ LIMIT %s OFFSET %s                      ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"                      ~ row["language_document_char"].as!string ~ "/html/"                      ~ row["src_filename_base"].as!string ~ "/" -                    ~ row["seg_name"].as!string ~ ".html#" ~ row["ocn"].as!string +                    ~ _sfn ~ ".html#" ~ row["ocn"].as!string                    ~ "\">" -                    ~ row["ocn"].as!string +                    ~  _id                    ~ "</a>:</p>"                  ~ "</div>"                  ~ "<div class=\"textview_found\">" @@ -1788,20 +1811,42 @@ LIMIT %s OFFSET %s                );              }            } else { +            string _sfn, _id;              if ((row["lev"].as!int < 4)              || (row["ocn"].as!string == "0")) { +              if (row["is_a"].as!string == "bookindex") { +                _sfn = "bookindex"; +                _id = "i"; +              } else if (row["is_a"].as!string == "blurb") { +                _sfn = "blurb"; +                _id = "bm"; +              } else { +                _sfn = "toc"; +                _id = row["ocn"].as!string; +              }                cgi.write(                  _matched_ocn_open                  ~ "<a href=\""                    ~ conf.http_request_type ~ "://"                    ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"                    ~ row["language_document_char"].as!string ~ "/html/" -                  ~ row["src_filename_base"].as!string ~ "/toc.html" +                  ~ row["src_filename_base"].as!string ~ "/" +                  ~ _sfn ~ ".html"                  ~ "\">" -                  ~ row["ocn"].as!string +                  ~ _id                  ~ "</a>, "                );              } else { +              if (row["is_a"].as!string == "bibliography") { +                _id = row["ocn"].as!string ~ "b"; +                _sfn = "bibliography"; +              } else if (row["is_a"].as!string == "glossary") { +                _id = row["ocn"].as!string ~ "g"; +                _sfn = "glossary"; +              } else { +                _id = row["ocn"].as!string; +                _sfn = row["seg_name"].as!string; +              }                cgi.write(                  _matched_ocn_open                  ~ "<a href=\"" @@ -1809,9 +1854,9 @@ LIMIT %s OFFSET %s                    ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"                    ~ row["language_document_char"].as!string ~ "/html/"                    ~ row["src_filename_base"].as!string ~ "/" -                  ~ row["seg_name"].as!string ~ ".html#" ~ row["ocn"].as!string +                  ~ _sfn ~ ".html#" ~ row["ocn"].as!string                  ~ "\">" -                  ~ row["ocn"].as!string +                  ~  _id                  ~ "</a>, "                );              } diff --git a/sundry/spine_search_cgi/src/spine_search.d_ b/sundry/spine_search_cgi/src/spine_search.d_ index 3703659..3c9a738 100755 --- a/sundry/spine_search_cgi/src/spine_search.d_ +++ b/sundry/spine_search_cgi/src/spine_search.d_ @@ -84,7 +84,7 @@ void cgi_function_intro(Cgi cgi) {    conf.http_request_type          = environment.get("REQUEST_SCHEME",        _cfg.http_request_type);    conf.http_host                  = environment.get("SERVER_NAME",           _cfg.http_host);    // conf.http_host                  = environment.get("HTTP_HOST",             _cfg.http_host); -  conf.doc_collection_subroot     = _cfg.www_doc_subroot; +  conf.doc_collection_subroot     = _cfg.www_url_doc_subroot;    conf.cgi_script_name            = environment.get("SCRIPT_NAME",           _cfg.cgi_filename);    conf.cgi_search_form_title      = _cfg.cgi_search_form_title; // ≅ SiSU spine search form    conf.cgi_search_form_html_title = "<a href=\"" @@ -1683,6 +1683,7 @@ SELECT    doc_objects.seg_name,    doc_objects.ocn,    doc_objects.lev, +  doc_objects.is_a,    metadata_and_text.uid  FROM    doc_objects, @@ -1750,8 +1751,19 @@ LIMIT %s OFFSET %s              );            }            if (cv.results_type == "txt") { +            string _sfn, _id;              if ((row["lev"].as!int < 4)              || (row["ocn"].as!string == "0")) { +              if (row["is_a"].as!string == "bookindex") { +                _sfn = "bookindex"; +                _id = "idx"; +              } else if (row["is_a"].as!string == "blurb") { +                _sfn = "blurb"; +                _id = "bm"; +              } else { +                _sfn = "toc"; +                _id = row["ocn"].as!string; +              }                cgi.write(                  "<div class=\"flex-container\">"                  ~ "<div class=\"textview_ocn\" style=\"flex: 0 0 1.2em\">" @@ -1759,9 +1771,10 @@ LIMIT %s OFFSET %s                      ~ conf.http_request_type ~ "://"                      ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"                      ~ row["language_document_char"].as!string ~ "/html/" -                    ~ row["src_filename_base"].as!string ~ "/toc.html" +                    ~ row["src_filename_base"].as!string ~ "/" +                    ~ _sfn ~ ".html"                    ~ "\">" -                    ~ row["ocn"].as!string +                    ~ _id                    ~ "</a>:</p>"                  ~ "</div>"                  ~ "<div class=\"textview_found\">" @@ -1770,6 +1783,16 @@ LIMIT %s OFFSET %s                  ~ "</div>"                );              } else { +              if (row["is_a"].as!string == "bibliography") { +                _id = row["ocn"].as!string ~ "b"; +                _sfn = "bibliography"; +              } else if (row["is_a"].as!string == "glossary") { +                _id = row["ocn"].as!string ~ "g"; +                _sfn = "glossary"; +              } else { +                _id = row["ocn"].as!string; +                _sfn = row["seg_name"].as!string; +              }                cgi.write(                  "<div class=\"flex-container\">"                  ~ "<div class=\"textview_ocn\" style=\"flex: 0 0 1.2em\">" @@ -1778,9 +1801,9 @@ LIMIT %s OFFSET %s                      ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"                      ~ row["language_document_char"].as!string ~ "/html/"                      ~ row["src_filename_base"].as!string ~ "/" -                    ~ row["seg_name"].as!string ~ ".html#" ~ row["ocn"].as!string +                    ~ _sfn ~ ".html#" ~ row["ocn"].as!string                    ~ "\">" -                    ~ row["ocn"].as!string +                    ~  _id                    ~ "</a>:</p>"                  ~ "</div>"                  ~ "<div class=\"textview_found\">" @@ -1790,20 +1813,42 @@ LIMIT %s OFFSET %s                );              }            } else { +            string _sfn, _id;              if ((row["lev"].as!int < 4)              || (row["ocn"].as!string == "0")) { +              if (row["is_a"].as!string == "bookindex") { +                _sfn = "bookindex"; +                _id = "i"; +              } else if (row["is_a"].as!string == "blurb") { +                _sfn = "blurb"; +                _id = "bm"; +              } else { +                _sfn = "toc"; +                _id = row["ocn"].as!string; +              }                cgi.write(                  _matched_ocn_open                  ~ "<a href=\""                    ~ conf.http_request_type ~ "://"                    ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"                    ~ row["language_document_char"].as!string ~ "/html/" -                  ~ row["src_filename_base"].as!string ~ "/toc.html" +                  ~ row["src_filename_base"].as!string ~ "/" +                  ~ _sfn ~ ".html"                  ~ "\">" -                  ~ row["ocn"].as!string +                  ~ _id                  ~ "</a>, "                );              } else { +              if (row["is_a"].as!string == "bibliography") { +                _id = row["ocn"].as!string ~ "b"; +                _sfn = "bibliography"; +              } else if (row["is_a"].as!string == "glossary") { +                _id = row["ocn"].as!string ~ "g"; +                _sfn = "glossary"; +              } else { +                _id = row["ocn"].as!string; +                _sfn = row["seg_name"].as!string; +              }                cgi.write(                  _matched_ocn_open                  ~ "<a href=\"" @@ -1811,9 +1856,9 @@ LIMIT %s OFFSET %s                    ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"                    ~ row["language_document_char"].as!string ~ "/html/"                    ~ row["src_filename_base"].as!string ~ "/" -                  ~ row["seg_name"].as!string ~ ".html#" ~ row["ocn"].as!string +                  ~ _sfn ~ ".html#" ~ row["ocn"].as!string                  ~ "\">" -                  ~ row["ocn"].as!string +                  ~  _id                  ~ "</a>, "                );              } diff --git a/sundry/spine_search_cgi/views/configuration.txt b/sundry/spine_search_cgi/views/configuration.txt index 51a8963..8e9540d 100644 --- a/sundry/spine_search_cgi/views/configuration.txt +++ b/sundry/spine_search_cgi/views/configuration.txt @@ -1,7 +1,7 @@  struct Cfg {    string http_request_type     = "http";    string http_host             = "localhost"; -  string www_doc_subroot       = "/spine"; +  string www_url_doc_subroot   = "/spine";    string cgi_filename          = "spine_search";    string cgi_search_form_title = "≅ SiSU Spine search";    string db_sqlite_path        = "/var/www/sqlite"; diff --git a/sundry/spine_search_cgi/views/configuration_example.txt b/sundry/spine_search_cgi/views/configuration_example.txt index ea43fde..0d5be00 100644 --- a/sundry/spine_search_cgi/views/configuration_example.txt +++ b/sundry/spine_search_cgi/views/configuration_example.txt @@ -2,7 +2,7 @@  struct Cfg {    string http_request_type     = "http";    string http_host             = "localhost"; -  string www_doc_subroot       = "/spine"; +  string www_url_doc_subroot   = "/spine";    string cgi_filename          = "spine_search";    string cgi_search_form_title = "≅ SiSU Spine search";    string db_sqlite_path        = "/var/www/sqlite"; diff --git a/views/configuration.txt b/views/configuration.txt index 8d35668..ab26992 100644 --- a/views/configuration.txt +++ b/views/configuration.txt @@ -1,22 +1,22 @@  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"; +  string http_request_type        = "http"; +  string http_host                = "localhost"; +  string www_url_doc_root         = "http://localhost"; +  string www_url_doc_subroot      = "/spine"; +  string processing_path_doc_root = "/srv/www/spine"; +  string cgi_bin_root             = "/var/www/cgi/cgi-bin"; +  string cgi_bin_subpath          = "/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_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(); diff --git a/views/configuration_example.txt b/views/configuration_example.txt index 02154de..203d56d 100644 --- a/views/configuration_example.txt +++ b/views/configuration_example.txt @@ -1,23 +1,23 @@  /+ obt - org-mode generated file +/  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       = "/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_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"; +  string http_request_type        = "http"; +  string http_host                = "localhost"; +  string www_url_doc_root         = "http://localhost"; +  string www_url_doc_subroot      = "/spine"; +  string processing_path_doc_root = "/srv/www/spine"; +  string cgi_bin_root             = "/var/www/cgi/cgi-bin"; +  string cgi_bin_subpath          = "/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_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(); | 
