From ed71ef0ac032456c882bea44b04c02863cb90a46 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 25 Jan 2020 13:34:47 -0500 Subject: code ctRegex calls, tidying --- src/doc_reform/meta/conf_make_meta_json.d | 4 +- src/doc_reform/meta/conf_make_meta_structs.d | 4 +- src/doc_reform/meta/conf_make_meta_yaml.d | 8 ++-- src/doc_reform/meta/defaults.d | 2 +- src/doc_reform/meta/doc_debugs.d | 4 +- src/doc_reform/meta/metadoc.d | 6 +-- src/doc_reform/meta/metadoc_from_src.d | 62 +++++++++++++------------- src/doc_reform/meta/metadoc_harvests_authors.d | 1 - src/doc_reform/meta/metadoc_harvests_topics.d | 1 - src/doc_reform/meta/rgx.d | 4 +- 10 files changed, 47 insertions(+), 49 deletions(-) (limited to 'src/doc_reform/meta') diff --git a/src/doc_reform/meta/conf_make_meta_json.d b/src/doc_reform/meta/conf_make_meta_json.d index 4fc3bc4..a6214ce 100644 --- a/src/doc_reform/meta/conf_make_meta_json.d +++ b/src/doc_reform/meta/conf_make_meta_json.d @@ -21,8 +21,8 @@ static template contentJSONtoSpineStruct() { doc_reform.meta.rgx; ConfComposite _struct_composite; @safe auto contentJSONtoSpineStruct(C,J,M)(C _struct_composite, J _json, M _manifested, string _identifier) { - mixin spineRgxInit; - static auto rgx = Rgx(); + mixin spineRgxIn; + static auto rgx = RgxI(); debug (json) { writeln(">> --------------------------- >>"); foreach (tag0; _json.object.byKeyValue) { diff --git a/src/doc_reform/meta/conf_make_meta_structs.d b/src/doc_reform/meta/conf_make_meta_structs.d index 683d355..7698388 100644 --- a/src/doc_reform/meta/conf_make_meta_structs.d +++ b/src/doc_reform/meta/conf_make_meta_structs.d @@ -12,8 +12,8 @@ import import doc_reform.meta.defaults, doc_reform.meta.rgx; -mixin spineRgxInit; -static auto rgx = Rgx(); +mixin spineRgxIn; +static auto rgx = RgxI(); mixin InternalMarkup; static auto mkup = InlineMarkup(); @safe string url_markup(string line) { diff --git a/src/doc_reform/meta/conf_make_meta_yaml.d b/src/doc_reform/meta/conf_make_meta_yaml.d index 5355a58..2efd515 100644 --- a/src/doc_reform/meta/conf_make_meta_yaml.d +++ b/src/doc_reform/meta/conf_make_meta_yaml.d @@ -26,8 +26,8 @@ template contentYAMLtoSpineStruct() { M _manifested, string _identifier ) { - mixin spineRgxInit; - static auto rgx = Rgx(); + mixin spineRgxIn; + static auto rgx = RgxI(); confCompositeMakeBuild _mk; /+ make ------------------------------------------------------------------- +/ if ("make" in _yaml @@ -829,9 +829,9 @@ template docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct() { doc_reform.meta.conf_make_meta_structs, doc_reform.meta.conf_make_meta_json, doc_reform.meta.rgx; - mixin spineRgxInit; + mixin spineRgxIn; mixin contentJSONtoSpineStruct; - static auto rgx = Rgx(); + static auto rgx = RgxI(); @system auto docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct(CCm,Src,M)( Src header_src, CCm _make_and_meta_struct, diff --git a/src/doc_reform/meta/defaults.d b/src/doc_reform/meta/defaults.d index eff632e..63eb5fa 100644 --- a/src/doc_reform/meta/defaults.d +++ b/src/doc_reform/meta/defaults.d @@ -2,7 +2,7 @@ default settings +/ module doc_reform.meta.defaults; -template spineRgxInitFlags() { +template spineRgxDocStructFlags() { /+ regex flags +/ @safe static int[string] flags_type_init() { int[string] flags_type_init = [ diff --git a/src/doc_reform/meta/doc_debugs.d b/src/doc_reform/meta/doc_debugs.d index 2815e4f..9ab9ea7 100644 --- a/src/doc_reform/meta/doc_debugs.d +++ b/src/doc_reform/meta/doc_debugs.d @@ -25,9 +25,9 @@ template spineDebugs() { const S contents, T doc_matters, ) { - mixin spineRgxInit; + mixin spineRgxIn; mixin InternalMarkup; - static auto rgx = Rgx(); + static auto rgx = RgxI(); auto markup = InlineMarkup(); string key; debug(parent) { diff --git a/src/doc_reform/meta/metadoc.d b/src/doc_reform/meta/metadoc.d index e18a19e..90fec4a 100644 --- a/src/doc_reform/meta/metadoc.d +++ b/src/doc_reform/meta/metadoc.d @@ -21,15 +21,15 @@ template spineAbstraction() { doc_reform.io_in.read_config_files, doc_reform.io_in.read_source_files, doc_reform.io_out.hub; - mixin spineRgxInit; + mixin spineRgxIn; mixin contentJSONtoSpineStruct; mixin spineBiblio; - mixin spineRgxInitFlags; + mixin spineRgxDocStructFlags; mixin outputHub; enum headBody { header, body_content, insert_file_list, image_list } enum makeMeta { make, meta } enum docAbst { doc_abstract_obj, doc_has } - static auto rgx = Rgx(); + static auto rgx = RgxI(); @system auto spineAbstraction(E,P,O,M,S)( E _env, P program_info, diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 3c58212..3ce25b5 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -20,7 +20,7 @@ template docAbstraction() { /+ ↓ abstraction mixins +/ mixin ObjectSetter; mixin InternalMarkup; - mixin spineRgxInit; + mixin spineRgxIn; /+ ↓ abstraction struct init +/ /+ initialize +/ ObjGenericComposite[] the_table_of_contents_section; @@ -257,7 +257,7 @@ template docAbstraction() { return object_citation_number.ocn_emitter(ocn_status_flag); } @safe static auto inline_markup_faces(L)(L line) { - static auto rgx = Rgx(); + static auto rgx = RgxI(); static auto mkup = InlineMarkup(); line = replaceAll!(m => mkup.quote_o ~ m[1] ~ mkup.quote_c)(line, rgx.within_quotes); line = replaceAll!(m => mkup.mono ~ mkup.ff_o ~ m["text"] ~ mkup.ff_c ~ mkup.mono)(line, rgx.inline_mark_mono); @@ -268,7 +268,7 @@ template docAbstraction() { return line; } @safe static string links_and_images()(string obj_txt) { - static auto rgx = Rgx(); + static auto rgx = RgxI(); static auto mkup = InlineMarkup(); if (obj_txt.match(rgx.smid_inline_url_generic)) { if ( @@ -319,7 +319,7 @@ template docAbstraction() { string[string] tag_in_seg, string[string][string] tag_assoc ) { - static auto rgx = Rgx(); + static auto rgx = RgxI(); if (auto m = an_object["substantive"].match(rgx.inline_link_anchor)) { if (m.captures[1] !in tag_assoc) { tag_assoc[(m.captures[1])]["seg_lv4"] = tag_in_seg["seg_lv4"]; @@ -338,7 +338,7 @@ template docAbstraction() { Mf manifested, bool _new_doc ) { - static auto rgx = Rgx(); + static auto rgx = RgxI(); /+ ↓ abstraction init +/ scope(success) { } @@ -355,7 +355,7 @@ template docAbstraction() { previous_length=0; reset_note_numbers=true; } - mixin spineRgxInitFlags; + mixin spineRgxDocStructFlags; mixin spineNode; auto node_para_int_ = node_metadata_para_int; auto node_para_str_ = node_metadata_para_str; @@ -2439,7 +2439,7 @@ template docAbstraction() { char[] line, int[string] obj_type_status, ) { - static auto rgx = Rgx(); + static auto rgx = RgxI(); if (!(line.empty) && (obj_type_status["ocn_status_off_for_multiple_objects"] == OCN_off_block_status.off) ) { @@ -2540,7 +2540,7 @@ template docAbstraction() { return ref uint[string] dochas, return ref string[string] object_number_poem ) { - static auto rgx = Rgx(); + static auto rgx = RgxI(); if (auto m = line.matchFirst(rgx.block_curly_code_open)) { dochas["codeblock"]++; an_object["lang"] = ""; @@ -2725,7 +2725,7 @@ template docAbstraction() { string[string] an_object, return ref int[string] obj_type_status ) { - static auto rgx = Rgx(); + static auto rgx = RgxI(); if (obj_type_status["curly_quote"] == TriState.on) { if (line.matchFirst(rgx.block_curly_quote_close)) { debug(quote) { // quote (curly) close @@ -2764,7 +2764,7 @@ template docAbstraction() { string[string] an_object, return ref int[string] obj_type_status ) { - static auto rgx = Rgx(); + static auto rgx = RgxI(); if (obj_type_status["curly_group"] == State.on) { if (line.matchFirst(rgx.block_curly_group_close)) { debug(group) { @@ -2803,7 +2803,7 @@ template docAbstraction() { string[string] an_object, return ref int[string] obj_type_status ) { - static auto rgx = Rgx(); + static auto rgx = RgxI(); if (obj_type_status["curly_block"] == TriState.on) { if (line.matchFirst(rgx.block_curly_block_close)) { debug(block) { // block (curly) close @@ -2846,7 +2846,7 @@ template docAbstraction() { CMM conf_make_meta, string[string] tag_in_seg, ) { - static auto rgx = Rgx(); + static auto rgx = RgxI(); if (obj_type_status["curly_poem"] == TriState.on) { if (line.matchFirst(rgx.block_curly_poem_close)) { if (an_object_key in an_object @@ -3084,7 +3084,7 @@ template docAbstraction() { return ref string[string] an_object, return ref int[string] obj_type_status ) { - static auto rgx = Rgx(); + static auto rgx = RgxI(); if (obj_type_status["curly_code"] == TriState.on) { if (line.matchFirst(rgx.block_curly_code_close)) { debug(codecurly) { // code (curly) close @@ -3127,7 +3127,7 @@ template docAbstraction() { return ref int[string] obj_type_status, return ref CMM conf_make_meta, ) { - static auto rgx = Rgx(); + static auto rgx = RgxI(); if (obj_type_status["curly_table"] == TriState.on) { if (line.matchFirst(rgx.block_curly_table_close)) { debug(table) { // table (curly) close @@ -3207,7 +3207,7 @@ template docAbstraction() { ) { mixin spineBiblio; auto jsn = BibJsnStr(); - static auto rgx = Rgx(); + static auto rgx = RgxI(); if (line.matchFirst(rgx.heading_biblio) && obj_type_status["para"] != State.on && obj_type_status["group"] != State.on @@ -3392,7 +3392,7 @@ template docAbstraction() { "code block status: closed" ); assertions_flag_types_block_status_none_or_closed(obj_type_status); - static auto rgx = Rgx(); + static auto rgx = RgxI(); if (obj_type_status["quote"] == TriState.closing) { obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); an_object["bookindex_nugget"] @@ -3685,7 +3685,7 @@ template docAbstraction() { return ref int[string] obj_type_status, B opt_action, ) { - static auto rgx = Rgx(); + static auto rgx = RgxI(); if (auto m = line.match(rgx.book_index)) { /+ match book_index +/ debug(bookindexmatch) { writefln( @@ -3735,7 +3735,7 @@ template docAbstraction() { return ref Regex!(char)[string] heading_match_rgx, return ref int[string] obj_type_status ) { - static auto rgx = Rgx(); + static auto rgx = RgxI(); if ((_make_unmarked_headings.length > 2) && (obj_type_status["make_headings"] == State.off)) { /+ headings found +/ debug(headingsfound) { @@ -3875,7 +3875,7 @@ template docAbstraction() { return ref int[string] obj_type_status, return ref CMM conf_make_meta, ) { - static auto rgx = Rgx(); + static auto rgx = RgxI(); if (auto m = line.match(rgx.heading)) { /+ heading match +/ ++line_occur["heading"]; obj_type_status["heading"] = State.on; @@ -4027,7 +4027,7 @@ template docAbstraction() { return ref int[string] obj_type_status, return ref int[string] line_occur, ) { - static auto rgx = Rgx(); + static auto rgx = RgxI(); if (line_occur["para"] == State.off) { line = font_faces_line(line); /+ para matches +/ @@ -4074,7 +4074,7 @@ template docAbstraction() { @safe char[] font_faces_line()( char[] textline, ) { - static auto rgx = Rgx(); + static auto rgx = RgxI(); static auto mkup = InlineMarkup(); if (textline.match(rgx.inline_faces_line)) { textline = textline @@ -4097,7 +4097,7 @@ template docAbstraction() { return ref ObjGenericComposite table_object, H table_head, ) { - static auto rgx = Rgx(); + static auto rgx = RgxI(); table_object.metainfo.is_of_part = "body"; table_object.metainfo.is_of_section = "body"; table_object.metainfo.is_of_type = "block"; @@ -4122,7 +4122,7 @@ template docAbstraction() { return ref ObjGenericComposite table_object, return ref T table_array, ) { - static auto rgx = Rgx(); + static auto rgx = RgxI(); static auto mng = InlineMarkup(); string _table_substantive; ulong col_num; @@ -4246,7 +4246,7 @@ template docAbstraction() { return ref ObjGenericComposite table_object, return ref T table_substantive, ) { - static auto rgx = Rgx(); + static auto rgx = RgxI(); static auto munge = ObjInlineMarkupMunge(); string[] _table_rows = (table_substantive).split(rgx.table_row_delimiter); string[] _table_cols; @@ -4262,7 +4262,7 @@ template docAbstraction() { return ref ObjGenericComposite table_object, return ref T table_substantive, ) { - static auto rgx = Rgx(); + static auto rgx = RgxI(); static auto munge = ObjInlineMarkupMunge(); string[] _table_rows = (table_substantive).split(rgx.table_row_delimiter_special); string[] _table_cols; @@ -4330,7 +4330,7 @@ template docAbstraction() { int n_foot, n_foot_reg, n_foot_sp_asterisk, n_foot_sp_plus; string asterisks_, plus_; string obj_txt_out, tail, note; - static auto rgx = Rgx(); + static auto rgx = RgxI(); static auto mkup = InlineMarkup(); int stage_reset_note_numbers = true; private auto initialize_note_numbers() { @@ -4576,7 +4576,7 @@ template docAbstraction() { } } static struct ObjInlineMarkup { - static auto rgx = Rgx(); + static auto rgx = RgxI(); static auto munge = ObjInlineMarkupMunge(); string[string] obj_txt; static string anchor_tag = ""; @@ -5162,7 +5162,7 @@ template docAbstraction() { ); } } - static auto rgx = Rgx(); + static auto rgx = RgxI(); if (!bookindex_section.empty) { auto bi_main_terms_split_arr = bookindex_section.split(rgx.bi_main_terms_split); @@ -5240,7 +5240,7 @@ template docAbstraction() { } struct BookIndexReportSection { int mkn, skn; - static auto rgx = Rgx(); + static auto rgx = RgxI(); static auto munge = ObjInlineMarkupMunge(); @safe void bookindex_write_section()( string[][string][string] bookindex_unordered_hashes @@ -5434,7 +5434,7 @@ template docAbstraction() { string[string] object_notes; int previous_count; int mkn; - static auto rgx = Rgx(); + static auto rgx = RgxI(); @safe private auto gather_notes_for_endnote_section( ObjGenericComposite[] contents_am, string[string] tag_in_seg, @@ -5722,7 +5722,7 @@ template docAbstraction() { int lv, lv0, lv1, lv2, lv3, lv4, lv5, lv6, lv7; int obj_cite_digit; int[string] p_; // p_ parent_ - static auto rgx = Rgx(); + static auto rgx = RgxI(); @safe ObjGenericComposite node_location_emitter(La,Ta,N)( string lev_markup_number, string[string] tag_in_seg, diff --git a/src/doc_reform/meta/metadoc_harvests_authors.d b/src/doc_reform/meta/metadoc_harvests_authors.d index 3a7aebc..132c0af 100644 --- a/src/doc_reform/meta/metadoc_harvests_authors.d +++ b/src/doc_reform/meta/metadoc_harvests_authors.d @@ -12,7 +12,6 @@ module doc_reform.meta.metadoc_harvests_authors; doc_reform.meta.rgx; mixin spineHarvest; mixin InternalMarkup; - mixin spineRgxInit; template spineMetaDocHarvestsAuthors() { static auto mkup = InlineMarkup(); void spineMetaDocHarvestsAuthors(H,M,O)( diff --git a/src/doc_reform/meta/metadoc_harvests_topics.d b/src/doc_reform/meta/metadoc_harvests_topics.d index 8c41f3b..aeb7cba 100644 --- a/src/doc_reform/meta/metadoc_harvests_topics.d +++ b/src/doc_reform/meta/metadoc_harvests_topics.d @@ -12,7 +12,6 @@ module doc_reform.meta.metadoc_harvests_topics; doc_reform.meta.rgx; mixin spineHarvest; mixin InternalMarkup; - mixin spineRgxInit; template spineMetaDocHarvestsTopics() { static auto mkup = InlineMarkup(); void spineMetaDocHarvestsTopics(H,M,O)( diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d index c7a110b..94ef091 100644 --- a/src/doc_reform/meta/rgx.d +++ b/src/doc_reform/meta/rgx.d @@ -2,8 +2,8 @@ regex: regular expressions used in sisu document parser +/ module doc_reform.meta.rgx; -static template spineRgxInit() { - static struct Rgx { +static template spineRgxIn() { + static struct RgxI { /+ misc +/ // static true_dollar = ctRegex!(`\$`, "gm"); static sep = ctRegex!(`␣`, "gm"); -- cgit v1.2.3