diff options
-rw-r--r-- | org/out_cgi_search_sqlite.org | 185 | ||||
-rw-r--r-- | 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 <!DOCTYPE html> <html> <head> @@ -827,6 +835,12 @@ string show_matched_objects (string fn) { <link rel="generator" href="sisudoc.org"> <link rel="shortcut icon" href="http://%%s/image_sys/spine.ico"> <style media = "all"> +#+END_SRC + +**** css + +#+NAME: cgi_sqlite_header +#+BEGIN_SRC css *{ padding : 0px; margin : 2px; @@ -895,6 +909,26 @@ string show_matched_objects (string fn) { 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; @@ -1291,12 +1325,113 @@ string show_matched_objects (string fn) { 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; } </style> </head> @@ -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"┃ <table summary="band" border="0" cellpadding="2" cellspacing="0"> @@ -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"┃ <form action="%%s" id="SubmitForm" method="post" accept-charset="UTF-8"> <table cellpadding="2"> @@ -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) ? "" : "</p>"; + _matched_ocn_open = (idx == 1) ? "" : "<p class=\"matched_ocn\">"; _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( - "<hr><a href=\"" + _close_para + ~ "<hr><p class=\"publication\"><a href=\"" ~ "http://" ~ conf.http_host ~ conf.doc_collection_sub_root ~ "/" ~ row["language_document_char"].as!string ~ "/html/" ~ row["src_filename_base"].as!string ~ "/" @@ -1750,52 +1889,51 @@ LIMIT %%s OFFSET %%s ~ row["creator_author_last_first"].as!string ~ " " ~ show_matched_objects(row["src_filename_base"].as!string) - ~ "<br> \n" + ~ "</p>" ); } #+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( - "<hr><a href=\"" + "<hr style=\"width:5%%; align:left\"><p class=\"ocn_is\"><a href=\"" ~ "http://" ~ conf.http_host ~ conf.doc_collection_sub_root ~ "/" ~ 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>" + ~ "</a>:</p>" ~ highlight_text_matched(row["body"].as!string, tf.text) ); } else { cgi.write( - "<hr><a href=\"" + "<hr style=\"width:5%%; align:left\"><p class=\"ocn_is\"><a href=\"" ~ "http://" ~ conf.http_host ~ conf.doc_collection_sub_root ~ "/" ~ row["language_document_char"].as!string ~ "/html/" ~ row["src_filename_base"].as!string ~ "/toc.html" ~ "\">" ~ row["ocn"].as!string - ~ "</a>" - ~ "<br>" + ~ "</a>:</p>" ~ 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( - "<a href=\"" + _matched_ocn_open + ~ "<a href=\"" ~ "http://" ~ conf.http_host ~ conf.doc_collection_sub_root ~ "/" ~ row["language_document_char"].as!string ~ "/html/" ~ row["src_filename_base"].as!string ~ "/" @@ -1806,7 +1944,8 @@ LIMIT %%s OFFSET %%s ); } else { cgi.write( - "<a href=\"" + _matched_ocn_open + ~ "<a href=\"" ~ "http://" ~ conf.http_host ~ conf.doc_collection_sub_root ~ "/" ~ row["language_document_char"].as!string ~ "/html/" ~ row["src_filename_base"].as!string ~ "/toc.html" @@ -1815,10 +1954,11 @@ LIMIT %%s OFFSET %%s ~ "</a>, " ); } + _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; } </style> </head> @@ -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) ? "" : "</p>"; + _matched_ocn_open = (idx == 1) ? "" : "<p class=\"matched_ocn\">"; _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( - "<hr><a href=\"" + _close_para + ~ "<hr><p class=\"publication\"><a href=\"" ~ "http://" ~ conf.http_host ~ conf.doc_collection_sub_root ~ "/" ~ row["language_document_char"].as!string ~ "/html/" ~ row["src_filename_base"].as!string ~ "/" @@ -1369,40 +1495,39 @@ LIMIT %%s OFFSET %%s ~ row["creator_author_last_first"].as!string ~ " " ~ show_matched_objects(row["src_filename_base"].as!string) - ~ "<br> \n" + ~ "</p>" ); } if (cv.results_type == "txt") { if (row["ocn"].as!string != "0") { cgi.write( - "<hr><a href=\"" + "<hr style=\"width:5%%; align:left\"><p class=\"ocn_is\"><a href=\"" ~ "http://" ~ conf.http_host ~ conf.doc_collection_sub_root ~ "/" ~ 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>" + ~ "</a>:</p>" ~ highlight_text_matched(row["body"].as!string, tf.text) ); } else { cgi.write( - "<hr><a href=\"" + "<hr style=\"width:5%%; align:left\"><p class=\"ocn_is\"><a href=\"" ~ "http://" ~ conf.http_host ~ conf.doc_collection_sub_root ~ "/" ~ row["language_document_char"].as!string ~ "/html/" ~ row["src_filename_base"].as!string ~ "/toc.html" ~ "\">" ~ row["ocn"].as!string - ~ "</a>" - ~ "<br>" + ~ "</a>:</p>" ~ highlight_text_matched(row["body"].as!string, tf.text) ); } } else { if (row["ocn"].as!string != "0") { cgi.write( - "<a href=\"" + _matched_ocn_open + ~ "<a href=\"" ~ "http://" ~ conf.http_host ~ conf.doc_collection_sub_root ~ "/" ~ row["language_document_char"].as!string ~ "/html/" ~ row["src_filename_base"].as!string ~ "/" @@ -1413,7 +1538,8 @@ LIMIT %%s OFFSET %%s ); } else { cgi.write( - "<a href=\"" + _matched_ocn_open + ~ "<a href=\"" ~ "http://" ~ conf.http_host ~ conf.doc_collection_sub_root ~ "/" ~ row["language_document_char"].as!string ~ "/html/" ~ row["src_filename_base"].as!string ~ "/toc.html" @@ -1422,6 +1548,7 @@ LIMIT %%s OFFSET %%s ~ "</a>, " ); } + _matched_ocn_open = ""; } } cgi.write( previous_next); |