diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2021-10-13 13:33:08 -0400 | 
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2021-11-27 19:51:22 -0500 | 
| commit | 0ff37b772594b21a26b4b878a5ddbc6f1e0d1e67 (patch) | |
| tree | 86de7f449aab13cee6be7dbff314a024c1aeb499 /sundry | |
| parent | configuration, hierarchy filenames & paths ... (diff) | |
org files, tangle output, some fixes
Diffstat (limited to 'sundry')
| -rw-r--r-- | sundry/misc/util/d/cgi/search/src/spine_cgi_sqlite_search.d | 942 | ||||
| -rwxr-xr-x | sundry/misc/util/rb/cgi/spine.search.cgi | 174 | ||||
| -rwxr-xr-x | sundry/misc/util/rb/tex/dr_tex.rb | 102 | ||||
| -rw-r--r-- | sundry/spine_search_cgi/.gitignore | 1 | ||||
| -rwxr-xr-x | sundry/spine_search_cgi/src/spine_search.d_ | 31 | 
5 files changed, 626 insertions, 624 deletions
| diff --git a/sundry/misc/util/d/cgi/search/src/spine_cgi_sqlite_search.d b/sundry/misc/util/d/cgi/search/src/spine_cgi_sqlite_search.d index aa073c0..73aa9ed 100644 --- a/sundry/misc/util/d/cgi/search/src/spine_cgi_sqlite_search.d +++ b/sundry/misc/util/d/cgi/search/src/spine_cgi_sqlite_search.d @@ -118,325 +118,325 @@ void cgi_function_intro(Cgi cgi) {        //   cgi.write(field ~ ": " ~ content ~ "<br>");        // }      } -  static struct Rgx { -    // static canned_query   = ctRegex!(`\A(?P<matched>.+)\Z`,                            "m"); -    static search_text_area  = ctRegex!(`\A(?P<matched>.+)\Z`,                            "m"); -    // static fulltext       = ctRegex!(`\A(?P<matched>.+)\Z`,                            "m"); -    static line              = ctRegex!(`^(?P<matched>.+?)(?: ~|$)`,                      "m"); -    static text              = ctRegex!(`(?:^|\s~\s*)text:\s+(?P<matched>.+?)(?: ~|$)`,   "m"); -    static author            = ctRegex!(`(?:^|\s~\s*)author:\s+(?P<matched>.+)$`,         "m"); -    static title             = ctRegex!(`(?:^|\s~\s*)title:\s+(?P<matched>.+)$`,          "m"); -    static uid               = ctRegex!(`(?:^|\s~\s*)uid:\s+(?P<matched>.+)$`,            "m"); -    static fn                = ctRegex!(`(?:^|\s~\s*)fn:\s+(?P<matched>.+)$`,             "m"); -    static keywords          = ctRegex!(`(?:^|\s~\s*)keywords:\s+(?P<matched>.+)$`,       "m"); -    static topic_register    = ctRegex!(`(?:^|\s~\s*)topic_register:\s+(?P<matched>.+)$`, "m"); -    static subject           = ctRegex!(`(?:^|\s~\s*)subject:\s+(?P<matched>.+)$`,        "m"); -    static description       = ctRegex!(`(?:^|\s~\s*)description:\s+(?P<matched>.+)$`,    "m"); -    static publisher         = ctRegex!(`(?:^|\s~\s*)publisher:\s+(?P<matched>.+)$`,      "m"); -    static editor            = ctRegex!(`(?:^|\s~\s*)editor:\s+(?P<matched>.+)$`,         "m"); -    static contributor       = ctRegex!(`(?:^|\s~\s*)contributor:\s+(?P<matched>.+)$`,    "m"); -    static date              = ctRegex!(`(?:^|\s~\s*)date:\s+(?P<matched>.+)$`,           "m"); -    static results_type      = ctRegex!(`(?:^|\s~\s*)type:\s+(?P<matched>.+)$`,           "m"); -    static format            = ctRegex!(`(?:^|\s~\s*)format:\s+(?P<matched>.+)$`,         "m"); -    static identifier        = ctRegex!(`(?:^|\s~\s*)identifier:\s+(?P<matched>.+)$`,     "m"); -    static source            = ctRegex!(`(?:^|\s~\s*)source:\s+(?P<matched>.+)$`,         "m"); -    static language          = ctRegex!(`(?:^|\s~\s*)language:\s+(?P<matched>.+)$`,       "m"); -    static relation          = ctRegex!(`(?:^|\s~\s*)relation:\s+(?P<matched>.+)$`,       "m"); -    static coverage          = ctRegex!(`(?:^|\s~\s*)coverage:\s+(?P<matched>.+)$`,       "m"); -    static rights            = ctRegex!(`(?:^|\s~\s*)rights:\s+(?P<matched>.+)$`,         "m"); -    static comment           = ctRegex!(`(?:^|\s~\s*)comment:\s+(?P<matched>.+)$`,        "m"); -    // static abstract_         = ctRegex!(`(?:^|\s~\s*)abstract:\s+(?P<matched>.+)$`,       "m"); -    static src_filename_base = ctRegex!(`^src_filename_base:\s+(?P<matched>.+)$`,         "m"); -  } -  struct searchFields { -    string canned_query      = ""; // GET  canned_query     == cq -    string search_text_area  = ""; // POST search_text_area == tsa -    string text              = ""; // text              == txt -    string author            = ""; // author            == au -    string title             = ""; // title             == ti -    string uid               = "";  // uid               == uid -    string fn                = ""; // fn                == fn -    string keywords          = ""; // keywords          == kw -    string topic_register    = ""; // topic_register    == tr -    string subject           = ""; // subject           == su -    string description       = ""; // description       == de -    string publisher         = ""; // publisher         == pb -    string editor            = ""; // editor            == ed -    string contributor       = ""; // contributor       == ct -    string date              = ""; // date              == dt -    string format            = ""; // format            == fmt -    string identifier        = ""; // identifier        == id -    string source            = ""; // source            == src sfn -    string language          = ""; // language          == lng -    string relation          = ""; // relation          == rl -    string coverage          = ""; // coverage          == cv -    string rights            = ""; // rights            == rgt -    string comment           = ""; // comment           == cmt -    // string abstract          = ""; -    string src_filename_base = ""; // src_filename_base == bfn -    string results_type      = ""; // results_type      == rt     radio -    string sql_match_limit   = ""; // sql_match_limit   == sml    radio -    string sql_match_offset  = ""; // sql_match_offset  == smo -    string stats             = ""; // stats             == sts    checked -    string echo              = ""; // echo              == ec     checked -    string url               = ""; // url               == url    checked -    string searched          = ""; // searched          == se     checked -    string sql               = ""; // sql               == sql    checked -  } -  auto rgx  = Rgx(); -  auto got  = searchFields(); -  if (environment.get("REQUEST_METHOD", "POST") == "POST") { -    if ("sf" in cgi.post) { -      got.search_text_area =  cgi.post["sf"]; -      if (auto m = got.search_text_area.matchFirst(rgx.text)) { -        got.text = m["matched"]; -        got.canned_query ~= "sf=" ~ m["matched"]; -      } else if (auto m = got.search_text_area.matchFirst(rgx.line)) { -        if ( -          !(m["matched"].matchFirst(rgx.author)) -          && !(m["matched"].matchFirst(rgx.title)) -        ) { +    static struct Rgx { +      // static canned_query   = ctRegex!(`\A(?P<matched>.+)\Z`,                            "m"); +      static search_text_area  = ctRegex!(`\A(?P<matched>.+)\Z`,                            "m"); +      // static fulltext       = ctRegex!(`\A(?P<matched>.+)\Z`,                            "m"); +      static line              = ctRegex!(`^(?P<matched>.+?)(?: ~|$)`,                      "m"); +      static text              = ctRegex!(`(?:^|\s~\s*)text:\s+(?P<matched>.+?)(?: ~|$)`,   "m"); +      static author            = ctRegex!(`(?:^|\s~\s*)author:\s+(?P<matched>.+)$`,         "m"); +      static title             = ctRegex!(`(?:^|\s~\s*)title:\s+(?P<matched>.+)$`,          "m"); +      static uid               = ctRegex!(`(?:^|\s~\s*)uid:\s+(?P<matched>.+)$`,            "m"); +      static fn                = ctRegex!(`(?:^|\s~\s*)fn:\s+(?P<matched>.+)$`,             "m"); +      static keywords          = ctRegex!(`(?:^|\s~\s*)keywords:\s+(?P<matched>.+)$`,       "m"); +      static topic_register    = ctRegex!(`(?:^|\s~\s*)topic_register:\s+(?P<matched>.+)$`, "m"); +      static subject           = ctRegex!(`(?:^|\s~\s*)subject:\s+(?P<matched>.+)$`,        "m"); +      static description       = ctRegex!(`(?:^|\s~\s*)description:\s+(?P<matched>.+)$`,    "m"); +      static publisher         = ctRegex!(`(?:^|\s~\s*)publisher:\s+(?P<matched>.+)$`,      "m"); +      static editor            = ctRegex!(`(?:^|\s~\s*)editor:\s+(?P<matched>.+)$`,         "m"); +      static contributor       = ctRegex!(`(?:^|\s~\s*)contributor:\s+(?P<matched>.+)$`,    "m"); +      static date              = ctRegex!(`(?:^|\s~\s*)date:\s+(?P<matched>.+)$`,           "m"); +      static results_type      = ctRegex!(`(?:^|\s~\s*)type:\s+(?P<matched>.+)$`,           "m"); +      static format            = ctRegex!(`(?:^|\s~\s*)format:\s+(?P<matched>.+)$`,         "m"); +      static identifier        = ctRegex!(`(?:^|\s~\s*)identifier:\s+(?P<matched>.+)$`,     "m"); +      static source            = ctRegex!(`(?:^|\s~\s*)source:\s+(?P<matched>.+)$`,         "m"); +      static language          = ctRegex!(`(?:^|\s~\s*)language:\s+(?P<matched>.+)$`,       "m"); +      static relation          = ctRegex!(`(?:^|\s~\s*)relation:\s+(?P<matched>.+)$`,       "m"); +      static coverage          = ctRegex!(`(?:^|\s~\s*)coverage:\s+(?P<matched>.+)$`,       "m"); +      static rights            = ctRegex!(`(?:^|\s~\s*)rights:\s+(?P<matched>.+)$`,         "m"); +      static comment           = ctRegex!(`(?:^|\s~\s*)comment:\s+(?P<matched>.+)$`,        "m"); +      // static abstract_         = ctRegex!(`(?:^|\s~\s*)abstract:\s+(?P<matched>.+)$`,       "m"); +      static src_filename_base = ctRegex!(`^src_filename_base:\s+(?P<matched>.+)$`,         "m"); +    } +    struct searchFields { +      string canned_query      = ""; // GET  canned_query     == cq +      string search_text_area  = ""; // POST search_text_area == tsa +      string text              = ""; // text              == txt +      string author            = ""; // author            == au +      string title             = ""; // title             == ti +      string uid               = "";  // uid               == uid +      string fn                = ""; // fn                == fn +      string keywords          = ""; // keywords          == kw +      string topic_register    = ""; // topic_register    == tr +      string subject           = ""; // subject           == su +      string description       = ""; // description       == de +      string publisher         = ""; // publisher         == pb +      string editor            = ""; // editor            == ed +      string contributor       = ""; // contributor       == ct +      string date              = ""; // date              == dt +      string format            = ""; // format            == fmt +      string identifier        = ""; // identifier        == id +      string source            = ""; // source            == src sfn +      string language          = ""; // language          == lng +      string relation          = ""; // relation          == rl +      string coverage          = ""; // coverage          == cv +      string rights            = ""; // rights            == rgt +      string comment           = ""; // comment           == cmt +      // string abstract          = ""; +      string src_filename_base = ""; // src_filename_base == bfn +      string results_type      = ""; // results_type      == rt     radio +      string sql_match_limit   = ""; // sql_match_limit   == sml    radio +      string sql_match_offset  = ""; // sql_match_offset  == smo +      string stats             = ""; // stats             == sts    checked +      string echo              = ""; // echo              == ec     checked +      string url               = ""; // url               == url    checked +      string searched          = ""; // searched          == se     checked +      string sql               = ""; // sql               == sql    checked +    } +    auto rgx  = Rgx(); +    auto got  = searchFields(); +    if (environment.get("REQUEST_METHOD", "POST") == "POST") { +      if ("sf" in cgi.post) { +        got.search_text_area =  cgi.post["sf"]; +        if (auto m = got.search_text_area.matchFirst(rgx.text)) {            got.text = m["matched"];            got.canned_query ~= "sf=" ~ m["matched"]; +        } else if (auto m = got.search_text_area.matchFirst(rgx.line)) { +          if ( +            !(m["matched"].matchFirst(rgx.author)) +            && !(m["matched"].matchFirst(rgx.title)) +          ) { +            got.text = m["matched"]; +            got.canned_query ~= "sf=" ~ m["matched"]; +          } +        } +        if (auto m = got.search_text_area.matchFirst(rgx.author)) { +          got.author = m["matched"]; +          got.canned_query ~= "&au=" ~ m["matched"]; +        } +        if (auto m = got.search_text_area.matchFirst(rgx.title)) { +          got.title = m["matched"]; +          got.canned_query ~= "&ti=" ~ m["matched"]; +        } +        if (auto m = got.search_text_area.matchFirst(rgx.uid)) { +          got.uid = m["matched"]; +          got.canned_query ~= "&uid=" ~ m["matched"]; +        } +        if (auto m = got.search_text_area.matchFirst(rgx.fn)) { +          got.fn = m["matched"]; +          got.canned_query ~= "&fn=" ~ m["matched"]; +        } +        if (auto m = got.search_text_area.matchFirst(rgx.keywords)) { +          got.keywords = m["matched"]; +          got.canned_query ~= "&kw=" ~ m["matched"]; +        } +        if (auto m = got.search_text_area.matchFirst(rgx.topic_register)) { +          got.topic_register = m["matched"]; +          got.canned_query ~= "&tr=" ~ m["matched"]; +        } +        if (auto m = got.search_text_area.matchFirst(rgx.subject)) { +          got.subject = m["matched"]; +          got.canned_query ~= "&su=" ~ m["matched"]; +        } +        if (auto m = got.search_text_area.matchFirst(rgx.description)) { +          got.description = m["matched"]; +          got.canned_query ~= "&de=" ~ m["matched"]; +        } +        if (auto m = got.search_text_area.matchFirst(rgx.publisher)) { +          got.publisher = m["matched"]; +          got.canned_query ~= "&pb=" ~ m["matched"]; +        } +        if (auto m = got.search_text_area.matchFirst(rgx.editor)) { +          got.editor = m["matched"]; +          got.canned_query ~= "&ed=" ~ m["matched"]; +        } +        if (auto m = got.search_text_area.matchFirst(rgx.contributor)) { +          got.contributor = m["matched"]; +          got.canned_query ~= "&ct=" ~ m["matched"]; +        } +        if (auto m = got.search_text_area.matchFirst(rgx.date)) { +          got.date = m["matched"]; +          got.canned_query ~= "&dt=" ~ m["matched"]; +        } +        // if (auto m = got.search_text_area.matchFirst(rgx.results_type)) { +        //   got.results_type = m["matched"]; +        //   got.canned_query ~= "&rt=" ~ m["matched"]; +        // } +        if (auto m = got.search_text_area.matchFirst(rgx.format)) { +          got.format = m["matched"]; +          got.canned_query ~= "&fmt=" ~ m["matched"]; +        } +        if (auto m = got.search_text_area.matchFirst(rgx.identifier)) { +          got.identifier = m["matched"]; +          got.canned_query ~= "&id=" ~ m["matched"]; +        } +        if (auto m = got.search_text_area.matchFirst(rgx.source)) { +          got.source = m["matched"]; +          got.canned_query ~= "&src=" ~ m["matched"]; +        } +        if (auto m = got.search_text_area.matchFirst(rgx.language)) { +          got.language = m["matched"]; +          got.canned_query ~= "&lng=" ~ m["matched"]; +        } +        if (auto m = got.search_text_area.matchFirst(rgx.relation)) { +          got.relation = m["matched"]; +          got.canned_query ~= "&rl=" ~ m["matched"]; +        } +        if (auto m = got.search_text_area.matchFirst(rgx.coverage)) { +          got.coverage = m["matched"]; +          got.canned_query ~= "&cv=" ~ m["matched"]; +        } +        if (auto m = got.search_text_area.matchFirst(rgx.rights)) { +          got.rights = m["matched"]; +          got.canned_query ~= "&rgt=" ~ m["matched"]; +        } +        if (auto m = got.search_text_area.matchFirst(rgx.comment)) { +          got.comment = m["matched"]; +          got.canned_query ~= "&cmt=" ~ m["matched"]; +        } +        // if (auto m = search_text_area.matchFirst(rgx.abstract)) { +        //   got.abstract = m["matched"]; +        // } +        if (auto m = got.search_text_area.matchFirst(rgx.src_filename_base)) { +          got.src_filename_base = m["matched"]; +          got.canned_query ~= "&bfn=" ~ m["matched"];          }        } -      if (auto m = got.search_text_area.matchFirst(rgx.author)) { -        got.author = m["matched"]; -        got.canned_query ~= "&au=" ~ m["matched"]; +      if ("fn" in cgi.post) { +        got.fn =  cgi.post["fn"]; +        got.canned_query ~= "&fn=" ~ cgi.post["fn"];        } -      if (auto m = got.search_text_area.matchFirst(rgx.title)) { -        got.title = m["matched"]; -        got.canned_query ~= "&ti=" ~ m["matched"]; +      if ("rt" in cgi.post) { +        got.results_type =  cgi.post["rt"]; +        got.canned_query ~= "&rt=" ~ cgi.post["rt"];        } -      if (auto m = got.search_text_area.matchFirst(rgx.uid)) { -        got.uid = m["matched"]; -        got.canned_query ~= "&uid=" ~ m["matched"]; +      if ("sts" in cgi.post) { +        got.stats =  cgi.post["sts"]; +        got.canned_query ~= "&sts=" ~ cgi.post["sts"];        } -      if (auto m = got.search_text_area.matchFirst(rgx.fn)) { -        got.fn = m["matched"]; -        got.canned_query ~= "&fn=" ~ m["matched"]; +      if ("ec" in cgi.post) { +        got.echo =  cgi.post["ec"]; +        got.canned_query ~= "&ec=" ~ cgi.post["ec"];        } -      if (auto m = got.search_text_area.matchFirst(rgx.keywords)) { -        got.keywords = m["matched"]; -        got.canned_query ~= "&kw=" ~ m["matched"]; +      if ("url" in cgi.post) { +        got.url =  cgi.post["url"]; +        got.canned_query ~= "&url=" ~ cgi.post["url"];        } -      if (auto m = got.search_text_area.matchFirst(rgx.topic_register)) { -        got.topic_register = m["matched"]; -        got.canned_query ~= "&tr=" ~ m["matched"]; +      if ("se" in cgi.post) { +        got.searched =  cgi.post["se"]; +        got.canned_query ~= "&se=" ~ cgi.post["se"];        } -      if (auto m = got.search_text_area.matchFirst(rgx.subject)) { -        got.subject = m["matched"]; -        got.canned_query ~= "&su=" ~ m["matched"]; +      if ("sql" in cgi.post) { +        got.sql =  cgi.post["sql"]; +        got.canned_query ~= "&sql=" ~ cgi.post["sql"];        } -      if (auto m = got.search_text_area.matchFirst(rgx.description)) { -        got.description = m["matched"]; -        got.canned_query ~= "&de=" ~ m["matched"]; +      if ("sml" in cgi.post) { +        got.sql_match_limit =  cgi.post["sml"]; +        got.canned_query ~= "&sml=" ~ cgi.post["sml"];        } -      if (auto m = got.search_text_area.matchFirst(rgx.publisher)) { -        got.publisher = m["matched"]; -        got.canned_query ~= "&pb=" ~ m["matched"]; +      if ("smo" in cgi.post) { +        got.sql_match_offset = "0";   // cgi.post["smo"]; +        got.canned_query ~= "&smo=0"; //  ~ cgi.post["smo"];        } -      if (auto m = got.search_text_area.matchFirst(rgx.editor)) { -        got.editor = m["matched"]; -        got.canned_query ~= "&ed=" ~ m["matched"]; +      got.canned_query = got.canned_query.strip.split(" ").join("%20"); +      conf.query_string = got.canned_query; +      // cgi.write("f.canned_query: " ~ got.canned_query ~ "<br>"); +    } else if (environment.get("REQUEST_METHOD", "POST") == "GET") { +      got.canned_query = environment.get("QUERY_STRING", ""); +      // cgi.write("f.canned_query: " ~ got.canned_query ~ "<br>"); +      got.search_text_area = ""; +      if ("sf" in canned_query && !(canned_query["sf"]).empty) { +        got.text = canned_query["sf"].split("%20").join(" "); +        got.search_text_area ~= "text: " ~ got.text ~ "\n";        } -      if (auto m = got.search_text_area.matchFirst(rgx.contributor)) { -        got.contributor = m["matched"]; -        got.canned_query ~= "&ct=" ~ m["matched"]; +      if ("au" in canned_query && !(canned_query["au"]).empty) { +        got.author = canned_query["au"].split("%20").join(" "); +        got.search_text_area ~= "author: " ~ got.author ~ "\n";        } -      if (auto m = got.search_text_area.matchFirst(rgx.date)) { -        got.date = m["matched"]; -        got.canned_query ~= "&dt=" ~ m["matched"]; +      if ("ti" in canned_query && !(canned_query["ti"]).empty) { +        got.title = canned_query["ti"].split("%20").join(" "); +        got.search_text_area ~= "title: " ~ got.title ~ "\n";        } -      // if (auto m = got.search_text_area.matchFirst(rgx.results_type)) { -      //   got.results_type = m["matched"]; -      //   got.canned_query ~= "&rt=" ~ m["matched"]; -      // } -      if (auto m = got.search_text_area.matchFirst(rgx.format)) { -        got.format = m["matched"]; -        got.canned_query ~= "&fmt=" ~ m["matched"]; +      if ("uid" in canned_query && !(canned_query["uid"]).empty) { +        got.uid = canned_query["uid"].split("%20").join(" "); +        got.search_text_area ~= "uid: " ~ got.uid ~ "\n";        } -      if (auto m = got.search_text_area.matchFirst(rgx.identifier)) { -        got.identifier = m["matched"]; -        got.canned_query ~= "&id=" ~ m["matched"]; +      if ("fn" in canned_query && !(canned_query["fn"]).empty) { +        got.fn = canned_query["fn"].split("%20").join(" "); +        got.search_text_area ~= "fn: " ~ got.fn ~ "\n";        } -      if (auto m = got.search_text_area.matchFirst(rgx.source)) { -        got.source = m["matched"]; -        got.canned_query ~= "&src=" ~ m["matched"]; +      if ("kw" in canned_query && !(canned_query["kw"]).empty) { +        got.keywords = canned_query["kw"].split("%20").join(" "); +        got.search_text_area ~= "keywords: " ~ got.keywords ~ "\n";        } -      if (auto m = got.search_text_area.matchFirst(rgx.language)) { -        got.language = m["matched"]; -        got.canned_query ~= "&lng=" ~ m["matched"]; +      if ("tr" in canned_query && !(canned_query["tr"]).empty) { +        got.topic_register = canned_query["tr"].split("%20").join(" "); +        got.search_text_area ~= "topic_register: " ~ got.topic_register ~ "\n";        } -      if (auto m = got.search_text_area.matchFirst(rgx.relation)) { -        got.relation = m["matched"]; -        got.canned_query ~= "&rl=" ~ m["matched"]; +      if ("su" in canned_query && !(canned_query["su"]).empty) { +        got.subject = canned_query["su"].split("%20").join(" "); +        got.search_text_area ~= "subject: " ~ got.subject ~ "\n";        } -      if (auto m = got.search_text_area.matchFirst(rgx.coverage)) { -        got.coverage = m["matched"]; -        got.canned_query ~= "&cv=" ~ m["matched"]; +      if ("de" in canned_query && !(canned_query["de"]).empty) { +        got.description = canned_query["de"].split("%20").join(" "); +        got.search_text_area ~= "description: " ~ got.description ~ "\n";        } -      if (auto m = got.search_text_area.matchFirst(rgx.rights)) { -        got.rights = m["matched"]; -        got.canned_query ~= "&rgt=" ~ m["matched"]; +      if ("pb" in canned_query && !(canned_query["pb"]).empty) { +        got.publisher = canned_query["pb"].split("%20").join(" "); +        got.search_text_area ~= "publisher: " ~ got.publisher ~ "\n";        } -      if (auto m = got.search_text_area.matchFirst(rgx.comment)) { -        got.comment = m["matched"]; -        got.canned_query ~= "&cmt=" ~ m["matched"]; +      if ("ed" in canned_query && !(canned_query["ed"]).empty) { +        got.editor = canned_query["ed"].split("%20").join(" "); +        got.search_text_area ~= "editor: " ~ got.editor ~ "\n";        } -      // if (auto m = search_text_area.matchFirst(rgx.abstract)) { -      //   got.abstract = m["matched"]; +      if ("ct" in canned_query && !(canned_query["ct"]).empty) { +        got.contributor = canned_query["ct"].split("%20").join(" "); +        got.search_text_area ~= "contributor: " ~ got.contributor ~ "\n"; +      } +      if ("dt" in canned_query && !(canned_query["dt"]).empty) { +        got.date = canned_query["dt"].split("%20").join(" "); +        got.search_text_area ~= "date: " ~ got.date ~ "\n"; +      } +      if ("rt" in canned_query && !(canned_query["rt"]).empty) { +        got.results_type = canned_query["rt"].split("%20").join(" "); +        // got.search_text_area ~= "results_type: " ~ got.results_type ~ "\n"; +      } +      if ("fmt" in canned_query && !(canned_query["fmt"]).empty) { +        got.format = canned_query["fmt"].split("%20").join(" "); +        got.search_text_area ~= "format: " ~ got.format ~ "\n"; +      } +      if ("id" in canned_query && !(canned_query["id"]).empty) { +        got.identifier = canned_query["id"].split("%20").join(" "); +        got.search_text_area ~= "identifier: " ~ got.identifier ~ "\n"; +      } +      if ("src" in canned_query && !(canned_query["src"]).empty) { +        got.source = canned_query["src"].split("%20").join(" "); +        got.search_text_area ~= "source: " ~ got.source ~ "\n"; +      } +      if ("lng" in canned_query && !(canned_query["lng"]).empty) { +        got.language = canned_query["lng"].split("%20").join(" "); +        got.search_text_area ~= "language: " ~ got.language ~ "\n"; +      } +      if ("rl" in canned_query && !(canned_query["rl"]).empty) { +        got.relation = canned_query["rl"].split("%20").join(" "); +        got.search_text_area ~= "relation: " ~ got.relation ~ "\n"; +      } +      if ("cv" in canned_query && !(canned_query["cv"]).empty) { +        got.coverage = canned_query["cv"].split("%20").join(" "); +        got.search_text_area ~= "coverage: " ~ got.coverage ~ "\n"; +      } +      if ("rgt" in canned_query && !(canned_query["rgt"]).empty) { +        got.rights = canned_query["rgt"].split("%20").join(" "); +        got.search_text_area ~= "rights: " ~ got.rights ~ "\n"; +      } +      if ("cmt" in canned_query && !(canned_query["cmt"]).empty) { +        got.comment = canned_query["cmt"].split("%20").join(" "); +        got.search_text_area ~= "comment: " ~ got.comment ~ "\n"; +      } +      // if ("abstract" in canned_query && !(canned_query["abstract"]).empty) { +      //   got.abstract = canned_query["abstract"];        // } -      if (auto m = got.search_text_area.matchFirst(rgx.src_filename_base)) { -        got.src_filename_base = m["matched"]; -        got.canned_query ~= "&bfn=" ~ m["matched"]; +      if ("bfn" in canned_query && !(canned_query["bfn"]).empty) { // search_field +        got.src_filename_base = canned_query["bfn"].split("%20").join(" "); +        got.search_text_area ~= "src_filename_base: " ~ got.src_filename_base ~ "\n";        } +      if ("sml" in canned_query && !(canned_query["sml"]).empty) { +        got.sql_match_limit = canned_query["sml"].split("%20").join(" "); +        // got.search_text_area ~= "sql_match_limit: " ~ got.sql_match_limit ~ "\n"; +      } +      // cgi.write("f.search_text_area: " ~ got.search_text_area ~ "<br>");      } -    if ("fn" in cgi.post) { -      got.fn =  cgi.post["fn"]; -      got.canned_query ~= "&fn=" ~ cgi.post["fn"]; -    } -    if ("rt" in cgi.post) { -      got.results_type =  cgi.post["rt"]; -      got.canned_query ~= "&rt=" ~ cgi.post["rt"]; -    } -    if ("sts" in cgi.post) { -      got.stats =  cgi.post["sts"]; -      got.canned_query ~= "&sts=" ~ cgi.post["sts"]; -    } -    if ("ec" in cgi.post) { -      got.echo =  cgi.post["ec"]; -      got.canned_query ~= "&ec=" ~ cgi.post["ec"]; -    } -    if ("url" in cgi.post) { -      got.url =  cgi.post["url"]; -      got.canned_query ~= "&url=" ~ cgi.post["url"]; -    } -    if ("se" in cgi.post) { -      got.searched =  cgi.post["se"]; -      got.canned_query ~= "&se=" ~ cgi.post["se"]; -    } -    if ("sql" in cgi.post) { -      got.sql =  cgi.post["sql"]; -      got.canned_query ~= "&sql=" ~ cgi.post["sql"]; -    } -    if ("sml" in cgi.post) { -      got.sql_match_limit =  cgi.post["sml"]; -      got.canned_query ~= "&sml=" ~ cgi.post["sml"]; -    } -    if ("smo" in cgi.post) { -      got.sql_match_offset = "0";   // cgi.post["smo"]; -      got.canned_query ~= "&smo=0"; //  ~ cgi.post["smo"]; -    } -    got.canned_query = got.canned_query.strip.split(" ").join("%20"); -    conf.query_string = got.canned_query; -    // cgi.write("f.canned_query: " ~ got.canned_query ~ "<br>"); -  } else if (environment.get("REQUEST_METHOD", "POST") == "GET") { -    got.canned_query = environment.get("QUERY_STRING", ""); -    // cgi.write("f.canned_query: " ~ got.canned_query ~ "<br>"); -    got.search_text_area = ""; -    if ("sf" in canned_query && !(canned_query["sf"]).empty) { -      got.text = canned_query["sf"].split("%20").join(" "); -      got.search_text_area ~= "text: " ~ got.text ~ "\n"; -    } -    if ("au" in canned_query && !(canned_query["au"]).empty) { -      got.author = canned_query["au"].split("%20").join(" "); -      got.search_text_area ~= "author: " ~ got.author ~ "\n"; -    } -    if ("ti" in canned_query && !(canned_query["ti"]).empty) { -      got.title = canned_query["ti"].split("%20").join(" "); -      got.search_text_area ~= "title: " ~ got.title ~ "\n"; -    } -    if ("uid" in canned_query && !(canned_query["uid"]).empty) { -      got.uid = canned_query["uid"].split("%20").join(" "); -      got.search_text_area ~= "uid: " ~ got.uid ~ "\n"; -    } -    if ("fn" in canned_query && !(canned_query["fn"]).empty) { -      got.fn = canned_query["fn"].split("%20").join(" "); -      got.search_text_area ~= "fn: " ~ got.fn ~ "\n"; -    } -    if ("kw" in canned_query && !(canned_query["kw"]).empty) { -      got.keywords = canned_query["kw"].split("%20").join(" "); -      got.search_text_area ~= "keywords: " ~ got.keywords ~ "\n"; -    } -    if ("tr" in canned_query && !(canned_query["tr"]).empty) { -      got.topic_register = canned_query["tr"].split("%20").join(" "); -      got.search_text_area ~= "topic_register: " ~ got.topic_register ~ "\n"; -    } -    if ("su" in canned_query && !(canned_query["su"]).empty) { -      got.subject = canned_query["su"].split("%20").join(" "); -      got.search_text_area ~= "subject: " ~ got.subject ~ "\n"; -    } -    if ("de" in canned_query && !(canned_query["de"]).empty) { -      got.description = canned_query["de"].split("%20").join(" "); -      got.search_text_area ~= "description: " ~ got.description ~ "\n"; -    } -    if ("pb" in canned_query && !(canned_query["pb"]).empty) { -      got.publisher = canned_query["pb"].split("%20").join(" "); -      got.search_text_area ~= "publisher: " ~ got.publisher ~ "\n"; -    } -    if ("ed" in canned_query && !(canned_query["ed"]).empty) { -      got.editor = canned_query["ed"].split("%20").join(" "); -      got.search_text_area ~= "editor: " ~ got.editor ~ "\n"; -    } -    if ("ct" in canned_query && !(canned_query["ct"]).empty) { -      got.contributor = canned_query["ct"].split("%20").join(" "); -      got.search_text_area ~= "contributor: " ~ got.contributor ~ "\n"; -    } -    if ("dt" in canned_query && !(canned_query["dt"]).empty) { -      got.date = canned_query["dt"].split("%20").join(" "); -      got.search_text_area ~= "date: " ~ got.date ~ "\n"; -    } -    if ("rt" in canned_query && !(canned_query["rt"]).empty) { -      got.results_type = canned_query["rt"].split("%20").join(" "); -      // got.search_text_area ~= "results_type: " ~ got.results_type ~ "\n"; -    } -    if ("fmt" in canned_query && !(canned_query["fmt"]).empty) { -      got.format = canned_query["fmt"].split("%20").join(" "); -      got.search_text_area ~= "format: " ~ got.format ~ "\n"; -    } -    if ("id" in canned_query && !(canned_query["id"]).empty) { -      got.identifier = canned_query["id"].split("%20").join(" "); -      got.search_text_area ~= "identifier: " ~ got.identifier ~ "\n"; -    } -    if ("src" in canned_query && !(canned_query["src"]).empty) { -      got.source = canned_query["src"].split("%20").join(" "); -      got.search_text_area ~= "source: " ~ got.source ~ "\n"; -    } -    if ("lng" in canned_query && !(canned_query["lng"]).empty) { -      got.language = canned_query["lng"].split("%20").join(" "); -      got.search_text_area ~= "language: " ~ got.language ~ "\n"; -    } -    if ("rl" in canned_query && !(canned_query["rl"]).empty) { -      got.relation = canned_query["rl"].split("%20").join(" "); -      got.search_text_area ~= "relation: " ~ got.relation ~ "\n"; -    } -    if ("cv" in canned_query && !(canned_query["cv"]).empty) { -      got.coverage = canned_query["cv"].split("%20").join(" "); -      got.search_text_area ~= "coverage: " ~ got.coverage ~ "\n"; -    } -    if ("rgt" in canned_query && !(canned_query["rgt"]).empty) { -      got.rights = canned_query["rgt"].split("%20").join(" "); -      got.search_text_area ~= "rights: " ~ got.rights ~ "\n"; -    } -    if ("cmt" in canned_query && !(canned_query["cmt"]).empty) { -      got.comment = canned_query["cmt"].split("%20").join(" "); -      got.search_text_area ~= "comment: " ~ got.comment ~ "\n"; -    } -    // if ("abstract" in canned_query && !(canned_query["abstract"]).empty) { -    //   got.abstract = canned_query["abstract"]; -    // } -    if ("bfn" in canned_query && !(canned_query["bfn"]).empty) { // search_field -      got.src_filename_base = canned_query["bfn"].split("%20").join(" "); -      got.search_text_area ~= "src_filename_base: " ~ got.src_filename_base ~ "\n"; -    } -    if ("sml" in canned_query && !(canned_query["sml"]).empty) { -      got.sql_match_limit = canned_query["sml"].split("%20").join(" "); -      // got.search_text_area ~= "sql_match_limit: " ~ got.sql_match_limit ~ "\n"; -    } -    // cgi.write("f.search_text_area: " ~ got.search_text_area ~ "<br>"); -  } -  return got; +    return got;    }    auto tf = text_fields; //    struct SQL_select { @@ -573,8 +573,8 @@ void cgi_function_intro(Cgi cgi) {      conf.http_host,     );    } - { -   table = format(q"┃ +  { +    table = format(q"┃  <table summary="band" border="0" cellpadding="2" cellspacing="0">  <tr><td width="20%%">   <table summary="home button / home information" border="0" cellpadding="2" cellspacing="0"> @@ -593,76 +593,76 @@ void cgi_function_intro(Cgi cgi) {  </td></tr>  </table>  ┃"); - } -{ -  string post_value(string field_name, string type="box", string set="on") { -    string val = ""; -    switch (type) { -    case "field": -      val = ((field_name in cgi.post && !(cgi.post[field_name]).empty) -        ? cgi.post[field_name] -        : (field_name in cgi.get) -          ? cgi.get[field_name] -          : ""); -      val = tf.search_text_area; -      break; -    case "box": // generic for checkbox or radio; checkbox set == "on" radio set == "name set" -      val = ((field_name in cgi.post && !(cgi.post[field_name]).empty) -        ? (cgi.post[field_name]  == set ? "checked" : "off") -        : (field_name in cgi.get) -          ? (cgi.get[field_name] == set ? "checked" : "off") -          :                               "off"); -      break; -    case "radio": // used generic bo -      val = ((field_name in cgi.post && !(cgi.post[field_name]).empty) -        ? (cgi.post[field_name]  == set ? "checked" : "off") -        : (field_name in cgi.get) -          ? (cgi.get[field_name] == set ? "checked" : "off") -          :                               "checked"); -      break; -    case "checkbox": // used generic bo -      val = ((field_name in cgi.post && !(cgi.post[field_name]).empty) -        ? (cgi.post[field_name]  == set ? "checked" : "off") -        : (field_name in cgi.get) -          ? (cgi.get[field_name] == set ? "checked" : "off") -          :                               "checked"); -      break; -    default: -    } -    return val;    } -string the_can(string fv) { -  string show_the_can = post_value("url"); -  string _the_can = ""; -  if (show_the_can == "checked") { -    tf = text_fields; -    string method_get_url            = conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?" ~ environment.get("QUERY_STRING", ""); -    string method_post_url_construct = conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?" ~ tf.canned_query; -    // assert(method_get_url == environment.get("HTTP_REFERER", conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?" ~ conf.query_string)); -    if (conf.request_method == "POST") { -      _the_can = -        "<font size=\"2\" color=\"#666666\">" -        ~ "POST: " -        ~ "<a href=\"" -        ~ method_post_url_construct -        ~ "\">" -        ~ method_post_url_construct -        ~ "</a></font>" -        ~ "<br>"; -    } else if (conf.request_method == "GET") { -      _the_can = -        "<font size=\"2\" color=\"#666666\">" -        ~ "GET:  " -        ~ "<a href=\"" -        ~ method_get_url -        ~ "\">" -        ~ method_get_url -        ~ "</a></font>"; +  { +    string post_value(string field_name, string type="box", string set="on") { +      string val = ""; +      switch (type) { +      case "field": +        val = ((field_name in cgi.post && !(cgi.post[field_name]).empty) +          ? cgi.post[field_name] +          : (field_name in cgi.get) +            ? cgi.get[field_name] +            : ""); +        val = tf.search_text_area; +        break; +      case "box": // generic for checkbox or radio; checkbox set == "on" radio set == "name set" +        val = ((field_name in cgi.post && !(cgi.post[field_name]).empty) +          ? (cgi.post[field_name]  == set ? "checked" : "off") +          : (field_name in cgi.get) +            ? (cgi.get[field_name] == set ? "checked" : "off") +            :                               "off"); +        break; +      case "radio": // used generic bo +        val = ((field_name in cgi.post && !(cgi.post[field_name]).empty) +          ? (cgi.post[field_name]  == set ? "checked" : "off") +          : (field_name in cgi.get) +            ? (cgi.get[field_name] == set ? "checked" : "off") +            :                               "checked"); +        break; +      case "checkbox": // used generic bo +        val = ((field_name in cgi.post && !(cgi.post[field_name]).empty) +          ? (cgi.post[field_name]  == set ? "checked" : "off") +          : (field_name in cgi.get) +            ? (cgi.get[field_name] == set ? "checked" : "off") +            :                               "checked"); +        break; +      default: +      } +      return val; +    } +    string the_can(string fv) { +      string show_the_can = post_value("url"); +      string _the_can = ""; +      if (show_the_can == "checked") { +        tf = text_fields; +        string method_get_url            = conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?" ~ environment.get("QUERY_STRING", ""); +        string method_post_url_construct = conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?" ~ tf.canned_query; +        // assert(method_get_url == environment.get("HTTP_REFERER", conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?" ~ conf.query_string)); +        if (conf.request_method == "POST") { +          _the_can = +            "<font size=\"2\" color=\"#666666\">" +            ~ "POST: " +            ~ "<a href=\"" +            ~ method_post_url_construct +            ~ "\">" +            ~ method_post_url_construct +            ~ "</a></font>" +            ~ "<br>"; +        } else if (conf.request_method == "GET") { +          _the_can = +            "<font size=\"2\" color=\"#666666\">" +            ~ "GET:  " +            ~ "<a href=\"" +            ~ method_get_url +            ~ "\">" +            ~ method_get_url +            ~ "</a></font>"; +        } +        conf.http_url = conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ tf.canned_query; +      } +      return _the_can;      } -    conf.http_url = conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ tf.canned_query; -  } -  return _the_can; -}      string provide_tip() {        string searched_tip = post_value("se");        string tip = ""; @@ -732,59 +732,59 @@ string the_can(string fv) {    </table>  </form>  ┃", -  "spine-search", -  (post_value("ec") == "checked") ? post_value("sf", "field") : "", -  provide_tip, -  search_note, -  the_can(post_value("sf", "field")), -  cv.db_selected, -  cv.db_selected, -  post_value("rt",  "box", "idx"), -  post_value("rt",  "box", "txt"), -  post_value("sml", "box", "1000"), -  post_value("sml", "box", "2500"), -  post_value("ec"), -  post_value("sts"), -  post_value("url"), -  post_value("se"), -  post_value("tip"), -  post_value("sql"), -); -  { -    string set_value(string field_name, string default_val) { -      string val; -      if (field_name in cgi.post) { -        val = cgi.post[field_name]; -      } else if (field_name in cgi.get) { -        val = cgi.get[field_name]; -      } else { val = default_val; } -      return val; -    } -    bool set_bool(string field_name) { -      bool val; -      if (field_name in cgi.post -      && cgi.post[field_name] == "on") { -        val = true; -      } else if (field_name in cgi.get -      && cgi.get[field_name] == "on") { -        val = true; -      } else { val = false; } -      return val; +      "spine-search", +      (post_value("ec") == "checked") ? post_value("sf", "field") : "", +      provide_tip, +      search_note, +      the_can(post_value("sf", "field")), +      cv.db_selected, +      cv.db_selected, +      post_value("rt",  "box", "idx"), +      post_value("rt",  "box", "txt"), +      post_value("sml", "box", "1000"), +      post_value("sml", "box", "2500"), +      post_value("ec"), +      post_value("sts"), +      post_value("url"), +      post_value("se"), +      post_value("tip"), +      post_value("sql"), +    ); +    { +      string set_value(string field_name, string default_val) { +        string val; +        if (field_name in cgi.post) { +          val = cgi.post[field_name]; +        } else if (field_name in cgi.get) { +          val = cgi.get[field_name]; +        } else { val = default_val; } +        return val; +      } +      bool set_bool(string field_name) { +        bool val; +        if (field_name in cgi.post +        && cgi.post[field_name] == "on") { +          val = true; +        } else if (field_name in cgi.get +        && cgi.get[field_name] == "on") { +          val = true; +        } else { val = false; } +        return val; +      } +      cv.db_selected      = set_value("selected_db",      "spine.search.db"); // selected_db == db +      cv.sql_match_limit  = set_value("sml", "1000"); +      cv.sql_match_offset = set_value("smo", "0"); +      cv.search_text      = set_value("sf",  "test");                         // remove test +      cv.results_type     = set_value("rt",  "idx"); +      cv.checked_echo     = set_bool("ec"); +      cv.checked_stats    = set_bool("sts"); +      cv.checked_url      = set_bool("url"); +      cv.checked_searched = set_bool("se"); +      cv.checked_tip      = set_bool("tip"); +      cv.checked_sql      = set_bool("sql"); +      tf = text_fields;      } -    cv.db_selected      = set_value("selected_db",      "spine.search.db"); // selected_db == db -    cv.sql_match_limit  = set_value("sml", "1000"); -    cv.sql_match_offset = set_value("smo", "0"); -    cv.search_text      = set_value("sf",  "test");                         // remove test -    cv.results_type     = set_value("rt",  "idx"); -    cv.checked_echo     = set_bool("ec"); -    cv.checked_stats    = set_bool("sts"); -    cv.checked_url      = set_bool("url"); -    cv.checked_searched = set_bool("se"); -    cv.checked_tip      = set_bool("tip"); -    cv.checked_sql      = set_bool("sql"); -    tf = text_fields;    } -}    {      cgi.write(header);      cgi.write(table); @@ -888,68 +888,68 @@ LIMIT %s OFFSET %s          cv.sql_match_limit,          cv.sql_match_offset,        ); -    (cv.checked_sql) -    ? cgi.write(previous_next ~ "<hr><font size=\"2\" color=\"#666666\">" ~ sql_select.the_body.split("\n  ").join(" ").split("\n").join("<br>") ~ "</font>\n") -    : ""; -    cgi.write(previous_next); -    auto select_query_results = db.execute(sql_select.the_body).cached; -    string _old_uid = ""; -    if (!select_query_results.empty) { -      foreach (row; select_query_results) { -        if (row["uid"].as!string != _old_uid) { -          _old_uid = row["uid"].as!string; -          auto m = (row["date_published"].as!string).match(regex(r"^([0-9]{4})")); // breaks if row missing or no match? -          cgi.write( -            "<hr><a href=\"" -              ~ "https://" ~ conf.http_host ~ "/" -              ~ row["language_document_char"].as!string ~ "/html/" -              ~ row["src_filename_base"].as!string ~ "/" -              ~ "toc.html" -            ~ "\">\"" -              ~ row["title"].as!string ~ "\"" -            ~ "</a> (" -            ~ m.hit -            ~ ") " -            ~ "[" -            ~ row["language_document_char"].as!string -            ~ "] " -            ~ row["creator_author_last_first"].as!string -            ~ ":<br>\n" -          ); -        } -        if (cv.results_type == "txt") { -          cgi.write( -            "<hr><a href=\"" -              ~ "https://" ~ conf.http_host ~ "/" -              ~ row["language_document_char"].as!string ~ "/html/" -              ~ row["src_filename_base"].as!string ~ "/" -              ~ row["seg_name"].as!string ~ ".html#" ~ row["ocn"].as!string -            ~ "\">" -              ~ row["ocn"].as!string -            ~ "</a>" -            ~ "<br>" -            ~ row["body"].as!string -          ); -        } else { -          cgi.write( -            "<a href=\"" -              ~ "https://" ~ conf.http_host ~ "/" -              ~ row["language_document_char"].as!string ~ "/html/" -              ~ row["src_filename_base"].as!string ~ "/" -              ~ row["seg_name"].as!string ~ ".html#" ~ row["ocn"].as!string -            ~ "\">" -              ~ row["ocn"].as!string -            ~ "</a>, " -          ); +      (cv.checked_sql) +      ? cgi.write(previous_next ~ "<hr><font size=\"2\" color=\"#666666\">" ~ sql_select.the_body.split("\n  ").join(" ").split("\n").join("<br>") ~ "</font>\n") +      : ""; +      cgi.write(previous_next); +      auto select_query_results = db.execute(sql_select.the_body).cached; +      string _old_uid = ""; +      if (!select_query_results.empty) { +        foreach (row; select_query_results) { +          if (row["uid"].as!string != _old_uid) { +            _old_uid = row["uid"].as!string; +            auto m = (row["date_published"].as!string).match(regex(r"^([0-9]{4})")); // breaks if row missing or no match? +            cgi.write( +              "<hr><a href=\"" +                ~ "https://" ~ conf.http_host ~ "/" +                ~ row["language_document_char"].as!string ~ "/html/" +                ~ row["src_filename_base"].as!string ~ "/" +                ~ "toc.html" +              ~ "\">\"" +                ~ row["title"].as!string ~ "\"" +              ~ "</a> (" +              ~ m.hit +              ~ ") " +              ~ "[" +              ~ row["language_document_char"].as!string +              ~ "] " +              ~ row["creator_author_last_first"].as!string +              ~ ":<br>\n" +            ); +          } +          if (cv.results_type == "txt") { +            cgi.write( +              "<hr><a href=\"" +                ~ "https://" ~ conf.http_host ~ "/" +                ~ row["language_document_char"].as!string ~ "/html/" +                ~ row["src_filename_base"].as!string ~ "/" +                ~ row["seg_name"].as!string ~ ".html#" ~ row["ocn"].as!string +              ~ "\">" +                ~ row["ocn"].as!string +              ~ "</a>" +              ~ "<br>" +              ~ row["body"].as!string +            ); +          } else { +            cgi.write( +              "<a href=\"" +                ~ "https://" ~ conf.http_host ~ "/" +                ~ row["language_document_char"].as!string ~ "/html/" +                ~ row["src_filename_base"].as!string ~ "/" +                ~ row["seg_name"].as!string ~ ".html#" ~ row["ocn"].as!string +              ~ "\">" +                ~ row["ocn"].as!string +              ~ "</a>, " +            ); +          }          } +        cgi.write( previous_next); +      } else { // offset_not_beyond_limit = false; +        cgi.write("select_query_results empty<p>\n");        } -      cgi.write( previous_next); -    } else { // offset_not_beyond_limit = false; -      cgi.write("select_query_results empty<p>\n");      } +    sql_search_query;    } -  sql_search_query; -}    {      db.close;    } diff --git a/sundry/misc/util/rb/cgi/spine.search.cgi b/sundry/misc/util/rb/cgi/spine.search.cgi index ff2bfc2..9184847 100755 --- a/sundry/misc/util/rb/cgi/spine.search.cgi +++ b/sundry/misc/util/rb/cgi/spine.search.cgi @@ -44,7 +44,7 @@     * Standard SiSU meta-markup syntax, and the     * Standard SiSU object citation numbering and system - * Hompages: + * Homepages:     <https://www.sisudoc.org>   * Ralph Amissah @@ -739,99 +739,99 @@ FCGI.each_cgi do |cgi|        <b>search string:</b> "#{green}#{analyze_format}</font>"<br />        #{p_text} #{p_fulltext} #{p_keywords} #{p_title} #{p_author} #{p_topic_register} #{p_subject} #{p_description} #{p_publisher} #{p_editor} #{p_contributor} #{p_date} #{p_type} #{p_format} #{p_identifier} #{p_source} #{p_language} #{p_relation} #{p_coverage} #{p_rights} #{p_comment} #{p_abstract} #{p_filename}        </font> -      WOK -  #eg = %{canned search e.g.:<br /> <a href="#{url}">#{url}</a><br />find: #{analyze}<br />database: #{database}} -  #% dbi_canning -  @header = Form.new(@base,search_field,selected_db,result_type,checked_sql_limit,checked_tip,checked_stats,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,search_note,the_can).submission_form #% form -  unless q['s1'] =~/\S/ or q['au'] =~/\S/ or @search[:text][1] =~/\S/ -    print "Content-type: text/html\n\n" -    puts (@header+@tail) -  else #% searches -    s1=(@search_for.text1 =~/\S/) \ -    ? @search_for.text1 -    : 'Unavailable' -    if checked_case=~/\S/ -      @search[:text]<<%{doc_objects.clean~'#{CGI.unescape(s1)}'} -    else -      @search[:text]<<%{doc_objects.clean~*'#{CGI.unescape(s1)}'} -    end -    #% dbi_request -    dbi_statement=DBI_SearchStatement.new(@conn,@search_for,q,checked_case) -    @text_search_flag=false -    @text_search_flag=dbi_statement.text_search_flag -    s_contents=dbi_statement.contents -    @body_main='' -    @search_regx=nil -    olduid="" -    if @text_search_flag -      if checked_sql =~/\S/ -        sql_select_body=dbi_statement.sql_select_body_format -      else sql_select_body='' -      end -      @body_main << sql_select_body -      #@body_main << '<p><hr><br /><b>Main Text:</b><br />' << sql_select_body -    else -    end -    @hostpath = "#{@hosturl_files}" -    #@hostpath="#{@hosturl_files}/#{@stub}" -    def path_manifest(fn,ln=nil) -      case @output_dir_structure_by -      when 'filename' -        @lingual =='mono' \ -        ? "#{@hostpath}/#{fn}/sisu_manifest.html" -        : "#{@hostpath}/#{fn}/sisu_manifest.#{ln}.html" -      when 'filetype' -        @lingual =='mono' \ -        ? "#{@hostpath}/manifest/#{fn}.html" -        : "#{@hostpath}/manifest/#{fn}.#{ln}.html" +    WOK +    #eg = %{canned search e.g.:<br /> <a href="#{url}">#{url}</a><br />find: #{analyze}<br />database: #{database}} +    #% dbi_canning +    @header = Form.new(@base,search_field,selected_db,result_type,checked_sql_limit,checked_tip,checked_stats,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,search_note,the_can).submission_form #% form +    unless q['s1'] =~/\S/ or q['au'] =~/\S/ or @search[:text][1] =~/\S/ +      print "Content-type: text/html\n\n" +      puts (@header+@tail) +    else #% searches +      s1=(@search_for.text1 =~/\S/) \ +      ? @search_for.text1 +      : 'Unavailable' +      if checked_case=~/\S/ +        @search[:text]<<%{doc_objects.clean~'#{CGI.unescape(s1)}'}        else -        "#{@hostpath}/#{ln}/manifest/#{fn}.html" +        @search[:text]<<%{doc_objects.clean~*'#{CGI.unescape(s1)}'}        end -    end -    def path_html_seg(fn,ln=nil) -      case @output_dir_structure_by -      when 'filename' -        "#{@hostpath}/#{fn}" -      when 'filetype' -        "#{@hostpath}/html/#{fn}" +      #% dbi_request +      dbi_statement=DBI_SearchStatement.new(@conn,@search_for,q,checked_case) +      @text_search_flag=false +      @text_search_flag=dbi_statement.text_search_flag +      s_contents=dbi_statement.contents +      @body_main='' +      @search_regx=nil +      olduid="" +      if @text_search_flag +        if checked_sql =~/\S/ +          sql_select_body=dbi_statement.sql_select_body_format +        else sql_select_body='' +        end +        @body_main << sql_select_body +        #@body_main << '<p><hr><br /><b>Main Text:</b><br />' << sql_select_body        else -        "#{@hostpath}/#{ln}/html/#{fn}"        end -    end -    def path_toc(fn,ln=nil) -      if @output_dir_structure_by =='filename' \ -      or @output_dir_structure_by =='filetype' -        @lingual =='mono' \ -        ? "#{path_html_seg(fn,ln)}/toc.html" -        : "#{path_html_seg(fn,ln)}/toc.#{ln}.html" -      else -        "#{path_html_seg(fn,ln)}/toc.html" +      @hostpath = "#{@hosturl_files}" +      #@hostpath="#{@hosturl_files}/#{@stub}" +      def path_manifest(fn,ln=nil) +        case @output_dir_structure_by +        when 'filename' +          @lingual =='mono' \ +          ? "#{@hostpath}/#{fn}/sisu_manifest.html" +          : "#{@hostpath}/#{fn}/sisu_manifest.#{ln}.html" +        when 'filetype' +          @lingual =='mono' \ +          ? "#{@hostpath}/manifest/#{fn}.html" +          : "#{@hostpath}/manifest/#{fn}.#{ln}.html" +        else +          "#{@hostpath}/#{ln}/manifest/#{fn}.html" +        end        end -    end -    def path_filename(fn,seg_name,ln=nil) -      if @output_dir_structure_by =='filename' \ -      or @output_dir_structure_by =='filetype' -        @lingual =='mono' \ -        ? "#{path_html_seg(fn,ln)}/#{seg_name}.html" -        : "#{path_html_seg(fn,ln)}/#{seg_name}.#{ln}.html" -      else -        "#{path_html_seg(fn,ln)}/#{seg_name}.html" +      def path_html_seg(fn,ln=nil) +        case @output_dir_structure_by +        when 'filename' +          "#{@hostpath}/#{fn}" +        when 'filetype' +          "#{@hostpath}/html/#{fn}" +        else +          "#{@hostpath}/#{ln}/html/#{fn}" +        end        end -    end -    def path_html_doc(fn,ln=nil) -      case @output_dir_structure_by -      when 'filename' -        @lingual =='mono' \ -        ? "#{path_html_seg(fn,ln)}/scroll.html" -        : "#{path_html_seg(fn,ln)}/scroll.#{ln}.html" -      when 'filetype' -        @lingual =='mono' \ -        ? "#{@hostpath}/html/#{fn}.html" -        : "#{@hostpath}/html/#{fn}.#{ln}.html" -      else -        "#{@hostpath}/#{ln}/html/#{fn}.html" +      def path_toc(fn,ln=nil) +        if @output_dir_structure_by =='filename' \ +        or @output_dir_structure_by =='filetype' +          @lingual =='mono' \ +          ? "#{path_html_seg(fn,ln)}/toc.html" +          : "#{path_html_seg(fn,ln)}/toc.#{ln}.html" +        else +          "#{path_html_seg(fn,ln)}/toc.html" +        end +      end +      def path_filename(fn,seg_name,ln=nil) +        if @output_dir_structure_by =='filename' \ +        or @output_dir_structure_by =='filetype' +          @lingual =='mono' \ +          ? "#{path_html_seg(fn,ln)}/#{seg_name}.html" +          : "#{path_html_seg(fn,ln)}/#{seg_name}.#{ln}.html" +        else +          "#{path_html_seg(fn,ln)}/#{seg_name}.html" +        end +      end +      def path_html_doc(fn,ln=nil) +        case @output_dir_structure_by +        when 'filename' +          @lingual =='mono' \ +          ? "#{path_html_seg(fn,ln)}/scroll.html" +          : "#{path_html_seg(fn,ln)}/scroll.#{ln}.html" +        when 'filetype' +          @lingual =='mono' \ +          ? "#{@hostpath}/html/#{fn}.html" +          : "#{@hostpath}/html/#{fn}.#{ln}.html" +        else +          "#{@hostpath}/#{ln}/html/#{fn}.html" +        end        end -    end                #% text_objects_body      s_contents.each do |c|                                               #% text body        location=c['src_filename_base'][/(.+?)\.(?:ssm\.sst|sst)$/,1] diff --git a/sundry/misc/util/rb/tex/dr_tex.rb b/sundry/misc/util/rb/tex/dr_tex.rb index f310735..bb4ec7d 100755 --- a/sundry/misc/util/rb/tex/dr_tex.rb +++ b/sundry/misc/util/rb/tex/dr_tex.rb @@ -1,54 +1,56 @@  #!/usr/bin/env ruby -# /+ -# - Name: Spine, Doc Reform [a part of] -#   - Description: documents, structuring, processing, publishing, search -#     - static content generator -#  -#   - Author: Ralph Amissah -#     [ralph.amissah@gmail.com] -#  -#   - Copyright: (C) 2015 - 2021 Ralph Amissah, All Rights -#     Reserved. -#  -#   - License: AGPL 3 or later: -#  -#     Spine (SiSU), a framework for document structuring, publishing and -#     search -#  -#     Copyright (C) Ralph Amissah -#  -#     This program is free software: you can redistribute it and/or modify it -#     under the terms of the GNU AFERO General Public License as published by the -#     Free Software Foundation, either version 3 of the License, or (at your -#     option) any later version. -#  -#     This program is distributed in the hope that it will be useful, but WITHOUT -#     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#     FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -#     more details. -#  -#     You should have received a copy of the GNU General Public License along with -#     this program. If not, see [https://www.gnu.org/licenses/]. -#  -#     If you have Internet connection, the latest version of the AGPL should be -#     available at these locations: -#     [https://www.fsf.org/licensing/licenses/agpl.html] -#     [https://www.gnu.org/licenses/agpl.html] -#  -#   - Spine (by Doc Reform, related to SiSU) uses standard: -#     - docReform markup syntax -#       - standard SiSU markup syntax with modified headers and minor modifications -#     - docReform object numbering -#       - standard SiSU object citation numbering & system -#  -#   - Homepages: -#     [https://www.doc_reform.org] -#     [https://www.sisudoc.org] -#  -#   - Git -#     [https://git.sisudoc.org/projects/?p=software/spine.git;a=summary] -#  -# +/ +=begin +/+ +- Name: Spine, Doc Reform [a part of] +  - Description: documents, structuring, processing, publishing, search +    - static content generator + +  - Author: Ralph Amissah +    [ralph.amissah@gmail.com] + +  - Copyright: (C) 2015 - 2021 Ralph Amissah, All Rights +    Reserved. + +  - License: AGPL 3 or later: + +    Spine (SiSU), a framework for document structuring, publishing and +    search + +    Copyright (C) Ralph Amissah + +    This program is free software: you can redistribute it and/or modify it +    under the terms of the GNU AFERO General Public License as published by the +    Free Software Foundation, either version 3 of the License, or (at your +    option) any later version. + +    This program is distributed in the hope that it will be useful, but WITHOUT +    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +    FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +    more details. + +    You should have received a copy of the GNU General Public License along with +    this program. If not, see [https://www.gnu.org/licenses/]. + +    If you have Internet connection, the latest version of the AGPL should be +    available at these locations: +    [https://www.fsf.org/licensing/licenses/agpl.html] +    [https://www.gnu.org/licenses/agpl.html] + +  - Spine (by Doc Reform, related to SiSU) uses standard: +    - docReform markup syntax +      - standard SiSU markup syntax with modified headers and minor modifications +    - docReform object numbering +      - standard SiSU object citation numbering & system + +  - Homepages: +    [https://www.doc_reform.org] +    [https://www.sisudoc.org] + +  - Git +    [https://git.sisudoc.org/projects/?p=software/spine.git;a=summary] + ++/ +=end  require 'fileutils'  pwd = Dir.pwd  argv,texfiles_with_path,flags=[],[],[] diff --git a/sundry/spine_search_cgi/.gitignore b/sundry/spine_search_cgi/.gitignore index 585b85c..d9d6575 100644 --- a/sundry/spine_search_cgi/.gitignore +++ b/sundry/spine_search_cgi/.gitignore @@ -2,6 +2,7 @@  *  !.gitignore  !README.md +!README  !COPYRIGHT  !CHANGELOG  !makefile diff --git a/sundry/spine_search_cgi/src/spine_search.d_ b/sundry/spine_search_cgi/src/spine_search.d_ index 836c746..c5d6525 100755 --- a/sundry/spine_search_cgi/src/spine_search.d_ +++ b/sundry/spine_search_cgi/src/spine_search.d_ @@ -1368,21 +1368,21 @@ void cgi_function_intro(Cgi cgi) {     );    }    { -  table = format(q"┃ -<table summary="band" border="0" cellpadding="2" cellspacing="0"> -<tr><td width="20%%"> - <table summary="home button / home information" border="0" cellpadding="2" cellspacing="0"> - <tr><td align="left"> -   %s - </td></tr> - </table> -</td> -<td> -</td></tr> -</table> -  ┃", -    conf.cgi_search_form_html_title, -  ); +    table = format(q"┃ +  <table summary="band" border="0" cellpadding="2" cellspacing="0"> +  <tr><td width="20%%"> +   <table summary="home button / home information" border="0" cellpadding="2" cellspacing="0"> +   <tr><td align="left"> +     %s +   </td></tr> +   </table> +  </td> +  <td> +  </td></tr> +  </table> +    ┃", +      conf.cgi_search_form_html_title, +    );    }    {      string post_value(string field_name, string type="box", string set="on") { @@ -1822,7 +1822,6 @@ LIMIT %s OFFSET %s            }          }          cgi.write( previous_next); -              } else { // offset_not_beyond_limit = false;          cgi.write("select_query_results empty<p>\n");        } | 
