From 9f5a72665fd94dcb082a9710c71e6a6a08386450 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 31 Jul 2018 10:25:29 -0400 Subject: messages & remove outputs not generated --- src/sdp/output/epub3.d | 4 +- src/sdp/output/html.d | 13 ++-- src/sdp/output/hub.d | 130 +++++++++++----------------------------- src/sdp/output/package.d | 1 + src/sdp/output/paths_output.d | 2 - src/sdp/output/source_sisupod.d | 6 +- src/sdp/output/sqlite.d | 28 +++++---- src/sdp/output/xmls.d | 2 +- 8 files changed, 66 insertions(+), 120 deletions(-) (limited to 'src/sdp/output') diff --git a/src/sdp/output/epub3.d b/src/sdp/output/epub3.d index d10b7f2..52e3ce2 100644 --- a/src/sdp/output/epub3.d +++ b/src/sdp/output/epub3.d @@ -761,7 +761,9 @@ template outputEPub3() { } catch (ErrnoException ex) { // Handle error } - writeln(" ", fn_epub); + if (!(doc_matters.opt.action.quiet)) { + writeln(" ", fn_epub); + } debug(epub_archive) { if (exists(fn_epub)) { try { diff --git a/src/sdp/output/html.d b/src/sdp/output/html.d index ba53eef..f1c25e8 100644 --- a/src/sdp/output/html.d +++ b/src/sdp/output/html.d @@ -53,7 +53,7 @@ template outputHTML() { break; } break; - case "body": assert(part == "body" || "head"); // surprise + case "body": assert(part == "body" || "head"); switch (obj.metainfo.is_of_type) { case "para": switch (obj.metainfo.is_a) { @@ -177,7 +177,9 @@ template outputHTML() { } catch (ErrnoException ex) { // Handle error } - writeln(" ", pth_html.fn_scroll(doc_matters.src.filename)); + if (!(doc_matters.opt.action.quiet)) { + writeln(" ", pth_html.fn_scroll(doc_matters.src.filename)); + } } void seg(D,M)( const D doc_abstraction, @@ -233,10 +235,9 @@ template outputHTML() { segment_filename = obj.tags.segment_anchor_tag; doc_html[segment_filename] ~= xhtml_format.html_head(doc_matters, "seg"); auto navigation_bar = xhtml_format.nav_pre_next_svg(obj); - doc_html[segment_filename] ~= navigation_bar.toc_pre_next; // navigation bar + doc_html[segment_filename] ~= navigation_bar.toc_pre_next; previous_seg_filename = segment_filename; foreach (top_level_heading; top_level_headings) { - // writeln(top_level_heading); doc_html[segment_filename] ~= top_level_heading; } auto t = xhtml_format.heading_seg(obj, _txt, suffix, "seg"); @@ -433,7 +434,9 @@ template outputHTML() { } catch (ErrnoException ex) { // handle error } - writeln(" ", pth_html.fn_seg(doc_matters.src.filename, "toc")); + if (!(doc_matters.opt.action.quiet)) { + writeln(" ", pth_html.fn_seg(doc_matters.src.filename, "toc")); + } } void css(M)( auto ref M doc_matters, diff --git a/src/sdp/output/hub.d b/src/sdp/output/hub.d index 47713f5..75be424 100644 --- a/src/sdp/output/hub.d +++ b/src/sdp/output/hub.d @@ -14,132 +14,64 @@ template outputHub() { sdp.output.paths_output; void outputHub(D,I)(D doc_abstraction, I doc_matters) { mixin SiSUoutputRgxInit; + mixin Msg; + auto msg = Msg!()(doc_matters); static auto rgx = Rgx(); - debug (substitutions) { - enum Substitute { match, markup, html, } - writeln(__LINE__, ":", __FILE__, ": DEBUG substitutions:"); - writeln("Doc Title: ", doc_matters.conf_make_meta.meta.title_full); - if (doc_matters.conf_make_meta.make.bold) { - writeln("regex to match: ", doc_matters.conf_make_meta.make.bold[Substitute.match]); - writeln("substitution to make: ", doc_matters.conf_make_meta.make.bold[Substitute.html]); - - auto _w = "1. Debian test string. Debian again. (the problem) do not use initialized only not repopulated" - .replaceAll( - regex(doc_matters.conf_make_meta.make.bold[Substitute.match]), - doc_matters.conf_make_meta.make.bold[Substitute.html] - ); - writeln(_w); - - writeln("2a. Debian test string. Debian again. (the problem) do not use initialized only not repopulated" - .replaceAll( - regex(doc_matters.conf_make_meta.make.bold[Substitute.match]), - doc_matters.conf_make_meta.make.bold[Substitute.html] - )); - - auto _v = regex(doc_matters.conf_make_meta.make.bold[Substitute.match]); - writeln("2b. Debian test string. Debian again. (the problem) do not use initialized only not repopulated" - .replaceAll( - _v, - doc_matters.conf_make_meta.make.bold[Substitute.html] - )); - } - } if (doc_matters.opt.action.verbose) { writeln(doc_matters.xml.keys_seq.seg); } if ((doc_matters.opt.action.source) || (doc_matters.opt.action.sisupod)) { - if ((doc_matters.opt.action.verbose) - && (doc_matters.opt.action.source)) { - writeln("sisu source processing... "); + if (doc_matters.opt.action.source) { + msg.v("sisu source processing..."); } - if ((doc_matters.opt.action.verbose) - && (doc_matters.opt.action.sisupod)) { - writeln("sisupod source processing... "); + if (doc_matters.opt.action.sisupod) { + msg.v("sisupod source processing..."); } SiSUpod!()(doc_matters); - if ((doc_matters.opt.action.verbose) - && (doc_matters.opt.action.debug_do) - && (doc_matters.opt.action.source)) { - writeln("sisu source done"); - } - if ((doc_matters.opt.action.verbose) - && (doc_matters.opt.action.debug_do) - && (doc_matters.opt.action.sisupod)) { - writeln("sisupod done"); + if (doc_matters.opt.action.source) { + msg.vv("sisu source done"); } - } - if (doc_matters.opt.action.text) { - /+ mixin outputText; +/ - if ((doc_matters.opt.action.verbose)) { - writeln("text processing... "); + if (doc_matters.opt.action.sisupod) { + msg.v("sisupod source done"); } } if (doc_matters.opt.action.html_seg) { - if ((doc_matters.opt.action.verbose)) { - writeln("html seg processing... "); - } + msg.v("html seg source processing..."); outputHTML!().seg(doc_abstraction, doc_matters); - if ((doc_matters.opt.action.verbose) - && (doc_matters.opt.action.debug_do)) { - writeln("html seg done"); - } - outputHTML!().css(doc_matters); - outputHTML!().images_cp(doc_matters); + msg.vv("html seg done"); } if (doc_matters.opt.action.html_scroll) { - if ((doc_matters.opt.action.verbose)) { - writeln("html scroll processing... "); - } + msg.v("html scroll source processing..."); outputHTML!().scroll(doc_abstraction, doc_matters); - if ((doc_matters.opt.action.verbose) - && (doc_matters.opt.action.debug_do)) { - writeln("html scroll done"); - } + msg.vv("html scroll done"); + } + if (doc_matters.opt.action.html_stuff) { + msg.v("html copying images & css..."); outputHTML!().css(doc_matters); outputHTML!().images_cp(doc_matters); + msg.vv("html css & images done"); } if (doc_matters.opt.action.epub) { - if ((doc_matters.opt.action.verbose)) { - writeln("epub3 processing... "); - } + msg.v("epub3 source processing..."); outputEPub3!()(doc_abstraction, doc_matters); - // epub.css_write; - if ((doc_matters.opt.action.verbose) - && (doc_matters.opt.action.debug_do)) { - writeln("epub3 done"); - } - } - if (doc_matters.opt.action.pdf) { - /+ mixin outputPDF; +/ - writeln("pdf processing"); - } - if (doc_matters.opt.action.odt) { - /+ mixin outputODT; +/ - writeln("odt processing"); + msg.vv("epub3 done"); } if (doc_matters.opt.action.sqlite_discrete) { - if ((doc_matters.opt.action.verbose)) { - writeln("sqlite processing... "); - } + msg.v("sqlite processing..."); SQLiteHubDiscreteBuildTablesAndPopulate!()(doc_abstraction, doc_matters); + msg.vv("sqlite done"); } if (doc_matters.opt.action.sqlite_insert || doc_matters.opt.action.sqlite_update ) { - if ((doc_matters.opt.action.verbose)) { - writeln("sqlite processing... "); - } + msg.v("sqlite update processing..."); SQLiteHubBuildTablesAndPopulate!()(doc_abstraction, doc_matters); + msg.vv("sqlite update done"); } else if (doc_matters.opt.action.sqlite_delete) { - if ((doc_matters.opt.action.verbose)) { - writeln("sqlite processing... "); - } + msg.v("sqlite delete processing..."); SQLiteHubBuildTablesAndPopulate!()(doc_abstraction, doc_matters); - } - if (doc_matters.opt.action.postgresql) { - /+ mixin outputPostgreSQL; +/ - writeln("pgsql processing"); + msg.vv("sqlite delete done"); } } } @@ -157,15 +89,21 @@ template outputHubOp() { static auto rgx = Rgx(); if ((opt_action.sqlite_db_drop)) { if ((opt_action.verbose)) { - writeln("sqlite drop db... "); + writeln("sqlite drop db..."); } SQLiteDbDrop!()(opt_action); + if ((opt_action.very_verbose)) { + writeln("sqlite drop db done"); + } } if ((opt_action.sqlite_db_create)) { if ((opt_action.verbose)) { - writeln("sqlite create table... "); + writeln("sqlite create table..."); } SQLiteTablesCreate!()(env, opt_action); + if ((opt_action.very_verbose)) { + writeln("sqlite create table done"); + } } } } diff --git a/src/sdp/output/package.d b/src/sdp/output/package.d index 2aa6544..40b4c20 100644 --- a/src/sdp/output/package.d +++ b/src/sdp/output/package.d @@ -15,6 +15,7 @@ public import // std.uni, std.utf; public import + sdp.share.defaults, sdp.source.paths_source, sdp.output.defaults, sdp.output.paths_output, diff --git a/src/sdp/output/paths_output.d b/src/sdp/output/paths_output.d index 3b18c75..112f47c 100644 --- a/src/sdp/output/paths_output.d +++ b/src/sdp/output/paths_output.d @@ -236,8 +236,6 @@ template SiSUpathsSQLiteDiscrete() { auto out_pth = SiSUoutPaths!()(output_pth_root, lng); string base_dir = "sqlite"; return asNormalizedPath((out_pth.output_base).chainPath(base_dir)).array; - // return asNormalizedPath((out_pth.output_root).chainPath(base_dir)).array; // single file for each file, multiple languages - // return asNormalizedPath((out_pth.output_base).chainPath(base_dir)).array; // separate files for each language } string seg(string fn_src) { return asNormalizedPath(base.chainPath(base_filename(fn_src))).array; diff --git a/src/sdp/output/source_sisupod.d b/src/sdp/output/source_sisupod.d index 97077de..44cf56b 100644 --- a/src/sdp/output/source_sisupod.d +++ b/src/sdp/output/source_sisupod.d @@ -124,14 +124,14 @@ template SiSUpod() { writeln("WARNING (io) src out NOT found (document make): ", fn_src_in); } } - } { /+ TODO bundle primary file +/ + } { /+ bundle primary file +/ auto fn_src_in = doc_matters.src.file_with_absolute_path.to!string; auto fn_src_out_sisupod_zip_base = pths_sisupod.fn_doc(doc_matters.src.filename, doc_matters.src.language).zpod.to!string; auto fn_src_out_filesystem - = pths_sisupod.fn_doc(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod.to!string; // needed without root path: + = pths_sisupod.fn_doc(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod.to!string; // without root path: auto fn_src_out_inside_pod - = pths_sisupod.fn_doc(doc_matters.src.filename, doc_matters.src.language).zpod.to!string; // needed without root path: + = pths_sisupod.fn_doc(doc_matters.src.filename, doc_matters.src.language).zpod.to!string; // without root path: string[] filelist_src_out_sisupod_arr; string[] filelist_src_zpod_arr; if (exists(fn_src_in)) { diff --git a/src/sdp/output/sqlite.d b/src/sdp/output/sqlite.d index 41d504e..0221264 100644 --- a/src/sdp/output/sqlite.d +++ b/src/sdp/output/sqlite.d @@ -47,7 +47,9 @@ template SQLiteHubBuildTablesAndPopulate() { } db.close; } - writeln(" ", pth_sqlite.sqlite_file); + if (!(doc_matters.opt.action.quiet)) { + writeln(" ", pth_sqlite.sqlite_file); + } } } SQLiteDbStatementComposite!()(db, doc_abstraction, doc_matters); @@ -77,7 +79,9 @@ template SQLiteHubDiscreteBuildTablesAndPopulate() { } db.close; } - writeln(" ", pth_sqlite.sqlite_file(doc_matters.src.filename)); + if (!(doc_matters.opt.action.quiet)) { + writeln(" ", pth_sqlite.sqlite_file(doc_matters.src.filename)); + } } } SQLiteDiscreteDbStatementComposite!()(db, doc_abstraction, doc_matters); @@ -589,8 +593,8 @@ template SQLiteTablesReCreate() { DROP TABLE IF EXISTS urls; CREATE TABLE metadata_and_text ( uid VARCHAR(256) UNIQUE, /* filename, language char, pod/txt (decide on delimiter [,;:/]) */ - src_composite_id_per_txt VARCHAR(256) NOT NULL, /* UNIQUE, /* z pod name if any + src filename + language code */ - src_composite_id_per_pod VARCHAR(256) NOT NULL, /* z pod name if any + src filename */ + src_composite_id_per_txt VARCHAR(256) NOT NULL, /* UNIQUE, /* z pod name if any + src filename + language code */ + src_composite_id_per_pod VARCHAR(256) NOT NULL, /* z pod name if any + src filename */ title VARCHAR(800) NOT NULL, title_main VARCHAR(400) NOT NULL, title_sub VARCHAR(400) NULL, @@ -945,12 +949,12 @@ template SQLiteInsertDocObjectsLoop() { break; } break; - case "body": // assert(part == "body", part); // TODO broken + case "body": // assert(part == "body", part); switch (obj.metainfo.is_of_type) { case "para": switch (obj.metainfo.is_a) { case "heading": - debug (asserts) { // TODO consider and fix or remove + debug (asserts) { if (part != "body") { writeln(__LINE__, ": ", obj.text); } @@ -1048,7 +1052,7 @@ template SQLiteInsertDocObjectsLoop() { break; } if (obj.metainfo.is_a == "heading") { - if ((doc_matters.opt.action.verbose)) { + if ((doc_matters.opt.action.very_verbose)) { writeln( "markup: ", obj.metainfo.heading_lev_markup, "> ", obj.metainfo.dom_structure_markedup_tags_status, @@ -1092,8 +1096,8 @@ template SQLiteTablesCreate() { DROP TABLE IF EXISTS urls; CREATE TABLE metadata_and_text ( uid VARCHAR(256) UNIQUE, /* filename, language char, pod/txt (decide on delimiter [,;:/]) */ - src_composite_id_per_txt VARCHAR(256) NOT NULL, /* UNIQUE, /* z pod name if any + src filename + language code */ - src_composite_id_per_pod VARCHAR(256) NOT NULL, /* z pod name if any + src filename */ + src_composite_id_per_txt VARCHAR(256) NOT NULL, /* UNIQUE, /* z pod name if any + src filename + language code */ + src_composite_id_per_pod VARCHAR(256) NOT NULL, /* z pod name if any + src filename */ title VARCHAR(800) NOT NULL, title_main VARCHAR(400) NOT NULL, title_sub VARCHAR(400) NULL, @@ -1212,9 +1216,9 @@ template SQLiteTablesCreate() { } if (opt_action.sqlite_db_create) { string _db_statement; - auto pth_sqlite = SiSUpathsSQLite!()(opt_action.sqlite_filename, opt_action.output_dir_set); // ISSUE + auto pth_sqlite = SiSUpathsSQLite!()(opt_action.sqlite_filename, opt_action.output_dir_set); pth_sqlite.base.mkdirRecurse; - auto db = Database(pth_sqlite.sqlite_file); // ISSUE + auto db = Database(pth_sqlite.sqlite_file); { _db_statement ~= SQLiteTablesReCreate!()(); } @@ -1226,7 +1230,7 @@ template SQLiteDbDrop() { void SQLiteDbDrop(O)(O opt_action) { writeln("db drop"); if ((opt_action.sqlite_db_drop)) { - auto pth_sqlite = SiSUpathsSQLite!()(opt_action.sqlite_filename, opt_action.output_dir_set); // ISSUE + auto pth_sqlite = SiSUpathsSQLite!()(opt_action.sqlite_filename, opt_action.output_dir_set); writeln("remove(", pth_sqlite.sqlite_file, ")"); try { remove(pth_sqlite.sqlite_file); diff --git a/src/sdp/output/xmls.d b/src/sdp/output/xmls.d index 874329f..32b46e5 100644 --- a/src/sdp/output/xmls.d +++ b/src/sdp/output/xmls.d @@ -326,7 +326,7 @@ template outputXHTMLs() { _img_pth = "../../../image/"; } if (_txt.match(rgx.inline_image)) { - _txt = _txt.replaceAll( // TODO bug where image dimensions (w or h) not given & consequently set to 0; should not be used (calculate earlier, abstraction) + _txt = _txt.replaceAll( rgx.inline_image, ("$1