From 8757dfd0fd175698b2bdf61ae49875080b8e1612 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 21 Feb 2022 12:48:35 -0500 Subject: debug flags, narrow purpose --- org/out_latex.org | 10 ++--- org/out_sqlite.org | 38 +++++++++---------- org/out_src_pod.org | 12 +++--- org/out_xmls.org | 76 +++++++++++++++++++------------------- org/spine.org | 51 ++++++++++++++++++++++++- src/doc_reform/io_out/epub3.d | 38 +++++++++---------- src/doc_reform/io_out/html.d | 36 +++++++++--------- src/doc_reform/io_out/latex.d | 10 ++--- src/doc_reform/io_out/source_pod.d | 12 +++--- src/doc_reform/io_out/sqlite.d | 38 +++++++++---------- src/doc_reform/io_out/xmls.d | 2 +- src/doc_reform/spine.d | 51 ++++++++++++++++++++++++- 12 files changed, 236 insertions(+), 138 deletions(-) diff --git a/org/out_latex.org b/org/out_latex.org index ab4ccd2..fcd5061 100644 --- a/org/out_latex.org +++ b/org/out_latex.org @@ -132,7 +132,7 @@ void writeOutputLaTeX(T,M)( auto pth_latex = spinePathsLaTeX(doc_matters); try { { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_latex && doc_matters.opt.action.verbose) { writeln(latex_content.head); writeln(latex_content.content); @@ -1695,9 +1695,9 @@ string _latex_head = format(q"┃%%%% spine LaTeX output #+NAME: output_latex_head_a_format_string_variables #+BEGIN_SRC d ┃", - doc_matters.opt.action.debug_do ? "" : doc_matters.generator_program.name_and_version.strip, - doc_matters.opt.action.debug_do ? "" : doc_matters.generator_program.compiler.strip, - doc_matters.opt.action.debug_do ? "" : doc_matters.generator_program.stime.strip, + doc_matters.opt.action.debug_do_latex ? "" : doc_matters.generator_program.name_and_version.strip, + doc_matters.opt.action.debug_do_latex ? "" : doc_matters.generator_program.compiler.strip, + doc_matters.opt.action.debug_do_latex ? "" : doc_matters.generator_program.stime.strip, doc_matters.generator_program.project_name.strip, doc_matters.generator_program.url_home.strip, paper_size_orientation_latex.strip, @@ -1904,7 +1904,7 @@ case "backmatter": break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_latex && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); diff --git a/org/out_sqlite.org b/org/out_sqlite.org index 36c0efd..d5fbe7b 100644 --- a/org/out_sqlite.org +++ b/org/out_sqlite.org @@ -158,7 +158,7 @@ template SQLiteDbRun() { writeln("ERROR SQLite : ", ex); } { /+ debug +/ - if (opt_action.debug_do + if (opt_action.debug_do_sqlite && opt_action.verbose) { writeln(note); if (opt_action.very_verbose) { @@ -519,7 +519,7 @@ string generic_munge_sanitize_text_for_search( _txt ~= _urls; } { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { writeln(_txt, "\n"); } @@ -576,7 +576,7 @@ string munge_html(M,O)( string _urls; string _txt = _html_font_face(_html_special_characters(obj.text)); { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { writeln(_txt, "\n"); } @@ -1205,7 +1205,7 @@ string[string] heading(M,O)( "html": html_heading(doc_matters, obj) ]; { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { debug(sql_txt) { writeln(obj_txt["text"]); @@ -1234,7 +1234,7 @@ string[string] para(M,O)( "html": html_para(doc_matters, obj) ]; { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { debug(sql_txt) { writeln(obj_txt["text"]); @@ -1263,7 +1263,7 @@ string[string] quote(M,O)( "html": html_quote(doc_matters, obj) ]; { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { debug(sql_txt) { writeln(obj_txt["text"]); @@ -1291,7 +1291,7 @@ string[string] group(M,O)( "html": html_group(doc_matters, obj) ]; { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { debug(sql_txt) { writeln(obj_txt["text"]); @@ -1320,7 +1320,7 @@ string[string] block(M,O)( "html": html_block(doc_matters, obj) ]; { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { debug(sql_txt) { writeln(obj_txt["text"]); @@ -1349,7 +1349,7 @@ string[string] verse(M,O)( "html": html_verse(doc_matters, obj) ]; { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { debug(sql_txt) { writeln(obj_txt["text"]); @@ -1378,7 +1378,7 @@ string[string] code(M,O)( "html": html_code(obj) ]; { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { debug(sql_txt) { writeln(obj_txt["text"]); @@ -1407,7 +1407,7 @@ string[string] table(M,O)( "html": html_table(doc_matters, obj) ]; { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { debug(sql_txt) { writeln(obj_txt["text"]); @@ -1443,7 +1443,7 @@ foreach (part; doc_matters.has.keys_seq.sql) { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -1453,7 +1453,7 @@ foreach (part; doc_matters.has.keys_seq.sql) { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } @@ -1478,7 +1478,7 @@ foreach (part; doc_matters.has.keys_seq.sql) { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -1510,7 +1510,7 @@ foreach (part; doc_matters.has.keys_seq.sql) { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -1520,7 +1520,7 @@ foreach (part; doc_matters.has.keys_seq.sql) { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } @@ -1550,7 +1550,7 @@ foreach (part; doc_matters.has.keys_seq.sql) { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -1560,7 +1560,7 @@ foreach (part; doc_matters.has.keys_seq.sql) { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } @@ -1572,7 +1572,7 @@ foreach (part; doc_matters.has.keys_seq.sql) { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && 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); diff --git a/org/out_src_pod.org b/org/out_src_pod.org index 7e45825..d08cbcc 100644 --- a/org/out_src_pod.org +++ b/org/out_src_pod.org @@ -181,7 +181,7 @@ auto fn_pod = pths_pod.pod_filename(doc_matters.src.filename).zpod; zip = pod_archive("file_path_bin", fn_src_in, fn_src_out_pod_zip_base, zip); } } else { - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_pod && doc_matters.opt.action.verbose) { writeln("WARNING (io) src out NOT found (image): ", fn_src_in); } @@ -208,7 +208,7 @@ auto fn_pod = pths_pod.pod_filename(doc_matters.src.filename).zpod; zip = pod_archive("file_path_text", fn_src_in, fn_src_out_pod_zip_base, zip); } } else { - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_pod && doc_matters.opt.action.verbose) { writeln("WARNING (io) src out NOT found (document make): ", fn_src_in); } @@ -235,7 +235,7 @@ auto fn_pod = pths_pod.pod_filename(doc_matters.src.filename).zpod; = File(pths_pod.fn_pod_filelist(doc_matters.src.filename).filesystem_open_zpod, "w"); Node _pmy; string _pm = "doc:\n filename: " ~ doc_matters.src.filename ~ "\n language: " ~ doc_matters.pod.manifest_list_of_languages.to!string ~ "\n"; - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_pod && doc_matters.opt.action.verbose) { try { _pmy = Loader.fromString(_pm).load(); @@ -298,7 +298,7 @@ auto fn_pod = pths_pod.pod_filename(doc_matters.src.filename).zpod; } } } else { - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_pod && doc_matters.opt.action.verbose) { writeln("WARNING (io) src in NOT found (markup source): ", fn_src_in); } @@ -341,7 +341,7 @@ auto fn_pod = pths_pod.pod_filename(doc_matters.src.filename).zpod; zip = pod_archive("file_path_text", _pth_mkup_src_in, _pth_mkup_src_out, zip); } } else { - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_pod && doc_matters.opt.action.verbose) { writeln("WARNING (io) src out NOT found (insert file): ", _pth_mkup_src_in); } @@ -373,7 +373,7 @@ auto fn_pod = pths_pod.pod_filename(doc_matters.src.filename).zpod; zip = pod_archive("file_path_text", fn_src_in, fn_src_out_pod_zip_base, zip); } } else { - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_pod && doc_matters.opt.action.verbose) { writeln("WARNING (io) src out NOT found (insert file): ", fn_src_in); } diff --git a/org/out_xmls.org b/org/out_xmls.org index 613925e..fdb64d9 100644 --- a/org/out_xmls.org +++ b/org/out_xmls.org @@ -315,7 +315,7 @@ import special_characters_text(doc_matters.conf_make_meta.meta.date_modified), doc_matters.src.language, special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright), - doc_matters.opt.action.debug_do ? "" : special_characters_text(doc_matters.generator_program.name_and_version), + doc_matters.opt.action.debug_do_xmls ? "" : special_characters_text(doc_matters.generator_program.name_and_version), special_characters_text(doc_matters.generator_program.url_home), ); return o; @@ -1769,7 +1769,7 @@ case "frontmatter": assert(part == "head" || "toc"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -1779,7 +1779,7 @@ case "frontmatter": assert(part == "head" || "toc"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } @@ -1805,7 +1805,7 @@ case "body": assert(part == "body" || "head"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -1837,7 +1837,7 @@ case "body": assert(part == "body" || "head"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -1847,7 +1847,7 @@ case "body": assert(part == "body" || "head"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } @@ -1889,7 +1889,7 @@ case "backmatter": break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -1899,7 +1899,7 @@ case "backmatter": break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } @@ -1911,7 +1911,7 @@ case "comment": break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); @@ -2053,7 +2053,7 @@ if (obj.metainfo.is_a == "heading") { break; case 8: .. case 9: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); writeln(__FILE__, ":", __LINE__, ": ", obj.text); @@ -2062,7 +2062,7 @@ if (obj.metainfo.is_a == "heading") { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); } @@ -2095,7 +2095,7 @@ case "frontmatter": assert(part == "head" || "toc"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -2105,7 +2105,7 @@ case "frontmatter": assert(part == "head" || "toc"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -2130,7 +2130,7 @@ case "body": assert(part == "body"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -2170,7 +2170,7 @@ case "body": assert(part == "body"); doc_html[segment_filename] ~= t[0].to!string; doc_html_endnotes[segment_filename] ~= t[1]; } else { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -2180,7 +2180,7 @@ case "body": assert(part == "body"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } @@ -2230,7 +2230,7 @@ case "backmatter": break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -2240,7 +2240,7 @@ case "backmatter": break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } @@ -2252,7 +2252,7 @@ case "comment": break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); } @@ -2765,7 +2765,7 @@ if (obj.metainfo.is_a == "heading") { break; case 8: .. case 9: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_epub && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); writeln(__FILE__, ":", __LINE__, ": ", obj.text); @@ -2774,7 +2774,7 @@ if (obj.metainfo.is_a == "heading") { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_epub && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); } @@ -2808,7 +2808,7 @@ case "frontmatter": assert(part == "head" || "toc"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_epub && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -2818,7 +2818,7 @@ case "frontmatter": assert(part == "head" || "toc"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_epub && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } @@ -2843,7 +2843,7 @@ case "body": assert(part == "body"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_epub && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -2884,7 +2884,7 @@ case "body": assert(part == "body"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_epub && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -2894,7 +2894,7 @@ case "body": assert(part == "body"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_epub && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } @@ -2944,7 +2944,7 @@ case "backmatter": break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_epub && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -2954,7 +2954,7 @@ case "backmatter": break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_epub && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } @@ -2972,7 +2972,7 @@ case "backmatter": break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_epub && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); } @@ -3077,7 +3077,7 @@ zip -0 file.epub mimetype && zip -r -9 file.epub META-INF OEBPS auto zip_arc_member_file = new ArchiveMember(); zip_arc_member_file.name = fn; auto zip_data = new OutBuffer(); - (doc_matters.opt.action.debug_do) + (doc_matters.opt.action.debug_do_epub) ? zip_data.write(contents.dup) : zip_data.write(contents.dup .replaceAll(rgx.spaces_line_start, "") @@ -3093,7 +3093,7 @@ zip -0 file.epub mimetype && zip -r -9 file.epub META-INF OEBPS pth_epub3.base.mkdirRecurse; } { /+ debug +/ - if (doc_matters.opt.action.debug_do) { + if (doc_matters.opt.action.debug_do_epub) { if (!exists(pth_epub3.dbg_doc_meta_inf(doc_matters.src.filename))) { pth_epub3.dbg_doc_meta_inf(doc_matters.src.filename).mkdirRecurse; } @@ -3112,7 +3112,7 @@ zip -0 file.epub mimetype && zip -r -9 file.epub META-INF OEBPS zip_arc_member_file.name = fn; auto zip_data = new OutBuffer(); { /+ debug +/ - if (doc_matters.opt.action.debug_do) { + if (doc_matters.opt.action.debug_do_epub) { string fn_dbg = pth_epub3.dbg_fn_oebps_content_xhtml(doc_matters.src.filename, seg_filename); auto f = File(fn_dbg, "w"); foreach (docseg; epub_write.doc_epub3[seg_filename]) { @@ -3142,7 +3142,7 @@ zip -0 file.epub mimetype && zip -r -9 file.epub META-INF OEBPS File f; { /+ mimetypes (identify zip file type) +/ { /+ debug +/ - if (doc_matters.opt.action.debug_do) { + if (doc_matters.opt.action.debug_do_epub) { fn_dbg = pth_epub3.dbg_fn_mimetypes(doc_matters.src.filename); File(fn_dbg, "w").writeln(epub_write.mimetypes); } @@ -3152,7 +3152,7 @@ zip -0 file.epub mimetype && zip -r -9 file.epub META-INF OEBPS } { /+ META-INF/container.xml (identify doc root) +/ { /+ debug +/ - if (doc_matters.opt.action.debug_do) { + if (doc_matters.opt.action.debug_do_epub) { fn_dbg = pth_epub3.dbg_fn_dmi_container_xml(doc_matters.src.filename); File(fn_dbg, "w").writeln(epub_write.meta_inf_container_xml); } @@ -3162,7 +3162,7 @@ zip -0 file.epub mimetype && zip -r -9 file.epub META-INF OEBPS } { /+ OEBPS/toc_nav.xhtml (navigation toc epub3) +/ { /+ debug +/ - if (doc_matters.opt.action.debug_do) { + if (doc_matters.opt.action.debug_do_epub) { fn_dbg = pth_epub3.dbg_fn_oebps_toc_nav_xhtml(doc_matters.src.filename); File(fn_dbg, "w").writeln(epub_write.oebps_toc_nav_xhtml); } @@ -3172,7 +3172,7 @@ zip -0 file.epub mimetype && zip -r -9 file.epub META-INF OEBPS } { /+ OEBPS/content.opf (doc manifest) +/ { /+ debug +/ - if (doc_matters.opt.action.debug_do) { + if (doc_matters.opt.action.debug_do_epub) { fn_dbg = pth_epub3.dbg_fn_oebps_content_opf(doc_matters.src.filename); File(fn_dbg, "w").writeln(epub_write.oebps_content_opf); } @@ -3183,7 +3183,7 @@ zip -0 file.epub mimetype && zip -r -9 file.epub META-INF OEBPS { /+ OEBPS/_dr/image (images) +/ foreach (image; doc_matters.srcs.image_list) { { /+ debug +/ - if (doc_matters.opt.action.debug_do) { + if (doc_matters.opt.action.debug_do_epub) { if (doc_matters.opt.action.very_verbose) { writeln( doc_matters.src.image_dir_path, "/", image, " -> ", @@ -3214,7 +3214,7 @@ zip -0 file.epub mimetype && zip -r -9 file.epub META-INF OEBPS { /+ OEBPS/epub.css +/ auto css = spineCss(doc_matters); { /+ debug +/ - if (doc_matters.opt.action.debug_do) { + if (doc_matters.opt.action.debug_do_epub) { fn_dbg = pth_epub3.dbg_fn_oebps_css(doc_matters.src.filename); File(fn_dbg, "w").writeln(css.epub); } diff --git a/org/spine.org b/org/spine.org index da5418d..ae78e86 100644 --- a/org/spine.org +++ b/org/spine.org @@ -334,6 +334,13 @@ bool[string] opts = [ "concordance" : false, "dark" : false, "debug" : false, + "debug-pod" : false, + "debug-epub" : false, + "debug-harvest" : false, + "debug-html" : false, + "debug-latex" : false, + "debug-manifest" : false, + "debug-sqlite" : false, "digest" : false, "epub" : false, "curate" : false, @@ -439,6 +446,13 @@ auto helpInfo = getopt(args, "curate-topics", "extract info on topics from document header metadata", &opts["curate-topics"], "dark", "alternative dark theme", &opts["dark"], "debug", "debug", &opts["debug"], + "debug-pod", "debug pod", &opts["debug-pod"], + "debug-epub", "debug epub", &opts["debug-epub"], + "debug-harvest", "debug harvest", &opts["debug-harvest"], + "debug-html", "debug html", &opts["debug-html"], + "debug-latex", "debug latex", &opts["debug-latex"], + "debug-manifest", "debug manifest", &opts["debug-manifest"], + "debug-sqlite", "debug sqlite", &opts["debug-sqlite"], "digest", "hash digest for each object", &opts["digest"], "epub", "process epub output", &opts["epub"], "hide-ocn", "object cite numbers", &opts["hide-ocn"], @@ -540,7 +554,42 @@ struct OptActions { return _is_light; } @trusted bool debug_do() { - return opts["debug"]; + bool _dbg; + if (opts["debug"] + ||opts["debug-epub"] + ||opts["debug-harvest"] + ||opts["debug-html"] + ||opts["debug-latex"] + ||opts["debug-manifest"] + ||opts["debug-sqlite"] + ) { + _dbg = true; + } else { _dbg = false; } + return _dbg; + } + @trusted bool debug_do_pod() { + return (opts["debug"] || opts["debug-pod"]) ? true : false; + } + @trusted bool debug_do_epub() { + return (opts["debug"] || opts["debug-epub"]) ? true : false; + } + @trusted bool debug_do_harvest() { + return (opts["debug"] || opts["debug-harvest"]) ? true : false; + } + @trusted bool debug_do_html() { + return (opts["debug"] || opts["debug-html"]) ? true : false; + } + @trusted bool debug_do_latex() { + return (opts["debug"] || opts["debug-latex"]) ? true : false; + } + @trusted bool debug_do_manifest() { + return (opts["debug"] || opts["debug-manifest"]) ? true : false; + } + @trusted bool debug_do_sqlite() { + return (opts["debug"] || opts["debug-sqlite"]) ? true : false; + } + @trusted bool debug_do_xmls() { + return (opts["debug"] || opts["debug-html"] || opts["debug-epub"]) ? true : false; } @trusted bool digest() { return opts["digest"]; diff --git a/src/doc_reform/io_out/epub3.d b/src/doc_reform/io_out/epub3.d index 8a8b9e4..39fcafe 100644 --- a/src/doc_reform/io_out/epub3.d +++ b/src/doc_reform/io_out/epub3.d @@ -365,7 +365,7 @@ template outputEPub3() { break; case 8: .. case 9: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_epub && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); writeln(__FILE__, ":", __LINE__, ": ", obj.text); @@ -374,7 +374,7 @@ template outputEPub3() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_epub && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); } @@ -396,7 +396,7 @@ template outputEPub3() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_epub && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -406,7 +406,7 @@ template outputEPub3() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_epub && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } @@ -425,7 +425,7 @@ template outputEPub3() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_epub && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -466,7 +466,7 @@ template outputEPub3() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_epub && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -476,7 +476,7 @@ template outputEPub3() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_epub && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } @@ -520,7 +520,7 @@ template outputEPub3() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_epub && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -530,7 +530,7 @@ template outputEPub3() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_epub && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } @@ -542,7 +542,7 @@ template outputEPub3() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_epub && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); } @@ -626,7 +626,7 @@ template outputEPub3() { auto zip_arc_member_file = new ArchiveMember(); zip_arc_member_file.name = fn; auto zip_data = new OutBuffer(); - (doc_matters.opt.action.debug_do) + (doc_matters.opt.action.debug_do_epub) ? zip_data.write(contents.dup) : zip_data.write(contents.dup .replaceAll(rgx.spaces_line_start, "") @@ -642,7 +642,7 @@ template outputEPub3() { pth_epub3.base.mkdirRecurse; } { /+ debug +/ - if (doc_matters.opt.action.debug_do) { + if (doc_matters.opt.action.debug_do_epub) { if (!exists(pth_epub3.dbg_doc_meta_inf(doc_matters.src.filename))) { pth_epub3.dbg_doc_meta_inf(doc_matters.src.filename).mkdirRecurse; } @@ -661,7 +661,7 @@ template outputEPub3() { zip_arc_member_file.name = fn; auto zip_data = new OutBuffer(); { /+ debug +/ - if (doc_matters.opt.action.debug_do) { + if (doc_matters.opt.action.debug_do_epub) { string fn_dbg = pth_epub3.dbg_fn_oebps_content_xhtml(doc_matters.src.filename, seg_filename); auto f = File(fn_dbg, "w"); foreach (docseg; epub_write.doc_epub3[seg_filename]) { @@ -691,7 +691,7 @@ template outputEPub3() { File f; { /+ mimetypes (identify zip file type) +/ { /+ debug +/ - if (doc_matters.opt.action.debug_do) { + if (doc_matters.opt.action.debug_do_epub) { fn_dbg = pth_epub3.dbg_fn_mimetypes(doc_matters.src.filename); File(fn_dbg, "w").writeln(epub_write.mimetypes); } @@ -701,7 +701,7 @@ template outputEPub3() { } { /+ META-INF/container.xml (identify doc root) +/ { /+ debug +/ - if (doc_matters.opt.action.debug_do) { + if (doc_matters.opt.action.debug_do_epub) { fn_dbg = pth_epub3.dbg_fn_dmi_container_xml(doc_matters.src.filename); File(fn_dbg, "w").writeln(epub_write.meta_inf_container_xml); } @@ -711,7 +711,7 @@ template outputEPub3() { } { /+ OEBPS/toc_nav.xhtml (navigation toc epub3) +/ { /+ debug +/ - if (doc_matters.opt.action.debug_do) { + if (doc_matters.opt.action.debug_do_epub) { fn_dbg = pth_epub3.dbg_fn_oebps_toc_nav_xhtml(doc_matters.src.filename); File(fn_dbg, "w").writeln(epub_write.oebps_toc_nav_xhtml); } @@ -721,7 +721,7 @@ template outputEPub3() { } { /+ OEBPS/content.opf (doc manifest) +/ { /+ debug +/ - if (doc_matters.opt.action.debug_do) { + if (doc_matters.opt.action.debug_do_epub) { fn_dbg = pth_epub3.dbg_fn_oebps_content_opf(doc_matters.src.filename); File(fn_dbg, "w").writeln(epub_write.oebps_content_opf); } @@ -732,7 +732,7 @@ template outputEPub3() { { /+ OEBPS/_dr/image (images) +/ foreach (image; doc_matters.srcs.image_list) { { /+ debug +/ - if (doc_matters.opt.action.debug_do) { + if (doc_matters.opt.action.debug_do_epub) { if (doc_matters.opt.action.very_verbose) { writeln( doc_matters.src.image_dir_path, "/", image, " -> ", @@ -763,7 +763,7 @@ template outputEPub3() { { /+ OEBPS/epub.css +/ auto css = spineCss(doc_matters); { /+ debug +/ - if (doc_matters.opt.action.debug_do) { + if (doc_matters.opt.action.debug_do_epub) { fn_dbg = pth_epub3.dbg_fn_oebps_css(doc_matters.src.filename); File(fn_dbg, "w").writeln(css.epub); } diff --git a/src/doc_reform/io_out/html.d b/src/doc_reform/io_out/html.d index 4efc91d..0227de0 100644 --- a/src/doc_reform/io_out/html.d +++ b/src/doc_reform/io_out/html.d @@ -90,7 +90,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -100,7 +100,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } @@ -120,7 +120,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -152,7 +152,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -162,7 +162,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } @@ -198,7 +198,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -208,7 +208,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } @@ -220,7 +220,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); @@ -331,7 +331,7 @@ template outputHTML() { break; case 8: .. case 9: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); writeln(__FILE__, ":", __LINE__, ": ", obj.text); @@ -340,7 +340,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); } @@ -361,7 +361,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -371,7 +371,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -390,7 +390,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -430,7 +430,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 + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -440,7 +440,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } @@ -484,7 +484,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -494,7 +494,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } @@ -506,7 +506,7 @@ template outputHTML() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_html && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); } diff --git a/src/doc_reform/io_out/latex.d b/src/doc_reform/io_out/latex.d index 088ffbd..e876eab 100644 --- a/src/doc_reform/io_out/latex.d +++ b/src/doc_reform/io_out/latex.d @@ -1110,9 +1110,9 @@ string table(O,M)( stringstyle=\color[rgb]{0.627,0.126,0.941}, } ┃", - doc_matters.opt.action.debug_do ? "" : doc_matters.generator_program.name_and_version.strip, - doc_matters.opt.action.debug_do ? "" : doc_matters.generator_program.compiler.strip, - doc_matters.opt.action.debug_do ? "" : doc_matters.generator_program.stime.strip, + doc_matters.opt.action.debug_do_latex ? "" : doc_matters.generator_program.name_and_version.strip, + doc_matters.opt.action.debug_do_latex ? "" : doc_matters.generator_program.compiler.strip, + doc_matters.opt.action.debug_do_latex ? "" : doc_matters.generator_program.stime.strip, doc_matters.generator_program.project_name.strip, doc_matters.generator_program.url_home.strip, paper_size_orientation_latex.strip, @@ -1275,7 +1275,7 @@ string table(O,M)( break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_latex && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); @@ -1313,7 +1313,7 @@ string table(O,M)( auto pth_latex = spinePathsLaTeX(doc_matters); try { { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_latex && doc_matters.opt.action.verbose) { writeln(latex_content.head); writeln(latex_content.content); diff --git a/src/doc_reform/io_out/source_pod.d b/src/doc_reform/io_out/source_pod.d index ed819fe..5da5a0a 100644 --- a/src/doc_reform/io_out/source_pod.d +++ b/src/doc_reform/io_out/source_pod.d @@ -161,7 +161,7 @@ template spinePod() { zip = pod_archive("file_path_bin", fn_src_in, fn_src_out_pod_zip_base, zip); } } else { - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_pod && doc_matters.opt.action.verbose) { writeln("WARNING (io) src out NOT found (image): ", fn_src_in); } @@ -188,7 +188,7 @@ template spinePod() { zip = pod_archive("file_path_text", fn_src_in, fn_src_out_pod_zip_base, zip); } } else { - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_pod && doc_matters.opt.action.verbose) { writeln("WARNING (io) src out NOT found (document make): ", fn_src_in); } @@ -215,7 +215,7 @@ template spinePod() { = File(pths_pod.fn_pod_filelist(doc_matters.src.filename).filesystem_open_zpod, "w"); Node _pmy; string _pm = "doc:\n filename: " ~ doc_matters.src.filename ~ "\n language: " ~ doc_matters.pod.manifest_list_of_languages.to!string ~ "\n"; - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_pod && doc_matters.opt.action.verbose) { try { _pmy = Loader.fromString(_pm).load(); @@ -278,7 +278,7 @@ template spinePod() { } } } else { - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_pod && doc_matters.opt.action.verbose) { writeln("WARNING (io) src in NOT found (markup source): ", fn_src_in); } @@ -321,7 +321,7 @@ template spinePod() { zip = pod_archive("file_path_text", _pth_mkup_src_in, _pth_mkup_src_out, zip); } } else { - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_pod && doc_matters.opt.action.verbose) { writeln("WARNING (io) src out NOT found (insert file): ", _pth_mkup_src_in); } @@ -353,7 +353,7 @@ template spinePod() { zip = pod_archive("file_path_text", fn_src_in, fn_src_out_pod_zip_base, zip); } } else { - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_pod && doc_matters.opt.action.verbose) { writeln("WARNING (io) src out NOT found (insert file): ", fn_src_in); } diff --git a/src/doc_reform/io_out/sqlite.d b/src/doc_reform/io_out/sqlite.d index f79a66e..3acd39e 100644 --- a/src/doc_reform/io_out/sqlite.d +++ b/src/doc_reform/io_out/sqlite.d @@ -172,7 +172,7 @@ template SQLiteDbRun() { writeln("ERROR SQLite : ", ex); } { /+ debug +/ - if (opt_action.debug_do + if (opt_action.debug_do_sqlite && opt_action.verbose) { writeln(note); if (opt_action.very_verbose) { @@ -221,7 +221,7 @@ template SQLiteFormatAndLoadObject() { _txt ~= _urls; } { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { writeln(_txt, "\n"); } @@ -265,7 +265,7 @@ template SQLiteFormatAndLoadObject() { string _urls; string _txt = _html_font_face(_html_special_characters(obj.text)); { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { writeln(_txt, "\n"); } @@ -755,7 +755,7 @@ template SQLiteFormatAndLoadObject() { "html": html_heading(doc_matters, obj) ]; { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { debug(sql_txt) { writeln(obj_txt["text"]); @@ -778,7 +778,7 @@ template SQLiteFormatAndLoadObject() { "html": html_para(doc_matters, obj) ]; { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { debug(sql_txt) { writeln(obj_txt["text"]); @@ -801,7 +801,7 @@ template SQLiteFormatAndLoadObject() { "html": html_quote(doc_matters, obj) ]; { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { debug(sql_txt) { writeln(obj_txt["text"]); @@ -824,7 +824,7 @@ template SQLiteFormatAndLoadObject() { "html": html_group(doc_matters, obj) ]; { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { debug(sql_txt) { writeln(obj_txt["text"]); @@ -847,7 +847,7 @@ template SQLiteFormatAndLoadObject() { "html": html_block(doc_matters, obj) ]; { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { debug(sql_txt) { writeln(obj_txt["text"]); @@ -870,7 +870,7 @@ template SQLiteFormatAndLoadObject() { "html": html_verse(doc_matters, obj) ]; { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { debug(sql_txt) { writeln(obj_txt["text"]); @@ -893,7 +893,7 @@ template SQLiteFormatAndLoadObject() { "html": html_code(obj) ]; { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { debug(sql_txt) { writeln(obj_txt["text"]); @@ -916,7 +916,7 @@ template SQLiteFormatAndLoadObject() { "html": html_table(doc_matters, obj) ]; { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { debug(sql_txt) { writeln(obj_txt["text"]); @@ -1297,7 +1297,7 @@ template SQLiteInsertDocObjectsLoop() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -1307,7 +1307,7 @@ template SQLiteInsertDocObjectsLoop() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } @@ -1332,7 +1332,7 @@ template SQLiteInsertDocObjectsLoop() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -1364,7 +1364,7 @@ template SQLiteInsertDocObjectsLoop() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -1374,7 +1374,7 @@ template SQLiteInsertDocObjectsLoop() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } @@ -1404,7 +1404,7 @@ template SQLiteInsertDocObjectsLoop() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } @@ -1414,7 +1414,7 @@ template SQLiteInsertDocObjectsLoop() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && doc_matters.opt.action.verbose) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } @@ -1426,7 +1426,7 @@ template SQLiteInsertDocObjectsLoop() { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do + if (doc_matters.opt.action.debug_do_sqlite && 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); diff --git a/src/doc_reform/io_out/xmls.d b/src/doc_reform/io_out/xmls.d index 86d012a..5ad5724 100644 --- a/src/doc_reform/io_out/xmls.d +++ b/src/doc_reform/io_out/xmls.d @@ -219,7 +219,7 @@ template outputXHTMLs() { special_characters_text(doc_matters.conf_make_meta.meta.date_modified), doc_matters.src.language, special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright), - doc_matters.opt.action.debug_do ? "" : special_characters_text(doc_matters.generator_program.name_and_version), + doc_matters.opt.action.debug_do_xmls ? "" : special_characters_text(doc_matters.generator_program.name_and_version), special_characters_text(doc_matters.generator_program.url_home), ); return o; diff --git a/src/doc_reform/spine.d b/src/doc_reform/spine.d index aacdaab..97cc6b0 100755 --- a/src/doc_reform/spine.d +++ b/src/doc_reform/spine.d @@ -116,6 +116,13 @@ string program_name = "spine"; "concordance" : false, "dark" : false, "debug" : false, + "debug-pod" : false, + "debug-epub" : false, + "debug-harvest" : false, + "debug-html" : false, + "debug-latex" : false, + "debug-manifest" : false, + "debug-sqlite" : false, "digest" : false, "epub" : false, "curate" : false, @@ -207,6 +214,13 @@ string program_name = "spine"; "curate-topics", "extract info on topics from document header metadata", &opts["curate-topics"], "dark", "alternative dark theme", &opts["dark"], "debug", "debug", &opts["debug"], + "debug-pod", "debug pod", &opts["debug-pod"], + "debug-epub", "debug epub", &opts["debug-epub"], + "debug-harvest", "debug harvest", &opts["debug-harvest"], + "debug-html", "debug html", &opts["debug-html"], + "debug-latex", "debug latex", &opts["debug-latex"], + "debug-manifest", "debug manifest", &opts["debug-manifest"], + "debug-sqlite", "debug sqlite", &opts["debug-sqlite"], "digest", "hash digest for each object", &opts["digest"], "epub", "process epub output", &opts["epub"], "hide-ocn", "object cite numbers", &opts["hide-ocn"], @@ -301,7 +315,42 @@ string program_name = "spine"; return _is_light; } @trusted bool debug_do() { - return opts["debug"]; + bool _dbg; + if (opts["debug"] + ||opts["debug-epub"] + ||opts["debug-harvest"] + ||opts["debug-html"] + ||opts["debug-latex"] + ||opts["debug-manifest"] + ||opts["debug-sqlite"] + ) { + _dbg = true; + } else { _dbg = false; } + return _dbg; + } + @trusted bool debug_do_pod() { + return (opts["debug"] || opts["debug-pod"]) ? true : false; + } + @trusted bool debug_do_epub() { + return (opts["debug"] || opts["debug-epub"]) ? true : false; + } + @trusted bool debug_do_harvest() { + return (opts["debug"] || opts["debug-harvest"]) ? true : false; + } + @trusted bool debug_do_html() { + return (opts["debug"] || opts["debug-html"]) ? true : false; + } + @trusted bool debug_do_latex() { + return (opts["debug"] || opts["debug-latex"]) ? true : false; + } + @trusted bool debug_do_manifest() { + return (opts["debug"] || opts["debug-manifest"]) ? true : false; + } + @trusted bool debug_do_sqlite() { + return (opts["debug"] || opts["debug-sqlite"]) ? true : false; + } + @trusted bool debug_do_xmls() { + return (opts["debug"] || opts["debug-html"] || opts["debug-epub"]) ? true : false; } @trusted bool digest() { return opts["digest"]; -- cgit v1.2.3