diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2020-04-20 13:12:53 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2020-05-20 11:27:26 -0400 |
commit | 437e3e7c363a0f876e551609518718bce2c89218 (patch) | |
tree | cd59ccaf9ea71908fbb4a0ca49b50e331555487a | |
parent | cgi search form, no date_published breaks regex, initialize to "0000" (diff) |
cgi search form title
-rw-r--r-- | org/meta_conf_make_meta.org | 12 | ||||
-rw-r--r-- | org/out_cgi_search_sqlite.org | 32 | ||||
-rw-r--r-- | org/output_show.org | 10 | ||||
-rw-r--r-- | org/spine.org | 5 | ||||
-rw-r--r-- | src/doc_reform/io_out/cgi_sqlite_search_form.d | 31 | ||||
-rw-r--r-- | src/doc_reform/meta/conf_make_meta_structs.d | 1 | ||||
-rw-r--r-- | src/doc_reform/meta/conf_make_meta_yaml.d | 10 | ||||
-rw-r--r-- | src/doc_reform/meta/metadoc_show_config.d | 10 | ||||
-rwxr-xr-x | src/doc_reform/spine.d | 5 |
9 files changed, 86 insertions, 30 deletions
diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org index d80a270..de0080b 100644 --- a/org/meta_conf_make_meta.org +++ b/org/meta_conf_make_meta.org @@ -44,6 +44,7 @@ webserv: cgi_bin_url: "http://localhost/cgi-bin" cgi_bin_part: "cgi-bin" cgi_bin_path: "/usr/lib/cgi-bin" + cgi_search_title: "≅ SiSU spine search form" cgi_search_script: "spine-search" cgi_search_script_raw_fn_d: "spine_search.d" cgi_port: "" @@ -266,6 +267,7 @@ struct ConfCompositeSiteLocal { string w_srv_cgi_domain; // if not set same as webserv_domain string w_srv_cgi_bin_part; string w_srv_cgi_bin_path; + string w_srv_cgi_search_title; string w_srv_cgi_search_script; string w_srv_cgi_search_script_raw_fn_d; string w_srv_cgi_port; @@ -690,6 +692,16 @@ if ("webserv" in _yaml ) { _struct_composite.conf.w_srv_cgi_bin_path = _yaml["webserv"]["cgi_bin_path"].get!string; } + if (_opt_action.cgi_search_title.length > 0) { + _struct_composite.conf.w_srv_cgi_search_title = _opt_action.cgi_search_title; + } else if ("cgi_search_title" in _yaml["webserv"] + && _yaml["webserv"]["cgi_search_title"].type.string + && _yaml["webserv"]["cgi_search_title"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_cgi_search_title = _yaml["webserv"]["cgi_search_title"].get!string; + } else { + _struct_composite.conf.w_srv_cgi_search_title = "≅ SiSU spine search form"; + } if (_opt_action.cgi_sqlite_search_filename.length > 0) { _struct_composite.conf.w_srv_cgi_search_script = _opt_action.cgi_sqlite_search_filename; } else if ("cgi_search_script" in _yaml["webserv"] diff --git a/org/out_cgi_search_sqlite.org b/org/out_cgi_search_sqlite.org index 62f456d..32e11ea 100644 --- a/org/out_cgi_search_sqlite.org +++ b/org/out_cgi_search_sqlite.org @@ -122,6 +122,9 @@ mixin GenericMain!cgi_function_intro; get_doc_collection_sub_root(make_and_meta_struct.conf.output_path), make_and_meta_struct.conf.output_path ~ "/sqlite/", _sqlite_db_fn, + (opt_action.cgi_search_title.empty) + ? make_and_meta_struct.conf.w_srv_cgi_search_title + : opt_action.cgi_search_title, (opt_action.css_theme_default) ? "FFFFFF" : "000000", (opt_action.css_theme_default) ? "000000" : "CCCCCC", (opt_action.css_theme_default) ? "FFFFFF" : "000000", @@ -139,6 +142,9 @@ mixin GenericMain!cgi_function_intro; (opt_action.css_theme_default) ? "FFFFFF" : "777777", (opt_action.css_theme_default) ? "000000" : "FFFF48", (opt_action.css_theme_default) ? "FFFF48" : "777748", + (opt_action.cgi_search_title.empty) + ? make_and_meta_struct.conf.w_srv_cgi_search_title + : opt_action.cgi_search_title, (opt_action.css_theme_default) ? "222222" : "AAAAAA", _cgi_search_script, _sqlite_db_fn, @@ -815,7 +821,7 @@ string show_matched_objects (string fn) { <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title> - ≅ SiSU spine search form + %s </title> <meta name="sourcefile" content="SiSU.sst"> <link rel="generator" href="sisudoc.org"> @@ -874,6 +880,7 @@ string show_matched_objects (string fn) { background-color : #%s; } p.norm { } + p.center { text-align : center; } p.i1 { padding-left : 1em; } p.i2 { padding-left : 2em; } p.i3 { padding-left : 3em; } @@ -1310,17 +1317,11 @@ string show_matched_objects (string fn) { <tr><td width="20%%%%"> <table summary="home button / home information" border="0" cellpadding="2" cellspacing="0"> <tr><td align="left"> - <br><a href="http://sisudoc.org/" target="_top"> - <label for="find"><b>≅ SiSU spine</b></label> - </a> - <br><a href="http://git.sisudoc.org/" target="_top"> - git - </a> + %s </td></tr> </table> </td> <td> - <label for="find">(generated) search form</label> </td></tr> </table> ┃"); @@ -1717,7 +1718,11 @@ LIMIT %%s OFFSET %%s #+NAME: cgi_sqlite_select_statement_0 #+BEGIN_SRC d (cv.checked_sql) - ? cgi.write(previous_next ~ "<hr><font size=\"2\" color=\"#666666\">" ~ sql_select.the_body.strip.split("\n ").join(" ").split("\n").join("<br>") ~ "</font>\n") + ? cgi.write(previous_next + ~ "<hr><font size=\"2\" color=\"#666666\">" + ~ sql_select.the_body.strip.split("\n ").join(" ").split("\n").join("<br>") + ~ "</font>\n" + ) : ""; cgi.write(previous_next); auto select_query_results = db.execute(sql_select.the_body).cached; @@ -1819,9 +1824,17 @@ LIMIT %%s OFFSET %%s #+BEGIN_SRC d } cgi.write( previous_next); + } else { // offset_not_beyond_limit = false; cgi.write("select_query_results empty<p>\n"); } + cgi.write("<br><p class=\"center\"><a href=\"http://sisudoc.org/\" target=\"_top\"> +<label for=\"find\"><b>≅ SiSU spine</b></label> +</a> <label for=\"find\">(generated) search form</label> +<br><a href=\"http://git.sisudoc.org/\" target=\"_top\"> + git</a> +</p> +"); } sql_search_query; } @@ -1899,3 +1912,4 @@ dub --force --compiler=ldc2 && sudo cp -v cgi-bin/spine-search /usr/lib/cgi-bin/ http://localhost/cgi-bin/spine-search? #+END_SRC + diff --git a/org/output_show.org b/org/output_show.org index 17b361a..e473c92 100644 --- a/org/output_show.org +++ b/org/output_show.org @@ -158,7 +158,7 @@ template spineShowSiteConfig() { #+NAME: meta_metadoc_show_site_config #+BEGIN_SRC d writefln( - "\n%s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n", + "\n%s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n", markup.repeat_character_by_number_provided("-", char_repeat_number), "- webserv domain name:", config.conf.w_srv_domain, @@ -188,6 +188,8 @@ writefln( config.conf.w_srv_cgi_bin_url, "- webserv cgi action:", config.conf.w_srv_cgi_action, + "- webserv cgi title:", + config.conf.w_srv_cgi_title, // "- webserv cgi file links:", // config.conf.w_srv_cgi_file_links, "- webserv sqlite db:", @@ -247,7 +249,7 @@ template spineShowConfig() { #+NAME: meta_metadoc_show_config #+BEGIN_SRC d writefln( - "%s\n\"%s\", %s\n%s\n%s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n", + "%s\n\"%s\", %s\n%s\n%s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n", markup.repeat_character_by_number_provided("-", char_repeat_number), doc_matters.conf_make_meta.meta.title_full, doc_matters.conf_make_meta.meta.creator_author, @@ -273,10 +275,6 @@ writefln( doc_matters.conf_make_meta.conf.w_srv_cgi_search_script, "- webserv cgi search script in d:", doc_matters.conf_make_meta.conf.w_srv_cgi_search_script_raw_fn_d, - "- webserv cgi port:", - doc_matters.conf_make_meta.conf.w_srv_cgi_port, - "- webserv cgi user:", - doc_matters.conf_make_meta.conf.w_srv_cgi_user, "- webserv cgi url:", doc_matters.conf_make_meta.conf.w_srv_cgi_bin_url, "- webserv cgi action:", diff --git a/org/spine.org b/org/spine.org index e5752ca..0f9b7a1 100644 --- a/org/spine.org +++ b/org/spine.org @@ -415,6 +415,7 @@ bool[string] opts = [ "workon" : false, ]; string[string] settings = [ + "cgi-search-title" : "", // config default: "spine-search" "cgi-sqlite-search-filename" : "", // config default: "spine-search" "config" : "", "output" : "", @@ -492,6 +493,7 @@ auto helpInfo = getopt(args, "very-verbose", "output to terminal", &opts["very-verbose"], "workon", "(reserved for some matters under development & testing)", &opts["workon"], "xhtml", "xhtml output", &opts["xhtml"], + "cgi-search-title", "if generating a cgi search form the title to use for it", &settings["cgi-search-title"], "cgi-sqlite-search-filename", "=[filename] default is spine-search", &settings["cgi-sqlite-search-filename"], "config", "=/path/to/config/file/including/filename", &settings["config"], "lang", "=[lang code e.g. =en or =en,es]", &settings["lang"], @@ -691,6 +693,9 @@ struct OptActions { @trusted string sqlite_filename() { return settings["sqlite-db-filename"]; } + @trusted string cgi_search_title() { + return settings["cgi-search-title"]; + } @trusted string cgi_sqlite_search_filename() { return settings["cgi-sqlite-search-filename"]; } 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 4a77d48..9c95f7d 100644 --- a/src/doc_reform/io_out/cgi_sqlite_search_form.d +++ b/src/doc_reform/io_out/cgi_sqlite_search_form.d @@ -516,7 +516,7 @@ void cgi_function_intro(Cgi cgi) { <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title> - ≅ SiSU spine search form + %s </title> <meta name="sourcefile" content="SiSU.sst"> <link rel="generator" href="sisudoc.org"> @@ -575,6 +575,7 @@ void cgi_function_intro(Cgi cgi) { background-color : #%s; } p.norm { } + p.center { text-align : center; } p.i1 { padding-left : 1em; } p.i2 { padding-left : 2em; } p.i3 { padding-left : 3em; } @@ -1005,17 +1006,11 @@ void cgi_function_intro(Cgi cgi) { <tr><td width="20%%%%"> <table summary="home button / home information" border="0" cellpadding="2" cellspacing="0"> <tr><td align="left"> - <br><a href="http://sisudoc.org/" target="_top"> - <label for="find"><b>≅ SiSU spine</b></label> - </a> - <br><a href="http://git.sisudoc.org/" target="_top"> - git - </a> + %s </td></tr> </table> </td> <td> - <label for="find">(generated) search form</label> </td></tr> </table> ┃"); @@ -1342,7 +1337,11 @@ LIMIT %%s OFFSET %%s cv.sql_match_offset, ); (cv.checked_sql) - ? cgi.write(previous_next ~ "<hr><font size=\"2\" color=\"#666666\">" ~ sql_select.the_body.strip.split("\n ").join(" ").split("\n").join("<br>") ~ "</font>\n") + ? cgi.write(previous_next + ~ "<hr><font size=\"2\" color=\"#666666\">" + ~ sql_select.the_body.strip.split("\n ").join(" ").split("\n").join("<br>") + ~ "</font>\n" + ) : ""; cgi.write(previous_next); auto select_query_results = db.execute(sql_select.the_body).cached; @@ -1426,9 +1425,17 @@ LIMIT %%s OFFSET %%s } } cgi.write( previous_next); + } else { // offset_not_beyond_limit = false; cgi.write("select_query_results empty<p>\n"); } + cgi.write("<br><p class=\"center\"><a href=\"http://sisudoc.org/\" target=\"_top\"> +<label for=\"find\"><b>≅ SiSU spine</b></label> +</a> <label for=\"find\">(generated) search form</label> +<br><a href=\"http://git.sisudoc.org/\" target=\"_top\"> + git</a> +</p> +"); } sql_search_query; } @@ -1447,6 +1454,9 @@ mixin GenericMain!cgi_function_intro; get_doc_collection_sub_root(make_and_meta_struct.conf.output_path), make_and_meta_struct.conf.output_path ~ "/sqlite/", _sqlite_db_fn, + (opt_action.cgi_search_title.empty) + ? make_and_meta_struct.conf.w_srv_cgi_search_title + : opt_action.cgi_search_title, (opt_action.css_theme_default) ? "FFFFFF" : "000000", (opt_action.css_theme_default) ? "000000" : "CCCCCC", (opt_action.css_theme_default) ? "FFFFFF" : "000000", @@ -1464,6 +1474,9 @@ mixin GenericMain!cgi_function_intro; (opt_action.css_theme_default) ? "FFFFFF" : "777777", (opt_action.css_theme_default) ? "000000" : "FFFF48", (opt_action.css_theme_default) ? "FFFF48" : "777748", + (opt_action.cgi_search_title.empty) + ? make_and_meta_struct.conf.w_srv_cgi_search_title + : opt_action.cgi_search_title, (opt_action.css_theme_default) ? "222222" : "AAAAAA", _cgi_search_script, _sqlite_db_fn, diff --git a/src/doc_reform/meta/conf_make_meta_structs.d b/src/doc_reform/meta/conf_make_meta_structs.d index 34b30a3..3c749df 100644 --- a/src/doc_reform/meta/conf_make_meta_structs.d +++ b/src/doc_reform/meta/conf_make_meta_structs.d @@ -156,6 +156,7 @@ struct ConfCompositeSiteLocal { string w_srv_cgi_domain; // if not set same as webserv_domain string w_srv_cgi_bin_part; string w_srv_cgi_bin_path; + string w_srv_cgi_search_title; string w_srv_cgi_search_script; string w_srv_cgi_search_script_raw_fn_d; string w_srv_cgi_port; diff --git a/src/doc_reform/meta/conf_make_meta_yaml.d b/src/doc_reform/meta/conf_make_meta_yaml.d index d6f9e22..9dac231 100644 --- a/src/doc_reform/meta/conf_make_meta_yaml.d +++ b/src/doc_reform/meta/conf_make_meta_yaml.d @@ -282,6 +282,16 @@ template contentYAMLtoSpineStruct() { ) { _struct_composite.conf.w_srv_cgi_bin_path = _yaml["webserv"]["cgi_bin_path"].get!string; } + if (_opt_action.cgi_search_title.length > 0) { + _struct_composite.conf.w_srv_cgi_search_title = _opt_action.cgi_search_title; + } else if ("cgi_search_title" in _yaml["webserv"] + && _yaml["webserv"]["cgi_search_title"].type.string + && _yaml["webserv"]["cgi_search_title"].tag.match(rgx.yaml_tag_is_str) + ) { + _struct_composite.conf.w_srv_cgi_search_title = _yaml["webserv"]["cgi_search_title"].get!string; + } else { + _struct_composite.conf.w_srv_cgi_search_title = "≅ SiSU spine search form"; + } if (_opt_action.cgi_sqlite_search_filename.length > 0) { _struct_composite.conf.w_srv_cgi_search_script = _opt_action.cgi_sqlite_search_filename; } else if ("cgi_search_script" in _yaml["webserv"] diff --git a/src/doc_reform/meta/metadoc_show_config.d b/src/doc_reform/meta/metadoc_show_config.d index 4c2b976..057d7ba 100644 --- a/src/doc_reform/meta/metadoc_show_config.d +++ b/src/doc_reform/meta/metadoc_show_config.d @@ -22,7 +22,7 @@ template spineShowSiteConfig() { auto char_repeat_number = 66; if (opt_action.show_config) { writefln( - "\n%s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n", + "\n%s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n", markup.repeat_character_by_number_provided("-", char_repeat_number), "- webserv domain name:", config.conf.w_srv_domain, @@ -52,6 +52,8 @@ template spineShowSiteConfig() { config.conf.w_srv_cgi_bin_url, "- webserv cgi action:", config.conf.w_srv_cgi_action, + "- webserv cgi title:", + config.conf.w_srv_cgi_title, // "- webserv cgi file links:", // config.conf.w_srv_cgi_file_links, "- webserv sqlite db:", @@ -116,7 +118,7 @@ template spineShowConfig() { } if (doc_matters.opt.action.show_config) { writefln( - "%s\n\"%s\", %s\n%s\n%s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n", + "%s\n\"%s\", %s\n%s\n%s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n", markup.repeat_character_by_number_provided("-", char_repeat_number), doc_matters.conf_make_meta.meta.title_full, doc_matters.conf_make_meta.meta.creator_author, @@ -142,10 +144,6 @@ template spineShowConfig() { doc_matters.conf_make_meta.conf.w_srv_cgi_search_script, "- webserv cgi search script in d:", doc_matters.conf_make_meta.conf.w_srv_cgi_search_script_raw_fn_d, - "- webserv cgi port:", - doc_matters.conf_make_meta.conf.w_srv_cgi_port, - "- webserv cgi user:", - doc_matters.conf_make_meta.conf.w_srv_cgi_user, "- webserv cgi url:", doc_matters.conf_make_meta.conf.w_srv_cgi_bin_url, "- webserv cgi action:", diff --git a/src/doc_reform/spine.d b/src/doc_reform/spine.d index 1ddfca1..01b7d8e 100755 --- a/src/doc_reform/spine.d +++ b/src/doc_reform/spine.d @@ -173,6 +173,7 @@ string program_name = "spine"; "workon" : false, ]; string[string] settings = [ + "cgi-search-title" : "", // config default: "spine-search" "cgi-sqlite-search-filename" : "", // config default: "spine-search" "config" : "", "output" : "", @@ -244,6 +245,7 @@ string program_name = "spine"; "very-verbose", "output to terminal", &opts["very-verbose"], "workon", "(reserved for some matters under development & testing)", &opts["workon"], "xhtml", "xhtml output", &opts["xhtml"], + "cgi-search-title", "if generating a cgi search form the title to use for it", &settings["cgi-search-title"], "cgi-sqlite-search-filename", "=[filename] default is spine-search", &settings["cgi-sqlite-search-filename"], "config", "=/path/to/config/file/including/filename", &settings["config"], "lang", "=[lang code e.g. =en or =en,es]", &settings["lang"], @@ -436,6 +438,9 @@ string program_name = "spine"; @trusted string sqlite_filename() { return settings["sqlite-db-filename"]; } + @trusted string cgi_search_title() { + return settings["cgi-search-title"]; + } @trusted string cgi_sqlite_search_filename() { return settings["cgi-sqlite-search-filename"]; } |