From 86204d301ae0dc2e5990f78081646e6d1189fcce Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 13 Jan 2019 13:50:10 -0500 Subject: cleaning --- src/doc_reform/doc_reform.d | 16 +++++----- src/doc_reform/meta/metadoc_from_src.d | 53 ++++------------------------------ src/doc_reform/meta/object_setter.d | 4 +-- src/doc_reform/meta/rgx.d | 10 +++---- src/doc_reform/output/hub.d | 7 +++-- src/doc_reform/output/rgx.d | 10 +++---- 6 files changed, 29 insertions(+), 71 deletions(-) (limited to 'src/doc_reform') diff --git a/src/doc_reform/doc_reform.d b/src/doc_reform/doc_reform.d index 53ddbcf..2d93c29 100755 --- a/src/doc_reform/doc_reform.d +++ b/src/doc_reform/doc_reform.d @@ -44,15 +44,13 @@ void main(string[] args) { enum dAM { abstraction, matters } static auto rgx = Rgx(); scope(success) { - debug(checkdoc) { - writefln( - "~ run complete, ok ~ (%s-%s.%s.%s, %s D:%s, %s %s)", - program_name, - _ver.major, _ver.minor, _ver.patch, - __VENDOR__, __VERSION__, - bits, os, - ); - } + writefln( + "~ run complete, ok ~ (%s-%s.%s.%s, %s D:%s, %s %s)", + program_name, + _ver.major, _ver.minor, _ver.patch, + __VENDOR__, __VERSION__, + bits, os, + ); } scope(failure) { debug(checkdoc) { diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 4f12e0b..9d2935c 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -780,7 +780,7 @@ template DocReformDocAbstraction() { } else { /+ not book_index +/ an_object_key="body_nugget"; - if (auto m = matchFirst(line, rgx.comment)) { + if (auto m = line.matchFirst(rgx.comment)) { /+ matched comment +/ debug(comment) { writeln(line); @@ -1047,7 +1047,7 @@ template DocReformDocAbstraction() { comp_obj_para.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; comp_obj_para.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_para.has.inline_links = substantive_obj_misc_tuple[sObj.links]; - comp_obj_para.has.contains_image_without_dimensions = substantive_obj_misc_tuple[sObj.image_no_dimensions]; + comp_obj_para.has.image_without_dimensions = substantive_obj_misc_tuple[sObj.image_no_dimensions]; the_document_body_section ~= comp_obj_para; tag_assoc = inline_para_link_anchor(an_object, tag_in_seg, tag_assoc); _common_reset_(line_occur, an_object, obj_type_status); @@ -1698,7 +1698,7 @@ template DocReformDocAbstraction() { } string[] segnames_lv0_to_4; auto _image_dimensions(M,O)(M manifest_matter, O obj) { - if (obj.has.contains_image_without_dimensions) { + if (obj.has.image_without_dimensions) { import std.math; import imageformats; int w, h, chans; @@ -2244,50 +2244,7 @@ template DocReformDocAbstraction() { dom_structure_markedup_tags_status_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; dom_structure_collapsed_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; dom_structure_collapsed_tags_status_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; - debug(abstraction) { - foreach (part; sequenced_document_keys.scroll) { - foreach (ref obj; document_the[part]) { - debug(node_misc) { - if (obj.metainfo.is_a == "heading") { - writeln("heading ancestors text?: ", obj.tags.heading_ancestors_text); - } - } - debug(node_headings) { - if (obj.metainfo.is_a == "heading") { - writeln("---"); - writeln(obj.text); - writeln(" node: ", obj.metainfo.node); - writeln(" ocn: ", obj.metainfo.ocn); - writeln(" markedup heading lev: ", obj.metainfo.heading_lev_markup); - writeln(" collapsed heading lev ", obj.metainfo.heading_lev_collapsed); - writeln(" parent ocn: ", obj.metainfo.parent_ocn); - writeln(" parent lev: ", obj.metainfo.parent_lev_markup); - writeln(" markedup ancestors o_n: ", obj.metainfo.markedup_ancestors); - writeln(" dom markedup: ", obj.metainfo.dom_structure_markedup_tags_status); - writeln(" collapsed ancestors o_n: ", obj.metainfo.collapsed_ancestors); - writeln(" dom collapsed: ", obj.metainfo.dom_structure_collapsed_tags_status); - } - } - debug(node_all) { - writeln("---"); - if (obj.metainfo.is_a == "heading") { - writeln(obj.text); - } - writeln("node: ", obj.metainfo.node); - writeln("ocn: ", obj.metainfo.ocn); - writeln("markedup heading lev: ", obj.metainfo.heading_lev_markup); - writeln("collapsed heading lev ", obj.metainfo.heading_lev_collapsed); - writeln("markedup ancestors o_n: ", obj.metainfo.markedup_ancestors); - writeln("collapsed ancestors o_n: ", obj.metainfo.collapsed_ancestors); - writeln("dom markedup: ", obj.metainfo.dom_structure_markedup_tags_status); - writeln("dom collapsed: ", obj.metainfo.dom_structure_collapsed_tags_status); - writeln("parent ocn: ", obj.metainfo.parent_ocn); - writeln("parent lev: ", obj.metainfo.parent_lev_markup); - writeln("Node: ", obj.metainfo.ocn); - } - } - } - } + auto t = tuple( document_the, sequenced_document_keys, @@ -4978,7 +4935,7 @@ template DocReformDocAbstraction() { if (auto n = munge_.match(rgx.heading_anchor_tag_plus_colon)) { auto tag_remunge_ = n.captures[2] .replaceAll(rgx.heading_marker_tag_has_colon, ".."); - munge_=munge_.replaceFirst(rgx.heading_anchor_tag_plus_colon, n.captures[1] ~ tag_remunge_ ~ " "); + munge_ = munge_.replaceFirst(rgx.heading_anchor_tag_plus_colon, n.captures[1] ~ tag_remunge_ ~ " "); } } else if (auto m = munge_.match(rgx.heading_extract_unnamed_anchor_tag)) { munge_ = munge_.replaceFirst( diff --git a/src/doc_reform/meta/object_setter.d b/src/doc_reform/meta/object_setter.d index 03197da..a4eaaf6 100644 --- a/src/doc_reform/meta/object_setter.d +++ b/src/doc_reform/meta/object_setter.d @@ -10,7 +10,7 @@ template ObjectSetter() { string is_of_part = ""; // frontmatter, body, backmatter string is_of_section = ""; // toc, body, glossary, biography, book index, blurb string is_of_type = ""; // para, block ? - string is_a = ""; // heading, para, table, code block, group, ... + string is_a = ""; // heading, para, table, code block, group, verse/poem ... alias of_part = is_of_part; alias of_section = is_of_section; alias is_of = is_of_type; @@ -86,7 +86,7 @@ template ObjectSetter() { bool inline_links = false; bool inline_notes_reg = false; bool inline_notes_star = false; - bool contains_image_without_dimensions = false; + bool image_without_dimensions = false; } struct DocObj_Table_ { int number_of_columns = 0; diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d index 8c592a6..c43390d 100644 --- a/src/doc_reform/meta/rgx.d +++ b/src/doc_reform/meta/rgx.d @@ -247,7 +247,7 @@ static template DocReformRgxInit() { static inline_al_delimiter_close_regular = ctRegex!(`】`, "m"); static inline_al_delimiter_open_and_close_regular = ctRegex!(`【|】`, "m"); static inline_notes_delimiter_al_regular = ctRegex!(`【(.+?)】`, "mg"); - static inline_notes_delimiter_al_regular_number_note = ctRegex!(`【(\d+)\s+(.+?)】`, "mg"); + static inline_notes_delimiter_al_regular_number_note = ctRegex!(`【(?P\d+)\s+(?P.+?)】`, "mg"); static inline_al_delimiter_open_asterisk = ctRegex!(`【\*`, "m"); static inline_al_delimiter_open_plus = ctRegex!(`【\+`, "m"); static inline_text_and_note_al = ctRegex!(`(?P.+?)【(?:[*+ ]*)(?P.+?)】`, "mg"); @@ -282,10 +282,10 @@ static template DocReformRgxInit() { static inline_mono_box = ctRegex!(`■\{(?P.+?)\}■`, "mg"); static inline_cite = ctRegex!(`"\{(?P.+?)\}"`, "mg"); static inline_faces_line = ctRegex!(`^[*!/_]_ (?P.+?)((?: [\\]{2}|[~]#){0,2}$)`); - static inline_emphasis_line = ctRegex!(`^\*_ (?P.+?)((?: [\\]{2}|[~]#){0,2}$)`); - static inline_bold_line = ctRegex!(`^!_ (?P.+?)((?: [\\]{2}|[~]#){0,2}$)`); - static inline_italics_line = ctRegex!(`^/_ (?P.+?)((?: [\\]{2}|[~]#){0,2}$)`); - static inline_underscore_line = ctRegex!(`^__ (?P.+?)((?: [\\]{2}|[~]#){0,2}$)`); + static inline_emphasis_line = ctRegex!(`^\*_ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`); + static inline_bold_line = ctRegex!(`^!_ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`); + static inline_italics_line = ctRegex!(`^/_ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`); + static inline_underscore_line = ctRegex!(`^__ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`); static inline_fontface_clean = ctRegex!(`[*!_/^,+#■"-]\{|\}[*!_/^,+#■"-]`, "mg"); static no_header_rgx = ctRegex!(`^=NULL$`); /+ table delimiters +/ diff --git a/src/doc_reform/output/hub.d b/src/doc_reform/output/hub.d index 4cff15e..1534bc0 100644 --- a/src/doc_reform/output/hub.d +++ b/src/doc_reform/output/hub.d @@ -18,10 +18,10 @@ template outputHub() { void Scheduled(D,I)(int sched, D doc_abstraction, I doc_matters) { auto msg = Msg!()(doc_matters); if (sched == outTask.pod) { - msg.v("sisu source processing... "); + msg.v("doc reform source processing... "); import doc_reform.output.source_pod; DocReformPod!()(doc_matters); - msg.vv("sisu source done"); + msg.vv("doc reform source done"); } if (sched == outTask.epub) { msg.v("epub3 processing... "); @@ -54,6 +54,9 @@ template outputHub() { msg.vv("sqlite done"); } } + if (!(doc_matters.opt.action.quiet)) { + writeln(" ", doc_matters.src.filename_base); + } if (!(doc_matters.opt.action.parallelise_subprocesses)) { foreach(schedule; doc_matters.opt.action.output_task_scheduler) { Scheduled!()(schedule, doc_abstraction, doc_matters); diff --git a/src/doc_reform/output/rgx.d b/src/doc_reform/output/rgx.d index 02c3cbb..0bcb2b6 100644 --- a/src/doc_reform/output/rgx.d +++ b/src/doc_reform/output/rgx.d @@ -55,7 +55,7 @@ static template DocReformOutputRgxInit() { static inline_al_delimiter_close_regular = ctRegex!(`】`, "m"); static inline_al_delimiter_open_and_close_regular = ctRegex!(`【|】`, "m"); static inline_notes_delimiter_al_regular = ctRegex!(`【(.+?)】`, "mg"); - static inline_notes_delimiter_al_regular_number_note = ctRegex!(`【(\d+)\s+(.+?)】`, "mg"); + static inline_notes_delimiter_al_regular_number_note = ctRegex!(`【(?P\d+)\s+(?P.+?)】`, "mg"); static inline_al_delimiter_open_asterisk = ctRegex!(`【\*`, "m"); static inline_al_delimiter_open_plus = ctRegex!(`【\+`, "m"); static inline_text_and_note_al = ctRegex!(`(?P.+?)【(?:[*+ ]*)(?P.+?)】`, "mg"); @@ -90,10 +90,10 @@ static template DocReformOutputRgxInit() { static inline_mono_box = ctRegex!(`■\{(?P.+?)\}■`, "mg"); static inline_cite = ctRegex!(`"\{(?P.+?)\}"`, "mg"); static inline_faces_line = ctRegex!(`^[*!/_]_ (?P.+?)((?: [\\]{2}|[~]#){0,2}$)`); - static inline_emphasis_line = ctRegex!(`^\*_ (?P.+?)((?: [\\]{2}|[~]#){0,2}$)`); - static inline_bold_line = ctRegex!(`^!_ (?P.+?)((?: [\\]{2}|[~]#){0,2}$)`); - static inline_italics_line = ctRegex!(`^/_ (?P.+?)((?: [\\]{2}|[~]#){0,2}$)`); - static inline_underscore_line = ctRegex!(`^__ (?P.+?)((?: [\\]{2}|[~]#){0,2}$)`); + static inline_emphasis_line = ctRegex!(`^\*_ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`); + static inline_bold_line = ctRegex!(`^!_ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`); + static inline_italics_line = ctRegex!(`^/_ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`); + static inline_underscore_line = ctRegex!(`^__ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`); static inline_fontface_clean = ctRegex!(`[*!_/^,+#■"-]\{|\}[*!_/^,+#■"-]`, "mg"); static no_header_rgx = ctRegex!(`^=NULL$`); /+ table delimiters +/ -- cgit v1.2.3