diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2020-04-11 20:54:48 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2020-05-20 11:27:26 -0400 |
commit | ae968985ebc6799f4fa08d671fbe52118bf9af0e (patch) | |
tree | b2478a672f99cb1ac4e6ed6040be70e1884bea87 | |
parent | syntax highlighting, start work, based on sisu.rb (diff) |
trust more, else minor
-rw-r--r-- | org/out_sqlite.org | 30 | ||||
-rw-r--r-- | org/out_xmls.org | 10 | ||||
-rw-r--r-- | org/spine.org | 158 | ||||
-rw-r--r-- | src/doc_reform/io_out/sqlite.d | 48 | ||||
-rw-r--r-- | src/doc_reform/io_out/xmls.d | 10 | ||||
-rw-r--r-- | src/doc_reform/meta/metadoc.d | 1 | ||||
-rwxr-xr-x | src/doc_reform/spine.d | 150 |
7 files changed, 214 insertions, 193 deletions
diff --git a/org/out_sqlite.org b/org/out_sqlite.org index b5c2532..77172e2 100644 --- a/org/out_sqlite.org +++ b/org/out_sqlite.org @@ -147,10 +147,6 @@ template SQLiteDbRun() { db_statement ~ "\nCOMMIT;\n" ); - if (!(opt_action.sqlite_discrete) - && !(opt_action.sqlite_db_create) - ) { - } } catch (ErrnoException ex) { writeln("ERROR SQLite : ", ex); } catch (Exception ex) { @@ -363,8 +359,8 @@ template SQLiteDbDrop() { #+NAME: sqlite_db_statement_composite_collection #+BEGIN_SRC d { - string _db_statement; { + string _db_statement; if ((doc_matters.opt.action.sqlite_db_create)) { auto pth_sqlite = spinePathsSQLite!()(doc_matters.sqlite.filename, doc_matters.output_path); pth_sqlite.base.mkdirRecurse; @@ -394,8 +390,8 @@ template SQLiteDbDrop() { #+NAME: sqlite_db_statement_composite_discrete #+BEGIN_SRC d { - string _db_statement; { + string _db_statement; _db_statement ~= SQLiteTablesReCreate!()(); _db_statement ~= SQLiteInsertMetadata!()(doc_matters); _db_statement ~= doc_abstraction.SQLiteInsertDocObjectsLoop!()(doc_matters); @@ -1059,7 +1055,7 @@ string html_table(M,O)( _txt = t[0]; string _note = t[1]; string o = format(q"┃<p class="%s"> - <table summary="normal text css" width="95%%" border="0" bgcolor="white" cellpadding="2" align="center"> + <table summary="normal text css" width="95%%" border="0" cellpadding="2" align="center"> %s </table> %s @@ -1105,7 +1101,7 @@ string sqlite_statement(O)( string _html, ) { void _sql_exe(O)( - string _sql, + string _sql, ) { writeln(_html); writeln(_sql); @@ -1716,16 +1712,16 @@ CREATE TABLE doc_objects ( #+NAME: sqlite_statement_create_index #+BEGIN_SRC sql -CREATE INDEX idx_ocn ON doc_objects(ocn); +CREATE INDEX idx_ocn ON doc_objects(ocn); CREATE INDEX idx_digest_clean ON doc_objects(digest_clean); -CREATE INDEX idx_digest_all ON doc_objects(digest_all); -CREATE INDEX idx_clean ON doc_objects(clean); -CREATE INDEX idx_title ON metadata_and_text(title); -CREATE INDEX idx_author ON metadata_and_text(creator_author_last_first); -CREATE INDEX idx_uid ON metadata_and_text(uid); -CREATE INDEX idx_filename ON metadata_and_text(src_filename_base); -CREATE INDEX idx_language ON metadata_and_text(language_document_char); -CREATE INDEX idx_topics ON metadata_and_text(classify_topic_register); +CREATE INDEX idx_digest_all ON doc_objects(digest_all); +CREATE INDEX idx_clean ON doc_objects(clean); +CREATE INDEX idx_title ON metadata_and_text(title); +CREATE INDEX idx_author ON metadata_and_text(creator_author_last_first); +CREATE INDEX idx_uid ON metadata_and_text(uid); +CREATE INDEX idx_filename ON metadata_and_text(src_filename_base); +CREATE INDEX idx_language ON metadata_and_text(language_document_char); +CREATE INDEX idx_topics ON metadata_and_text(classify_topic_register); #+END_SRC *** TODO local site link & info diff --git a/org/out_xmls.org b/org/out_xmls.org index acd2b79..0211cd5 100644 --- a/org/out_xmls.org +++ b/org/out_xmls.org @@ -1154,7 +1154,9 @@ import </p> </div>┃", obj.metainfo.identifier, - (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier), + (doc_matters.opt.action.ocn_off) ? "" + : ((obj.metainfo.object_number.empty) ? "" + : obj.metainfo.identifier), obj.metainfo.is_a, obj.metainfo.identifier, _txt @@ -1235,7 +1237,9 @@ import <p class="%s" id="%s">%s</p> </div>┃", obj.metainfo.identifier, - (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier), + (doc_matters.opt.action.ocn_off) ? "" + : ((obj.metainfo.object_number.empty) ? "" + : obj.metainfo.identifier), obj.metainfo.is_a, obj.metainfo.identifier, _txt.stripRight @@ -1504,7 +1508,7 @@ align="left|right|center" o = format(q"┃ <div class="substance"> <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> <p class="%s" id="%s">%s - <table summary="normal text css" width="95%%" border="0" bgcolor="white" cellpadding="2" align="center"> + <table summary="normal text css" width="95%%" border="0" cellpadding="2" align="center"> %s </table> %s diff --git a/org/spine.org b/org/spine.org index 8341b67..f6dd0b2 100644 --- a/org/spine.org +++ b/org/spine.org @@ -115,7 +115,9 @@ string program_name = "spine"; } } else { // note cannot parallelise sqlite shared db foreach(manifest; _manifests[1..$]) { - writeln("parallelisation off: actions include sqlite shared db"); + if (_opt_action.very_verbose) { + writeln("parallelisation off: actions include sqlite shared db"); + } if (!empty(manifest.src.filename)) { <<spine_each_file_do_scope>> <<spine_each_file_do_abstraction>> @@ -347,77 +349,84 @@ scope(failure) { *** getopt args for loop :args:getopt: **** set getopt options - set getopt options +***** initialize #+NAME: spine_args #+BEGIN_SRC d bool[string] opts = [ - "abstraction" : false, - "assertions" : false, - "cgi-search-form-codegen" : false, - "concordance" : false, - "dark" : false, - "debug" : false, - "digest" : false, - "epub" : false, - "harvest" : false, - "harvest-authors" : false, - "harvest-topics" : false, - "html" : false, - "html-link-harvest" : false, - "html-link-search" : false, - "html-seg" : false, - "html-scroll" : false, - "latex" : false, - "latex-color-links" : false, - "light" : false, - "manifest" : false, - "hide-ocn" : false, - "ocn-off" : false, - "odf" : false, - "odt" : false, - "parallel" : false, - "parallel-subprocesses" : false, - "pdf" : false, - "pdf-color-links" : false, - "quiet" : false, - "pod" : false, - "serial" : false, - "show-summary" : false, - "show-metadata" : false, - "show-make" : false, - "show-config" : false, - "source" : false, - "sqlite-discrete" : false, - "sqlite-db-create" : false, - "sqlite-db-drop" : false, - "sqlite-db-recreate" : false, - "sqlite-delete" : false, - "sqlite-insert" : false, - "sqlite-update" : false, - "text" : false, - "verbose" : false, - "very-verbose" : false, - "xhtml" : false, - "section_toc" : true, - "section_body" : true, - "section_endnotes" : true, - "section_glossary" : true, - "section_biblio" : true, - "section_bookindex" : true, - "section_blurb" : true, - "backmatter" : true, - "skip-output" : false, - "theme-dark" : false, - "theme-light" : false, - "workon" : false, + "abstraction" : false, + "assertions" : false, + "cgi-search-form-codegen" : false, + "concordance" : false, + "dark" : false, + "debug" : false, + "digest" : false, + "epub" : false, + "harvest" : false, + "harvest-authors" : false, + "harvest-topics" : false, + "html" : false, + "html-link-harvest" : false, + "html-link-search" : false, + "html-seg" : false, + "html-scroll" : false, + "latex" : false, + "latex-color-links" : false, + "light" : false, + "manifest" : false, + "hide-ocn" : false, + "ocn-off" : false, + "odf" : false, + "odt" : false, + "parallel" : false, + "parallel-subprocesses" : false, + "pdf" : false, + "pdf-color-links" : false, + "quiet" : false, + "pod" : false, + "serial" : false, + "show-summary" : false, + "show-metadata" : false, + "show-make" : false, + "show-config" : false, + "source" : false, + "sqlite-discrete" : false, + "sqlite-db-create" : false, + "sqlite-db-drop" : false, + "sqlite-db-recreate" : false, + "sqlite-delete" : false, + "sqlite-insert" : false, + "sqlite-update" : false, + "text" : false, + "verbose" : false, + "very-verbose" : false, + "xhtml" : false, + "section_toc" : true, + "section_body" : true, + "section_endnotes" : true, + "section_glossary" : true, + "section_biblio" : true, + "section_bookindex" : true, + "section_blurb" : true, + "backmatter" : true, + "skip-output" : false, + "theme-dark" : false, + "theme-light" : false, + "workon" : false, ]; string[string] settings = [ "cgi-sqlite-search-filename" : "", // "spine-search" - "config" : "", - "output" : "", - "lang" : "all", - "sqlite-db-filename" : "", // "spine-search.db" + "config" : "", + "output" : "", + "lang" : "all", + "sqlite-db-filename" : "", // "spine-search.db" ]; +#+END_SRC + +***** set & describe + +#+NAME: spine_args +#+BEGIN_SRC d auto helpInfo = getopt(args, std.getopt.config.passThrough, "abstraction", "document abstraction ", &opts["abstraction"], @@ -507,7 +516,7 @@ struct OptActions { @trusted bool concordance() { return opts["concordance"]; } - auto config_path_set() { + @trusted string config_path_set() { return settings["config"]; } @trusted bool css_theme_default() { @@ -665,23 +674,29 @@ struct OptActions { @trusted bool workon() { return opts["workon"]; } - auto languages_set() { + @trusted string[] languages_set() { return settings["lang"].split(","); } - auto output_dir_set() { + @trusted string output_dir_set() { return settings["output"]; } - auto sqlite_filename() { + @trusted string sqlite_filename() { return settings["sqlite-db-filename"]; } - auto cgi_sqlite_search_filename() { + @trusted string cgi_sqlite_search_filename() { return settings["cgi-sqlite-search-filename"]; } - auto cgi_sqlite_search_filename_d() { + @trusted string cgi_sqlite_search_filename_d() { return (settings["cgi-sqlite-search-filename"].length > 0) ? (settings["cgi-sqlite-search-filename"].translate(['-' : "_"]) ~ ".d") : ""; } + @trusted string latex_papersize() { + return settings["set-papersize"]; + } + @trusted string webserver_domain_name() { + return settings["webserv-domain"]; + } @trusted bool parallelise() { bool _is; if (opts["parallel"] == true) { @@ -797,7 +812,7 @@ struct OptActions { ) ? true : false; } } -auto _opt_action = OptActions(); +OptActions _opt_action = OptActions(); #+END_SRC **** env @@ -1270,7 +1285,6 @@ template spineAbstraction() { <<spine_each_file_do_document_abstraction>> <<spine_each_file_do_document_matters>> auto t = tuple(doc_abstraction, doc_matters); - static assert(t.length==2); return t; } } diff --git a/src/doc_reform/io_out/sqlite.d b/src/doc_reform/io_out/sqlite.d index 99a6b5d..1b010d2 100644 --- a/src/doc_reform/io_out/sqlite.d +++ b/src/doc_reform/io_out/sqlite.d @@ -26,8 +26,8 @@ template SQLiteHubBuildTablesAndPopulate() { M doc_matters, ) { { - string _db_statement; { + string _db_statement; if ((doc_matters.opt.action.sqlite_db_create)) { auto pth_sqlite = spinePathsSQLite!()(doc_matters.sqlite.filename, doc_matters.output_path); pth_sqlite.base.mkdirRecurse; @@ -74,8 +74,8 @@ template SQLiteHubDiscreteBuildTablesAndPopulate() { M doc_matters, ) { { - string _db_statement; { + string _db_statement; _db_statement ~= SQLiteTablesReCreate!()(); _db_statement ~= SQLiteInsertMetadata!()(doc_matters); _db_statement ~= doc_abstraction.SQLiteInsertDocObjectsLoop!()(doc_matters); @@ -107,10 +107,6 @@ template SQLiteDbRun() { db_statement ~ "\nCOMMIT;\n" ); - if (!(opt_action.sqlite_discrete) - && !(opt_action.sqlite_db_create) - ) { - } } catch (ErrnoException ex) { writeln("ERROR SQLite : ", ex); } catch (Exception ex) { @@ -630,7 +626,7 @@ template SQLiteFormatAndLoadObject() { _txt = t[0]; string _note = t[1]; string o = format(q"┃<p class="%s"> - <table summary="normal text css" width="95%%" border="0" bgcolor="white" cellpadding="2" align="center"> + <table summary="normal text css" width="95%%" border="0" cellpadding="2" align="center"> %s </table> %s @@ -661,7 +657,7 @@ template SQLiteFormatAndLoadObject() { string _html, ) { void _sql_exe(O)( - string _sql, + string _sql, ) { writeln(_html); writeln(_sql); @@ -998,16 +994,16 @@ template SQLiteTablesReCreate() { seg_name CHAR(256), types CHAR(1) NULL ); - CREATE INDEX idx_ocn ON doc_objects(ocn); + CREATE INDEX idx_ocn ON doc_objects(ocn); CREATE INDEX idx_digest_clean ON doc_objects(digest_clean); - CREATE INDEX idx_digest_all ON doc_objects(digest_all); - CREATE INDEX idx_clean ON doc_objects(clean); - CREATE INDEX idx_title ON metadata_and_text(title); - CREATE INDEX idx_author ON metadata_and_text(creator_author_last_first); - CREATE INDEX idx_uid ON metadata_and_text(uid); - CREATE INDEX idx_filename ON metadata_and_text(src_filename_base); - CREATE INDEX idx_language ON metadata_and_text(language_document_char); - CREATE INDEX idx_topics ON metadata_and_text(classify_topic_register); + CREATE INDEX idx_digest_all ON doc_objects(digest_all); + CREATE INDEX idx_clean ON doc_objects(clean); + CREATE INDEX idx_title ON metadata_and_text(title); + CREATE INDEX idx_author ON metadata_and_text(creator_author_last_first); + CREATE INDEX idx_uid ON metadata_and_text(uid); + CREATE INDEX idx_filename ON metadata_and_text(src_filename_base); + CREATE INDEX idx_language ON metadata_and_text(language_document_char); + CREATE INDEX idx_topics ON metadata_and_text(classify_topic_register); ┃",); return _sql_instruct; } @@ -1528,16 +1524,16 @@ template SQLiteTablesCreate() { seg_name CHAR(256), types CHAR(1) NULL ); - CREATE INDEX idx_ocn ON doc_objects(ocn); + CREATE INDEX idx_ocn ON doc_objects(ocn); CREATE INDEX idx_digest_clean ON doc_objects(digest_clean); - CREATE INDEX idx_digest_all ON doc_objects(digest_all); - CREATE INDEX idx_clean ON doc_objects(clean); - CREATE INDEX idx_title ON metadata_and_text(title); - CREATE INDEX idx_author ON metadata_and_text(creator_author_last_first); - CREATE INDEX idx_uid ON metadata_and_text(uid); - CREATE INDEX idx_filename ON metadata_and_text(src_filename_base); - CREATE INDEX idx_language ON metadata_and_text(language_document_char); - CREATE INDEX idx_topics ON metadata_and_text(classify_topic_register); + CREATE INDEX idx_digest_all ON doc_objects(digest_all); + CREATE INDEX idx_clean ON doc_objects(clean); + CREATE INDEX idx_title ON metadata_and_text(title); + CREATE INDEX idx_author ON metadata_and_text(creator_author_last_first); + CREATE INDEX idx_uid ON metadata_and_text(uid); + CREATE INDEX idx_filename ON metadata_and_text(src_filename_base); + CREATE INDEX idx_language ON metadata_and_text(language_document_char); + CREATE INDEX idx_topics ON metadata_and_text(classify_topic_register); ┃",); return _sql_instruct; } diff --git a/src/doc_reform/io_out/xmls.d b/src/doc_reform/io_out/xmls.d index c13d31f..ffcdcb6 100644 --- a/src/doc_reform/io_out/xmls.d +++ b/src/doc_reform/io_out/xmls.d @@ -916,7 +916,9 @@ template outputXHTMLs() { </p> </div>┃", obj.metainfo.identifier, - (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier), + (doc_matters.opt.action.ocn_off) ? "" + : ((obj.metainfo.object_number.empty) ? "" + : obj.metainfo.identifier), obj.metainfo.is_a, obj.metainfo.identifier, _txt @@ -978,7 +980,9 @@ template outputXHTMLs() { <p class="%s" id="%s">%s</p> </div>┃", obj.metainfo.identifier, - (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier), + (doc_matters.opt.action.ocn_off) ? "" + : ((obj.metainfo.object_number.empty) ? "" + : obj.metainfo.identifier), obj.metainfo.is_a, obj.metainfo.identifier, _txt.stripRight @@ -1132,7 +1136,7 @@ template outputXHTMLs() { o = format(q"┃ <div class="substance"> <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> <p class="%s" id="%s">%s - <table summary="normal text css" width="95%%" border="0" bgcolor="white" cellpadding="2" align="center"> + <table summary="normal text css" width="95%%" border="0" cellpadding="2" align="center"> %s </table> %s diff --git a/src/doc_reform/meta/metadoc.d b/src/doc_reform/meta/metadoc.d index 5c45c96..8432073 100644 --- a/src/doc_reform/meta/metadoc.d +++ b/src/doc_reform/meta/metadoc.d @@ -235,7 +235,6 @@ template spineAbstraction() { writeln("- step4 complete"); } auto t = tuple(doc_abstraction, doc_matters); - static assert(t.length==2); return t; } } diff --git a/src/doc_reform/spine.d b/src/doc_reform/spine.d index d6a2f07..53a4a5a 100755 --- a/src/doc_reform/spine.d +++ b/src/doc_reform/spine.d @@ -112,72 +112,72 @@ string program_name = "spine"; } } bool[string] opts = [ - "abstraction" : false, - "assertions" : false, - "cgi-search-form-codegen" : false, - "concordance" : false, - "dark" : false, - "debug" : false, - "digest" : false, - "epub" : false, - "harvest" : false, - "harvest-authors" : false, - "harvest-topics" : false, - "html" : false, - "html-link-harvest" : false, - "html-link-search" : false, - "html-seg" : false, - "html-scroll" : false, - "latex" : false, - "latex-color-links" : false, - "light" : false, - "manifest" : false, - "hide-ocn" : false, - "ocn-off" : false, - "odf" : false, - "odt" : false, - "parallel" : false, - "parallel-subprocesses" : false, - "pdf" : false, - "pdf-color-links" : false, - "quiet" : false, - "pod" : false, - "serial" : false, - "show-summary" : false, - "show-metadata" : false, - "show-make" : false, - "show-config" : false, - "source" : false, - "sqlite-discrete" : false, - "sqlite-db-create" : false, - "sqlite-db-drop" : false, - "sqlite-db-recreate" : false, - "sqlite-delete" : false, - "sqlite-insert" : false, - "sqlite-update" : false, - "text" : false, - "verbose" : false, - "very-verbose" : false, - "xhtml" : false, - "section_toc" : true, - "section_body" : true, - "section_endnotes" : true, - "section_glossary" : true, - "section_biblio" : true, - "section_bookindex" : true, - "section_blurb" : true, - "backmatter" : true, - "skip-output" : false, - "theme-dark" : false, - "theme-light" : false, - "workon" : false, + "abstraction" : false, + "assertions" : false, + "cgi-search-form-codegen" : false, + "concordance" : false, + "dark" : false, + "debug" : false, + "digest" : false, + "epub" : false, + "harvest" : false, + "harvest-authors" : false, + "harvest-topics" : false, + "html" : false, + "html-link-harvest" : false, + "html-link-search" : false, + "html-seg" : false, + "html-scroll" : false, + "latex" : false, + "latex-color-links" : false, + "light" : false, + "manifest" : false, + "hide-ocn" : false, + "ocn-off" : false, + "odf" : false, + "odt" : false, + "parallel" : false, + "parallel-subprocesses" : false, + "pdf" : false, + "pdf-color-links" : false, + "quiet" : false, + "pod" : false, + "serial" : false, + "show-summary" : false, + "show-metadata" : false, + "show-make" : false, + "show-config" : false, + "source" : false, + "sqlite-discrete" : false, + "sqlite-db-create" : false, + "sqlite-db-drop" : false, + "sqlite-db-recreate" : false, + "sqlite-delete" : false, + "sqlite-insert" : false, + "sqlite-update" : false, + "text" : false, + "verbose" : false, + "very-verbose" : false, + "xhtml" : false, + "section_toc" : true, + "section_body" : true, + "section_endnotes" : true, + "section_glossary" : true, + "section_biblio" : true, + "section_bookindex" : true, + "section_blurb" : true, + "backmatter" : true, + "skip-output" : false, + "theme-dark" : false, + "theme-light" : false, + "workon" : false, ]; string[string] settings = [ "cgi-sqlite-search-filename" : "", // "spine-search" - "config" : "", - "output" : "", - "lang" : "all", - "sqlite-db-filename" : "", // "spine-search.db" + "config" : "", + "output" : "", + "lang" : "all", + "sqlite-db-filename" : "", // "spine-search.db" ]; auto helpInfo = getopt(args, std.getopt.config.passThrough, @@ -261,7 +261,7 @@ string program_name = "spine"; @trusted bool concordance() { return opts["concordance"]; } - auto config_path_set() { + @trusted string config_path_set() { return settings["config"]; } @trusted bool css_theme_default() { @@ -419,23 +419,29 @@ string program_name = "spine"; @trusted bool workon() { return opts["workon"]; } - auto languages_set() { + @trusted string[] languages_set() { return settings["lang"].split(","); } - auto output_dir_set() { + @trusted string output_dir_set() { return settings["output"]; } - auto sqlite_filename() { + @trusted string sqlite_filename() { return settings["sqlite-db-filename"]; } - auto cgi_sqlite_search_filename() { + @trusted string cgi_sqlite_search_filename() { return settings["cgi-sqlite-search-filename"]; } - auto cgi_sqlite_search_filename_d() { + @trusted string cgi_sqlite_search_filename_d() { return (settings["cgi-sqlite-search-filename"].length > 0) ? (settings["cgi-sqlite-search-filename"].translate(['-' : "_"]) ~ ".d") : ""; } + @trusted string latex_papersize() { + return settings["set-papersize"]; + } + @trusted string webserver_domain_name() { + return settings["webserv-domain"]; + } @trusted bool parallelise() { bool _is; if (opts["parallel"] == true) { @@ -551,7 +557,7 @@ string program_name = "spine"; ) ? true : false; } } - auto _opt_action = OptActions(); + OptActions _opt_action = OptActions(); @safe auto program_info() { struct ProgramInfo { @safe string project() { @@ -891,7 +897,9 @@ string program_name = "spine"; } } else { // note cannot parallelise sqlite shared db foreach(manifest; _manifests[1..$]) { - writeln("parallelisation off: actions include sqlite shared db"); + if (_opt_action.very_verbose) { + writeln("parallelisation off: actions include sqlite shared db"); + } if (!empty(manifest.src.filename)) { scope(success) { if (!(_opt_action.quiet)) { |