From 0c693b23c4ff8f98a151884a24f150a5ff746dd4 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 16 Oct 2020 19:16:18 -0400 Subject: org mode, unique code-block names & adjust headers - avoid org-mode undefined behavior, provide unique code-block names --- org/util_cgi_d_sqlite_search.org | 60 ++++++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 21 deletions(-) (limited to 'org/util_cgi_d_sqlite_search.org') diff --git a/org/util_cgi_d_sqlite_search.org b/org/util_cgi_d_sqlite_search.org index 86242f4..e2f3cfd 100644 --- a/org/util_cgi_d_sqlite_search.org +++ b/org/util_cgi_d_sqlite_search.org @@ -7,6 +7,7 @@ #+COPYRIGHT: Copyright (C) 2015 - 2020 Ralph Amissah #+LANGUAGE: en #+STARTUP: content hideblocks hidestars noindent entitiespretty +#+OPTIONS: H:3 num:nil toc:t \n:nil @:t ::t |:t ^:nil _:nil -:t f:t *:t <:t #+PROPERTY: header-args :exports code #+PROPERTY: header-args+ :noweb yes #+PROPERTY: header-args+ :eval no @@ -27,13 +28,30 @@ dub --force --compiler=ldc2 && sudo cp -v cgi-bin/spine-search /usr/lib/cgi-bin/ <> <> void cgi_function_intro(Cgi cgi) { - <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> <> <> -<> +<> +<> +<> +<> +<> +<> <> <> <> +<> +<> <> <> } @@ -65,7 +83,7 @@ import std.process : environment; ** void main *** initialize -#+NAME: cgi_sqlite_initialize +#+NAME: cgi_sqlite_initialize_0 #+BEGIN_SRC d string header; string table; @@ -74,7 +92,7 @@ string form; **** config -#+NAME: cgi_sqlite_initialize +#+NAME: cgi_sqlite_initialize_1 #+BEGIN_SRC d struct Config { string http_request_type; @@ -106,7 +124,7 @@ conf.request_method = environment.get("REQUEST_METHOD", "POST"); **** cgi val -#+NAME: cgi_sqlite_initialize +#+NAME: cgi_sqlite_initialize_2 #+BEGIN_SRC d struct CGI_val { string db_selected = ""; @@ -128,7 +146,7 @@ cv.db_selected = "spine.search.db"; // config, set db name **** text fields ***** open -#+NAME: cgi_sqlite_initialize +#+NAME: cgi_sqlite_initialize_3 #+BEGIN_SRC d auto text_fields() { string canned_query_str = environment.get("QUERY_STRING", ""); @@ -151,7 +169,7 @@ auto text_fields() { ***** rgx -#+NAME: cgi_sqlite_initialize +#+NAME: cgi_sqlite_initialize_4 #+BEGIN_SRC d static struct Rgx { // static canned_query = ctRegex!(`\A(?P.+)\Z`, "m"); @@ -187,7 +205,7 @@ auto text_fields() { ***** searchfields -#+NAME: cgi_sqlite_initialize +#+NAME: cgi_sqlite_initialize_5 #+BEGIN_SRC d struct searchFields { string canned_query = ""; // GET canned_query == cq @@ -231,7 +249,7 @@ auto text_fields() { ***** env ****** POST -#+NAME: cgi_sqlite_initialize +#+NAME: cgi_sqlite_initialize_6 #+BEGIN_SRC d if (environment.get("REQUEST_METHOD", "POST") == "POST") { if ("sf" in cgi.post) { @@ -383,7 +401,7 @@ auto text_fields() { ****** GET -#+NAME: cgi_sqlite_initialize +#+NAME: cgi_sqlite_initialize_7 #+BEGIN_SRC d } else if (environment.get("REQUEST_METHOD", "POST") == "GET") { got.canned_query = environment.get("QUERY_STRING", ""); @@ -495,7 +513,7 @@ auto text_fields() { ***** tail -#+NAME: cgi_sqlite_initialize +#+NAME: cgi_sqlite_initialize_8 #+BEGIN_SRC d } auto tf = text_fields; // @@ -503,7 +521,7 @@ auto tf = text_fields; // **** SQL select -#+NAME: cgi_sqlite_initialize +#+NAME: cgi_sqlite_initialize_9 #+BEGIN_SRC d struct SQL_select { string the_body = ""; @@ -514,7 +532,7 @@ auto sql_select = SQL_select(); **** misc -#+NAME: cgi_sqlite_initialize +#+NAME: cgi_sqlite_initialize_10 #+BEGIN_SRC d string base ; // = ""; string tip ; // = ""; @@ -683,7 +701,7 @@ string previous_next () { *** cgi html form -#+NAME: cgi_sqlite_form +#+NAME: cgi_sqlite_form_0 #+BEGIN_SRC d { string post_value(string field_name, string type="box", string set="on") { @@ -726,7 +744,7 @@ string previous_next () { **** canned search -#+NAME: cgi_sqlite_form +#+NAME: cgi_sqlite_form_1 #+BEGIN_SRC d string the_can(string fv) { string show_the_can = post_value("url"); @@ -764,7 +782,7 @@ string previous_next () { **** provide tip -#+NAME: cgi_sqlite_form +#+NAME: cgi_sqlite_form_2 #+BEGIN_SRC d string provide_tip() { string searched_tip = post_value("se"); @@ -801,7 +819,7 @@ string previous_next () { **** the form ***** form html -#+NAME: cgi_sqlite_form +#+NAME: cgi_sqlite_form_3 #+BEGIN_SRC d form = format(q"┃
@@ -846,7 +864,7 @@ string previous_next () { ***** form values -#+NAME: cgi_sqlite_form +#+NAME: cgi_sqlite_form_4 #+BEGIN_SRC d "spine-search", (post_value("ec") == "checked") ? post_value("sf", "field") : "", @@ -870,7 +888,7 @@ string previous_next () { **** set value (debug) -#+NAME: cgi_sqlite_form +#+NAME: cgi_sqlite_form_5 #+BEGIN_SRC d { string set_value(string field_name, string default_val) { @@ -999,7 +1017,7 @@ auto db = Database(conf.db_path ~ cv.db_selected); **** db select statement ***** the body -#+NAME: cgi_sqlite_select_statement_0 +#+NAME: cgi_sqlite_select_statement_1 #+BEGIN_SRC d sql_select.the_body ~= format(q"┃ SELECT @@ -1042,7 +1060,7 @@ LIMIT %s OFFSET %s ***** html write selected ****** ocn index -#+NAME: cgi_sqlite_select_statement_0 +#+NAME: cgi_sqlite_select_statement_2 #+BEGIN_SRC d (cv.checked_sql) ? cgi.write(previous_next ~ "
" ~ sql_select.the_body.split("\n ").join(" ").split("\n").join("
") ~ "
\n") -- cgit v1.2.3