From 703ddafbb14127db4b7b52bfada3d3d96e22754d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 9 Jul 2019 18:25:00 -0400 Subject: cosmetic --- org/default_paths.org | 12 +----- org/default_regex.org | 1 - org/doc_reform.org | 14 +----- org/meta_abstraction.org | 79 +++++++++++++++++----------------- org/output_latex.org | 4 +- org/output_xmls.org | 4 +- src/doc_reform/meta/metadoc_from_src.d | 18 ++++---- src/doc_reform/meta/object_setter.d | 31 +++++++------ src/doc_reform/meta/rgx.d | 1 - src/doc_reform/output/html.d | 4 +- src/doc_reform/output/latex.d | 4 +- src/doc_reform/output/paths_output.d | 5 +-- src/doc_reform/output/rgx.d | 1 - src/doc_reform/source/paths_source.d | 7 +-- 14 files changed, 80 insertions(+), 105 deletions(-) diff --git a/org/default_paths.org b/org/default_paths.org index b1d6980..abc1d51 100644 --- a/org/default_paths.org +++ b/org/default_paths.org @@ -69,7 +69,7 @@ template PodManifest() { _manifest_path = m.captures["podpath"]; } } else { - writeln("WARNING, issue with manifest_path: ", _pth); // remove? + writeln("WARNING, issue with manifest_path: ", _pth); _manifest_path = null; // _manifest_path = ""; } return _manifest_path; @@ -158,11 +158,6 @@ template PathMatters() { } auto collection_root() { auto _collection_root = asNormalizedPath(chainPath(_manifest.pod_manifest_path, "..")).array; - if (auto m = (_collection_root).match(rgx.src_pth_pod_root)) { - // consider testing for last dir in path name being pod, and giving warning if not - } else { - writeln("WARNING, collection_root not named \"pod\""); - } return _collection_root; } string manifest_filename() { @@ -1269,9 +1264,6 @@ template DocReformPathsEPUB() { string base() { return asNormalizedPath((out_pth.output_base).chainPath(base_dir)).array; } - string base_filename(string fn_src) { - return fn_src.baseName.stripExtension ~ "." ~ lng; - } string base_filename(string fn_src) { return fn_src.baseName.stripExtension; } @@ -1291,7 +1283,7 @@ template DocReformPathsEPUB() { return asNormalizedPath(doc_oebps.chainPath("image")).array; } string epub_file(string fn_src) { - return asNormalizedPath(base.chainPath(base_filename(fn_src) ~ ".epub")).array; + return asNormalizedPath(base.chainPath(base_filename_epub(fn_src) ~ ".epub")).array; } string dirtop() { return "".chainPath("").array; diff --git a/org/default_regex.org b/org/default_regex.org index 6d17f0c..a4fc043 100644 --- a/org/default_regex.org +++ b/org/default_regex.org @@ -470,7 +470,6 @@ static special_markup_chars = ctRegex!(`[【】〖〗 static src_pth_sst_or_ssm = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.](?Pss[tm]))$`); static src_pth_pod_sst_or_ssm = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)media/text/[a-z]{2}/(?P[a-zA-Z0-9._-]+[.]ss[tm])$`); static src_pth_contents = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+)/pod[.]manifest$`); -static src_pth_pod_root = ctRegex!(`^(?P(?:[/]?(?:[a-zA-Z0-9._-]+/)*)(pod))$`); static src_pth_zip = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.]zip)$`); static src_pth_unzip_pod = ctRegex!(`^(?Pmedia/text/[a-z]{2}/)*(?P[a-zA-Z0-9._-]+[.]ss[im])$`); static src_pth_types = diff --git a/org/doc_reform.org b/org/doc_reform.org index 848291f..2791c4f 100644 --- a/org/doc_reform.org +++ b/org/doc_reform.org @@ -248,17 +248,6 @@ import keep up to date, configuration in ../maker.org -check: -- http://github.com/Abscissa/SDLang-D -- https://github.com/abscissa/libInputVisitor - -std.conv, -std.variant, - -- https://code.dlang.org/packages/toml -- https://github.com/toml-lang/toml -- https://github.com/toml-lang/toml/blob/master/README.md - **** mixins :mixin: ***** version.txt :version: @@ -1148,8 +1137,7 @@ if ((_opt_action.debug_do) - _return tuple of_: - document abstraction (_the_document_ or doc_abstraction) - document abstraction keys - - (head, toc, body, endnotes, glossary, bibliography, bookindex, blurb, - tail) + - (head, toc, body, endnotes, glossary, bibliography, bookindex, blurb, tail) - (transfer to _doc_matters_) - segnames for html epub (transfer to _doc_matters_) - image list (transfer to _doc_matters_) diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index 317be72..25e742d 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -525,16 +525,16 @@ line_occur = [ "blurb" : 0, ]; uint[string] dochas = [ - "inline_links" : 0, - "inline_notes" : 0, + "inline_links" : 0, + "inline_notes" : 0, "inline_notes_star" : 0, - "codeblock" : 0, - "table" : 0, - "block" : 0, - "group" : 0, - "poem" : 0, - "quote" : 0, - "images" : 0, + "codeblock" : 0, + "table" : 0, + "block" : 0, + "group" : 0, + "poem" : 0, + "quote" : 0, + "images" : 0, ]; auto obj_type_status = flags_type_init; string[string] object_number_poem = [ @@ -3583,21 +3583,21 @@ final string biblio_tag_map()(string abr) { final string biblio_tag_map_()(string abr) { string name; switch (abr) { - case "au": name="author_raw"; break; - case "ed": name="editor_raw"; break; - case "ti": name="fulltitle"; break; - case "lng": name="language"; break; - case "jo": name="journal"; break; - case "vol": name="volume"; break; - case "edn": name="edition"; break; - case "yr": name="year"; break; - case "pl": name="place"; break; - case "pb": name="publisher"; break; - case "pub": name="publisher"; break; - case "pg": name="pages"; break; - case "pgs": name="pages"; break; - case "sn": name="short_name"; break; - default: name=abr; break; + case "au" : name = "author_raw"; break; + case "ed" : name = "editor_raw"; break; + case "ti" : name = "fulltitle"; break; + case "lng" : name = "language"; break; + case "jo" : name = "journal"; break; + case "vol" : name = "volume"; break; + case "edn" : name = "edition"; break; + case "yr" : name = "year"; break; + case "pl" : name = "place"; break; + case "pb" : name = "publisher"; break; + case "pub" : name = "publisher"; break; + case "pg" : name = "pages"; break; + case "pgs" : name = "pages"; break; + case "sn" : name = "short_name"; break; + default : name = abr; break; } return name; } @@ -7601,8 +7601,8 @@ struct DocObj_MetaInfo_ { alias of_part = is_of_part; alias of_section = is_of_section; alias is_of = is_of_type; - string attrib = ""; // TODO analyze attrib and subdivide here? - string lang = ""; // blocks: group, block, quote; not codeblock; TODO poem:verse not yet done + string attrib = ""; + string lang = ""; // blocks: group, block, quote; not codeblock; string syntax = ""; // codeblock only /+ o_n +/ int o_n_substantive = 0; @@ -7631,7 +7631,6 @@ struct DocObj_MetaInfo_ { } bool object_number_off = false; bool visible_object_number = false; - // enum ONtype { none, substantive, non_substantive, glossary, bibliography, book_index, blurb, comment } int object_number_type = 0; // { ocn, non, bkidx } /+ node +/ string[string][string] node; @@ -7646,15 +7645,15 @@ struct DocObj_MetaInfo_ { string marked_up_level() const @property { string _out; switch (heading_lev_markup) { - case 0: _out = "A"; break; - case 1: _out = "B"; break; - case 2: _out = "C"; break; - case 3: _out = "D"; break; - case 4: _out = "1"; break; - case 5: _out = "2"; break; - case 6: _out = "3"; break; - case 7: _out = "4"; break; - default: _out = ""; break; + case 0 : _out = "A"; break; + case 1 : _out = "B"; break; + case 2 : _out = "C"; break; + case 3 : _out = "D"; break; + case 4 : _out = "1"; break; + case 5 : _out = "2"; break; + case 6 : _out = "3"; break; + case 7 : _out = "4"; break; + default : _out = ""; break; // "9"; } return _out; } @@ -7677,7 +7676,7 @@ struct DocObj_TxtAttrib_ { int indent_base = 0; int indent_hang = 0; bool bullet = false; - string language = ""; // not implemented, consider + string language = ""; } #+END_SRC @@ -7685,7 +7684,7 @@ struct DocObj_TxtAttrib_ { #+name: meta_structs_init #+BEGIN_SRC d -struct DocObj_Has_ { // doc object has +struct DocObj_Has_ { bool inline_links = false; bool inline_notes_reg = false; bool inline_notes_star = false; @@ -7703,7 +7702,7 @@ struct DocObj_Table_ { double[] column_widths = []; string[] column_aligns = []; bool heading = false; - bool walls = false; // not implemented + bool walls = false; } #+END_SRC @@ -7741,7 +7740,7 @@ struct DocObj_Pointer_ { #+name: meta_structs_init #+BEGIN_SRC d struct DocObj_Tags_ { - string[] heading_ancestors_text = [ "", "", "", "", "", "", "", "", ]; // TODO redundant? see markedup and collapsed ancestors DONE + string[] heading_ancestors_text = [ "", "", "", "", "", "", "", "", ]; string anchor_tag_html = ""; string in_segment_html = ""; string segment_anchor_tag_epub = ""; diff --git a/org/output_latex.org b/org/output_latex.org index be0e653..f0ce620 100644 --- a/org/output_latex.org +++ b/org/output_latex.org @@ -64,7 +64,9 @@ void writeOutputLaTeX(T,M)( if (!exists(pth_latex.latex_path_stuff)) { (pth_latex.latex_path_stuff).mkdirRecurse; } - writeln(pth_latex.latex_file_with_path); + if (!(doc_matters.opt.action.quiet)) { + writeln(pth_latex.latex_file_with_path); + } auto f = File(pth_latex.latex_file_with_path, "w"); f.writeln(latex_content.head); f.writeln(latex_content.content); diff --git a/org/output_xmls.org b/org/output_xmls.org index 5e312f2..d8a839d 100644 --- a/org/output_xmls.org +++ b/org/output_xmls.org @@ -2084,7 +2084,9 @@ void images_cp(M)( if (exists(fn_src_in)) { fn_src_in.copy(fn_src_out); } else { - writeln("WARNING image not found: ", fn_src_in); + if (!(doc_matters.opt.action.quiet)) { + writeln("WARNING image not found: ", fn_src_in); + } } } } diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index bd8a635..7775f4c 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -345,16 +345,16 @@ template DocReformDocAbstraction() { "blurb" : 0, ]; uint[string] dochas = [ - "inline_links" : 0, - "inline_notes" : 0, + "inline_links" : 0, + "inline_notes" : 0, "inline_notes_star" : 0, - "codeblock" : 0, - "table" : 0, - "block" : 0, - "group" : 0, - "poem" : 0, - "quote" : 0, - "images" : 0, + "codeblock" : 0, + "table" : 0, + "block" : 0, + "group" : 0, + "poem" : 0, + "quote" : 0, + "images" : 0, ]; auto obj_type_status = flags_type_init; string[string] object_number_poem = [ diff --git a/src/doc_reform/meta/object_setter.d b/src/doc_reform/meta/object_setter.d index 264d439..6a95bcf 100644 --- a/src/doc_reform/meta/object_setter.d +++ b/src/doc_reform/meta/object_setter.d @@ -14,8 +14,8 @@ template ObjectSetter() { alias of_part = is_of_part; alias of_section = is_of_section; alias is_of = is_of_type; - string attrib = ""; // TODO analyze attrib and subdivide here? - string lang = ""; // blocks: group, block, quote; not codeblock; TODO poem:verse not yet done + string attrib = ""; + string lang = ""; // blocks: group, block, quote; not codeblock; string syntax = ""; // codeblock only /+ o_n +/ int o_n_substantive = 0; @@ -44,7 +44,6 @@ template ObjectSetter() { } bool object_number_off = false; bool visible_object_number = false; - // enum ONtype { none, substantive, non_substantive, glossary, bibliography, book_index, blurb, comment } int object_number_type = 0; // { ocn, non, bkidx } /+ node +/ string[string][string] node; @@ -59,15 +58,15 @@ template ObjectSetter() { string marked_up_level() const @property { string _out; switch (heading_lev_markup) { - case 0: _out = "A"; break; - case 1: _out = "B"; break; - case 2: _out = "C"; break; - case 3: _out = "D"; break; - case 4: _out = "1"; break; - case 5: _out = "2"; break; - case 6: _out = "3"; break; - case 7: _out = "4"; break; - default: _out = ""; break; + case 0 : _out = "A"; break; + case 1 : _out = "B"; break; + case 2 : _out = "C"; break; + case 3 : _out = "D"; break; + case 4 : _out = "1"; break; + case 5 : _out = "2"; break; + case 6 : _out = "3"; break; + case 7 : _out = "4"; break; + default : _out = ""; break; // "9"; } return _out; } @@ -84,9 +83,9 @@ template ObjectSetter() { int indent_base = 0; int indent_hang = 0; bool bullet = false; - string language = ""; // not implemented, consider + string language = ""; } - struct DocObj_Has_ { // doc object has + struct DocObj_Has_ { bool inline_links = false; bool inline_notes_reg = false; bool inline_notes_star = false; @@ -98,7 +97,7 @@ template ObjectSetter() { double[] column_widths = []; string[] column_aligns = []; bool heading = false; - bool walls = false; // not implemented + bool walls = false; } struct DocObj_CodeBlock_ { string syntax = ""; @@ -112,7 +111,7 @@ template ObjectSetter() { int heading = 0; } struct DocObj_Tags_ { - string[] heading_ancestors_text = [ "", "", "", "", "", "", "", "", ]; // TODO redundant? see markedup and collapsed ancestors DONE + string[] heading_ancestors_text = [ "", "", "", "", "", "", "", "", ]; string anchor_tag_html = ""; string in_segment_html = ""; string segment_anchor_tag_epub = ""; diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d index 544b432..949a665 100644 --- a/src/doc_reform/meta/rgx.d +++ b/src/doc_reform/meta/rgx.d @@ -216,7 +216,6 @@ static template DocReformRgxInit() { static src_pth_sst_or_ssm = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.](?Pss[tm]))$`); static src_pth_pod_sst_or_ssm = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)media/text/[a-z]{2}/(?P[a-zA-Z0-9._-]+[.]ss[tm])$`); static src_pth_contents = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+)/pod[.]manifest$`); - static src_pth_pod_root = ctRegex!(`^(?P(?:[/]?(?:[a-zA-Z0-9._-]+/)*)(pod))$`); static src_pth_zip = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.]zip)$`); static src_pth_unzip_pod = ctRegex!(`^(?Pmedia/text/[a-z]{2}/)*(?P[a-zA-Z0-9._-]+[.]ss[im])$`); static src_pth_types = diff --git a/src/doc_reform/output/html.d b/src/doc_reform/output/html.d index 396f4a0..820b9a7 100644 --- a/src/doc_reform/output/html.d +++ b/src/doc_reform/output/html.d @@ -532,7 +532,9 @@ template outputHTML() { if (exists(fn_src_in)) { fn_src_in.copy(fn_src_out); } else { - writeln("WARNING image not found: ", fn_src_in); + if (!(doc_matters.opt.action.quiet)) { + writeln("WARNING image not found: ", fn_src_in); + } } } } diff --git a/src/doc_reform/output/latex.d b/src/doc_reform/output/latex.d index 586e9fb..88cc75c 100644 --- a/src/doc_reform/output/latex.d +++ b/src/doc_reform/output/latex.d @@ -1130,7 +1130,9 @@ string table(O,M)( if (!exists(pth_latex.latex_path_stuff)) { (pth_latex.latex_path_stuff).mkdirRecurse; } - writeln(pth_latex.latex_file_with_path); + if (!(doc_matters.opt.action.quiet)) { + writeln(pth_latex.latex_file_with_path); + } auto f = File(pth_latex.latex_file_with_path, "w"); f.writeln(latex_content.head); f.writeln(latex_content.content); diff --git a/src/doc_reform/output/paths_output.d b/src/doc_reform/output/paths_output.d index 0ca9fa7..70b1614 100644 --- a/src/doc_reform/output/paths_output.d +++ b/src/doc_reform/output/paths_output.d @@ -298,9 +298,6 @@ template DocReformPathsEPUB() { string base() { return asNormalizedPath((out_pth.output_base).chainPath(base_dir)).array; } - string base_filename(string fn_src) { - return fn_src.baseName.stripExtension ~ "." ~ lng; - } string base_filename(string fn_src) { return fn_src.baseName.stripExtension; } @@ -320,7 +317,7 @@ template DocReformPathsEPUB() { return asNormalizedPath(doc_oebps.chainPath("image")).array; } string epub_file(string fn_src) { - return asNormalizedPath(base.chainPath(base_filename(fn_src) ~ ".epub")).array; + return asNormalizedPath(base.chainPath(base_filename_epub(fn_src) ~ ".epub")).array; } string dirtop() { return "".chainPath("").array; diff --git a/src/doc_reform/output/rgx.d b/src/doc_reform/output/rgx.d index 5ab71f9..e5689c1 100644 --- a/src/doc_reform/output/rgx.d +++ b/src/doc_reform/output/rgx.d @@ -20,7 +20,6 @@ static template DocReformOutputRgxInit() { static src_pth_sst_or_ssm = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.](?Pss[tm]))$`); static src_pth_pod_sst_or_ssm = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)media/text/[a-z]{2}/(?P[a-zA-Z0-9._-]+[.]ss[tm])$`); static src_pth_contents = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+)/pod[.]manifest$`); - static src_pth_pod_root = ctRegex!(`^(?P(?:[/]?(?:[a-zA-Z0-9._-]+/)*)(pod))$`); static src_pth_zip = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.]zip)$`); static src_pth_unzip_pod = ctRegex!(`^(?Pmedia/text/[a-z]{2}/)*(?P[a-zA-Z0-9._-]+[.]ss[im])$`); static src_pth_types = diff --git a/src/doc_reform/source/paths_source.d b/src/doc_reform/source/paths_source.d index 408d227..f315ab9 100644 --- a/src/doc_reform/source/paths_source.d +++ b/src/doc_reform/source/paths_source.d @@ -38,7 +38,7 @@ template PodManifest() { _manifest_path = m.captures["podpath"]; } } else { - writeln("WARNING, issue with manifest_path: ", _pth); // remove? + writeln("WARNING, issue with manifest_path: ", _pth); _manifest_path = null; // _manifest_path = ""; } return _manifest_path; @@ -105,11 +105,6 @@ template PathMatters() { } auto collection_root() { auto _collection_root = asNormalizedPath(chainPath(_manifest.pod_manifest_path, "..")).array; - if (auto m = (_collection_root).match(rgx.src_pth_pod_root)) { - // consider testing for last dir in path name being pod, and giving warning if not - } else { - writeln("WARNING, collection_root not named \"pod\""); - } return _collection_root; } string manifest_filename() { -- cgit v1.2.3