diff options
| author | Ralph Amissah <ralph@amissah.com> | 2017-07-27 04:38:26 -0400 | 
|---|---|---|
| committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:14 -0400 | 
| commit | d56624bce222d870298d937e634fe01aef5c39e4 (patch) | |
| tree | fda4da44a0fdddda9e99202ad69ebce9193c55ba | |
| parent | meta_abstraction, mark some functions pure (diff) | |
static, liberal use of keyword
29 files changed, 225 insertions, 221 deletions
| diff --git a/org/default_misc.org b/org/default_misc.org index 993d2a0..fdba922 100644 --- a/org/default_misc.org +++ b/org/default_misc.org @@ -65,7 +65,7 @@ import  #+name: meta_defaults_template_registers  #+BEGIN_SRC d -string[string][string] conf_aa_empty() { +static string[string][string] conf_aa_empty() {    auto conf_ = [      "webserv": [         "url_root"         : "", @@ -146,7 +146,7 @@ string[string][string] conf_aa_empty() {  #+name: meta_defaults_template_registers  #+BEGIN_SRC d -string[string][string] meta_aa_empty() { +static string[string][string] meta_aa_empty() {    auto meta_ = [      "classify": [        "dewey"             : "", @@ -214,7 +214,7 @@ string[string][string] meta_aa_empty() {  #+name: meta_defaults_template_registers  #+BEGIN_SRC d -auto ptr_head_main = +static auto ptr_head_main =    [      "classify",      "creator", @@ -227,7 +227,7 @@ auto ptr_head_main =      "rights",      "title"    ]; -auto ptr_head_sub_classify = +static auto ptr_head_sub_classify =    [      "dewey",      "keywords", @@ -235,7 +235,7 @@ auto ptr_head_sub_classify =      "subject",      "topic_register"    ]; -auto ptr_head_sub_creator = +static auto ptr_head_sub_creator =    [      "author",      "author_email", @@ -243,7 +243,7 @@ auto ptr_head_sub_creator =      "illustrator",      "translator"    ]; -auto ptr_head_sub_date = +static auto ptr_head_sub_date =    [      "added_to_site",      "available", @@ -253,14 +253,14 @@ auto ptr_head_sub_date =      "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", @@ -275,27 +275,27 @@ auto ptr_head_sub_make =      "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", @@ -394,7 +394,7 @@ header.  #+BEGIN_SRC d  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, @@ -437,7 +437,7 @@ template SiSUrgxInitFlags() {  #+name: meta_defaults_template_node  #+BEGIN_SRC d  template SiSUnode() { -  string[string] node_metadata_heading_str() { +  static string[string] node_metadata_heading_str() {      auto _node = [          "is"                            : "",          "ocn"                           : "", @@ -447,7 +447,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, @@ -460,7 +460,7 @@ template SiSUnode() {      ];      return _node;    } -  string[string] node_metadata_para_str() { +  static string[string] node_metadata_para_str() {      auto _node = [          "is"                            : "",          "ocn"                           : "", @@ -468,7 +468,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, @@ -487,7 +487,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"  : "", @@ -568,7 +568,7 @@ import  #+name: defaults_template_markup  #+BEGIN_SRC d  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 = "┝"; @@ -587,11 +587,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;      } @@ -606,7 +606,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"    ], @@ -673,18 +673,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_);      }    } @@ -695,7 +695,7 @@ template SiSUlanguageCodes() {  #+name: meta_ansi_colors  #+BEGIN_SRC d -string[string] scr_txt_color = [ +static string[string] scr_txt_color = [    "off"           : "\033[0m",    "white"         : "\033[37m",    "white_bold"    : "\033[1m", @@ -731,7 +731,7 @@ string[string] scr_txt_color = [    "navy"          : "\033[34m",    "black"         : "\033[30m"  ]; -string[string] scr_txt_marker = [ +static string[string] scr_txt_marker = [    "white"         : "\033[37m*\033[0m ",    "bold"          : "\033[1m*\033[0m ",    "invert"        : "\033[7m*\033[0m ", diff --git a/org/default_paths.org b/org/default_paths.org index 2a414bd..6d6c1db 100644 --- a/org/default_paths.org +++ b/org/default_paths.org @@ -32,7 +32,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, @@ -131,7 +131,7 @@ doc  #+BEGIN_SRC d  template SiSUpathsSisupod() {    mixin SiSUrgxInit; -  auto rgx = Rgx(); +  static auto rgx = Rgx();    string base_dir = "sisupod";    string suffix = ".zip";    auto SiSUpathsSisupod()() { @@ -157,7 +157,7 @@ template SiSUpathsSisupod() {  #+BEGIN_SRC d  template SiSUpathsSisupodZipped() {    mixin SiSUrgxInit; -  auto rgx = Rgx(); +  static auto rgx = Rgx();    auto SiSUpathsSisupodZipped(Ps,Lng)(      Ps  src_pth_info,      Lng lng, @@ -215,7 +215,7 @@ template SiSUpathsSisupodZipped() {  #+BEGIN_SRC d  template SiSUpathsSisupodFileSystem() {    mixin SiSUrgxInit; -  auto rgx = Rgx(); +  static auto rgx = Rgx();    auto SiSUpathsSisupodFileSystem(Ps,Lng)(      Ps  src_pth_info,      Lng lng, @@ -295,7 +295,7 @@ template SiSUoutPaths() {  #+BEGIN_SRC d  template SiSUpathsHTML() {    mixin SiSUrgxInit; -  auto rgx = Rgx(); +  static auto rgx = Rgx();    auto SiSUpathsHTML(Ps,Lng)(      Ps  src_pth_info,      Lng lng, @@ -340,7 +340,7 @@ template SiSUpathsHTML() {  #+BEGIN_SRC d  template SiSUpathsEPUB() {    mixin SiSUrgxInit; -  auto rgx = Rgx(); +  static auto rgx = Rgx();    auto SiSUpathsEPUB(Ps,Lng)(      Ps  src_pth_info,      Lng lng, diff --git a/org/default_regex.org b/org/default_regex.org index 95167b4..f255bb6 100644 --- a/org/default_regex.org +++ b/org/default_regex.org @@ -30,9 +30,9 @@ http://dlang.org/phobos/std_regex.html    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 {      <<meta_rgx>>      <<prgmkup_rgx>>    } @@ -88,8 +88,8 @@ static comments                                       = ctRegex!(`^%+ |^%+$`);  #+name: meta_rgx  #+BEGIN_SRC d  /+ header +/ -static make_simple_substitutions_rb                     = ctRegex!(`(?P<substitution>/(?P<match>.+?)/,[ ]*['"](?P<replace>.+?)['"])`); -static make_simple_substitutions_d                      = ctRegex!(`(?P<substitution>``(?P<match>.+?)``,[ ]*['"](?P<replace>.+?)['"])`); +static make_simple_substitutions_rb                   = ctRegex!(`(?P<substitution>/(?P<match>.+?)/,[ ]*['"](?P<replace>.+?)['"])`); +static make_simple_substitutions_d                    = ctRegex!(`(?P<substitution>``(?P<match>.+?)``,[ ]*['"](?P<replace>.+?)['"])`);  #+END_SRC  ** native headers @@ -369,9 +369,9 @@ http://dlang.org/phobos/std_regex.html    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 {      <<prgmkup_rgx>>      <<sp_ch_xhtml_rgx>>    } diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index 678462b..cf86961 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -15,7 +15,7 @@  #+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n)  [[./sdp.org][sdp]]  [[./][org/]] -* 1. Document Abstraction                 :module:sdp:meta_metadoc_from_src: +* 1. Document Abstraction                :module:sdp:metadoc_from_src:  Process markup document, create document abstraction.  ** 0. module template @@ -24,7 +24,7 @@ Process markup document, create document abstraction.  /++    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() { @@ -41,7 +41,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])); @@ -215,8 +215,8 @@ int verse_line, heading_ptr;  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(); @@ -513,8 +513,8 @@ the_table_of_contents_section = [    "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; @@ -560,7 +560,7 @@ debug(srclines) {  #+name: abs_in_loop_body_00  #+BEGIN_SRC d  if (!line.empty) { -  _check_ocn_status_(line, type); +  type = _check_ocn_status_(line, type);  }  #+END_SRC @@ -2307,7 +2307,7 @@ functions used in document abstraction  #+name: abs_functions_object_reset  #+BEGIN_SRC d -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]));    } @@ -2316,6 +2316,7 @@ auto object_reset(O)(ref O an_object) {    an_object.remove("is");    an_object.remove("attrib");    an_object.remove("bookindex_nugget"); +  return an_object;  }  #+END_SRC @@ -2337,7 +2338,7 @@ auto _common_reset_(L,O,T)(    line_occur["para"]    = State.off;    type["heading"]       = State.off;    type["para"]          = State.off; -  object_reset(an_object); +  an_object = object_reset(an_object);  }  #+END_SRC @@ -2345,15 +2346,15 @@ auto _common_reset_(L,O,T)(  #+name: abs_functions_ocn_status  #+BEGIN_SRC d -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)) { @@ -2393,6 +2394,7 @@ void _check_ocn_status_(L,T)(        }      }    } +  return type;  }  #+END_SRC @@ -2418,7 +2420,7 @@ void _start_block_(L,T,N)(  #+name: abs_functions_block  #+BEGIN_SRC d -  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)) { @@ -2604,7 +2606,7 @@ void _code_block_(L,O,T)(      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 @@ -2745,7 +2747,7 @@ void _biblio_block_(  ) {    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; @@ -2874,7 +2876,7 @@ void _quote_block_(L,O,T)(      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 @@ -2926,7 +2928,7 @@ void _group_block_(L,O,T)(      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) { @@ -2979,7 +2981,7 @@ void _block_block_(L,O,T)(      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 @@ -3036,7 +3038,7 @@ void _poem_block_(L,O,T,C,N,Ma)(      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 @@ -3272,7 +3274,7 @@ void _table_block_(L,O,T,Ma)(      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 @@ -3695,7 +3697,7 @@ auto _book_index_(L,I,O,T,B)(      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 @@ -3761,7 +3763,7 @@ auto _heading_found_(L,X,H,R,T)(      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 +/ @@ -3933,7 +3935,7 @@ auto _heading_matched_(L,C,O,K,Lv,Lc,T,Me)(      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; @@ -4092,7 +4094,7 @@ void _para_match_(L,O,K,I,B,T,C)(      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 +/ @@ -4142,9 +4144,9 @@ void _para_match_(L,O,K,I,B,T,C)(  #+name: abs_functions_para  #+BEGIN_SRC d  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")) @@ -4173,7 +4175,7 @@ auto table_instructions(O,H)(    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"; @@ -4201,8 +4203,8 @@ auto table_array_munge(O,T)(    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_; @@ -4331,8 +4333,8 @@ auto table_array_munge_open_close(O,T)(    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) { @@ -4356,8 +4358,8 @@ auto table_substantive_munge(O,T)(    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; @@ -4378,8 +4380,8 @@ auto table_substantive_munge_special(O,T)(    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; @@ -4424,13 +4426,13 @@ pure struct OCNemitter {  #+name: meta_emitters_obj_inline_markup_munge  #+BEGIN_SRC d -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; @@ -4444,11 +4446,11 @@ struct ObjInlineMarkupMunge {  #+name: meta_emitters_obj_inline_markup_munge  #+BEGIN_SRC d -  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)) { @@ -4853,9 +4855,9 @@ struct ObjInlineMarkupMunge {  #+name: meta_emitters_obj_inline_markup  #+BEGIN_SRC d -struct ObjInlineMarkup { -  auto rgx = Rgx(); -  auto munge = ObjInlineMarkupMunge(); +static struct ObjInlineMarkup { +  static auto rgx = Rgx(); +  static auto munge = ObjInlineMarkupMunge();    string[string] obj_txt;  #+END_SRC @@ -4986,7 +4988,7 @@ struct ObjInlineMarkup {    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=""; @@ -5748,7 +5750,7 @@ struct BookIndexNuggetHash {      }    }    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); @@ -5845,8 +5847,8 @@ struct BookIndexReportIndent {  #+BEGIN_SRC d  struct BookIndexReportSection {    int  mkn, skn; -  auto rgx = Rgx(); -  auto munge = ObjInlineMarkupMunge(); +  static auto rgx = Rgx(); +  static auto munge = ObjInlineMarkupMunge();  #+END_SRC  ****** bookindex write section @@ -5900,7 +5902,7 @@ struct BookIndexReportSection {      }      mixin SiSUnode;      mixin InternalMarkup; -    auto mkup = InlineMarkup(); +    static auto mkup = InlineMarkup();      string type_is;      string lev;      int heading_lev_markup, heading_lev_collapsed; @@ -6062,7 +6064,7 @@ struct NotesSection {    string[string] object_notes;    int previous_count;    int mkn; -  auto rgx = Rgx(); +  static auto rgx = Rgx();  #+END_SRC  ***** { gather notes for endnote section struct open @@ -6090,8 +6092,8 @@ struct NotesSection {    }    body {      mixin InternalMarkup; -    auto mkup = InlineMarkup(); -    auto munge = ObjInlineMarkupMunge(); +    static auto mkup = InlineMarkup(); +    static auto munge = ObjInlineMarkupMunge();      foreach(        m;        (contents_am[cntr].text).matchAll( @@ -6394,7 +6396,7 @@ struct NodeStructureMetadata {    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();  #+END_SRC  ***** node metadata emitter diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org index 5e4cb6d..2f06970 100644 --- a/org/meta_conf_make_meta.org +++ b/org/meta_conf_make_meta.org @@ -47,7 +47,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, @@ -95,7 +95,7 @@ template SiSUextractSDLang() {    struct extractSDL {      mixin SiSUregisters;      mixin SiSUrgxInit; -    auto rgx = Rgx(); +    static auto rgx = Rgx();      <<meta_conf_make_meta_sdl>>    }  } @@ -276,7 +276,7 @@ template SiSUheaderExtractNative() {      mixin SiSUregisters;      mixin SiSUrgxInitFlags;      mixin SiSUrgxInit; -    auto rgx = Rgx(); +    static auto rgx = Rgx();      enum State { off, on }      string hm, hs;      <<meta_markup_header_extract_native>> @@ -630,8 +630,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)) { @@ -698,7 +698,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/org/meta_debugs.org b/org/meta_debugs.org index fb34b34..cd457e4 100644 --- a/org/meta_debugs.org +++ b/org/meta_debugs.org @@ -72,7 +72,7 @@ import  #+name: initialize  #+BEGIN_SRC d -auto rgx = Rgx(); +static auto rgx = Rgx();  auto markup = InlineMarkup();  string key;  #+END_SRC diff --git a/org/meta_read_source_files.org b/org/meta_read_source_files.org index 06c3cb7..c8355ae 100644 --- a/org/meta_read_source_files.org +++ b/org/meta_read_source_files.org @@ -161,7 +161,7 @@ template SiSUrawMarkupContent() {      sdp.meta.rgx;    <<imports_std>>    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 = @@ -313,7 +313,7 @@ final private char[][] markupSourceLineArray(in char[] src_text) {  #+name: meta_markup_source_raw_read_in_file  #+BEGIN_SRC d  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/org/output_hub.org b/org/output_hub.org index f4eb1de..8f06194 100644 --- a/org/output_hub.org +++ b/org/output_hub.org @@ -28,7 +28,7 @@ template outputHub() {    <<output_imports>>    void outputHub(D,I)(D doc_abstraction, I doc_matters) {      mixin SiSUoutputRgxInit; -    auto rgx = Rgx(); +    static auto rgx = Rgx();      <<output_options>>    }  } @@ -36,7 +36,7 @@ template outputHubOp() {    <<output_imports>>    void outputHubOp(C)(C config) {      mixin SiSUoutputRgxInit; -    auto rgx = Rgx(); +    static auto rgx = Rgx();      <<output_options_op>>    }  } diff --git a/org/output_sisupod.org b/org/output_sisupod.org index 338fc33..a2085dd 100644 --- a/org/output_sisupod.org +++ b/org/output_sisupod.org @@ -69,7 +69,7 @@ auto pth_sisupod = SiSUpathsSisupodZipped!()(src_path_info, lng);  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));  #+END_SRC diff --git a/org/output_xmls.org b/org/output_xmls.org index ae58b4b..19ed021 100644 --- a/org/output_xmls.org +++ b/org/output_xmls.org @@ -26,7 +26,7 @@ template outputXHTMLs() {    <<output_imports>>    mixin SiSUoutputRgxInit;    struct outputXHTMLs { -    auto rgx = Rgx(); +    static auto rgx = Rgx();      <<xhtml_format_objects>>      <<xhtml_format_objects_code>>    } diff --git a/org/sdp.org b/org/sdp.org index eed2bbc..7b3a608 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -198,7 +198,7 @@ string[] fns_src;  string flag_action;  string arg_unrecognized;  enum dAM { abstraction, matters } -auto rgx = Rgx(); +static auto rgx = Rgx();  #+END_SRC  *** scope (run complete)                                            :scope: @@ -464,7 +464,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){      <<sdp_conf_files>>      <<sdp_each_file_do_read_and_split_sisu_markup_file_content_into_header_and_body>> 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<substitution>/(?P<match>.+?)/,[ ]*['"](?P<replace>.+?)['"])`); -    static make_simple_substitutions_d                      = ctRegex!(`(?P<substitution>``(?P<match>.+?)``,[ ]*['"](?P<replace>.+?)['"])`); +    static make_simple_substitutions_rb                   = ctRegex!(`(?P<substitution>/(?P<match>.+?)/,[ ]*['"](?P<replace>.+?)['"])`); +    static make_simple_substitutions_d                    = ctRegex!(`(?P<substitution>``(?P<match>.+?)``,[ ]*['"](?P<replace>.+?)['"])`);      /+ 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!("^<br>\n|<br>\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( | 
