From 29af0a143fd2304ab8fa228ac6487c314db80072 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 21 Apr 2020 21:06:01 -0400 Subject: cgi output, adjust appearance --- org/out_cgi_search_sqlite.org | 185 ++++++++++++++++++++++--- src/doc_reform/io_out/cgi_sqlite_search_form.d | 149 ++++++++++++++++++-- 2 files changed, 300 insertions(+), 34 deletions(-) diff --git a/org/out_cgi_search_sqlite.org b/org/out_cgi_search_sqlite.org index 32e11ea..9b0c092 100644 --- a/org/out_cgi_search_sqlite.org +++ b/org/out_cgi_search_sqlite.org @@ -812,10 +812,18 @@ string show_matched_objects (string fn) { ** cgi *** cgi html header +**** format + #+NAME: cgi_sqlite_header #+BEGIN_SRC d { header = format(q"┃ +#+END_SRC + +**** html + +#+NAME: cgi_sqlite_header +#+BEGIN_SRC html @@ -827,6 +835,12 @@ string show_matched_objects (string fn) { @@ -1310,7 +1445,7 @@ string show_matched_objects (string fn) { *** cgi html table #+NAME: cgi_sqlite_table -#+BEGIN_SRC d +#+BEGIN_SRC html { table = format(q"┃ @@ -1449,7 +1584,7 @@ string show_matched_objects (string fn) { ***** form html #+NAME: cgi_sqlite_form -#+BEGIN_SRC d +#+BEGIN_SRC html form = format(q"┃
@@ -1583,7 +1718,7 @@ string show_matched_objects (string fn) { auto db = Database(conf.db_path ~ cv.db_selected); #+END_SRC -*** db select statement +*** db sql SELECT statement **** select where #+NAME: cgi_sqlite_select_statement_0 @@ -1669,11 +1804,10 @@ auto db = Database(conf.db_path ~ cv.db_selected); fields_str ~= fields.join(" AND "); #+END_SRC -**** db select statement -***** the body +**** db SELECT statement, the body #+NAME: cgi_sqlite_select_statement_0 -#+BEGIN_SRC d +#+BEGIN_SRC sql sql_select.the_body ~= format(q"┃ SELECT metadata_and_text.uid, @@ -1712,8 +1846,8 @@ LIMIT %%s OFFSET %%s ); #+END_SRC -***** html write selected -****** head +**** html write selected +***** head #+NAME: cgi_sqlite_select_statement_0 #+BEGIN_SRC d @@ -1729,15 +1863,20 @@ LIMIT %%s OFFSET %%s string _old_uid = ""; if (!select_query_results.empty) { string _date_published = "0000"; - foreach (row; select_query_results) { + string _close_para = ""; + string _matched_ocn_open = ""; + foreach (idx, row; select_query_results) { if (row["uid"].as!string != _old_uid) { + _close_para = (idx == 1) ? "" : "

"; + _matched_ocn_open = (idx == 1) ? "" : "

"; _old_uid = row["uid"].as!string; _date_published = (row["date_published"].as!string.match(regex(r"^([0-9]{4})"))) ? row["date_published"].as!string : "0000"; // used in regex that breaks if no match auto m = _date_published.match(regex(r"^([0-9]{4})")); string _date = (m.hit == "0000") ? "(year?) " : "(" ~ m.hit ~ ") "; cgi.write( - "


\n" + ~ "

" ); } #+END_SRC -****** text found +***** text found #+NAME: cgi_sqlite_select_statement_0 #+BEGIN_SRC d if (cv.results_type == "txt") { if (row["ocn"].as!string != "0") { cgi.write( - "

" ~ row["ocn"].as!string - ~ "" - ~ "
" + ~ ":

" ~ highlight_text_matched(row["body"].as!string, tf.text) ); } else { cgi.write( - "

" ~ row["ocn"].as!string - ~ "" - ~ "
" + ~ ":

" ~ highlight_text_matched(row["body"].as!string, tf.text) ); } #+END_SRC -****** ocn index +***** ocn index #+NAME: cgi_sqlite_select_statement_0 #+BEGIN_SRC d } else { if (row["ocn"].as!string != "0") { cgi.write( - ", " ); } + _matched_ocn_open = ""; } #+END_SRC -****** tail +***** tail #+NAME: cgi_sqlite_select_statement_0 #+BEGIN_SRC d @@ -1912,4 +2052,3 @@ 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/src/doc_reform/io_out/cgi_sqlite_search_form.d b/src/doc_reform/io_out/cgi_sqlite_search_form.d index 9c95f7d..d823e8c 100644 --- a/src/doc_reform/io_out/cgi_sqlite_search_form.d +++ b/src/doc_reform/io_out/cgi_sqlite_search_form.d @@ -590,6 +590,26 @@ void cgi_function_intro(Cgi cgi) { padding-left : 0em; text-indent : 0em; } + p.publication { + font-size : 100%%%%; + margin-left : 0em; + margin-top : 0px; + margin-bottom : 0px; + margin-right : 6px; + text-align : left; + } + p.ocn_is { + font-size : 100%%%%; + display : inline-block; + } + p.matched_ocn { + font-size : 90%%%%; + margin-left : 2em; + margin-top : 0px; + margin-bottom : 0px; + margin-right : 6px; + text-align : left; + } p[indent="h0i1"] { padding-left : 1em; text-indent : -1em; @@ -986,12 +1006,113 @@ void cgi_function_intro(Cgi cgi) { padding-left : 9em; text-indent : 0em; } + p.spaced { white-space : pre; } + p.block { + white-space : pre; + } + p.group { } + p.alt { } + p.verse { + white-space : pre; + margin-bottom : 6px; + } + p.caption { + text-align : left; + font-size : 80%%%%; + display : inline; + } + p.endnote { + font-size : 96%%%%; + line-height : 120%%%%; + text-align : left; + margin-right : 15mm; + } + p.endnote_indent { + font-size : 96%%%%; + line-height : 120%%%%; + text-align : left; + margin-left : 2em; + margin-right : 15mm; + } + p.center { + text-align : center; + } + p.bold { + font-weight : bold; + } + p.bold_left { + font-weight : bold; + text-align : left; + } + p.centerbold { + text-align : center; + font-weight : bold; + } + p.em { + font-weight : bold; + font-style : normal; + background : #FFF3B6; + } + p.small { + font-size : 80%%%%; + margin-top : 0px; + margin-bottom : 0px; + margin-right : 6px; + text-align : left; + } + .tiny, .tiny_left, .tiny_right, .tiny_center { + font-size : 10px; + margin-top : 0px; + margin-bottom : 0px; + color : #EEEEEE; + margin-right : 6px; + text-align : left; + } + p.tiny { } + p.tiny_left { + margin-left : 0px; + margin-right : 0px; + text-align : left; + } + p.tiny_right { + margin-right : 1em; + text-align : right; + } + p.tiny_center { + margin-left : 0px; + margin-right : 0px; + text-align : center; + } + p.book_index_lev1 { + line-height : 100%%%%; + margin-top : 4px; + margin-bottom : 1px; + } + p.book_index_lev2 { + line-height : 100%%%%; + text-align : left; + margin-left : 3em; + margin-top : 1px; + margin-bottom : 3px; + } + tt { + font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace; + background-color : #555555; + color : #DDDDDD; + } hr { + display : block; + height : 1px; width : 100%%%%; + border : 0; + border-top : 1px solid #AAAAAA; + border-color : #AAAAAA + background-color : #AAAAAA margin-left : 0%%%%; margin-right : 0em; margin-top : 0.5em; margin-bottom : 0.5em; + padding : 0; } @@ -1348,15 +1469,20 @@ LIMIT %%s OFFSET %%s string _old_uid = ""; if (!select_query_results.empty) { string _date_published = "0000"; - foreach (row; select_query_results) { + string _close_para = ""; + string _matched_ocn_open = ""; + foreach (idx, row; select_query_results) { if (row["uid"].as!string != _old_uid) { + _close_para = (idx == 1) ? "" : "

"; + _matched_ocn_open = (idx == 1) ? "" : "

"; _old_uid = row["uid"].as!string; _date_published = (row["date_published"].as!string.match(regex(r"^([0-9]{4})"))) ? row["date_published"].as!string : "0000"; // used in regex that breaks if no match auto m = _date_published.match(regex(r"^([0-9]{4})")); string _date = (m.hit == "0000") ? "(year?) " : "(" ~ m.hit ~ ") "; cgi.write( - "


\n" + ~ "

" ); } if (cv.results_type == "txt") { if (row["ocn"].as!string != "0") { cgi.write( - "

" ~ row["ocn"].as!string - ~ "" - ~ "
" + ~ ":

" ~ highlight_text_matched(row["body"].as!string, tf.text) ); } else { cgi.write( - "

" ~ row["ocn"].as!string - ~ "" - ~ "
" + ~ ":

" ~ highlight_text_matched(row["body"].as!string, tf.text) ); } } else { if (row["ocn"].as!string != "0") { cgi.write( - ", " ); } + _matched_ocn_open = ""; } } cgi.write( previous_next); -- cgit v1.2.3