From 614e44ad155e693f82a8228897bba2f4869167dd Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 22 Feb 2022 14:23:35 -0500 Subject: rethink verbose & debug flags, introduce show --- src/doc_reform/io_out/epub3.d | 30 ++++++------------ src/doc_reform/io_out/html.d | 54 +++++++++++---------------------- src/doc_reform/io_out/source_pod.d | 3 +- src/doc_reform/io_out/sqlite.d | 62 ++++++++++++++------------------------ 4 files changed, 53 insertions(+), 96 deletions(-) (limited to 'src/doc_reform/io_out') diff --git a/src/doc_reform/io_out/epub3.d b/src/doc_reform/io_out/epub3.d index 39fcafe..eb5e46a 100644 --- a/src/doc_reform/io_out/epub3.d +++ b/src/doc_reform/io_out/epub3.d @@ -365,8 +365,7 @@ template outputEPub3() { break; case 8: .. case 9: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); writeln(__FILE__, ":", __LINE__, ": ", obj.text); } @@ -374,8 +373,7 @@ template outputEPub3() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); } } @@ -396,8 +394,7 @@ template outputEPub3() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -406,8 +403,7 @@ template outputEPub3() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -425,8 +421,7 @@ template outputEPub3() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -466,8 +461,7 @@ template outputEPub3() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -476,8 +470,7 @@ template outputEPub3() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -520,8 +513,7 @@ template outputEPub3() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -530,8 +522,7 @@ template outputEPub3() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -542,8 +533,7 @@ template outputEPub3() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); } } diff --git a/src/doc_reform/io_out/html.d b/src/doc_reform/io_out/html.d index 0227de0..2e6d0ad 100644 --- a/src/doc_reform/io_out/html.d +++ b/src/doc_reform/io_out/html.d @@ -90,8 +90,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -100,8 +99,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -120,8 +118,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -152,8 +149,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -162,8 +158,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -198,8 +193,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -208,8 +202,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -220,8 +213,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); writeln(__FILE__, ":", __LINE__, ": ", obj.text); @@ -331,8 +323,7 @@ template outputHTML() { break; case 8: .. case 9: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); writeln(__FILE__, ":", __LINE__, ": ", obj.text); } @@ -340,8 +331,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); } } @@ -361,8 +351,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -371,8 +360,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -390,8 +378,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -430,8 +417,7 @@ template outputHTML() { doc_html[segment_filename] ~= t[0].to!string; doc_html_endnotes[segment_filename] ~= t[1]; } else { /+ debug +/ - if (doc_matters.opt.action.debug_do_html - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -440,8 +426,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -484,8 +469,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -494,8 +478,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -506,8 +489,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); } } diff --git a/src/doc_reform/io_out/source_pod.d b/src/doc_reform/io_out/source_pod.d index 3b21000..4b59116 100644 --- a/src/doc_reform/io_out/source_pod.d +++ b/src/doc_reform/io_out/source_pod.d @@ -127,7 +127,8 @@ template spinePod() { pths_pod.doc_lng(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod.mkdirRecurse; } } - debug(pod) { + if (doc_matters.opt.action.debug_do_pod + && doc_matters.opt.action.verbose) { writeln(__LINE__, ": ", doc_matters.src.filename, " -> ", pths_pod.fn_doc(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod diff --git a/src/doc_reform/io_out/sqlite.d b/src/doc_reform/io_out/sqlite.d index 3acd39e..7e4d605 100644 --- a/src/doc_reform/io_out/sqlite.d +++ b/src/doc_reform/io_out/sqlite.d @@ -172,8 +172,7 @@ template SQLiteDbRun() { writeln("ERROR SQLite : ", ex); } { /+ debug +/ - if (opt_action.debug_do_sqlite - && opt_action.verbose) { + if (opt_action.debug_do_sqlite) { writeln(note); if (opt_action.very_verbose) { writeln(db_statement); @@ -221,8 +220,7 @@ template SQLiteFormatAndLoadObject() { _txt ~= _urls; } { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_sqlite) { writeln(_txt, "\n"); } } @@ -265,8 +263,7 @@ template SQLiteFormatAndLoadObject() { string _urls; string _txt = _html_font_face(_html_special_characters(obj.text)); { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_sqlite) { writeln(_txt, "\n"); } } @@ -755,8 +752,7 @@ template SQLiteFormatAndLoadObject() { "html": html_heading(doc_matters, obj) ]; { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_sqlite) { debug(sql_txt) { writeln(obj_txt["text"]); } @@ -778,8 +774,7 @@ template SQLiteFormatAndLoadObject() { "html": html_para(doc_matters, obj) ]; { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_sqlite) { debug(sql_txt) { writeln(obj_txt["text"]); } @@ -801,8 +796,7 @@ template SQLiteFormatAndLoadObject() { "html": html_quote(doc_matters, obj) ]; { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_sqlite) { debug(sql_txt) { writeln(obj_txt["text"]); } @@ -824,8 +818,7 @@ template SQLiteFormatAndLoadObject() { "html": html_group(doc_matters, obj) ]; { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_sqlite) { debug(sql_txt) { writeln(obj_txt["text"]); } @@ -847,8 +840,7 @@ template SQLiteFormatAndLoadObject() { "html": html_block(doc_matters, obj) ]; { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_sqlite) { debug(sql_txt) { writeln(obj_txt["text"]); } @@ -870,8 +862,7 @@ template SQLiteFormatAndLoadObject() { "html": html_verse(doc_matters, obj) ]; { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_sqlite) { debug(sql_txt) { writeln(obj_txt["text"]); } @@ -893,8 +884,7 @@ template SQLiteFormatAndLoadObject() { "html": html_code(obj) ]; { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_sqlite) { debug(sql_txt) { writeln(obj_txt["text"]); } @@ -916,8 +906,7 @@ template SQLiteFormatAndLoadObject() { "html": html_table(doc_matters, obj) ]; { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_sqlite) { debug(sql_txt) { writeln(obj_txt["text"]); } @@ -1297,8 +1286,7 @@ template SQLiteInsertDocObjectsLoop() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_sqlite) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -1307,8 +1295,7 @@ template SQLiteInsertDocObjectsLoop() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_sqlite) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -1332,8 +1319,7 @@ template SQLiteInsertDocObjectsLoop() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_sqlite) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -1364,8 +1350,7 @@ template SQLiteInsertDocObjectsLoop() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_sqlite) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -1374,8 +1359,7 @@ template SQLiteInsertDocObjectsLoop() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_sqlite) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -1404,8 +1388,7 @@ template SQLiteInsertDocObjectsLoop() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_sqlite) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -1414,8 +1397,7 @@ template SQLiteInsertDocObjectsLoop() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_sqlite) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -1426,8 +1408,7 @@ template SQLiteInsertDocObjectsLoop() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_sqlite - && doc_matters.opt.action.verbose) { + if (doc_matters.opt.action.debug_do_sqlite) { 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 @@ -1436,7 +1417,10 @@ template SQLiteInsertDocObjectsLoop() { break; } if (obj.metainfo.is_a == "heading") { - if ((doc_matters.opt.action.very_verbose)) { + if (doc_matters.opt.action.show_sqlite) { + if (obj.metainfo.heading_lev_markup == 0) { + writeln(doc_matters.src.filename); + } writeln( "markup: ", obj.metainfo.heading_lev_markup, "> ", obj.metainfo.dom_structure_markedup_tags_status, -- cgit v1.2.3