From c37eb0768635a42686ea986343ff95ae03f08c1d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 30 Oct 2018 11:46:44 -0400 Subject: 0.3.0 internal links, anchor tags & segment associations --- org/output_sqlite.org | 245 +++++++++++++++++++++++++++++++------------------- 1 file changed, 151 insertions(+), 94 deletions(-) (limited to 'org/output_sqlite.org') diff --git a/org/output_sqlite.org b/org/output_sqlite.org index ae1eb6d..c1f5ecb 100644 --- a/org/output_sqlite.org +++ b/org/output_sqlite.org @@ -111,10 +111,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); + } } } } @@ -362,8 +365,11 @@ auto generic_munge_sanitize_text_for_search( 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); @@ -423,8 +429,11 @@ auto munge_html(M,O)( 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; } @@ -534,7 +543,7 @@ auto inline_links(M,O)( 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┝┤" @@ -549,7 +558,7 @@ auto inline_links(M,O)( "┥$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" ~ "├" @@ -981,15 +990,18 @@ auto heading(M,O)( "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; } @@ -1007,15 +1019,18 @@ auto para(M,O)( "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; } @@ -1033,15 +1048,18 @@ auto quote(M,O)( "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; } @@ -1058,15 +1076,18 @@ auto group(M,O)( "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; } @@ -1084,15 +1105,18 @@ auto block(M,O)( "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; } @@ -1110,15 +1134,18 @@ auto verse(M,O)( "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; } @@ -1136,15 +1163,18 @@ auto code(M,O)( "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; } @@ -1162,15 +1192,18 @@ auto table(M,O)( "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; } @@ -1195,15 +1228,21 @@ foreach (part; doc_matters.xml.keys_seq.sql) { 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; } @@ -1224,8 +1263,11 @@ foreach (part; doc_matters.xml.keys_seq.sql) { 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; } @@ -1253,21 +1295,27 @@ foreach (part; doc_matters.xml.keys_seq.sql) { 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) { @@ -1280,22 +1328,28 @@ foreach (part; doc_matters.xml.keys_seq.sql) { 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; } @@ -1303,10 +1357,13 @@ foreach (part; doc_matters.xml.keys_seq.sql) { 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; } -- cgit v1.2.3