From d56624bce222d870298d937e634fe01aef5c39e4 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 27 Jul 2017 04:38:26 -0400 Subject: static, liberal use of keyword --- src/sdp/meta/composite_make.d | 4 +- src/sdp/meta/conf_make_meta.d | 2 +- src/sdp/meta/conf_make_meta_native.d | 2 +- src/sdp/meta/conf_make_meta_sdlang.d | 2 +- src/sdp/meta/defaults.d | 54 +++++++++--------- src/sdp/meta/doc_debugs.d | 2 +- src/sdp/meta/metadoc.d | 2 +- src/sdp/meta/metadoc_from_src.d | 106 ++++++++++++++++++----------------- src/sdp/meta/read_source_files.d | 4 +- src/sdp/meta/rgx.d | 8 +-- src/sdp/output/defaults.d | 16 +++--- src/sdp/output/hub.d | 4 +- src/sdp/output/paths_output.d | 10 ++-- src/sdp/output/paths_source.d | 2 +- src/sdp/output/rgx.d | 4 +- src/sdp/output/source_sisupod.d | 2 +- src/sdp/output/xmls.d | 2 +- src/sdp/sdp.d | 2 +- 18 files changed, 115 insertions(+), 113 deletions(-) (limited to 'src') diff --git a/src/sdp/meta/composite_make.d b/src/sdp/meta/composite_make.d index dc28206..bcbe20c 100644 --- a/src/sdp/meta/composite_make.d +++ b/src/sdp/meta/composite_make.d @@ -13,8 +13,8 @@ template compositeMkCnf() { string _italics; string _emphasis; auto compositeMkCnf(Mks...)(Mks makes) { + static auto rgx = Rgx(); foreach (make; makes) { - auto rgx = Rgx(); if (auto z = "make" in make) { if (auto x = "substitute" in *z) { foreach (m; (*x).matchAll(rgx.make_simple_substitutions_d)) { @@ -78,7 +78,7 @@ template compositeMkCnfAA() { mixin SiSUrgxInit; string[] _substitutions; string[string][] _sub; - auto rgx = Rgx(); + static auto rgx = Rgx(); auto compositeMkCnfAA(Mks...)(Mks makes) { /+ - skip.first_make which is the "composite make output" diff --git a/src/sdp/meta/conf_make_meta.d b/src/sdp/meta/conf_make_meta.d index 5beeae2..140b6ba 100644 --- a/src/sdp/meta/conf_make_meta.d +++ b/src/sdp/meta/conf_make_meta.d @@ -26,7 +26,7 @@ template docHeaderMakeAndMetaTupExtractAndConvertToAA() { mixin SiSUrgxInit; mixin SiSUheaderExtractNative; mixin SiSUextractSDLang; - auto rgx = Rgx(); + static auto rgx = Rgx(); auto docHeaderMakeAndMetaTupExtractAndConvertToAA(DocMake, Src)( DocMake conf_doc_make_aa, Src header_src, diff --git a/src/sdp/meta/conf_make_meta_native.d b/src/sdp/meta/conf_make_meta_native.d index fc7912f..39e40b0 100644 --- a/src/sdp/meta/conf_make_meta_native.d +++ b/src/sdp/meta/conf_make_meta_native.d @@ -20,7 +20,7 @@ template SiSUheaderExtractNative() { mixin SiSUregisters; mixin SiSUrgxInitFlags; mixin SiSUrgxInit; - auto rgx = Rgx(); + static auto rgx = Rgx(); enum State { off, on } string hm, hs; auto header_metadata_and_make_aa(H,Me,Ma)( diff --git a/src/sdp/meta/conf_make_meta_sdlang.d b/src/sdp/meta/conf_make_meta_sdlang.d index f4af643..480a8fe 100644 --- a/src/sdp/meta/conf_make_meta_sdlang.d +++ b/src/sdp/meta/conf_make_meta_sdlang.d @@ -19,7 +19,7 @@ template SiSUextractSDLang() { struct extractSDL { mixin SiSUregisters; mixin SiSUrgxInit; - auto rgx = Rgx(); + static auto rgx = Rgx(); private auto docHeaderSDLtagGet(Hs)(Hs src_header) { debug(asserts){ static assert(is(typeof(src_header) == char[])); diff --git a/src/sdp/meta/defaults.d b/src/sdp/meta/defaults.d index fb95e3a..ecc558b 100644 --- a/src/sdp/meta/defaults.d +++ b/src/sdp/meta/defaults.d @@ -22,7 +22,7 @@ template SiSUregisters() { std.uni, std.utf, std.conv : to; - string[string][string] conf_aa_empty() { + static string[string][string] conf_aa_empty() { auto conf_ = [ "webserv": [ "url_root" : "", @@ -97,7 +97,7 @@ template SiSUregisters() { ]; return conf_; } - string[string][string] meta_aa_empty() { + static string[string][string] meta_aa_empty() { auto meta_ = [ "classify": [ "dewey" : "", @@ -159,7 +159,7 @@ template SiSUregisters() { ]; return meta_; } - auto ptr_head_main = + static auto ptr_head_main = [ "classify", "creator", @@ -172,7 +172,7 @@ template SiSUregisters() { "rights", "title" ]; - auto ptr_head_sub_classify = + static auto ptr_head_sub_classify = [ "dewey", "keywords", @@ -180,7 +180,7 @@ template SiSUregisters() { "subject", "topic_register" ]; - auto ptr_head_sub_creator = + static auto ptr_head_sub_creator = [ "author", "author_email", @@ -188,7 +188,7 @@ template SiSUregisters() { "illustrator", "translator" ]; - auto ptr_head_sub_date = + static auto ptr_head_sub_date = [ "added_to_site", "available", @@ -198,14 +198,14 @@ template SiSUregisters() { "published", "valid" ]; - auto ptr_head_sub_identifier = + static auto ptr_head_sub_identifier = [ "isbn", "oclc", "pg" ]; /+ make +/ - auto ptr_head_sub_make = + static auto ptr_head_sub_make = [ "cover_image", "home_button_image", @@ -220,27 +220,27 @@ template SiSUregisters() { "texpdf_font", "css" ]; - auto ptr_head_sub_notes = + static auto ptr_head_sub_notes = [ "abstract", "description" ]; - auto ptr_head_sub_original = + static auto ptr_head_sub_original = [ "language", "source", "title" ]; - auto ptr_head_sub_publisher = + static auto ptr_head_sub_publisher = [ "name" ]; - auto ptr_head_sub_rights = + static auto ptr_head_sub_rights = [ "copyright", "cover", "illustrations", "license" ]; - auto ptr_head_sub_title = + static auto ptr_head_sub_title = [ "edition", "full", @@ -254,7 +254,7 @@ template SiSUregisters() { } template SiSUrgxInitFlags() { /+ regex flags +/ - int[string] flags_type_init() { + static int[string] flags_type_init() { int[string] flags_type_init = [ "make_headings" : 0, "header_make" : 0, @@ -293,7 +293,7 @@ template SiSUrgxInitFlags() { } } template SiSUnode() { - string[string] node_metadata_heading_str() { + static string[string] node_metadata_heading_str() { auto _node = [ "is" : "", "ocn" : "", @@ -303,7 +303,7 @@ template SiSUnode() { ]; return _node; } - int[string] node_metadata_heading_int() { + static int[string] node_metadata_heading_int() { auto _node = [ "ocn" : 0, // decide whether to use or keep? "ptr_doc_object" : 0, @@ -316,7 +316,7 @@ template SiSUnode() { ]; return _node; } - string[string] node_metadata_para_str() { + static string[string] node_metadata_para_str() { auto _node = [ "is" : "", "ocn" : "", @@ -324,7 +324,7 @@ template SiSUnode() { ]; return _node; } - int[string] node_metadata_para_int() { + static int[string] node_metadata_para_int() { auto _node = [ "ocn" : 0, "indent_base" : 0, @@ -337,7 +337,7 @@ template SiSUnode() { template SiSUbiblio() { // required: deemed_author (author || editor); year; fulltitle; struct BibJsnStr { - auto biblio_entry_tags_jsonstr() { + static auto biblio_entry_tags_jsonstr() { string x = `{ "is" : "", "sortby_deemed_author_year_title" : "", @@ -372,7 +372,7 @@ template SiSUbiblio() { } } template InternalMarkup() { - struct InlineMarkup { + static struct InlineMarkup { auto en_a_o = "【"; auto en_a_c = "】"; auto en_b_o = "〖"; auto en_b_c = "〗"; auto lnk_o = "┥"; auto lnk_c = "┝"; @@ -391,11 +391,11 @@ template InternalMarkup() { auto tc_c = "┚"; auto tc_p = "┆"; auto mono = "■"; - string indent_by_spaces_provided(int indent, string _indent_spaces ="░░") { + static string indent_by_spaces_provided(int indent, string _indent_spaces ="░░") { _indent_spaces = replicate(_indent_spaces, indent); return _indent_spaces; } - string repeat_character_by_number_provided(C,N)(C _character ="-", N number=10) { + static string repeat_character_by_number_provided(C,N)(C _character ="-", N number=10) { _character = replicate(_character, number); return _character; } @@ -404,7 +404,7 @@ template InternalMarkup() { template SiSUlanguageCodes() { /+ language codes +/ struct Lang { - string[string][string] codes() { + static string[string][string] codes() { auto _lang_codes = [ "am": [ "c": "am", "n": "Amharic", "t": "Amharic", "xlp": "amharic" ], "bg": [ "c": "bg", "n": "Bulgarian", "t": "Български (Bəlgarski)", "xlp": "bulgarian" ], @@ -471,18 +471,18 @@ template SiSUlanguageCodes() { ]; return _lang_codes; } - string[] code_arr_ptr() { + static string[] code_arr_ptr() { auto _lang_codes = ["am", "bg", "bn", "br", "ca", "cs", "cy", "da", "de", "el", "en", "eo", "es", "et", "eu", "fi", "fr", "ga", "gl", "he", "hi", "hr", "hy", "ia", "is", "it", "ja", "ko", "la", "lo", "lt", "lv", "ml", "mr", "nl", "no", "nn", "oc", "pl", "pt", "pt_BR", "ro", "ru", "sa", "se", "sk", "sl", "sq", "sr", "sv", "ta", "te", "th", "tk", "tr", "uk", "ur", "us", "vi", "zh", "en", "xx",]; return _lang_codes; } - string[] code_arr() { + static string[] code_arr() { auto _lang_codes = ["am", "bg", "bn", "br", "ca", "cs", "cy", "da", "de", "el", "en", "eo", "es", "et", "eu", "fi", "fr", "ga", "gl", "he", "hi", "hr", "hy", "ia", "is", "it", "ja", "ko", "la", "lo", "lt", "lv", "ml", "mr", "nl", "no", "nn", "oc", "pl", "pt", "pt_BR", "ro", "ru", "sa", "se", "sk", "sl", "sq", "sr", "sv", "ta", "te", "th", "tk", "tr", "uk", "ur", "vi", "zh"]; return _lang_codes; } - auto codes_() { + static auto codes_() { return "(" ~ join(code_arr,"|") ~ ")"; } - auto codes_regex() { + static auto codes_regex() { return regex(codes_); } } diff --git a/src/sdp/meta/doc_debugs.d b/src/sdp/meta/doc_debugs.d index 6d94b05..19cd4b1 100644 --- a/src/sdp/meta/doc_debugs.d +++ b/src/sdp/meta/doc_debugs.d @@ -28,7 +28,7 @@ template SiSUdebugs() { ) { mixin SiSUrgxInit; mixin InternalMarkup; - auto rgx = Rgx(); + static auto rgx = Rgx(); auto markup = InlineMarkup(); string key; debug(parent) { diff --git a/src/sdp/meta/metadoc.d b/src/sdp/meta/metadoc.d index 4174b67..243da9d 100644 --- a/src/sdp/meta/metadoc.d +++ b/src/sdp/meta/metadoc.d @@ -29,7 +29,7 @@ template SiSUabstraction() { enum headBody { header, body_content, insert_filelist } enum makeMeta { make, meta } enum docAbst { doc_abstraction, section_keys, segnames, segnames_0_4, images } - auto rgx = Rgx(); + static auto rgx = Rgx(); auto SiSUabstraction(Fn,O,E)(Fn fn_src, O opts, E env){ auto sdl_root_config_share = configRead!()("config_local", env); auto sdl_root_config_local = configRead!()("config_share", env); diff --git a/src/sdp/meta/metadoc_from_src.d b/src/sdp/meta/metadoc_from_src.d index 0484cae..ebcfe71 100644 --- a/src/sdp/meta/metadoc_from_src.d +++ b/src/sdp/meta/metadoc_from_src.d @@ -1,7 +1,7 @@ /++ document abstraction: abstraction of sisu markup for downstream processing - meta_metadoc_from_src.d + metadoc_from_src.d +/ module sdp.meta.metadoc_from_src; template SiSUdocAbstraction() { @@ -64,8 +64,8 @@ template SiSUdocAbstraction() { int[string] indent; bool bullet = true; string content_non_header = "8"; - auto obj_im = ObjInlineMarkup(); - auto obj_att = ObjAttributes(); + static auto obj_im = ObjInlineMarkup(); + static auto obj_att = ObjAttributes(); /+ ocn +/ int obj_cite_number, obj_cite_number_; auto object_citation_number = OCNemitter(); @@ -232,7 +232,7 @@ template SiSUdocAbstraction() { Meta dochead_meta_aa, Opt opt_action, ) { - auto rgx = Rgx(); + static auto rgx = Rgx(); debug(asserts) { static assert(is(typeof(markup_sourcefile_content) == char[][])); static assert(is(typeof(dochead_make_aa) == string[string][string])); @@ -341,8 +341,8 @@ template SiSUdocAbstraction() { "seg": [toc_head], "scroll": [toc_head], ]; - auto mkup = InlineMarkup(); - auto munge = ObjInlineMarkupMunge(); + static auto mkup = InlineMarkup(); + static auto munge = ObjInlineMarkupMunge(); auto note_section = NotesSection(); auto bookindex_extract_hash = BookIndexNuggetHash(); string[][string] lev4_subtoc; @@ -380,7 +380,7 @@ template SiSUdocAbstraction() { } } if (!line.empty) { - _check_ocn_status_(line, type); + type = _check_ocn_status_(line, type); } if (type["code"] == TriState.on) { /+ block object: code +/ @@ -1715,7 +1715,7 @@ template SiSUdocAbstraction() { /+ post loop markup document/text ↑ +/ } /+ ← closed: abstract doc source +/ /+ ↓ abstraction functions +/ - auto object_reset(O)(ref O an_object) { + static auto object_reset(O)(O an_object) { debug(asserts) { static assert(is(typeof(an_object) == string[string])); } @@ -1724,6 +1724,7 @@ template SiSUdocAbstraction() { an_object.remove("is"); an_object.remove("attrib"); an_object.remove("bookindex_nugget"); + return an_object; } auto _common_reset_(L,O,T)( return ref L line_occur, @@ -1739,17 +1740,17 @@ template SiSUdocAbstraction() { line_occur["para"] = State.off; type["heading"] = State.off; type["para"] = State.off; - object_reset(an_object); + an_object = object_reset(an_object); } - void _check_ocn_status_(L,T)( + static auto _check_ocn_status_(L,T)( L line, - return ref T type + T type ) { debug(asserts) { static assert(is(typeof(line) == char[])); static assert(is(typeof(type) == int[string])); } - auto rgx = Rgx(); + static auto rgx = Rgx(); if ((!line.empty) && (type["ocn_status_multi_obj"] == TriState.off)) { /+ not multi-line object, check whether obj_cite_number is on or turned off +/ if (line.matchFirst(rgx.obj_cite_number_block_marks)) { @@ -1789,6 +1790,7 @@ template SiSUdocAbstraction() { } } } + return type; } void _start_block_(L,T,N)( L line, @@ -1800,7 +1802,7 @@ template SiSUdocAbstraction() { static assert(is(typeof(type) == int[string])); static assert(is(typeof(obj_cite_number_poem) == string[string])); } - auto rgx = Rgx(); + static auto rgx = Rgx(); string code_block_syntax = ""; bool code_block_numbered = false; if (auto m = line.matchFirst(rgx.block_curly_code_open)) { @@ -1967,7 +1969,7 @@ template SiSUdocAbstraction() { static assert(is(typeof(an_object) == string[string])); static assert(is(typeof(type) == int[string])); } - auto rgx = Rgx(); + static auto rgx = Rgx(); if (type["curly_quote"] == TriState.on) { if (line.matchFirst(rgx.block_curly_quote_close)) { debug(quote) { // quote (curly) close @@ -2010,7 +2012,7 @@ template SiSUdocAbstraction() { static assert(is(typeof(an_object) == string[string])); static assert(is(typeof(type) == int[string])); } - auto rgx = Rgx(); + static auto rgx = Rgx(); if (type["curly_group"] == State.on) { if (line.matchFirst(rgx.block_curly_group_close)) { debug(group) { @@ -2053,7 +2055,7 @@ template SiSUdocAbstraction() { static assert(is(typeof(an_object) == string[string])); static assert(is(typeof(type) == int[string])); } - auto rgx = Rgx(); + static auto rgx = Rgx(); if (type["curly_block"] == TriState.on) { if (line.matchFirst(rgx.block_curly_block_close)) { debug(block) { // block (curly) close @@ -2102,7 +2104,7 @@ template SiSUdocAbstraction() { static assert(is(typeof(obj_cite_number_poem) == string[string])); static assert(is(typeof(dochead_make_aa) == string[string][string])); } - auto rgx = Rgx(); + static auto rgx = Rgx(); if (type["curly_poem"] == TriState.on) { if (line.matchFirst(rgx.block_curly_poem_close)) { if (an_object_key in an_object @@ -2315,7 +2317,7 @@ template SiSUdocAbstraction() { static assert(is(typeof(an_object) == string[string])); static assert(is(typeof(type) == int[string])); } - auto rgx = Rgx(); + static auto rgx = Rgx(); if (type["curly_code"] == TriState.on) { if (line.matchFirst(rgx.block_curly_code_close)) { debug(code) { // code (curly) close @@ -2363,7 +2365,7 @@ template SiSUdocAbstraction() { static assert(is(typeof(an_object) == string[string])); static assert(is(typeof(type) == int[string])); } - auto rgx = Rgx(); + static auto rgx = Rgx(); if (type["curly_table"] == TriState.on) { if (line.matchFirst(rgx.block_curly_table_close)) { debug(table) { // table (curly) close @@ -2446,7 +2448,7 @@ template SiSUdocAbstraction() { ) { mixin SiSUbiblio; auto jsn = BibJsnStr(); - auto rgx = Rgx(); + static auto rgx = Rgx(); if (line.matchFirst(rgx.heading_biblio)) { type["biblio_section"] = TriState.on; type["blurb_section"] = State.off; @@ -2862,7 +2864,7 @@ template SiSUdocAbstraction() { static assert(is(typeof(type) == int[string])); static assert(is(typeof(opt_action) == bool[string])); } - auto rgx = Rgx(); + static auto rgx = Rgx(); if (auto m = line.match(rgx.book_index)) { /+ match book_index +/ debug(bookindexmatch) { // book index @@ -2921,7 +2923,7 @@ template SiSUdocAbstraction() { static assert(is(typeof(heading_match_rgx) == Regex!(char)[string])); static assert(is(typeof(type) == int[string])); } - auto rgx = Rgx(); + static auto rgx = Rgx(); if ((dochead_make_identify_unmarked_headings.length > 2) && (type["make_headings"] == State.off)) { /+ headings found +/ @@ -3081,7 +3083,7 @@ template SiSUdocAbstraction() { static assert(is(typeof(type) == int[string])); static assert(is(typeof(dochead_meta_aa) == string[string][string])); } - auto rgx = Rgx(); + static auto rgx = Rgx(); if (auto m = line.match(rgx.heading)) { /+ heading match +/ type["heading"] = State.on; @@ -3234,7 +3236,7 @@ template SiSUdocAbstraction() { static assert(is(typeof(type) == int[string])); static assert(is(typeof(line_occur) == int[string])); } - auto rgx = Rgx(); + static auto rgx = Rgx(); if (line_occur["para"] == State.off) { line = font_faces_line(line); /+ para matches +/ @@ -3278,9 +3280,9 @@ template SiSUdocAbstraction() { } } auto font_faces_line(T)( - return ref T textline, + T textline, ) { - auto rgx = Rgx(); + static auto rgx = Rgx(); if (textline.match(rgx.inline_faces_line)) { textline = (textline) .replaceFirst(rgx.inline_emphasis_line, ("*{$1}*$2")) @@ -3294,7 +3296,7 @@ template SiSUdocAbstraction() { return ref O table_object, return ref H table_head, ) { - auto rgx = Rgx(); + static auto rgx = Rgx(); table_object.use = "body"; table_object.is_of = "block"; table_object.is_a = "table"; @@ -3316,8 +3318,8 @@ template SiSUdocAbstraction() { return ref O table_object, return ref T table_array, ) { - auto rgx = Rgx(); - auto mng = InlineMarkup(); + static auto rgx = Rgx(); + static auto mng = InlineMarkup(); string _table_substantive; ulong col_num; ulong col_num_; @@ -3440,8 +3442,8 @@ template SiSUdocAbstraction() { return ref O table_object, return ref T table_array, ) { - auto rgx = Rgx(); - auto mng = InlineMarkup(); + static auto rgx = Rgx(); + static auto mng = InlineMarkup(); string _table_substantive; foreach(row; table_array) { foreach(col; row) { @@ -3459,8 +3461,8 @@ template SiSUdocAbstraction() { return ref O table_object, return ref T table_substantive, ) { - auto rgx = Rgx(); - auto munge = ObjInlineMarkupMunge(); + static auto rgx = Rgx(); + static auto munge = ObjInlineMarkupMunge(); string[] _table_rows = (table_substantive).split(rgx.table_row_delimiter); string[] _table_cols; string[][] _table; @@ -3475,8 +3477,8 @@ template SiSUdocAbstraction() { return ref O table_object, return ref T table_substantive, ) { - auto rgx = Rgx(); - auto munge = ObjInlineMarkupMunge(); + static auto rgx = Rgx(); + static auto munge = ObjInlineMarkupMunge(); string[] _table_rows = (table_substantive).split(rgx.table_row_delimiter_special); string[] _table_cols; string[][] _table; @@ -3508,13 +3510,13 @@ template SiSUdocAbstraction() { } } /+ +/ - struct ObjInlineMarkupMunge { + static struct ObjInlineMarkupMunge { string[string] obj_txt; int n_foot, n_foot_reg, n_foot_sp_asterisk, n_foot_sp_plus; string asterisks_; string obj_txt_out, tail, note; - auto rgx = Rgx(); - auto mkup = InlineMarkup(); + static auto rgx = Rgx(); + static auto mkup = InlineMarkup(); int stage_reset_note_numbers = true; private auto initialize_note_numbers() { n_foot = 0; @@ -3522,11 +3524,11 @@ template SiSUdocAbstraction() { n_foot_sp_asterisk = 0; n_foot_sp_plus = 0; } - string url_links(Ot)(Ot obj_txt_in) { + static string url_links(Ot)(Ot obj_txt_in) { debug(asserts) { static assert(is(typeof(obj_txt_in) == string)); } - auto mng = InlineMarkup(); + static auto mng = InlineMarkup(); obj_txt_in = obj_txt_in.replaceAll(rgx.inline_mono, (mng.mono ~ "{$1}" ~ mng.mono)); /+ url matched +/ if (obj_txt_in.match(rgx.inline_url_generic)) { @@ -3815,9 +3817,9 @@ template SiSUdocAbstraction() { invariant() { } } - struct ObjInlineMarkup { - auto rgx = Rgx(); - auto munge = ObjInlineMarkupMunge(); + static struct ObjInlineMarkup { + static auto rgx = Rgx(); + static auto munge = ObjInlineMarkupMunge(); string[string] obj_txt; auto obj_inline_markup_and_anchor_tags_and_misc(O,K,Ma)( O obj_, @@ -3936,7 +3938,7 @@ template SiSUdocAbstraction() { body { ObjGenericComposite comp_obj_toc; mixin InternalMarkup; - auto mkup = InlineMarkup(); + static auto mkup = InlineMarkup(); char[] heading_toc_ = (obj_["substantive"].dup.strip.to!(char[])).replaceAll(rgx.inline_notes_al, ""); heading_toc_ = _clean_heading_toc_(heading_toc_); auto attrib=""; @@ -4571,7 +4573,7 @@ template SiSUdocAbstraction() { } } body { - auto rgx = Rgx(); + static auto rgx = Rgx(); if (!bookindex_section.empty) { auto bi_main_terms_split_arr = bookindex_section.split(rgx.bi_main_terms_split); @@ -4655,8 +4657,8 @@ template SiSUdocAbstraction() { } struct BookIndexReportSection { int mkn, skn; - auto rgx = Rgx(); - auto munge = ObjInlineMarkupMunge(); + static auto rgx = Rgx(); + static auto munge = ObjInlineMarkupMunge(); auto bookindex_write_section(BI)( BI bookindex_unordered_hashes ) { @@ -4698,7 +4700,7 @@ template SiSUdocAbstraction() { } mixin SiSUnode; mixin InternalMarkup; - auto mkup = InlineMarkup(); + static auto mkup = InlineMarkup(); string type_is; string lev; int heading_lev_markup, heading_lev_collapsed; @@ -4849,7 +4851,7 @@ template SiSUdocAbstraction() { string[string] object_notes; int previous_count; int mkn; - auto rgx = Rgx(); + static auto rgx = Rgx(); private auto gather_notes_for_endnote_section( ObjGenericComposite[] contents_am, string segment_anchor_tag_that_object_belongs_to, @@ -4871,8 +4873,8 @@ template SiSUdocAbstraction() { } body { mixin InternalMarkup; - auto mkup = InlineMarkup(); - auto munge = ObjInlineMarkupMunge(); + static auto mkup = InlineMarkup(); + static auto munge = ObjInlineMarkupMunge(); foreach( m; (contents_am[cntr].text).matchAll( @@ -5115,7 +5117,7 @@ template SiSUdocAbstraction() { int lv, lv0, lv1, lv2, lv3, lv4, lv5, lv6, lv7; int obj_cite_number; int[string] p_; // p_ parent_ - auto rgx = Rgx(); + static auto rgx = Rgx(); ObjGenericComposite node_location_emitter(Lv,Ta,N,C,P,I)( Lv lev_markup_number, Ta segment_anchor_tag, diff --git a/src/sdp/meta/read_source_files.d b/src/sdp/meta/read_source_files.d index 60f0777..482b587 100644 --- a/src/sdp/meta/read_source_files.d +++ b/src/sdp/meta/read_source_files.d @@ -12,7 +12,7 @@ template SiSUrawMarkupContent() { std.file, std.path; mixin SiSUrgxInit; - auto rgx = Rgx(); + static auto rgx = Rgx(); auto rawsrc = RawMarkupContent(); auto SiSUrawMarkupContent(Fn)(Fn fn_src) { auto _0_header_1_body_content_2_insert_filelist_tuple = @@ -93,7 +93,7 @@ template SiSUrawMarkupContent() { return source_line_arr; } auto markupSourceReadIn(in string fn_src) { - auto rgx = Rgx(); + static auto rgx = Rgx(); enforce( fn_src.match(rgx.src_pth), "not a sisu markup filename" diff --git a/src/sdp/meta/rgx.d b/src/sdp/meta/rgx.d index 854e9cc..135f923 100644 --- a/src/sdp/meta/rgx.d +++ b/src/sdp/meta/rgx.d @@ -2,9 +2,9 @@ regex: regular expressions used in sisu document parser +/ module sdp.meta.rgx; -template SiSUrgxInit() { +static template SiSUrgxInit() { import sdp.meta.defaults; - struct Rgx { + static struct Rgx { /+ misc +/ static true_dollar = ctRegex!(`\$`, "gm"); static flag_action = ctRegex!(`^(--[a-z][a-z0-9-]+)$`); @@ -38,8 +38,8 @@ template SiSUrgxInit() { static comment = ctRegex!(`^%+ `); static comments = ctRegex!(`^%+ |^%+$`); /+ header +/ - static make_simple_substitutions_rb = ctRegex!(`(?P/(?P.+?)/,[ ]*['"](?P.+?)['"])`); - static make_simple_substitutions_d = ctRegex!(`(?P``(?P.+?)``,[ ]*['"](?P.+?)['"])`); + static make_simple_substitutions_rb = ctRegex!(`(?P/(?P.+?)/,[ ]*['"](?P.+?)['"])`); + static make_simple_substitutions_d = ctRegex!(`(?P``(?P.+?)``,[ ]*['"](?P.+?)['"])`); /+ header +/ static main_headers = ctRegex!(`^(?:creator|title|rights|date|original|classify|identifier|notes|publisher|make|links)$`, "m"); diff --git a/src/sdp/output/defaults.d b/src/sdp/output/defaults.d index d63c3d5..a15d438 100644 --- a/src/sdp/output/defaults.d +++ b/src/sdp/output/defaults.d @@ -4,7 +4,7 @@ module sdp.output.defaults; template InternalMarkup() { - struct InlineMarkup { + static struct InlineMarkup { auto en_a_o = "【"; auto en_a_c = "】"; auto en_b_o = "〖"; auto en_b_c = "〗"; auto lnk_o = "┥"; auto lnk_c = "┝"; @@ -23,11 +23,11 @@ template InternalMarkup() { auto tc_c = "┚"; auto tc_p = "┆"; auto mono = "■"; - string indent_by_spaces_provided(int indent, string _indent_spaces ="░░") { + static string indent_by_spaces_provided(int indent, string _indent_spaces ="░░") { _indent_spaces = replicate(_indent_spaces, indent); return _indent_spaces; } - string repeat_character_by_number_provided(C,N)(C _character ="-", N number=10) { + static string repeat_character_by_number_provided(C,N)(C _character ="-", N number=10) { _character = replicate(_character, number); return _character; } @@ -36,7 +36,7 @@ template InternalMarkup() { template SiSUlanguageCodes() { /+ language codes +/ struct Lang { - string[string][string] codes() { + static string[string][string] codes() { auto _lang_codes = [ "am": [ "c": "am", "n": "Amharic", "t": "Amharic", "xlp": "amharic" ], "bg": [ "c": "bg", "n": "Bulgarian", "t": "Български (Bəlgarski)", "xlp": "bulgarian" ], @@ -103,18 +103,18 @@ template SiSUlanguageCodes() { ]; return _lang_codes; } - string[] code_arr_ptr() { + static string[] code_arr_ptr() { auto _lang_codes = ["am", "bg", "bn", "br", "ca", "cs", "cy", "da", "de", "el", "en", "eo", "es", "et", "eu", "fi", "fr", "ga", "gl", "he", "hi", "hr", "hy", "ia", "is", "it", "ja", "ko", "la", "lo", "lt", "lv", "ml", "mr", "nl", "no", "nn", "oc", "pl", "pt", "pt_BR", "ro", "ru", "sa", "se", "sk", "sl", "sq", "sr", "sv", "ta", "te", "th", "tk", "tr", "uk", "ur", "us", "vi", "zh", "en", "xx",]; return _lang_codes; } - string[] code_arr() { + static string[] code_arr() { auto _lang_codes = ["am", "bg", "bn", "br", "ca", "cs", "cy", "da", "de", "el", "en", "eo", "es", "et", "eu", "fi", "fr", "ga", "gl", "he", "hi", "hr", "hy", "ia", "is", "it", "ja", "ko", "la", "lo", "lt", "lv", "ml", "mr", "nl", "no", "nn", "oc", "pl", "pt", "pt_BR", "ro", "ru", "sa", "se", "sk", "sl", "sq", "sr", "sv", "ta", "te", "th", "tk", "tr", "uk", "ur", "vi", "zh"]; return _lang_codes; } - auto codes_() { + static auto codes_() { return "(" ~ join(code_arr,"|") ~ ")"; } - auto codes_regex() { + static auto codes_regex() { return regex(codes_); } } diff --git a/src/sdp/output/hub.d b/src/sdp/output/hub.d index b2ae4a6..b7f274a 100644 --- a/src/sdp/output/hub.d +++ b/src/sdp/output/hub.d @@ -13,7 +13,7 @@ template outputHub() { sdp.output.paths_output; void outputHub(D,I)(D doc_abstraction, I doc_matters) { mixin SiSUoutputRgxInit; - auto rgx = Rgx(); + static auto rgx = Rgx(); if ((doc_matters.opt_action["verbose"])) { writeln(doc_matters.keys_seq.seg); } @@ -92,7 +92,7 @@ template outputHubOp() { sdp.output.paths_output; void outputHubOp(C)(C config) { mixin SiSUoutputRgxInit; - auto rgx = Rgx(); + static auto rgx = Rgx(); if ((config["sqlite-create"])) { if ((config["verbose"])) { writeln("sqlite create table... "); } // SQLtableCreate!()(); diff --git a/src/sdp/output/paths_output.d b/src/sdp/output/paths_output.d index bf88b54..8d689d0 100644 --- a/src/sdp/output/paths_output.d +++ b/src/sdp/output/paths_output.d @@ -9,7 +9,7 @@ import std.array, import sdp.meta.rgx; template SiSUpathsSisupod() { mixin SiSUrgxInit; - auto rgx = Rgx(); + static auto rgx = Rgx(); string base_dir = "sisupod"; string suffix = ".zip"; auto SiSUpathsSisupod()() { @@ -29,7 +29,7 @@ template SiSUpathsSisupod() { } template SiSUpathsSisupodZipped() { mixin SiSUrgxInit; - auto rgx = Rgx(); + static auto rgx = Rgx(); auto SiSUpathsSisupodZipped(Ps,Lng)( Ps src_pth_info, Lng lng, @@ -81,7 +81,7 @@ template SiSUpathsSisupodZipped() { } template SiSUpathsSisupodFileSystem() { mixin SiSUrgxInit; - auto rgx = Rgx(); + static auto rgx = Rgx(); auto SiSUpathsSisupodFileSystem(Ps,Lng)( Ps src_pth_info, Lng lng, @@ -149,7 +149,7 @@ template SiSUoutPaths() { } template SiSUpathsHTML() { mixin SiSUrgxInit; - auto rgx = Rgx(); + static auto rgx = Rgx(); auto SiSUpathsHTML(Ps,Lng)( Ps src_pth_info, Lng lng, @@ -188,7 +188,7 @@ template SiSUpathsHTML() { } template SiSUpathsEPUB() { mixin SiSUrgxInit; - auto rgx = Rgx(); + static auto rgx = Rgx(); auto SiSUpathsEPUB(Ps,Lng)( Ps src_pth_info, Lng lng, diff --git a/src/sdp/output/paths_source.d b/src/sdp/output/paths_source.d index d7b326f..c0dc234 100644 --- a/src/sdp/output/paths_source.d +++ b/src/sdp/output/paths_source.d @@ -11,7 +11,7 @@ import std.array, import sdp.meta.rgx; template SiSUpathsSRC() { mixin SiSUrgxInit; - auto rgx = Rgx(); + static auto rgx = Rgx(); auto SiSUpathsSRC(D,Fn)( D _pwd, Fn _fn_src_and_relative_path, diff --git a/src/sdp/output/rgx.d b/src/sdp/output/rgx.d index 728e3f9..343561b 100644 --- a/src/sdp/output/rgx.d +++ b/src/sdp/output/rgx.d @@ -2,9 +2,9 @@ regex: regular expressions used in sisu document parser +/ module sdp.output.rgx; -template SiSUoutputRgxInit() { +static template SiSUoutputRgxInit() { import sdp.output.defaults; - struct Rgx { + static struct Rgx { static newline = ctRegex!("\n", "mg"); static strip_br = ctRegex!("^
\n|
\n*$"); static space = ctRegex!(`[ ]`, "mg"); diff --git a/src/sdp/output/source_sisupod.d b/src/sdp/output/source_sisupod.d index bb8ea80..db19f68 100644 --- a/src/sdp/output/source_sisupod.d +++ b/src/sdp/output/source_sisupod.d @@ -23,7 +23,7 @@ template SiSUpod() { auto pth_sisupod_filesystem = SiSUpathsSisupodFileSystem!()(src_path_info, lng); mixin SiSUlanguageCodes; auto lang = Lang(); - auto rgx = Rgx(); + static auto rgx = Rgx(); assert (doc_matters.source_filename.match(rgx.src_fn)); try { /+ create directory structure +/ diff --git a/src/sdp/output/xmls.d b/src/sdp/output/xmls.d index b86fb46..1181c6f 100644 --- a/src/sdp/output/xmls.d +++ b/src/sdp/output/xmls.d @@ -13,7 +13,7 @@ template outputXHTMLs() { sdp.output.xmls_css; mixin SiSUoutputRgxInit; struct outputXHTMLs { - auto rgx = Rgx(); + static auto rgx = Rgx(); string special_characters(O)( auto return ref const O obj, string _txt diff --git a/src/sdp/sdp.d b/src/sdp/sdp.d index 1abf462..78effa5 100755 --- a/src/sdp/sdp.d +++ b/src/sdp/sdp.d @@ -42,7 +42,7 @@ void main(string[] args) { string flag_action; string arg_unrecognized; enum dAM { abstraction, matters } - auto rgx = Rgx(); + static auto rgx = Rgx(); scope(success) { debug(checkdoc) { writefln( -- cgit v1.2.3