diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2018-10-30 11:46:44 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2019-04-10 15:14:15 -0400 |
commit | c37eb0768635a42686ea986343ff95ae03f08c1d (patch) | |
tree | b05d4c4030758aa245f9bb483c7aaa36f5759ada /src/doc_reform/output/sqlite.d | |
parent | 0.2.1 segnames, anchor tags (diff) |
0.3.0 internal links, anchor tags & segment associationsdoc-reform_v0.3.0
Diffstat (limited to 'src/doc_reform/output/sqlite.d')
-rw-r--r-- | src/doc_reform/output/sqlite.d | 245 |
1 files changed, 151 insertions, 94 deletions
diff --git a/src/doc_reform/output/sqlite.d b/src/doc_reform/output/sqlite.d index 0d31e2f..2456509 100644 --- a/src/doc_reform/output/sqlite.d +++ b/src/doc_reform/output/sqlite.d @@ -112,10 +112,13 @@ template SQLiteDbRun() { } catch (Exception ex) { writeln("ERROR SQLite : ", ex); } - if (opt_action.debug_do) { - writeln(note); - if (opt_action.verbose) { - writeln(db_statement); + { /+ debug +/ + if (opt_action.debug_do + && opt_action.verbose) { + writeln(note); + if (opt_action.very_verbose) { + writeln(db_statement); + } } } } @@ -158,8 +161,11 @@ template SQLiteFormatAndLoadObject() { if (_urls.length > 0) { _txt ~= _urls; } - if (doc_matters.opt.action.debug_do) { - writeln(_txt, "\n"); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(_txt, "\n"); + } } debug(sql_text_clean) { writeln(_txt); @@ -206,8 +212,11 @@ template SQLiteFormatAndLoadObject() { if (_notes.length > 0) { _txt ~= _notes; } - if (doc_matters.opt.action.debug_do) { - writeln(_txt, "\n"); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(_txt, "\n"); + } } return _txt; } @@ -285,7 +294,7 @@ template SQLiteFormatAndLoadObject() { if (_xml_type == "seg") { foreach (m; _txt.match(rgx.inline_link_hash)) { if (m.captures[3] in doc_matters.xml.tag_associations) { - if (m.captures[3] == doc_matters.xml.tag_associations[(m.captures[3])][0]) { + if (m.captures[3] == doc_matters.xml.tag_associations[(m.captures[3])]["seg_lv4"]) { _txt = _txt.replaceFirst( rgx.inline_link_hash, "┥$1┝┤" @@ -300,7 +309,7 @@ template SQLiteFormatAndLoadObject() { "┥$1┝┤" ~ doc_matters.conf_make_meta.conf.webserv_url_doc_root ~ "/" - ~ doc_matters.xml.tag_associations[(m.captures[3])][0] + ~ doc_matters.xml.tag_associations[(m.captures[3])]["seg_lv4"] ~ ".html" ~ "#" ~ "$3" ~ "├" @@ -621,15 +630,18 @@ template SQLiteFormatAndLoadObject() { "text": generic_munge_sanitize_text_for_search(obj.text), "html": html_heading(doc_matters, obj) ]; - if (doc_matters.opt.action.debug_do) { - debug(sql_txt) { - writeln(obj_txt["text"]); - } - debug(sql_html) { - writeln(obj_txt["html"]); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + debug(sql_txt) { + writeln(obj_txt["text"]); + } + debug(sql_html) { + writeln(obj_txt["html"]); + } + } else { + // load sql } - } else { - // load sql } return obj_txt; } @@ -641,15 +653,18 @@ template SQLiteFormatAndLoadObject() { "text": generic_munge_sanitize_text_for_search(obj.text), "html": html_para(doc_matters, obj) ]; - if (doc_matters.opt.action.debug_do) { - debug(sql_txt) { - writeln(obj_txt["text"]); - } - debug(sql_html) { - writeln(obj_txt["html"]); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + debug(sql_txt) { + writeln(obj_txt["text"]); + } + debug(sql_html) { + writeln(obj_txt["html"]); + } + } else { + // load sql } - } else { - // load sql } return obj_txt; } @@ -661,15 +676,18 @@ template SQLiteFormatAndLoadObject() { "text": generic_munge_sanitize_text_for_search(obj.text), "html": html_quote(doc_matters, obj) ]; - if (doc_matters.opt.action.debug_do) { - debug(sql_txt) { - writeln(obj_txt["text"]); - } - debug(sql_html) { - writeln(obj_txt["html"]); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + debug(sql_txt) { + writeln(obj_txt["text"]); + } + debug(sql_html) { + writeln(obj_txt["html"]); + } + } else { + // load sql } - } else { - // load sql } return obj_txt; } @@ -681,15 +699,18 @@ template SQLiteFormatAndLoadObject() { "text": generic_munge_sanitize_text_for_search(obj.text), "html": html_group(doc_matters, obj) ]; - if (doc_matters.opt.action.debug_do) { - debug(sql_txt) { - writeln(obj_txt["text"]); - } - debug(sql_html) { - writeln(obj_txt["html"]); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + debug(sql_txt) { + writeln(obj_txt["text"]); + } + debug(sql_html) { + writeln(obj_txt["html"]); + } + } else { + // load sql } - } else { - // load sql } return obj_txt; } @@ -701,15 +722,18 @@ template SQLiteFormatAndLoadObject() { "text": generic_munge_sanitize_text_for_search(obj.text), "html": html_block(doc_matters, obj) ]; - if (doc_matters.opt.action.debug_do) { - debug(sql_txt) { - writeln(obj_txt["text"]); - } - debug(sql_html) { - writeln(obj_txt["html"]); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + debug(sql_txt) { + writeln(obj_txt["text"]); + } + debug(sql_html) { + writeln(obj_txt["html"]); + } + } else { + // load sql } - } else { - // load sql } return obj_txt; } @@ -721,15 +745,18 @@ template SQLiteFormatAndLoadObject() { "text": generic_munge_sanitize_text_for_search(obj.text), "html": html_verse(doc_matters, obj) ]; - if (doc_matters.opt.action.debug_do) { - debug(sql_txt) { - writeln(obj_txt["text"]); - } - debug(sql_html) { - writeln(obj_txt["html"]); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + debug(sql_txt) { + writeln(obj_txt["text"]); + } + debug(sql_html) { + writeln(obj_txt["html"]); + } + } else { + // load sql } - } else { - // load sql } return obj_txt; } @@ -741,15 +768,18 @@ template SQLiteFormatAndLoadObject() { "text": generic_munge_sanitize_text_for_search(obj.text), "html": html_code(obj) ]; - if (doc_matters.opt.action.debug_do) { - debug(sql_txt) { - writeln(obj_txt["text"]); - } - debug(sql_html) { - writeln(obj_txt["html"]); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + debug(sql_txt) { + writeln(obj_txt["text"]); + } + debug(sql_html) { + writeln(obj_txt["html"]); + } + } else { + // load sql } - } else { - // load sql } return obj_txt; } @@ -761,15 +791,18 @@ template SQLiteFormatAndLoadObject() { "text": generic_munge_sanitize_text_for_search(obj.text), "html": html_table(doc_matters, obj) ]; - if (doc_matters.opt.action.debug_do) { - debug(sql_txt) { - writeln(obj_txt["text"]); - } - debug(sql_html) { - writeln(obj_txt["html"]); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + debug(sql_txt) { + writeln(obj_txt["text"]); + } + debug(sql_html) { + writeln(obj_txt["html"]); + } + } else { + // load sql } - } else { - // load sql } return obj_txt; } @@ -1139,15 +1172,21 @@ template SQLiteInsertDocObjectsLoop() { obj_txt = format_and_sqlite_load.heading(doc_matters, obj); break; default: - if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } } break; } break; default: - if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } } break; } @@ -1168,8 +1207,11 @@ template SQLiteInsertDocObjectsLoop() { obj_txt = format_and_sqlite_load.para(doc_matters, obj); break; default: - if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } } break; } @@ -1197,21 +1239,27 @@ template SQLiteInsertDocObjectsLoop() { obj_txt = format_and_sqlite_load.table(doc_matters, obj); break; default: - if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } } break; } break; default: - if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } } break; } break; case "backmatter": - assert(part == "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail", part); + assert(part == "glossary" || "bibliography" || "bookindex" || "blurb" || "tail", part); switch (obj.metainfo.is_of_type) { case "para": switch (obj.metainfo.is_a) { @@ -1224,22 +1272,28 @@ template SQLiteInsertDocObjectsLoop() { case "bibliography": assert(part == "bibliography", part); obj_txt = format_and_sqlite_load.para(doc_matters, obj); break; - case "bookindex": assert(part == "bookindex_seg", part); + case "bookindex": assert(part == "bookindex", part); obj_txt = format_and_sqlite_load.para(doc_matters, obj); break; case "blurb": assert(part == "blurb", part); obj_txt = format_and_sqlite_load.para(doc_matters, obj); break; default: - if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + } } break; } break; default: - if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); + } } break; } @@ -1247,10 +1301,13 @@ template SQLiteInsertDocObjectsLoop() { case "comment": break; default: - if ((doc_matters.opt.action.debug_do)) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); // check where empty value could come from - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); - writeln(__FILE__, ":", __LINE__, ": ", obj.text); // check where empty value could come from + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); // check where empty value could come from + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + writeln(__FILE__, ":", __LINE__, ": ", obj.text); // check where empty value could come from + } } break; } |