diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2024-03-12 22:39:09 -0400 | 
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2024-03-12 22:56:34 -0400 | 
| commit | e9e17be24eba558c30fcdc41ea5bb9a1da7fd4e7 (patch) | |
| tree | 1ed3c4b528b0a8e54d0eb9babc391e562578c7b4 | |
| parent | nix flake & env upkeep (diff) | |
mark modules as @safe: (& identify what is not)
61 files changed, 757 insertions, 680 deletions
| diff --git a/org/compile_time_info.org b/org/compile_time_info.org index 763a602..f333390 100644 --- a/org/compile_time_info.org +++ b/org/compile_time_info.org @@ -35,6 +35,7 @@ version(Windows) {} else { ... }    compile_time_info  +/  module doc_reform.conf.compile_time_info; +@safe:  template CompileTimeInfo() {    <<spine_compile_time_info_0>>    <<spine_compile_time_info_1>> diff --git a/org/default_misc.org b/org/default_misc.org index fd5681f..22a9781 100644 --- a/org/default_misc.org +++ b/org/default_misc.org @@ -29,6 +29,7 @@    default settings  +/  module doc_reform.meta.defaults; +@safe:  <<meta_defaults_template_node>>  <<meta_defaults_template_curate_metadata>>  <<meta_defaults_template_biblio>> @@ -42,7 +43,7 @@ module doc_reform.meta.defaults;  #+NAME: meta_defaults_template_node  #+BEGIN_SRC d  template spineNode() { -  @safe static string[string] node_metadata_heading_str() { +  static string[string] node_metadata_heading_str() {      string[string] _node = [          "is"                            : "",          "ocn"                           : "", @@ -53,7 +54,7 @@ template spineNode() {      ];      return _node;    } -  @safe static int[string] node_metadata_heading_int() { +  static int[string] node_metadata_heading_int() {      int[string] _node = [          "ocn"                           : 0, // decide whether to use or keep?          "ptr_doc_object"                : 0, @@ -66,7 +67,7 @@ template spineNode() {      ];      return _node;    } -  @safe static string[string] node_metadata_para_str() { +  static string[string] node_metadata_para_str() {      string[string] _node = [          "is"                            : "",          "ocn"                           : "", @@ -74,7 +75,7 @@ template spineNode() {      ];      return _node;    } -  @safe static int[string] node_metadata_para_int() { +  static int[string] node_metadata_para_int() {      int[string] _node = [          "ocn"                           : 0,          "indent_base"                   : 0, @@ -91,7 +92,7 @@ template spineNode() {  #+NAME: meta_defaults_template_curate_metadata  #+BEGIN_SRC d  template spineCurateMetadata() { -  @safe auto spineCurateMetadata() { +  auto spineCurateMetadata() {      struct _Curate {        struct Curate {          string   title                = ""; @@ -131,7 +132,7 @@ template spineCurateMetadata() {  template spineBiblio() {    // required: deemed_author (author || editor); year; fulltitle;    struct BibJsnStr { -    @safe static auto biblio_entry_tags_jsonstr() { +    static auto biblio_entry_tags_jsonstr() {        string x =  `{          "is"                               : "",          "sortby_deemed_author_year_title"  : "", @@ -179,6 +180,7 @@ template spineBiblio() {    default settings  +/  module doc_reform.io_out.defaults; +@safe:  <<defaults_template_init_flags>>  <<defaults_template_markup>>  <<defaults_template_language_codes>> @@ -273,7 +275,7 @@ template InternalMarkup() {  template spineLanguageCodes() {    /+ language codes +/    struct Lang { -    @safe static 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"    ], @@ -340,15 +342,15 @@ template spineLanguageCodes() {        ];        return _lang_codes;      } -    @safe static string[] code_arr_ptr() { +    static string[] code_arr_ptr() {        string[] _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;      } -    @safe static string[] code_arr() { +    static string[] code_arr() {        string[] _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;      } -    @safe static auto codes_() { +    static auto codes_() {        return "(" ~ join(code_arr,"|") ~ ")";      }      static auto codes_regex() { diff --git a/org/default_paths.org b/org/default_paths.org index 009770d..9e9770f 100644 --- a/org/default_paths.org +++ b/org/default_paths.org @@ -30,6 +30,7 @@    meta_config_files.d  +/  module doc_reform.io_in.paths_source; +@safe:  import    std.array,    std.file, @@ -56,7 +57,7 @@ import  template PodManifest() {    mixin spineRgxFiles;    static auto rgx_files = RgxFiles(); -  @safe auto PodManifest(O)( +  auto PodManifest(O)(      O       _opt_action,      string  _pth=""    ) { @@ -64,7 +65,7 @@ template PodManifest() {        string pod_manifest_filename() {          return "pod.manifest";        } -      @safe string pod_manifest_path() { +      string pod_manifest_path() {          string _manifest_path;          if ((isValidPath(_pth) && exists(_pth) != 0 && _pth.isDir)          && (exists(_pth.chainPath(pod_manifest_filename).array) != 0 @@ -86,10 +87,10 @@ template PodManifest() {          }          return _manifest_path;        } -      @safe string pods_collection_root_path() { +      string pods_collection_root_path() {          return (pod_manifest_path.length > 0) ? ((chainPath(pod_manifest_path, "..")).asNormalizedPath).array.to!string : "";        } -      @safe string pod_manifest_file_with_path() { +      string pod_manifest_file_with_path() {          string _k;          if  (exists(pod_manifest_path.chainPath(pod_manifest_filename).array)!=0) {            _k = pod_manifest_path.chainPath(pod_manifest_filename).array; @@ -133,14 +134,14 @@ template PathMatters() {    mixin spineRgxFiles;    static auto rgx_files = RgxFiles();    static auto mkup = InlineMarkup(); -  @safe auto PathMatters(O,E)( +  auto PathMatters(O,E)(      O        _opt_action,      E        _env,      string   _pth,      string   _fns              = "",      char[][] _manifest_fn_list = [[]],    ) { -    @safe auto _manifested = PodManifest!()(_opt_action, _pth); +    auto _manifested = PodManifest!()(_opt_action, _pth);      struct ManifestMatters_ {        auto env() {          auto _env = _env; @@ -154,7 +155,7 @@ template PathMatters() {          }          return Env_();        } -      @safe auto opt() { +      auto opt() {          struct Opt_ {            auto action() {              return _opt_action; @@ -162,45 +163,45 @@ template PathMatters() {          }          return Opt_();        } -      @safe bool src_is_pod() { +      bool src_is_pod() {          return (_manifested.pod_manifest_path.length > 0) ? true : false;        } -      @safe auto pod() { +      auto pod() {          struct Pod_ { -          @safe bool src_is_pod() { +          bool src_is_pod() {              return (_manifested.pod_manifest_path.length > 0) ? true : false;            } -          @safe string collection_root() { +          string collection_root() {              return _manifested.pods_collection_root_path;            } -          @safe string manifest_filename() { +          string manifest_filename() {              return _manifested.pod_manifest_filename;            } -          @safe string manifest_path() { +          string manifest_path() {              return _manifested.pod_manifest_path;            } -          @safe string pod_name_with_path() { +          string pod_name_with_path() {              return _manifested.pod_manifest_path.baseName;            } -          @safe string manifest_file_with_path() { +          string manifest_file_with_path() {              return _manifested.pod_manifest_file_with_path;            } -          @safe string[] config_dr_document_make_dirs() { +          string[] config_dr_document_make_dirs() {              string[] _config_dirs;              return _config_dirs;            } -          @safe string[] config_local_site_dirs() { +          string[] config_local_site_dirs() {              string[] _config_dirs;              return _config_dirs;            } -          @safe string[] image_dirs() { +          string[] image_dirs() {              string[] _image_dirs;              return _image_dirs;            } -          @safe auto manifest_list_of_filenames() { +          auto manifest_list_of_filenames() {              return _manifest_fn_list;            } -          @safe string[] manifest_list_of_languages() { +          string[] manifest_list_of_languages() {              string[] _lngs;              foreach (filename_; manifest_list_of_filenames) {                string _k = "en"; @@ -214,43 +215,43 @@ template PathMatters() {          }          return Pod_();        } -      @safe auto src() { +      auto src() {          string _fns = _fns; // required here by dmd & not by ldc (for D:2078)          auto _opt_action = _opt_action;          auto _env = _env;          struct SRC_ { -          @safe bool is_pod() { +          bool is_pod() {              return (_manifested.pod_manifest_path.length > 0) ? true : false;            } -          @safe string path_and_fn() { +          string path_and_fn() {              return _fns;            } -          @safe string pod_name_with_path() { +          string pod_name_with_path() {              return (is_pod) ? _manifested.pod_manifest_path : "";            } -          @safe string pods_collection_root_path() { +          string pods_collection_root_path() {              return (is_pod) ? _manifested.pods_collection_root_path : "";            } -          @safe string pod_name() { +          string pod_name() {              return pod_name_with_path.baseName;            } -          @safe string filename() { +          string filename() {              return path_and_fn.baseName;            } -          @safe string filename_base() { +          string filename_base() {              return filename.stripExtension;            } -          @safe string filename_extension() { +          string filename_extension() {              return filename.match(rgx_files.src_pth_sst_or_ssm).captures["extension"];            } -          @safe string lng() { +          string lng() {              string _k;              if (auto m = path_and_fn.match(rgx_files.language_code_and_filename)) {                _k = m.captures[1];              } else {_k = "en"; }              return _k;            } -          @safe string doc_uid() { +          string doc_uid() {              string _uid;              if (is_pod && !(pod_name_with_path.empty)) {                if (pod_name_with_path.baseName == filename_base) { @@ -263,7 +264,7 @@ template PathMatters() {              }              return _uid;            } -          @safe string doc_uid_out() { +          string doc_uid_out() {              string _uid;              if (is_pod && !(pod_name_with_path.empty)) {                if (pod_name_with_path.baseName == filename_base) { @@ -276,7 +277,7 @@ template PathMatters() {              }              return _uid;            } -          @safe string docname_composite_unique_per_src_doc() { +          string docname_composite_unique_per_src_doc() {              string _fn;              if (pod_name_with_path.baseName == filename_base) {                _fn = filename_base ~ mkup.uid_sep ~ filename_extension ~ mkup.uid_sep ~ lng; @@ -287,7 +288,7 @@ template PathMatters() {              }              return _fn;            } -          @safe string docname_composite_unique_per_src_pod() { +          string docname_composite_unique_per_src_pod() {            /+              z pod name if any + src filename (without lng code)               filename ~ mkup.uid_sep ~ lng @@ -306,19 +307,19 @@ template PathMatters() {              }              return _fn;            } -          @safe string language() { +          string language() {              return lng();            } -          @safe string file_with_absolute_path() { +          string file_with_absolute_path() {              return _env["pwd"].chainPath(path_and_fn).array;            } -          @safe string absolute_path_to_src() { +          string absolute_path_to_src() {              return (_env["pwd"].chainPath(path_and_fn)).dirName.array;            } -          @safe string path_to_doc_root_path_to_lang_and_filename() { +          string path_to_doc_root_path_to_lang_and_filename() {              return _env["pwd"].chainPath(path_and_fn).array;            } -          @safe string base_dir() { +          string base_dir() {              string _dir;              if (                auto m = (absolute_path_to_src) @@ -336,7 +337,7 @@ template PathMatters() {              }              return _dir;            } -          @safe string base_parent_dir_path() { +          string base_parent_dir_path() {              string _dir;              if (                auto m = (absolute_path_to_src) @@ -348,7 +349,7 @@ template PathMatters() {              }              return _dir;            } -          @safe string base_dir_path() { +          string base_dir_path() {              string _dir;              if (                auto m = (absolute_path_to_src) @@ -368,11 +369,11 @@ template PathMatters() {              }              return _dir;            } -          @safe string media_dir_path() { +          string media_dir_path() {              string _dir = ((base_dir_path.chainPath("media")).asNormalizedPath).array;              return _dir;            } -          @safe string image_dir_path() { +          string image_dir_path() {              string _paths;              string[] _possible_img_pths = [ "./image", "../image", "../../image" ];              string _img_pth_found = ""; @@ -396,10 +397,10 @@ template PathMatters() {              }              return _img_pth_found;            } -          @safe auto conf_dir_path() { +          auto conf_dir_path() {              return ((base_dir_path.chainPath("conf")).asNormalizedPath).array;            } -          @safe auto base_parent_dir() { +          auto base_parent_dir() {              string _dir;              if (                auto m = (absolute_path_to_src) @@ -414,13 +415,13 @@ template PathMatters() {              }              return _dir;            } -          @safe string[] config_dirs() { +          string[] config_dirs() {              string[] _config_dirs;              if (is_pod) {              } else {}              return _config_dirs;            } -          @safe string[] image_dirs() { +          string[] image_dirs() {              string[] _image_dirs;              if (is_pod) {              } else {} @@ -429,7 +430,7 @@ template PathMatters() {          }          return SRC_();        } -      @safe auto output() { +      auto output() {          /+            - command line if output path set            - config file if found and set set @@ -443,7 +444,7 @@ template PathMatters() {          +/          auto _env = _env;          struct Out_ { -          @safe auto path() { +          auto path() {              auto _output_path = _env["pwd"];              if ((_opt_action.output_dir_set.length > 0)                && isValidPath(_opt_action.output_dir_set) @@ -477,21 +478,21 @@ template PathMatters() {  #+NAME: template_paths_src_2  #+BEGIN_SRC d  template configFilePaths() { -  @safe auto configFilePaths(M,E)( +  auto configFilePaths(M,E)(      M      _manifested,      E      _env,      string _cli_config_path_set = ""    ) {      struct ConfFilePaths { -      @safe string config_filename_document() { +      string config_filename_document() {          return "dr_document_make";        } -      @safe string config_filename_site() { +      string config_filename_site() {          return "config_local_site";        } -      @safe auto possible_config_path_locations() { +      auto possible_config_path_locations() {          struct _ConfFilePaths { -          @safe string[] dr_document_make() { +          string[] dr_document_make() {              /+ FIX clean up conf paths ↓ +/              /+ config local site (file system only, not in pod) +/              /+ return paths +/ @@ -539,7 +540,7 @@ template configFilePaths() {              +/              return _possible_config_path_locations;            } -          @safe string[] config_local_site() { +          string[] config_local_site() {              /+ FIX clean up conf paths ↓ +/              /+ config local site (file system only, not in pod) +/              string[] _possible_config_path_locations; @@ -650,15 +651,15 @@ filelist for processing [things to ponder]  template spinePathsSRC() {    mixin spineRgxFiles;    static auto rgx_files = RgxFiles(); -  @safe auto spinePathsSRC(D,Fn)( +  auto spinePathsSRC(D,Fn)(      D   _pwd,      Fn  _fn_src_and_path,    ) {      struct drSrcPaths { -      @safe auto pwd() { +      auto pwd() {          return _pwd;        } -      @safe string language() { +      string language() {          // use command line info as well?          string _k;          if (auto m = _fn_src_and_path.match(rgx_files.language_code_and_filename)) { @@ -668,28 +669,28 @@ template spinePathsSRC() {          }          return _k;        } -      @safe string doc_root() { +      string doc_root() {          return "dr_doc";        } -      @safe auto media_root() { +      auto media_root() {          return ((doc_root.chainPath("media")).asNormalizedPath).array;        } -      @safe auto conf_root() { +      auto conf_root() {          return ((doc_root.chainPath("conf")).asNormalizedPath).array;        } -      @safe auto text_root() { +      auto text_root() {          return ((media_root.chainPath("text")).asNormalizedPath).array;        } -      @safe auto image_root() { +      auto image_root() {          return ((media_root.chainPath("image")).asNormalizedPath).array;        } -      @safe auto doc_src_fn_with_path_for_text_root_and_lng() { +      auto doc_src_fn_with_path_for_text_root_and_lng() {          return ((text_root.chainPath(language)).asNormalizedPath).array;        } -      @safe auto doc_src_fn() { +      auto doc_src_fn() {          return ((_fn_src_and_path.baseName).asNormalizedPath).array;        } -      @safe auto doc_src_with_path() { +      auto doc_src_with_path() {          return ((pwd.chainPath(_fn_src_and_path)).asNormalizedPath).array;        }      } @@ -972,6 +973,7 @@ template spinePathsPods() {    default settings  +/  module doc_reform.io_out.paths_output; +@safe:  import    std.array,    std.path, diff --git a/org/default_regex.org b/org/default_regex.org index 72be106..bce6fa6 100644 --- a/org/default_regex.org +++ b/org/default_regex.org @@ -42,6 +42,7 @@ https://dlang.org/phobos/std_regex.html    regex: regular expressions used in sisu document parser  +/  module doc_reform.meta.rgx; +@safe:  static template spineRgxIn() {    static struct RgxI {      <<meta_rgx_misc>> @@ -460,6 +461,7 @@ https://dlang.org/phobos/std_regex.html    regex: regular expressions used in sisu document parser  +/  module doc_reform.io_out.rgx; +@safe:  static template spineRgxOut() {    static struct RgxO {      <<makes>> @@ -664,6 +666,7 @@ static table_delimiter_row                      = ctRegex!("[ ]*\n", "mg");    regex: regular expressions used in sisu document parser  +/  module doc_reform.meta.rgx_files; +@safe:  static template spineRgxFiles() {    static struct RgxFiles {      <<prgmkup_rgx_filename_and_path>> @@ -697,6 +700,7 @@ static src_formalised_file_path_parts           = ctRegex!(`(?P<pth>(?:[/a-zA-Z0    regex: regular expressions used in sisu document parser  +/  module doc_reform.meta.rgx_yaml; +@safe:  static template spineRgxYamlTags() {    static struct RgxYaml {      <<meta_rgx_yaml>> @@ -723,6 +727,7 @@ static yaml_tag_is_seq                          = ctRegex!(`:seq$`);    regex: regular expressions used in sisu document parser  +/  module doc_reform.io_out.rgx_xhtml; +@safe:  static template spineRgxXHTML() {    static struct RgxXHTML {      <<sp_ch_xhtml_rgx>> @@ -751,6 +756,7 @@ static line_break                               = ctRegex!(` [\\]{2}`, "m"); //    regex: regular expressions used in sisu document parser  +/  module doc_reform.io_out.rgx_latex; +@safe:  static template spineRgxLSC() {    static struct RgxLSC {      <<sp_ch_latex_rgx>> diff --git a/org/default_shared_snippets.org b/org/default_shared_snippets.org index ed262e4..66041f3 100644 --- a/org/default_shared_snippets.org +++ b/org/default_shared_snippets.org @@ -25,6 +25,7 @@  #+BEGIN_SRC d  <<doc_header_including_copyright_and_license>>  module doc_reform.io_out.html_snippet; +@safe:  template htmlSnippet() {    import      std.file, @@ -60,7 +61,7 @@ template htmlSnippet() {      );      return html_blank_default;    } -  @safe string special_characters_text(string _txt) { +  string special_characters_text(string _txt) {      mixin spineRgxOut;      mixin spineRgxXHTML;      static auto rgx = RgxO(); @@ -90,6 +91,7 @@ template htmlSnippet() {    shared default settings  +/  module doc_reform.share.defaults; +@safe:  <<shared_messages>>  #+END_SRC @@ -99,7 +101,7 @@ module doc_reform.share.defaults;  #+BEGIN_SRC d  template Msg() {    import std.stdio; -  @safe auto Msg(I)(I doc_matters) { +  auto Msg(I)(I doc_matters) {      struct Msg_ {        void v()(string message) {          if (doc_matters.opt.action.vox_gt1) { diff --git a/org/in_source_files.org b/org/in_source_files.org index 267bdbc..2e21928 100644 --- a/org/in_source_files.org +++ b/org/in_source_files.org @@ -30,6 +30,7 @@    meta_config_files.d  +/  module doc_reform.io_in.read_config_files; +@safe:  import    std.file,    std.path; @@ -38,7 +39,6 @@ import    doc_reform.io_in.paths_source,    doc_reform.meta.rgx_files,    doc_reform.meta.rgx; -<<meta_config_file_in>>  <<meta_config_file_hub_read_site_config>>  <<meta_config_file_hub_read_document_config>>  <<meta_config_file_hub_read_site_yaml>> @@ -224,13 +224,13 @@ static template readConfigDoc() {        if (config_file_str.length > 0) { break; }      }      struct _ConfContent { -      @safe string filename() { +      string filename() {          return conf_filename;        } -      @safe string content() { +      string content() {          return config_file_str;        } -      @safe string filetype() { +      string filetype() {          string _ft = "";          if (content.match(rgx.yaml_config)) {            _ft = "yaml"; @@ -257,7 +257,7 @@ static template configReadSiteYAML() {      doc_reform.io_in.paths_source,      doc_reform.meta.rgx_files,      doc_reform.meta.rgx; -  @safe final YAMLDocument configReadSiteYAML(M,E)(M _manifested, E _env) { +  final YAMLDocument configReadSiteYAML(M,E)(M _manifested, E _env) {      string _configuration = configReadInSiteYAML!()(_manifested, _env);      auto _conf_file_details = configFilePaths!()(_manifested, _env);      string _conf_yaml_fn = _conf_file_details.config_filename_site; @@ -272,7 +272,7 @@ static template configReadDocYAML() {    import      doc_reform.meta,      doc_reform.io_in.paths_source; -  @safe final YAMLDocument configReadDocYAML(M,E)(M _manifested, E _env) { +  final YAMLDocument configReadDocYAML(M,E)(M _manifested, E _env) {      string _configuration = configReadInDocYAML!()(_manifested, _env);      auto _conf_file_details = configFilePaths!()(_manifested, _env);      string _conf_yaml_fn = _conf_file_details.config_filename_document; @@ -295,6 +295,7 @@ static template configReadDocYAML() {    - if master file scan for addional files to import/insert  +/  module doc_reform.io_in.read_source_files; +@safe:  template spineRawMarkupContent() {    import      std.file, @@ -309,7 +310,7 @@ template spineRawMarkupContent() {    mixin spineRgxFiles;    static auto rgx_files = RgxFiles();    string[] _images=[]; -  @safe string[] _extract_images(S)(S content_block) { +  string[] _extract_images(S)(S content_block) {      string[] images_;      string _content_block = content_block.to!string;      if (auto m = _content_block.matchAll(rgx.image)) { @@ -329,19 +330,19 @@ template spineRawMarkupContent() {      string[], "insert_files",      string[], "images"    ); -  @safe auto spineRawMarkupContent(O,Fn)(O _opt_action, Fn fn_src) { +  auto spineRawMarkupContent(O,Fn)(O _opt_action, Fn fn_src) {      auto _0_header_1_body_content_2_insert_filelist_tuple        = rawsrc.sourceContentSplitIntoHeaderAndBody(_opt_action, rawsrc.sourceContent(fn_src), fn_src);      return _0_header_1_body_content_2_insert_filelist_tuple;    }    struct RawMarkupContent { -    @safe final sourceContent(in string fn_src) { +    final sourceContent(in string fn_src) {        auto raw = MarkupRawUnit();        string source_txt_str          = raw.markupSourceReadIn(fn_src);        return source_txt_str;      } -    @safe final auto sourceContentSplitIntoHeaderAndBody(O)( +    final auto sourceContentSplitIntoHeaderAndBody(O)(        O         _opt_action,        in string source_txt_str,        in string fn_src="" @@ -390,7 +391,7 @@ template spineRawMarkupContent() {        char[][], "insert_contents",        string[], "images"      ); -    @safe ContentsAndImages scan_subdoc_source(O)( +    ContentsAndImages scan_subdoc_source(O)(        O        _opt_action,        char[][] markup_sourcefile_insert_content,        string   fn_src @@ -401,7 +402,7 @@ template spineRawMarkupContent() {        } // end src subdoc (inserts) loop        <<meta_inserts_scan_post>>      } -    @safe ContentsInsertsImages scan_master_src_for_insert_files_and_import_content(O)( +    ContentsInsertsImages scan_master_src_for_insert_files_and_import_content(O)(        O        _opt_action,        char[][] sourcefile_body_content,        string   fn_src @@ -422,7 +423,7 @@ template spineRawMarkupContent() {  #+NAME: meta_markup_source_raw_read_file_source_string  #+BEGIN_SRC d -@safe final private string readInMarkupSource(in char[] fn_src) { +final private string readInMarkupSource(in char[] fn_src) {    enforce(      exists(fn_src) != 0,      "file not found: «" ~ @@ -488,7 +489,7 @@ split is on first match of level A~ (which is required)  #+NAME: meta_markup_source_raw_read_in_file  #+BEGIN_SRC d -@safe string markupSourceReadIn(in string fn_src) { +string markupSourceReadIn(in string fn_src) {    static auto rgx_files = RgxFiles();    enforce(      fn_src.match(rgx_files.src_pth_sst_or_ssm), @@ -509,7 +510,7 @@ split is on first match of level A~ (which is required)  #+NAME: meta_markup_source_raw_tuple_of_header_and_body  #+BEGIN_SRC d -@safe HeaderContentInsertsImages markupSourceHeaderContentRawLineTupleArray(in string source_txt_str) { +HeaderContentInsertsImages markupSourceHeaderContentRawLineTupleArray(in string source_txt_str) {    string[] file_insert_list = [];    string[] images_list = [];    char[][] hc = header0Content1(source_txt_str); @@ -530,7 +531,7 @@ split is on first match of level A~ (which is required)  #+NAME: meta_markup_source_raw_get_insert_source_line_array  #+BEGIN_SRC d -@safe final char[][] getInsertMarkupSourceContentRawLineArray( +final char[][] getInsertMarkupSourceContentRawLineArray(    in char[]    fn_src_insert,    Regex!(char) rgx_file  ) { diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org index e3fe678..8b5fc12 100644 --- a/org/meta_conf_make_meta.org +++ b/org/meta_conf_make_meta.org @@ -237,6 +237,7 @@ import doc_reform.meta.conf_make_meta_structs;  #+BEGIN_SRC d  <<doc_header_including_copyright_and_license>>  module doc_reform.meta.conf_make_meta_structs; +@safe:  <<meta_defaults_template_structs_init>>  <<meta_defaults_template_structs_setup>>  <<meta_defaults_template_structs_composite_make_init>> @@ -276,7 +277,7 @@ static auto mkup = InlineMarkup();  #+NAME: meta_defaults_template_structs_setup  #+BEGIN_SRC d -@safe string url_markup(string line) { +string url_markup(string line) {    string line_ = line      .replaceAll(        rgx.smid_inline_link_markup_regular, @@ -318,7 +319,7 @@ struct ConfCompositeMakeStr {    string[][] substitute;    string     texpdf_font;  } -struct confCompositeMakeBuild { +@trusted struct confCompositeMakeBuild {    string[] bold(string _mk) {      string[] _out;      if (_mk) { @@ -568,6 +569,7 @@ JSONValue config_jsonstr = `{    extract yaml header return struct  +/  module doc_reform.meta.conf_make_meta_yaml; +@safe:  template contentYAMLtoSpineStruct() {    import      std.algorithm, @@ -1746,6 +1748,7 @@ if ("rights" in _yaml    extract json header return json  +/  module doc_reform.meta.conf_make_meta_json; +@safe:  static template contentJSONtoSpineStruct() {    import      std.algorithm, @@ -1763,7 +1766,7 @@ static template contentJSONtoSpineStruct() {      doc_reform.meta.defaults,      doc_reform.meta.rgx;    ConfComposite _struct_composite; -  @safe auto contentJSONtoSpineStruct(C,J,M)(C _struct_composite, J _json, M _manifested, string _identifier) { +  auto contentJSONtoSpineStruct(C,J,M)(C _struct_composite, J _json, M _manifested, string _identifier) {      mixin spineRgxIn;      static auto rgx = RgxI();      debug (json) { diff --git a/org/ocda.org b/org/ocda.org index 3a671ca..74c1f64 100644 --- a/org/ocda.org +++ b/org/ocda.org @@ -30,6 +30,7 @@ Process markup document, create document abstraction.  // abstraction of sisu markup for downstream processing  // metadoc_from_src.d  module doc_reform.meta.metadoc_from_src; +@safe:  template docAbstraction() {    <<docInitialize>>    @system auto docAbstraction(CMM,Opt,Mf) ( @@ -1528,7 +1529,7 @@ struct DocHas_ {      return tag_assoc;    }  } -@safe auto doc_has() { +auto doc_has() {    return DocHas_();  }  // the doc to be returned diff --git a/org/ocda_functions.org b/org/ocda_functions.org index b6240e0..00e391d 100644 --- a/org/ocda_functions.org +++ b/org/ocda_functions.org @@ -30,6 +30,7 @@ Process markup document, create document abstraction.  // abstraction of sisu markup for downstream processing  // metadoc_from_src.d  module doc_reform.meta.metadoc_from_src_functions; +@safe:  template docAbstractionFunctions() {    <<docInitialize>>    <<docAbstractionRelatedFunctions>> @@ -145,11 +146,11 @@ auto node_construct = NodeStructureMetadata();  #+HEADER: :noweb yes  #+BEGIN_SRC d  // ↓ - emitters -@safe pure struct OCNemitter { +pure struct OCNemitter {    int ocn_digit, ocn_object_number, ocn_on_, ocn_off_, ocn_bkidx, ocn_bkidx_;    string object_identifier;    bool ocn_is_off; -  @safe auto ocn_emitter(int ocn_status_flag) { +  auto ocn_emitter(int ocn_status_flag) {      OCNset ocn;      assert(ocn_status_flag <= eN.ocn.reset);      ocn_object_number              = ocn_bkidx = 0; @@ -193,7 +194,7 @@ auto node_construct = NodeStructureMetadata();    invariant() {    }  } -@safe pure ObjGenericComposite obj_heading_ancestors()( +pure ObjGenericComposite obj_heading_ancestors()(    ObjGenericComposite  obj,    string[]             lv_ancestors_txt,  ) { @@ -234,10 +235,10 @@ auto node_construct = NodeStructureMetadata();    }    return obj;  } -@safe static  OCNset ocn_emit(int ocn_status_flag) { +static  OCNset ocn_emit(int ocn_status_flag) {    return object_citation_number.ocn_emitter(ocn_status_flag);  } -@safe static uint[string] _check_ocn_status_()( +static uint[string] _check_ocn_status_()(    char[]       line,    uint[string] pith,  ) { @@ -312,7 +313,7 @@ auto node_construct = NodeStructureMetadata();    return ret;  }  // ↓ - reset object -@safe static string[string] object_reset()(string[string] an_object) { +static string[string] object_reset()(string[string] an_object) {    an_object.remove("body_nugget");    an_object.remove("substantive");    an_object.remove("is"); @@ -330,7 +331,7 @@ auto node_construct = NodeStructureMetadata();  #+HEADER: :noweb yes  #+BEGIN_SRC d  // ↓ - markup text by line -@safe char[] font_faces_line()(char[] textline) { +char[] font_faces_line()(char[] textline) {    static auto rgx = RgxI();    static auto mkup = InlineMarkup();    if (textline.match(rgx.inline_faces_line)) { @@ -350,7 +351,7 @@ auto node_construct = NodeStructureMetadata();    }    return textline;  } -@safe auto inline_markup_faces(L)(L line) { +auto inline_markup_faces(L)(L line) {    static auto rgx = RgxI();    static auto mkup = InlineMarkup();    line = replaceAll!(m => mkup.quote_o ~ m[1] ~ mkup.quote_c)(line, rgx.within_quotes); @@ -361,7 +362,7 @@ auto node_construct = NodeStructureMetadata();    }    return line;  } -@safe static string links_and_images()(string obj_txt) { +static string links_and_images()(string obj_txt) {    static auto rgx = RgxI();    static auto mkup = InlineMarkup();    if (obj_txt.match(rgx.smid_inline_url_generic)) { @@ -401,7 +402,7 @@ auto node_construct = NodeStructureMetadata();    }    return obj_txt;  } -@safe char[] _doc_header_and_make_substitutions_(CMM)( +char[] _doc_header_and_make_substitutions_(CMM)(    char[]  line,    CMM     conf_make_meta,  ) { @@ -416,7 +417,7 @@ auto node_construct = NodeStructureMetadata();    }    return line;  } -@safe char[] _doc_header_and_make_substitutions_fontface_(CMM)( +char[] _doc_header_and_make_substitutions_fontface_(CMM)(    char[]  line,    CMM     conf_make_meta,  ) { @@ -450,7 +451,7 @@ auto node_construct = NodeStructureMetadata();  #+HEADER: :noweb yes  #+BEGIN_SRC d  // ↓ - para -@safe string[string][string] inline_para_link_anchor()( +string[string][string] inline_para_link_anchor()(    string[string]          an_object,    string[string]          tag_in_seg,    string[string][string]  tag_assoc @@ -466,7 +467,7 @@ auto node_construct = NodeStructureMetadata();    }    return tag_assoc;  } -@safe ST_flow_para_match flow_para_match_()( +ST_flow_para_match flow_para_match_()(    char[]         line,    string[string]  an_object,    string          an_object_key, @@ -529,7 +530,7 @@ auto node_construct = NodeStructureMetadata();  #+HEADER: :noweb yes  #+BEGIN_SRC d  // ↓ - heading -@safe ST_flow_heading_found flow_heading_found_()( +ST_flow_heading_found flow_heading_found_()(    char[]                line,    string[string]        heading_match_str,    string[]              _make_unmarked_headings, @@ -614,7 +615,7 @@ auto node_construct = NodeStructureMetadata();    }    return ret;  } -@safe ST_flow_heading_make_set flow_heading_make_set_()( +ST_flow_heading_make_set flow_heading_make_set_()(               char[]                line,               int[string]           line_occur,    return ref Regex!(char)[string]  heading_match_rgx, @@ -662,7 +663,7 @@ auto node_construct = NodeStructureMetadata();    }    return ret;  } -@safe auto flow_heading_matched_(CMM)( +auto flow_heading_matched_(CMM)(    char[]          line,    string[string]  an_object,    int[string]     line_occur, @@ -860,7 +861,7 @@ auto node_construct = NodeStructureMetadata();  #+HEADER: :noweb yes  #+BEGIN_SRC d  // ↓ - table -@safe ObjGenericComposite flow_table_instructions(H)( +ObjGenericComposite flow_table_instructions(H)(    ObjGenericComposite  table_object,    H                    table_head,  ) { @@ -885,7 +886,7 @@ auto node_construct = NodeStructureMetadata();    }    return table_object;  } -@safe ST_flow_table_array_munge flow_table_array_munge()( +ST_flow_table_array_munge flow_table_array_munge()(    ObjGenericComposite  table_object,    string[][]           table_array,  ) { @@ -1428,7 +1429,7 @@ auto node_construct = NodeStructureMetadata();  #+HEADER: :noweb yes  #+BEGIN_SRC d  // ↓ - images -@safe string[] extract_images()(string content_block) { +string[] extract_images()(string content_block) {    static auto rgx = RgxI();    string[] images_;    if (auto m = content_block.matchAll(rgx.image)) { @@ -1483,7 +1484,7 @@ auto node_construct = NodeStructureMetadata();  #+HEADER: :noweb yes  #+BEGIN_SRC d  // ↓ - links -@safe auto _links(O)(O obj) { +auto _links(O)(O obj) {    static auto rgx = RgxI();    if (auto m = obj.text.match(rgx.inline_link_stow_uri)) {      debug(links) { @@ -1512,7 +1513,7 @@ auto node_construct = NodeStructureMetadata();  #+HEADER: :noweb yes  #+BEGIN_SRC d  // ↓ - text by line (blocks etc.) -@safe ST_txt_by_line_block_start txt_by_line_block_start()( +ST_txt_by_line_block_start txt_by_line_block_start()(    char[]         line,    uint[string]   pith,    uint[string]   dochas, @@ -1646,7 +1647,7 @@ auto node_construct = NodeStructureMetadata();    }    return ret;  } -@safe ST_txt_by_line_block_generic txt_by_line_block_group()( +ST_txt_by_line_block_generic txt_by_line_block_group()(    char[]          line,    string[string]  an_object,    uint[string]    pith, @@ -1684,7 +1685,7 @@ auto node_construct = NodeStructureMetadata();    }    return ret;  } -@safe ST_txt_by_line_block_generic txt_by_line_block_block()( +ST_txt_by_line_block_generic txt_by_line_block_block()(    char[]          line,    string[string]  an_object,    uint[string]    pith, @@ -1722,7 +1723,7 @@ auto node_construct = NodeStructureMetadata();    }    return ret;  } -@safe ST_txt_by_line_block_poem txt_by_line_block_poem(CMM)( +ST_txt_by_line_block_poem txt_by_line_block_poem(CMM)(    char[]          line,    string[string]  an_object,    uint[string]    pith, @@ -1924,7 +1925,7 @@ auto node_construct = NodeStructureMetadata();    }    return ret;  } -@safe ST_txt_by_line_block_generic txt_by_line_block_code()( +ST_txt_by_line_block_generic txt_by_line_block_code()(    char[]          line,    string[string]  an_object,    uint[string]    pith, @@ -2037,7 +2038,7 @@ auto node_construct = NodeStructureMetadata();    }    return ret;  } -@safe ST_txt_by_line_block_generic txt_by_line_block_quote()( +ST_txt_by_line_block_generic txt_by_line_block_quote()(    char[]          line,    string[string]  an_object,    uint[string]    pith, @@ -2220,7 +2221,7 @@ auto node_construct = NodeStructureMetadata();  #+HEADER: :noweb yes  #+BEGIN_SRC d  // ↓ - object set -@safe ObjGenericComposite set_object_heading()( +ObjGenericComposite set_object_heading()(    string level,    string part,    string section, @@ -2251,7 +2252,7 @@ auto node_construct = NodeStructureMetadata();    }    return comp_obj;  } -@safe ObjGenericComposite set_object_generic()( +ObjGenericComposite set_object_generic()(    string part,    string section,    string type, @@ -2280,7 +2281,7 @@ auto node_construct = NodeStructureMetadata();  #+HEADER: :noweb yes  #+BEGIN_SRC d  // ↓ - object inline munge -@safe static 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_, plus_; @@ -2294,7 +2295,7 @@ auto node_construct = NodeStructureMetadata();      n_foot_sp_asterisk              = 0;      n_foot_sp_plus                  = 0;    } -  @safe static auto images()(string obj_txt_in) { +  static auto images()(string obj_txt_in) {      static auto mng = InlineMarkup();      // url matched      obj_txt_in = obj_txt_in.replaceAll(rgx.inline_notes_al_special, ""); // TODO reinstate when special footnotes are implemented @@ -2318,7 +2319,7 @@ auto node_construct = NodeStructureMetadata();      }      return obj_txt_in;    } -  @safe ST_txtPlusHasFootnotes footnotes_endnotes_markup_and_number_or_stars()(string obj_txt_in, bool reset_note_numbers) { +  ST_txtPlusHasFootnotes footnotes_endnotes_markup_and_number_or_stars()(string obj_txt_in, bool reset_note_numbers) {      // endnotes (regular)      bool flg_notes_reg  = false;      bool flg_notes_star = false; @@ -2390,7 +2391,7 @@ auto node_construct = NodeStructureMetadata();      }      return ret;    } -  @safe private ST_txtPlusHasFootnotesUrlsImages object_notes_and_links_()( +  private ST_txtPlusHasFootnotesUrlsImages object_notes_and_links_()(      string obj_txt_in,      bool reset_note_numbers = false    ) { @@ -2445,7 +2446,7 @@ auto node_construct = NodeStructureMetadata();      }      return ret;    } -  @safe private ST_txtPlusHasFootnotesUrlsImages object_only_()( +  private ST_txtPlusHasFootnotesUrlsImages object_only_()(      string obj_txt_in,      bool reset_note_numbers = false    ) { @@ -2466,7 +2467,7 @@ auto node_construct = NodeStructureMetadata();    }    invariant() {    } -  @safe ST_txtPlusHasFootnotesUrlsImages munge_heading()( +  ST_txtPlusHasFootnotesUrlsImages munge_heading()(      string obj_txt_in,      bool reset_note_numbers = false    ) { @@ -2481,7 +2482,7 @@ auto node_construct = NodeStructureMetadata();    }    invariant() {    } -  @safe ST_txtPlusHasFootnotesUrlsImages munge_para()(string obj_txt_in) { +  ST_txtPlusHasFootnotesUrlsImages munge_para()(string obj_txt_in) {      obj_txt["munge"] = (obj_txt_in)        .replaceFirst(rgx.para_attribs, "")        .replaceFirst(rgx.object_number_off_all, "") @@ -2493,44 +2494,44 @@ auto node_construct = NodeStructureMetadata();      }      return ret;    } -  @safe ST_txtPlusHasFootnotesUrlsImages munge_quote()(string obj_txt_in) { +  ST_txtPlusHasFootnotesUrlsImages munge_quote()(string obj_txt_in) {      ST_txtPlusHasFootnotesUrlsImages ret = object_notes_and_links_(obj_txt_in.split("\n\n").join(" \\\\\n \\\\\n"));      return ret;    }    invariant() {    } -  @safe ST_txtPlusHasFootnotesUrlsImages munge_group(string obj_txt_in) { +  ST_txtPlusHasFootnotesUrlsImages munge_group(string obj_txt_in) {      ST_txtPlusHasFootnotesUrlsImages ret = object_notes_and_links_(obj_txt_in.split("\n\n").join("\n" ~ mkup.br_line_spaced ~ "\n"));      return ret;    }    invariant() {    } -  @safe ST_txtPlusHasFootnotesUrlsImages munge_block()(string obj_txt_in) { +  ST_txtPlusHasFootnotesUrlsImages munge_block()(string obj_txt_in) {      ST_txtPlusHasFootnotesUrlsImages ret = object_notes_and_links_(obj_txt_in);      return ret;    }    invariant() {    } -  @safe auto munge_verse()(string obj_txt_in) { +  auto munge_verse()(string obj_txt_in) {      ST_txtPlusHasFootnotesUrlsImages ret = object_notes_and_links_(obj_txt_in);      return ret;    }    invariant() {    } -  @safe ST_txtPlusHasFootnotesUrlsImages munge_code()(string obj_txt_in) { +  ST_txtPlusHasFootnotesUrlsImages munge_code()(string obj_txt_in) {      obj_txt_in = obj_txt_in.replaceAll(rgx.space, mkup.nbsp);      ST_txtPlusHasFootnotesUrlsImages ret = object_only_(obj_txt_in);      return ret;    }    invariant() {    } -  @safe ST_txtPlusHasFootnotesUrlsImages munge_table()(string obj_txt_in) { +  ST_txtPlusHasFootnotesUrlsImages munge_table()(string obj_txt_in) {      ST_txtPlusHasFootnotesUrlsImages ret = object_notes_and_links_(obj_txt_in);      return ret;    }    invariant() {    } -  @safe ST_txtPlusHasFootnotesUrlsImages munge_comment()(string obj_txt_in) { +  ST_txtPlusHasFootnotesUrlsImages munge_comment()(string obj_txt_in) {      ST_txtPlusHasFootnotesUrlsImages ret = object_only_(obj_txt_in);      return ret;    } @@ -2551,7 +2552,7 @@ static struct ObjInlineMarkup {    static auto munge = ObjInlineMarkupMunge();    string[string] obj_txt;    string anchor_tag = ""; -  @safe ST_txtAndAnchorTagPlusHasFootnotesUrlsImages obj_inline_markup_and_anchor_tags_and_misc(CMM)( +  ST_txtAndAnchorTagPlusHasFootnotesUrlsImages obj_inline_markup_and_anchor_tags_and_misc(CMM)(      string[string]   obj_,      string           obj_key_,      CMM              conf_make_meta, @@ -2640,14 +2641,14 @@ static struct ObjInlineMarkup {    }    invariant() {    } -  @safe auto _clean_heading_toc_()( +  auto _clean_heading_toc_()(      char[] heading_toc_,    ) {     auto m = (cast(char[]) heading_toc_).matchFirst(rgx.heading);     heading_toc_ = (m.post).replaceAll(rgx.inline_notes_curly_gen, "");     return heading_toc_;    }; -  @safe ST_flow_table_of_contents_gather_headings flow_table_of_contents_gather_headings(CMM)( // +  ST_flow_table_of_contents_gather_headings flow_table_of_contents_gather_headings(CMM)( //      string[string]         obj_,      CMM                    conf_make_meta,      string[string]         tag_in_seg, @@ -2738,7 +2739,7 @@ private:    static string heading_number_auto_composite = "";    static string heading_number_auto_composite_segname = "";    static bool[] auto_heading_numbering = [ true, true, true, true]; -  @safe static string _configured_auto_heading_numbering_and_segment_anchor_tags(CMM)( +  static string _configured_auto_heading_numbering_and_segment_anchor_tags(CMM)(      string           munge_,      string[string]   obj_,      CMM              conf_make_meta, @@ -2880,7 +2881,7 @@ private:      return munge_;    }    static int heading_num_lev1 = 0; -  @safe static string _make_segment_anchor_tags_if_none_provided()( +  static string _make_segment_anchor_tags_if_none_provided()(      string munge_,      string lev_,      bool   _new_doc @@ -2925,7 +2926,7 @@ private:  // ↓ - object attributes  struct ObjAttributes {    string[string] _obj_attrib; -  @safe string obj_attributes()( +  string obj_attributes()(      string              obj_is_,      string              obj_raw,      ObjGenericComposite comp_obj_, @@ -2988,7 +2989,7 @@ struct ObjAttributes {    }    private:    string _obj_attributes; -  @safe string txt_para_and_blocks()(string obj_txt_in) { +  string txt_para_and_blocks()(string obj_txt_in) {      if (obj_txt_in.matchFirst(rgx.para_bullet)) {        _obj_attributes =" \"bullet\": \"true\","        ~ " \"indent_hang\": 0," @@ -3012,7 +3013,7 @@ struct ObjAttributes {      }      return _obj_attributes;    } -  @safe string txt_heading()(string obj_txt_in) { +  string txt_heading()(string obj_txt_in) {      _obj_attributes = " \"use\": \"content\","      ~ " \"of\": \"para\","      ~ " \"is\": \"heading\""; @@ -3020,7 +3021,7 @@ struct ObjAttributes {    }    invariant() {    } -  @safe string txt_para()(string obj_txt_in) { +  string txt_para()(string obj_txt_in) {      _obj_attributes = " \"use\": \"content\","      ~ " \"of\": \"para\","      ~ " \"is\": \"para\""; @@ -3028,7 +3029,7 @@ struct ObjAttributes {    }    invariant() {    } -  @safe string txt_quote()(string obj_txt_in) { +  string txt_quote()(string obj_txt_in) {      _obj_attributes = " \"use\": \"content\","      ~ " \"of\": \"block\","      ~ " \"is\": \"quote\""; @@ -3036,7 +3037,7 @@ struct ObjAttributes {    }    invariant() {    } -  @safe string txt_group()(string obj_txt_in) { +  string txt_group()(string obj_txt_in) {      _obj_attributes = " \"use\": \"content\","      ~ " \"of\": \"block\","      ~ " \"is\": \"group\""; @@ -3044,7 +3045,7 @@ struct ObjAttributes {    }    invariant() {    } -  @safe string txt_block()(string obj_txt_in) { +  string txt_block()(string obj_txt_in) {      _obj_attributes = " \"use\": \"content\","      ~ " \"of\": \"block\","      ~ " \"is\": \"block\""; @@ -3052,7 +3053,7 @@ struct ObjAttributes {    }    invariant() {    } -  @safe string txt_verse()(string obj_txt_in) { +  string txt_verse()(string obj_txt_in) {      _obj_attributes = " \"use\": \"content\","      ~ " \"of\": \"block\","      ~ " \"is\": \"verse\""; @@ -3060,7 +3061,7 @@ struct ObjAttributes {    }    invariant() {    } -  @safe string txt_code()(string obj_txt_in) { +  string txt_code()(string obj_txt_in) {      _obj_attributes = " \"use\": \"content\","      ~ " \"of\": \"block\","      ~ " \"is\": \"code\""; @@ -3068,7 +3069,7 @@ struct ObjAttributes {    }    invariant() {    } -  @safe string txt_table()(string obj_txt_in) { +  string txt_table()(string obj_txt_in) {      _obj_attributes = " \"use\": \"content\","      ~ " \"of\": \"block\","      ~ " \"is\": \"table\""; @@ -3076,7 +3077,7 @@ struct ObjAttributes {    }    invariant() {    } -  @safe string txt_comment()(string obj_txt_in) { +  string txt_comment()(string obj_txt_in) {      _obj_attributes = " \"use\": \"comment\","      ~ " \"of\": \"comment\","      ~ " \"is\": \"comment\""; @@ -3084,7 +3085,7 @@ struct ObjAttributes {    }    invariant() {    } -  @safe string _set_additional_values_parse_as_json()( +  string _set_additional_values_parse_as_json()(      string              _obj_attrib,      string              obj_is_,      ObjGenericComposite comp_obj_, @@ -3115,7 +3116,7 @@ struct ObjAttributes {  #+HEADER: :noweb yes  #+BEGIN_SRC d  // ↓ - object tags -@safe pure ObjGenericComposite obj_dom_structure_set_markup_tags()( +pure ObjGenericComposite obj_dom_structure_set_markup_tags()(    ObjGenericComposite  obj,    int[]                dom,    int                  lev @@ -3157,7 +3158,7 @@ struct ObjAttributes {    obj.metainfo.dom_structure_markedup_tags_status = dom.dup;    return obj;  } -@safe pure ObjGenericComposite obj_dom_set_collapsed_tags()( +pure ObjGenericComposite obj_dom_set_collapsed_tags()(    ObjGenericComposite  obj,    int[]                dom,    int                  lev @@ -3323,7 +3324,7 @@ struct NotesSection {    int previous_count;    int mkn;    static auto rgx = RgxI(); -  @safe private auto gather_notes_for_endnote_section( +  private auto gather_notes_for_endnote_section(      ObjGenericComposite[] contents_am,      string[string]        tag_in_seg,      int                   cntr, @@ -3401,7 +3402,7 @@ struct NotesSection {      }      return object_notes;    } -  @safe private auto gathered_notes() { +  private auto gathered_notes() {      string[][string] endnotes_;      if (object_notes.length > 1) {        endnotes_["notes"] = (object_notes["notes"].split(rgx.break_string))[0..$-1]; @@ -3412,7 +3413,7 @@ struct NotesSection {      }      return endnotes_;    } -  @safe private ST_endnotes backmatter_endnote_objects(O)( +  private ST_endnotes backmatter_endnote_objects(O)(      OCNset         obj_cite_digits,      O              opt_action,    ) { @@ -3552,7 +3553,7 @@ struct BookIndexNuggetHash {    string[] object_numbers;    string[][string][string] bi_hash_nugget;    string[] bi_main_terms_split_arr; -  @safe string[][string][string] bookindex_nugget_hash(S)( +  string[][string][string] bookindex_nugget_hash(S)(      string bookindex_section,      OCNset obj_cite_digits,      S      tag_in_seg, @@ -3620,7 +3621,7 @@ struct BookIndexNuggetHash {  }  struct BookIndexReportIndent {    int mkn, skn; -  @safe void bookindex_report_indented()( +  void bookindex_report_indented()(      string[][string][string] bookindex_unordered_hashes    ) {      auto mainkeys @@ -3646,7 +3647,7 @@ struct BookIndexReportSection {    int  mkn, skn;    static auto rgx = RgxI();    static auto munge = ObjInlineMarkupMunge(); -  @safe void bookindex_write_section()( +  void bookindex_write_section()(      string[][string][string] bookindex_unordered_hashes    ) {      auto mainkeys = @@ -4317,7 +4318,7 @@ struct NodeStructureMetadata {    int obj_cite_digit;    int[string] p_; // p_ parent_    static auto rgx = RgxI(); -  @safe ObjGenericComposite node_location_emitter(La,Ta)( +  ObjGenericComposite node_location_emitter(La,Ta)(      string         lev_markup_number,      string[string] tag_in_seg,      La             lev_anchor_tag, @@ -4366,7 +4367,7 @@ struct NodeStructureMetadata {    }    invariant() {    } -  @safe ObjGenericComposite node_emitter_heading(O,TaL,TA,SOAT)( +  ObjGenericComposite node_emitter_heading(O,TaL,TA,SOAT)(      O              an_object,      string[string] tag_in_seg,      TaL            lev_anchor_tag, @@ -4565,7 +4566,7 @@ struct NodeStructureMetadata {    ObjGenericComposite[] the_document_bookindex_section,    ObjGenericComposite[] the_document_blurb_section,  ) { -  @safe int[] _get_ancestors_markup(ObjGenericComposite obj, int[] _ancestors_markup) { +  int[] _get_ancestors_markup(ObjGenericComposite obj, int[] _ancestors_markup) {      if (obj.metainfo.is_a == "heading") {        debug(dom) { writeln(obj.text); }        if (obj.metainfo.heading_lev_markup == 1) { @@ -4648,7 +4649,7 @@ struct NodeStructureMetadata {      debug(ancestor_markup) { writeln("marked up: ", _ancestors_markup); }      return _ancestors_markup;    } -  @safe int[] _get_ancestors_collapsed(ObjGenericComposite obj, int[] _ancestors_collapsed) { +  int[] _get_ancestors_collapsed(ObjGenericComposite obj, int[] _ancestors_collapsed) {      if (obj.metainfo.is_a == "heading") {        if (obj.metainfo.heading_lev_collapsed == 1) {          _ancestors_collapsed = [ @@ -4771,7 +4772,7 @@ struct NodeStructureMetadata {  #+BEGIN_SRC d  // ↓ - descendants  // descendants -@safe auto after_doc_get_descendants()(ObjGenericComposite[] document_sections) { +auto after_doc_get_descendants()(ObjGenericComposite[] document_sections) {    int[string] _heading_ocn_descendants;    string[] _ocn_open_key = ["","","","","","","",""];    auto _doc_sect_length = document_sections.length - 1; @@ -4827,7 +4828,7 @@ struct NodeStructureMetadata {  #+HEADER: :noweb yes  #+BEGIN_SRC d  // ↓ - assertions -@safe pure void assertions_doc_structure()( +pure void assertions_doc_structure()(    string[string]  an_object,    string          an_object_key,    int[string]     lv @@ -5405,7 +5406,7 @@ struct NodeStructureMetadata {  #+NAME: docSectKeysSeq  #+HEADER: :noweb yes  #+BEGIN_SRC d -@safe auto docSectKeysSeq(string[][string] document_section_keys_sequenced) { +auto docSectKeysSeq(string[][string] document_section_keys_sequenced) {    struct doc_sect_keys_seq {      string[] scroll() {        return document_section_keys_sequenced["scroll"]; diff --git a/org/ocda_obj_setter.org b/org/ocda_obj_setter.org index 4791dcf..e009a67 100644 --- a/org/ocda_obj_setter.org +++ b/org/ocda_obj_setter.org @@ -33,6 +33,7 @@ set abstracted objects for downstream processing    metadoc_object_setter.d  +/  module doc_reform.meta.metadoc_object_setter; +@safe:  template ObjectSetter() {    /+ structs +/    <<meta_structs_docObjects>> @@ -66,25 +67,25 @@ struct DocObj_MetaInfo_ {    int                    o_n_bibliography                     = 0;    int                    o_n_book_index                       = 0;    int                    o_n_blurb                            = 0; -  @safe  string object_number_substantive() const @property { +   string object_number_substantive() const @property {      return (o_n_substantive == 0) ? "" : o_n_substantive.to!string;    } -  @safe string object_number_non_substantive() const @property { +  string object_number_non_substantive() const @property {      return (o_n_non_substantive == 0) ? "" : o_n_non_substantive.to!string;    } -  @safe string object_number_glossary() const @property { +  string object_number_glossary() const @property {      return (o_n_glossary == 0) ? "" : o_n_glossary.to!string;    } -  @safe string object_number_bibliography() const @property { +  string object_number_bibliography() const @property {      return (o_n_bibliography == 0) ? "" : o_n_bibliography.to!string;    } -  @safe string object_number_book_index() const @property { +  string object_number_book_index() const @property {      return (o_n_book_index == 0) ? "" : o_n_book_index.to!string;    } -  @safe string object_number_blurb() const @property { +  string object_number_blurb() const @property {      return (o_n_blurb == 0) ? "" : o_n_blurb.to!string;    } -  @safe string marked_up_level() const @property { +  string marked_up_level() const @property {      string _out;      switch (heading_lev_markup) {      case 0  : _out = "A"; break; @@ -99,7 +100,7 @@ struct DocObj_MetaInfo_ {      }      return _out;    } -  @safe string object_number() const @property { +  string object_number() const @property {      return (ocn == 0) ? "" : ocn.to!string;    }    bool                   object_number_off                    = false; @@ -387,7 +388,7 @@ enum Status { off, on, }  enum OCNtype { ocn, non, bkidx, }  enum DomTags { none, open, close, close_and_open, open_still, }  enum Substitute { match, markup, } -@safe static auto eN() { +static auto eN() {    struct _e {      enum bi {        off, diff --git a/org/out_curate_metadata.org b/org/out_curate_metadata.org index 7daa7ce..470fc17 100644 --- a/org/out_curate_metadata.org +++ b/org/out_curate_metadata.org @@ -31,8 +31,9 @@  #+BEGIN_SRC d  <<doc_header_including_copyright_and_license>>  module doc_reform.meta.metadoc_curate; +@safe:  template spineMetaDocCurate() { -  @safe auto spineMetaDocCurate(T,H)( +  auto spineMetaDocCurate(T,H)(      T  doc_matters,      H  hvst,    ) { @@ -125,6 +126,7 @@ return hvst.curate;  #+BEGIN_SRC d  <<doc_header_including_copyright_and_license>>  module doc_reform.meta.metadoc_curate_topics; +@safe:    import      std.algorithm,      std.array, @@ -469,6 +471,7 @@ try {  #+BEGIN_SRC d  <<doc_header_including_copyright_and_license>>  module doc_reform.meta.metadoc_curate_authors; +@safe:    import      std.algorithm,      std.array, @@ -824,7 +827,7 @@ string theme_light_1 = format(q"┃  #+NAME: curated_html_search  #+BEGIN_SRC d -@safe string inline_search_form(M)( +string inline_search_form(M)(    M  _make_and_meta_truct,  ) {    string o; diff --git a/org/out_latex.org b/org/out_latex.org index 7f31c3c..8783da8 100644 --- a/org/out_latex.org +++ b/org/out_latex.org @@ -27,6 +27,7 @@  #+BEGIN_SRC d  <<doc_header_including_copyright_and_license>>  module doc_reform.io_out.latex; +@safe:  <<Template_paper_latex>>  <<Template_output_latex>>  <<Template_latex_init>> @@ -691,7 +692,7 @@ string mm(uint mmi) {    return _mm;  }  struct PaperType { -  @safe auto a4() { +  auto a4() {      struct A4 {        auto portrait() {          struct V { @@ -742,7 +743,7 @@ struct PaperType {      }      return A4();    } -  @safe auto a5() { +  auto a5() {      struct A5 {        auto portrait() {          struct V { @@ -793,7 +794,7 @@ struct PaperType {      }      return A5();    } -  @safe auto b4() { +  auto b4() {      struct B4 {        auto portrait() {          struct V { @@ -844,7 +845,7 @@ struct PaperType {      }      return B4();    } -  @safe auto letter() { +  auto letter() {      struct Letter {        auto portrait() {          struct V { @@ -895,7 +896,7 @@ struct PaperType {      }      return Letter();    } -  @safe auto legal() { +  auto legal() {      struct Legal {        auto portrait() {          struct V { @@ -961,7 +962,7 @@ struct PaperType {  #+NAME: Function_shared_special_characters_to_escape_operations  #+BEGIN_SRC d -@safe string sp_char_ops()( +string sp_char_ops()(    string      _txt,  ) {    string _unescape_sp_char_esc()(string _txt) { @@ -989,7 +990,7 @@ struct PaperType {  #+NAME: Function_shared_special_characters_to_escape_object  #+BEGIN_SRC d -@safe string sp_char_esc(O)( +string sp_char_esc(O)(    string      _txt,    const    O  obj,  ) { @@ -1004,7 +1005,7 @@ struct PaperType {  #+NAME: Function_shared_special_characters_to_escape_text  #+BEGIN_SRC d -@safe string sp_char_esc_txt()( +string sp_char_esc_txt()(    string      _txt,  ) {    _txt = _txt.sp_char_ops; @@ -1016,7 +1017,7 @@ struct PaperType {  #+NAME: Function_shared_marked_linebreaks_newline_to_latex  #+BEGIN_SRC d -@safe string marked_linebreaks_newlines()( +string marked_linebreaks_newlines()(    string      _txt,  ) {    _txt = _txt.split(rgx.br_linebreaks_newlines).join("\\br\n").strip; @@ -1028,7 +1029,7 @@ struct PaperType {  *** not used latex \escape special characters UNUSED  #+BEGIN_SRC d -@safe string sp_char_esc_()( +string sp_char_esc_()(    string      _txt,  ) {    _txt = replaceAll!(m => "\\" ~ m[1])(_txt, rgx_sc.latex_special_char); @@ -1043,7 +1044,7 @@ struct PaperType {  #+NAME: Function_shared_fontface  #+BEGIN_SRC d -@safe string fontface()( +string fontface()(    string      _txt,  ) {  _txt = _txt @@ -1066,7 +1067,7 @@ _txt = _txt  #+NAME: Function_shared_leading_hardspaces  #+BEGIN_SRC d -@safe string leading_hardspaces()( +string leading_hardspaces()(    string      _txt,  ) {    string hardspaces(string _spaces) { @@ -1083,7 +1084,7 @@ _txt = _txt  #+NAME: output_latex_shared_character_nbsp_to_hardspace_  #+BEGIN_SRC d -@safe string nbsp_char_replace()(string _txt) { +string nbsp_char_replace()(string _txt) {    if (_txt.match(rgx.nbsp_char)) {      _txt = _txt.replaceAll(rgx.nbsp_char, "{\\s}");    } @@ -1095,7 +1096,7 @@ _txt = _txt  #+NAME: Function_shared_character_nbsp_to_hardspace  #+BEGIN_SRC d -@safe string nbsp_char()(string _txt) { +string nbsp_char()(string _txt) {    if (_txt.match(rgx.nbsp_char)) {      foreach (m; _txt.matchAll(rgx.nbsp_chars)) {        int spaces_ = 0; @@ -1113,7 +1114,7 @@ _txt = _txt  #+NAME: Function_shared_character_spaces_to_hardspace  #+BEGIN_SRC d -@safe string spaces_to_nbsp()(string _txt) { +string spaces_to_nbsp()(string _txt) {    if (_txt.match(rgx.spaces_keep)) {      foreach (m; _txt.matchAll(rgx.spaces_keep)) {        int spaces_ = 0; @@ -1131,7 +1132,7 @@ _txt = _txt  #+NAME: Function_shared_character_nbsp_to_space  #+BEGIN_SRC d -@safe string nbsp_char_to_space()(string _txt) { +string nbsp_char_to_space()(string _txt) {    if (_txt.match(rgx.nbsp_char)) {      _txt  = _txt.replaceAll(rgx.nbsp_char, " ");    } @@ -1144,7 +1145,7 @@ _txt = _txt  #+NAME: Function_shared_links_and_images  #+BEGIN_SRC d -@safe string links_and_images(O,M)( +string links_and_images(O,M)(    string      _txt,    const    O  obj,             M  doc_matters, @@ -1198,7 +1199,7 @@ _txt = _txt  #+NAME: Function_shared_footnotes  #+BEGIN_SRC d -@safe string footnotes()( +string footnotes()(    string      _txt,  ) {    if (_txt.match(rgx.inline_notes_al_gen)) { @@ -1219,7 +1220,7 @@ _txt = _txt  #+NAME: Function_shared_footnotes_remove  #+BEGIN_SRC d -@safe string remove_footnotes()( +string remove_footnotes()(    string      _txt,  ) {    if (_txt.match(rgx.inline_notes_al_gen)) { @@ -1234,7 +1235,7 @@ _txt = _txt  #+NAME: Function_shared_para  #+BEGIN_SRC d -@safe string para(O)( +string para(O)(    string      _txt,    O           obj,  ) { @@ -1254,7 +1255,7 @@ _txt = _txt  #+NAME: Function_shared_bookindex  #+BEGIN_SRC d -@safe string bookindex(O)( +string bookindex(O)(    string      _txt,    O           obj,  ) { @@ -1275,7 +1276,7 @@ _txt = _txt  #+NAME: Function_head_bullets_and_indentation  #+BEGIN_SRC d -@safe string bullets_and_indentation(O)( +string bullets_and_indentation(O)(    string      _txt,    O           obj,  ) { @@ -1320,7 +1321,7 @@ _txt = _txt  #+NAME: Function_shared_heading  #+BEGIN_SRC d -  @safe string heading(O,M)( +  string heading(O,M)(      string      _txt,      O           obj,      M           doc_matters, diff --git a/org/out_metadata.org b/org/out_metadata.org index 0b20133..e048abd 100644 --- a/org/out_metadata.org +++ b/org/out_metadata.org @@ -26,8 +26,9 @@  #+BEGIN_SRC d  <<doc_header_including_copyright_and_license>>  module doc_reform.io_out.metadata; +@safe:  template outputMetadata() { -  @safe void outputMetadata(T)( T  doc_matters) { +  void outputMetadata(T)( T  doc_matters) {      <<curated_html_search>>      <<output_imports>>  <<curated_html_themes_0>> @@ -274,7 +275,7 @@ metadata_write_output(doc_matters, metadata_);  #+NAME: output_metadata_write  #+BEGIN_SRC d -@safe void metadata_write_output(M)(M doc_matters, string[] metadata_) { +void metadata_write_output(M)(M doc_matters, string[] metadata_) {    auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language);    try {      if (!exists(pth_html.base)) { @@ -612,7 +613,7 @@ string theme_light_1 = format(q"┃  #+NAME: curated_html_search  #+BEGIN_SRC d -@safe string inline_search_form(M)( +string inline_search_form(M)(    M  doc_matters,  ) {    string o; diff --git a/org/out_odt.org b/org/out_odt.org index 935b040..022fdc7 100644 --- a/org/out_odt.org +++ b/org/out_odt.org @@ -51,6 +51,7 @@  #+BEGIN_SRC d  <<doc_header_including_copyright_and_license>>  module doc_reform.io_out.odt; +@safe:  template formatODT() {    <<output_imports>>    mixin spineRgxOut; @@ -145,7 +146,7 @@ template outputODT() {  #+NAME: odt_format_objects_0  #+BEGIN_SRC d -@safe string _tags(O)(const O obj) { +string _tags(O)(const O obj) {    string _tags = "";    if (obj.tags.anchor_tags.length > 0) {      foreach (tag_; obj.tags.anchor_tags) { @@ -169,7 +170,7 @@ template outputODT() {  #+NAME: odt_format_objects_1  #+BEGIN_SRC d -@safe string _xhtml_anchor_tags(O)(O obj) { +string _xhtml_anchor_tags(O)(O obj) {    const(string[]) anchor_tags = obj.tags.anchor_tags;    string tags="";    if (anchor_tags.length > 0) { @@ -187,7 +188,7 @@ template outputODT() {  #+NAME: odt_format_objects_2  #+BEGIN_SRC d -@safe string obj_num(O)(const O obj) { // TODO +string obj_num(O)(const O obj) { // TODO    string _on;    _on = (obj.metainfo.object_number.empty)    ? "" @@ -203,7 +204,7 @@ template outputODT() {  #+NAME: odt_format_objects_3  #+BEGIN_SRC d -@safe string _footnotes()(string _txt) { +string _footnotes()(string _txt) {    static auto rgx = RgxO();    static auto rgx_xhtml = RgxXHTML();    _txt = _txt.replaceAll( @@ -229,7 +230,7 @@ template outputODT() {  #+NAME: odt_format_objects_4  #+BEGIN_SRC d -@safe string _bullet(O)(const O obj) { +string _bullet(O)(const O obj) {    string _b = "";    if (obj.attrib.bullet) {      _b = format(q"┃● ┃",); @@ -242,7 +243,7 @@ template outputODT() {  #+NAME: odt_format_objects_5  #+BEGIN_SRC d -@safe string _indent(O)(string _txt, const O obj) { // TODO +string _indent(O)(string _txt, const O obj) { // TODO    // if (obj.attrib.indent_base > 0 ||    //   obj.attrib.indent_hang > 0    // ) { @@ -356,7 +357,7 @@ template outputODT() {  #+NAME: odt_format_objects_6  #+BEGIN_SRC d -@safe string _block_type_delimiters(O)(string[] _block_lines, const O obj) { // TODO +string _block_type_delimiters(O)(string[] _block_lines, const O obj) { // TODO    string _block = "";    foreach (i, _line; _block_lines) {      _line = _footnotes(_line); @@ -397,7 +398,7 @@ template outputODT() {  #+NAME: odt_format_objects_7  #+BEGIN_SRC d -@safe string _special_characters(O)(string _txt, const O obj) { +string _special_characters(O)(string _txt, const O obj) {    _txt = _txt      .replaceAll(rgx_xhtml.ampersand,    "&")      .replaceAll(rgx_xhtml.quotation,    """) @@ -412,7 +413,7 @@ template outputODT() {  #+NAME: odt_format_objects_8  #+BEGIN_SRC d -@safe string _preserve_white_spaces(O)(string _txt, const O obj) { +string _preserve_white_spaces(O)(string _txt, const O obj) {    if (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block") {      _txt = _txt        .replaceAll(rgx.space,      " "); @@ -445,9 +446,9 @@ string _font_face(string _txt){  #+NAME: odt_format_objects_10  #+BEGIN_SRC d -@safe auto _obj_num(O)(O obj) { // NOT USED YET +auto _obj_num(O)(O obj) { // NOT USED YET    struct objNum { -    @safe string reference() { +    string reference() {        return format(q"┃<text:span text:style-name="Span_subscript">      <text:bookmark-start text:name="%s"/>      <text:bookmark-end text:name="%s"/> @@ -456,7 +457,7 @@ string _font_face(string _txt){          obj.object_number,        );      } -    @safe string display() { +    string display() {        return format(q"┃<text:span text:style-name="Span_subscript">    %s%s%s    </text:span>┃", @@ -474,7 +475,7 @@ string _font_face(string _txt){  #+NAME: odt_format_objects_11  #+BEGIN_SRC d -@safe string _break_page()() { +string _break_page()() {    return format(q"┃  <text:p text:style-name="P_normal_page_new"/>  ┃", @@ -483,7 +484,7 @@ string _font_face(string _txt){  #+END_SRC  #+BEGIN_SRC d -@safe string _break_page()() { +string _break_page()() {    return format(q"┃  <text:p text:style-name="P_page_break"> </text:p>  <text:p text:style-name="P_normal_page_new"/>┃", @@ -495,7 +496,7 @@ string _font_face(string _txt){  #+NAME: odt_format_objects_12  #+BEGIN_SRC d -@safe string _empty_line_break(O)(string _txt, const O obj) { +string _empty_line_break(O)(string _txt, const O obj) {    if (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block") {      _txt = _txt        .replaceAll(rgx.br_empty_line,    "<br />"); @@ -508,7 +509,7 @@ string _font_face(string _txt){  #+NAME: odt_format_objects_13  #+BEGIN_SRC d -@safe string _links(O)(string _txt, const O obj) { +string _links(O)(string _txt, const O obj) {    if (obj.metainfo.is_a != "code") {      if (obj.metainfo.is_a == "toc") {        _txt = replaceAll!(m => @@ -554,7 +555,7 @@ string _font_face(string _txt){  #+NAME: odt_format_objects_14  #+BEGIN_SRC d -@safe string _images(O)(string _txt, const O obj) { +string _images(O)(string _txt, const O obj) {    if (_txt.match(rgx.inline_image)) {      _txt = _txt        .replaceAll(rgx.inline_image, @@ -571,7 +572,7 @@ string _font_face(string _txt){  #+NAME: odt_format_objects_15  #+BEGIN_SRC d -@safe string markup(O)(const O obj) { +string markup(O)(const O obj) {    /+ markup TODO +/    string _txt = obj.text;    _txt = _special_characters(_txt, obj);     // TODO & why both obj & obj.text, consider also in output_xmls.org @@ -593,7 +594,7 @@ string _font_face(string _txt){  #+NAME: odt_format_objects_16  #+BEGIN_SRC d -@safe string heading(O,M)( +string heading(O,M)(    const        O  obj,    const        M  doc_matters,  ) { @@ -643,7 +644,7 @@ string _font_face(string _txt){  #+NAME: odt_format_objects_17  #+BEGIN_SRC d -@safe string para(O,M)( +string para(O,M)(    const        O  obj,    const        M  doc_matters,  ) { @@ -669,7 +670,7 @@ string _font_face(string _txt){  #+NAME: odt_format_objects_18  #+BEGIN_SRC d -@safe string quote(O,M)( +string quote(O,M)(    const        O  obj,    const        M  doc_matters,  ) { @@ -690,7 +691,7 @@ string _font_face(string _txt){  #+NAME: odt_format_objects_19  #+BEGIN_SRC d -@safe string group(O,M)( +string group(O,M)(    const        O  obj,    const        M  doc_matters,  ) { @@ -725,7 +726,7 @@ string _font_face(string _txt){  #+NAME: odt_format_objects_20  #+BEGIN_SRC d -@safe string block(O,M)( +string block(O,M)(    const        O  obj,    const        M  doc_matters,  ) { @@ -748,7 +749,7 @@ string _font_face(string _txt){  #+NAME: odt_format_objects_21  #+BEGIN_SRC d -@safe string verse(O,M)( +string verse(O,M)(    const        O  obj,    const        M  doc_matters,  ) { @@ -767,7 +768,7 @@ string _font_face(string _txt){  #+NAME: odt_format_objects_22  #+BEGIN_SRC d -@safe string code(O,M)( +string code(O,M)(    const        O  obj,    const        M  doc_matters,  ) { @@ -821,7 +822,7 @@ string _font_face(string _txt){  #+NAME: odt_format_objects_23  #+BEGIN_SRC d -@safe Tuple!(string, string) tablarize(O)( +Tuple!(string, string) tablarize(O)(    const        O    obj,    string            _txt,  ) { @@ -862,7 +863,7 @@ string _font_face(string _txt){  #+NAME: odt_format_objects_24  #+BEGIN_SRC d  int _table_number = 0; -@safe string table(O,M)( +string table(O,M)(    const        O  obj,    const        M  doc_matters,  ) { @@ -901,7 +902,7 @@ int _table_number = 0;  #+NAME: output_odt_0  #+BEGIN_SRC d -void writeOutputODT(W,I)( +@trusted void writeOutputODT(W,I)(    const W    odt_content,          I    doc_matters,  ) { @@ -960,7 +961,7 @@ void writeOutputODT(W,I)(                auto zip_arc_member_file = new ArchiveMember();                zip_arc_member_file.name = fn_out;                auto zip_data = new OutBuffer(); -              zip_data.write(cast(char[]) ((fn_src).read)); +              zip_data.write(cast(char[]) ((fn_src).read)); // trusted?                zip_arc_member_file.expandedData = zip_data.toBytes();                zip.addMember(zip_arc_member_file);                createZipFile!()(fn_odt, zip.build()); @@ -1096,7 +1097,7 @@ void dirtree(I)(  #+NAME: output_odt_fixed_mimetype  #+BEGIN_SRC d -@safe string mimetype() { +string mimetype() {    string mimetype_ = format(q"┃application/vnd.oasis.opendocument.text┃");    return mimetype_;  } @@ -1106,7 +1107,7 @@ void dirtree(I)(  #+NAME: output_odt_fixed_manifest_rdf_0  #+BEGIN_SRC d -@safe string manifest_rdf() { +string manifest_rdf() {    string _manifest_rdf = format(q"┃<?xml version="1.0" encoding="utf-8"?>  #+END_SRC @@ -1142,7 +1143,7 @@ void dirtree(I)(  #+NAME: output_odt_fixed_settings_xml_0  #+BEGIN_SRC d -@safe string settings_xml() { +string settings_xml() {    string _settings_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?>  #+END_SRC @@ -1256,7 +1257,7 @@ void dirtree(I)(  #+NAME: output_odt_fixed_styles_xml_0  #+BEGIN_SRC d -@safe string styles_xml() { +string styles_xml() {    string _styles_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?>  #+END_SRC @@ -2169,7 +2170,7 @@ void dirtree(I)(  #+NAME: output_odt_variable_content_xml_0  #+BEGIN_SRC d -@safe string odt_head(I)(I doc_matters) { +string odt_head(I)(I doc_matters) {    string _has_tables = format(q"┃  #+END_SRC @@ -2308,7 +2309,7 @@ void dirtree(I)(  #+NAME: output_odt_variable_content_xml_5  #+BEGIN_SRC d -@safe string odt_body(D,I)( +string odt_body(D,I)(    const D    doc_abstraction,          I    doc_matters,  ) { @@ -2475,7 +2476,7 @@ void dirtree(I)(  #+NAME: output_odt_variable_content_xml_12  #+BEGIN_SRC d -@safe string odt_tail() { +string odt_tail() {    string _odt_tail = format(q"┃<text:p text:style-name="P_normal">spine: <<text:a xl:type="simple" xl:href="https://www.doc_reform.org">www.doc_reform.org</text:a>> and <<text:a xl:type="simple" xl:href="https://www.sisudoc.org">www.sisudoc.org</text:a>></text:p>  </office:text></office:body></office:document-content>┃",);    return _odt_tail; @@ -2486,7 +2487,7 @@ void dirtree(I)(  #+NAME: output_odt_variable_content_xml_13  #+BEGIN_SRC d -@safe string content_xml(D,I)( +string content_xml(D,I)(    const D    doc_abstraction,          I    doc_matters,  ) { @@ -2507,7 +2508,7 @@ void dirtree(I)(  #+NAME: output_odt_variable_manifest_xml_0  #+BEGIN_SRC d -@safe string manifest_xml(M)( +string manifest_xml(M)(    auto ref              M    doc_matters,  ) {    string _bullet = format(q"┃<manifest:file-entry manifest:media-type="" manifest:full-path="Pictures/bullet_09.png"/>┃"); @@ -2545,7 +2546,7 @@ _images.join("\n"),  #+NAME: output_odt_variable_meta_xml_0  #+BEGIN_SRC d -@safe string meta_xml(M)( +string meta_xml(M)(    auto ref              M    doc_matters,  ) {    /+ (meta_xml includes output time-stamp) +/ @@ -2579,7 +2580,7 @@ doc_matters.generated_time,  #+NAME: output_odt_variable_copy_odt_images  #+BEGIN_SRC d -@safe void images_cp(M)( +void images_cp(M)(    auto ref              M    doc_matters,  ) {    { /+ (copy odt images) +/ diff --git a/org/out_src_pod.org b/org/out_src_pod.org index bf504c2..883572f 100644 --- a/org/out_src_pod.org +++ b/org/out_src_pod.org @@ -26,6 +26,7 @@  #+BEGIN_SRC d  <<doc_header_including_copyright_and_license>>  module doc_reform.io_out.source_pod; +@system: // is not @safe: use: @system: or @trusted:  template spinePod() {    <<output_imports>>    void spinePod(T)(T doc_matters) { diff --git a/org/out_xmls.org b/org/out_xmls.org index 75289a3..e9f8d79 100644 --- a/org/out_xmls.org +++ b/org/out_xmls.org @@ -23,7 +23,6 @@  2024  #+END_SRC -  * xml offspring (xhtml html epub)  ** format xhtml objects :format:  *** _module template_ :module: @@ -33,6 +32,7 @@  #+BEGIN_SRC d  <<doc_header_including_copyright_and_license>>  module doc_reform.io_out.xmls; +@safe:  template outputXHTMLs() {    <<output_imports_xml>>    mixin spineRgxOut; @@ -130,7 +130,7 @@ import  #+NAME: xhtml_format_objects_div_delimit  #+BEGIN_SRC d -@safe string div_delimit( +string div_delimit(               string  section,    return ref string  previous_section  ) { @@ -166,7 +166,7 @@ import  #+NAME: xhtml_format_objects_special_characters_text  #+BEGIN_SRC d -@safe string special_characters_text(string _txt) { +string special_characters_text(string _txt) {    _txt = _txt      .replaceAll(rgx_xhtml.ampersand,    "&")  // "&"      .replaceAll(rgx_xhtml.quotation,    """) // """ @@ -184,7 +184,7 @@ import  #+NAME: xhtml_format_objects_special_characters_date  #+BEGIN_SRC d -@safe string special_characters_date(string _txt) { +string special_characters_date(string _txt) {    _txt = _txt      .replaceAll(regex(r"(?:-00)+"),     "")      .replaceAll(rgx.br_line,            "<br />") @@ -199,7 +199,7 @@ import  #+NAME: xhtml_format_objects_breaks_indents_bullets  #+BEGIN_SRC d -@safe string special_characters_breaks_indents_bullets(O)( +string special_characters_breaks_indents_bullets(O)(    const  O         obj,  ) {    string _txt = special_characters_text(obj.text); @@ -256,7 +256,7 @@ import  #+NAME: xhtml_format_objects_font_face  #+BEGIN_SRC d -@safe string font_face(string _txt) { +string font_face(string _txt) {    _txt = _txt      .replaceAll(rgx.inline_emphasis,    ("<em>$1</em>"))      .replaceAll(rgx.inline_bold,        ("<b>$1</b>")) @@ -276,7 +276,7 @@ import  #+NAME: xhtml_format_objects_xml_anchor_tags  #+BEGIN_SRC d -@safe string _xhtml_anchor_tags(O)(O obj) { +string _xhtml_anchor_tags(O)(O obj) {    string tags="";    if (obj.tags.anchor_tags.length > 0) {      foreach (tag; obj.tags.anchor_tags) { @@ -294,7 +294,7 @@ import  #+NAME: xhtml_format_objects_header_metadata  #+BEGIN_SRC d -@safe string header_metadata(M)( +string header_metadata(M)(    M  doc_matters,  ) {    string _publisher="Publisher"; // TODO @@ -337,7 +337,7 @@ import  #+NAME: xhtml_format_objects_site_info_button  #+BEGIN_SRC d -@safe string site_info_button(M)( +string site_info_button(M)(    M  doc_matters,  ) {    string _locations; @@ -367,7 +367,7 @@ import  #+NAME: xhtml_format_objects_inline_search_form  #+BEGIN_SRC d -@safe string inline_search_form(M)( +string inline_search_form(M)(    M  doc_matters,  ) {    string o; @@ -434,7 +434,7 @@ import  #+NAME: xhtml_format_objects_html_head  #+BEGIN_SRC d -@safe string html_head(M)( +string html_head(M)(    M  doc_matters,    string type,  ) { @@ -522,7 +522,7 @@ import  #+NAME: xhtml_format_objects_epub3_seg_head  #+BEGIN_SRC d -@safe string epub3_seg_head(M)( +string epub3_seg_head(M)(    M  doc_matters,  ) {    string html_base = format(q"┃<!DOCTYPE html> @@ -596,7 +596,7 @@ import  #+NAME: xhtml_format_objects_dom_close  #+BEGIN_SRC d -@safe string dom_close() { +string dom_close() {    string o;    o = format(q"┃</div>┃");    return o; @@ -608,7 +608,7 @@ import  #+NAME: xhtml_format_objects_tail  #+HEADER: :noweb yes  #+BEGIN_SRC d -@safe string tail(M)(M doc_matters) { +string tail(M)(M doc_matters) {    string o;    o = format(q"┃<hr />    <div class="rights"> @@ -650,7 +650,7 @@ import  #+NAME: xhtml_format_objects_inline_images  #+BEGIN_SRC d -@safe string inline_images(O,M)( +string inline_images(O,M)(    string          _txt,    const        O  obj,                 M  doc_matters, @@ -683,7 +683,7 @@ import  #+NAME: xhtml_format_objects_inline_links  #+BEGIN_SRC d -@safe string inline_links(O,M)( +string inline_links(O,M)(    string          _txt,    const        O  obj,                 M  doc_matters, @@ -781,7 +781,7 @@ import  #+NAME: xhtml_format_objects_inline_notes_scroll  #+BEGIN_SRC d -@safe string inline_notes_scroll(O,M)( +string inline_notes_scroll(O,M)(    string          _txt,    const        O  obj,                 M  doc_matters, @@ -818,7 +818,7 @@ import  #+NAME: xhtml_format_objects_inline_notes_seg  #+BEGIN_SRC d -@safe Tuple!(string, string[]) inline_notes_seg(O,M)( +Tuple!(string, string[]) inline_notes_seg(O,M)(              string  _txt,    const     O       obj,              M       doc_matters, @@ -889,7 +889,7 @@ import  #+NAME: xhtml_format_objects_inline_markup_scroll  #+BEGIN_SRC d -@safe string inline_markup_scroll(O,M)( +string inline_markup_scroll(O,M)(    string          _txt,    const        O  obj,                 M  doc_matters, @@ -911,7 +911,7 @@ import  #+NAME: xhtml_format_objects_inline_markup_seg  #+BEGIN_SRC d -@safe Tuple!(string, string[]) inline_markup_seg(O,M)( +Tuple!(string, string[]) inline_markup_seg(O,M)(    string          _txt,    const        O  obj,                 M  doc_matters, @@ -938,7 +938,7 @@ import  #+NAME: xhtml_format_objects_lev4_heading_subtoc  #+BEGIN_SRC d -@safe string lev4_heading_subtoc(O,M)( +string lev4_heading_subtoc(O,M)(    const        O  obj,                 M  doc_matters,  ) { @@ -971,7 +971,7 @@ import  #+NAME: xhtml_format_objects_nav_pre_next_svg  #+BEGIN_SRC d -@safe auto nav_pre_next_svg(O,M)( +auto nav_pre_next_svg(O,M)(    const        O  obj,                 M  doc_matters,  ) { @@ -1048,7 +1048,7 @@ import  #+NAME: xhtml_format_objects_heading  #+BEGIN_SRC d -@safe string heading(O,M)( +string heading(O,M)(          string _txt,    const O      obj,          M      doc_matters, @@ -1142,7 +1142,7 @@ import  #+NAME: xhtml_format_objects_heading_scroll  #+BEGIN_SRC d -@safe string heading_scroll(O,M)( +string heading_scroll(O,M)(    string          _txt,    const        O  obj,                 M  doc_matters, @@ -1158,7 +1158,7 @@ import  #+NAME: xhtml_format_objects_heading_seg  #+BEGIN_SRC d -@safe Tuple!(string, string[]) heading_seg(O,M)( +Tuple!(string, string[]) heading_seg(O,M)(    string          _txt,    const        O  obj,                 M  doc_matters, @@ -1182,7 +1182,7 @@ import  #+NAME: xhtml_format_objects_para  #+BEGIN_SRC d -@safe string para(O,M)( +string para(O,M)(          string _txt,    const O      obj,          M      doc_matters, @@ -1238,7 +1238,7 @@ import  #+NAME: xhtml_format_objects_para_scroll  #+BEGIN_SRC d -@safe string para_scroll(O,M)( +string para_scroll(O,M)(    string          _txt,    const        O  obj,                 M  doc_matters, @@ -1257,7 +1257,7 @@ import  #+NAME: xhtml_format_objects_para_seg  #+BEGIN_SRC d -@safe Tuple!(string, string[]) para_seg(O,M)( +Tuple!(string, string[]) para_seg(O,M)(    string          _txt,    const        O  obj,                 M  doc_matters, @@ -1281,7 +1281,7 @@ import  #+NAME: xhtml_format_objects_quote  #+BEGIN_SRC d -@safe string quote(O,M)( +string quote(O,M)(          string _txt,    const O      obj,          M      doc_matters, @@ -1323,7 +1323,7 @@ import  #+NAME: xhtml_format_objects_quote_scroll  #+BEGIN_SRC d -@safe string quote_scroll(O,M)( +string quote_scroll(O,M)(    string          _txt,    const        O  obj,                 M  doc_matters, @@ -1339,7 +1339,7 @@ import  #+NAME: xhtml_format_objects_quote_seg  #+BEGIN_SRC d -@safe Tuple!(string, string[]) quote_seg(O,M)( +Tuple!(string, string[]) quote_seg(O,M)(    string          _txt,    const        O  obj,                 M  doc_matters, @@ -1363,7 +1363,7 @@ import  #+NAME: xhtml_format_objects_group  #+BEGIN_SRC d -@safe string group(O,M)( +string group(O,M)(          string _txt,    const O      obj,          M      doc_matters, @@ -1407,7 +1407,7 @@ import  #+NAME: xhtml_format_objects_group_scroll  #+BEGIN_SRC d -@safe string group_scroll(O,M)( +string group_scroll(O,M)(    string          _txt,    const        O  obj,                 M  doc_matters, @@ -1424,7 +1424,7 @@ import  #+NAME: xhtml_format_objects_group_seg  #+BEGIN_SRC d -@safe Tuple!(string, string[]) group_seg(O,M)( +Tuple!(string, string[]) group_seg(O,M)(    string          _txt,    const        O  obj,                 M  doc_matters, @@ -1448,7 +1448,7 @@ import  #+NAME: xhtml_format_objects_block  #+BEGIN_SRC d -@safe string block(O,M)( +string block(O,M)(          string _txt,    const O      obj,          M      doc_matters, @@ -1488,7 +1488,7 @@ import  #+NAME: xhtml_format_objects_block_scroll  #+BEGIN_SRC d -@safe string block_scroll(O,M)( +string block_scroll(O,M)(    string          _txt,    const        O  obj,                 M  doc_matters, @@ -1505,7 +1505,7 @@ import  #+NAME: xhtml_format_objects_block_seg  #+BEGIN_SRC d -@safe Tuple!(string, string[]) block_seg(O,M)( +Tuple!(string, string[]) block_seg(O,M)(    string          _txt,    const        O  obj,                 M  doc_matters, @@ -1529,7 +1529,7 @@ import  #+NAME: xhtml_format_objects_verse  #+BEGIN_SRC d -@safe string verse(O,M)( +string verse(O,M)(          string _txt,    const O      obj,          M      doc_matters, @@ -1567,7 +1567,7 @@ import  #+NAME: xhtml_format_objects_verse_scroll  #+BEGIN_SRC d -@safe string verse_scroll(O,M)( +string verse_scroll(O,M)(    string          _txt,    const        O  obj,                 M  doc_matters, @@ -1584,7 +1584,7 @@ import  #+NAME: xhtml_format_objects_verse_seg  #+BEGIN_SRC d -@safe Tuple!(string, string[]) verse_seg(O,M)( +Tuple!(string, string[]) verse_seg(O,M)(    string          _txt,    const        O  obj,                 M  doc_matters, @@ -1607,7 +1607,7 @@ import  #+NAME: xhtml_format_objects_code  #+BEGIN_SRC d -@safe string code(O,M)( +string code(O,M)(          string _txt,    const O      obj,          M      doc_matters, @@ -1679,7 +1679,7 @@ align="left|right|center"  #+NAME: xhtml_format_objects_tablarize  #+BEGIN_SRC d -@safe Tuple!(string, string) tablarize(O)( +Tuple!(string, string) tablarize(O)(    string            _txt,    const        O    obj,  ) { @@ -1718,7 +1718,7 @@ align="left|right|center"  #+NAME: xhtml_format_objects_table  #+BEGIN_SRC d -@safe string table(O,M)( +string table(O,M)(          string _txt,    const O      obj,          M      doc_matters, @@ -1762,10 +1762,11 @@ align="left|right|center"  #+BEGIN_SRC d  <<doc_header_including_copyright_and_license>>  module doc_reform.io_out.html; +@safe:  template outputHTML() {    <<output_imports_xml>>    mixin outputXHTMLs; -  @safe void scroll(D,M)( +  void scroll(D,M)(      const        D    doc_abstraction,                   M    doc_matters,    ) { @@ -1777,7 +1778,7 @@ template outputHTML() {      <<output_html_scroll_close_is_case>>    }    <<output_html_scroll_scroll_write_output>> -  @safe void seg(D,M)( +  void seg(D,M)(      const D    doc_abstraction,            M    doc_matters,    ) { @@ -2382,7 +2383,7 @@ seg_write_output(doc_html, doc_html_endnotes, doc_matters);  #+NAME: output_html_css  #+BEGIN_SRC d -@safe void css(M)(M doc_matters) { +void css(M)(M doc_matters) {    auto css = spineCss(doc_matters);    auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language);    try { @@ -2480,6 +2481,7 @@ seg_write_output(doc_html, doc_html_endnotes, doc_matters);  #+BEGIN_SRC d  <<doc_header_including_copyright_and_license>>  module doc_reform.io_out.epub3; +@safe:  template outputEPub3() {    <<output_imports_epub>>    mixin InternalMarkup; @@ -2514,7 +2516,7 @@ template outputEPub3() {  #+NAME: output_epub3_fixed_mimetypes  #+BEGIN_SRC d -@safe string epub3_mimetypes() { +string epub3_mimetypes() {    string o;    o = format(q"┃application/epub+zip┃") ~ "\n";    return o; @@ -2527,7 +2529,7 @@ template outputEPub3() {  #+NAME: output_epub3_fixed_container_xml  #+BEGIN_SRC d -@safe string epub3_container_xml() { +string epub3_container_xml() {    string o;    o = format(q"┃<?xml version="1.0" encoding="utf-8"?>┃") ~ "\n";    o ~= format(q"┃<container version="1.0" @@ -2560,7 +2562,7 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container">  #+NAME: output_epub3_constructs_oebps_content  #+HEADER: :noweb yes  #+BEGIN_SRC d -@safe string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) { +string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) {    auto xhtml_format = outputXHTMLs();    auto pth_epub3 = spinePathsEPUB!()(doc_matters.output_path, doc_matters.src.language);    string _uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO sort uuid in doc_matters! @@ -2656,7 +2658,7 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container">  #+NAME: output_epub3_constructs_oebps_toc_nav_xhtml  #+BEGIN_SRC d -@safe string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { +string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) {    enum DomTags { none, open, close, close_and_open, open_still, }    auto markup = InlineMarkup();    static auto rgx = RgxO(); diff --git a/org/out_xmls_css.org b/org/out_xmls_css.org index 2cb6978..9e0d10a 100644 --- a/org/out_xmls_css.org +++ b/org/out_xmls_css.org @@ -29,9 +29,10 @@    default css settings  +/  module doc_reform.io_out.xmls_css; +@safe:  template spineCss() {    import std.format; -  @safe auto spineCss(M)(M doc_matters) { +  auto spineCss(M)(M doc_matters) {  <<css_insert_shared_insert_variable_indent_values>>  <<css_insert_shared_insert_variable_ocn_color_values>>      string _css_light_html_seg = format(q"┃ @@ -148,7 +149,7 @@ template spineCss() {      _css_indent,      _color_ocn_dark,  ); -    @safe auto css_() { +    auto css_() {        struct _CSS {          string html_seg    = "/* spine css html seg stylesheet */\n";          string html_scroll = "/* spine css html scroll stylesheet */\n"; diff --git a/org/out_zip.org b/org/out_zip.org index 1435458..1302d18 100644 --- a/org/out_zip.org +++ b/org/out_zip.org @@ -26,13 +26,14 @@  #+BEGIN_SRC d  <<doc_header_including_copyright_and_license>>  module doc_reform.io_out.create_zip_file; +@safe:  template createZipFile() {    import      std.file,      std.outbuffer,      std.string,      std.zip; -  @safe void createZipFile( +  void createZipFile(      string zip_file_name,      void[] compressed_zip_data,    ) { diff --git a/org/output_hub.org b/org/output_hub.org index f2531c4..a6a2db1 100644 --- a/org/output_hub.org +++ b/org/output_hub.org @@ -29,6 +29,7 @@    check & generate output types requested  +/  module doc_reform.io_out.hub; +@safe:  template outputHub() {    <<output_imports>>    @system void outputHub(D,I)( diff --git a/org/output_show.org b/org/output_show.org index 934d6e3..0247176 100644 --- a/org/output_show.org +++ b/org/output_show.org @@ -26,8 +26,9 @@  #+BEGIN_SRC d  <<doc_header_including_copyright_and_license>>  module doc_reform.meta.metadoc_show_summary; +@safe:  template spineMetaDocSummary() { -  @safe void spineMetaDocSummary(S,T)( +  void spineMetaDocSummary(S,T)(      const S  doc_abstraction,            T  doc_matters,    ) { @@ -155,8 +156,9 @@ writefln(  #+HEADER: :noweb yes  #+BEGIN_SRC d  module doc_reform.meta.metadoc_show_config; +@safe:  template spineShowSiteConfig() { -  @safe void spineShowSiteConfig(O,T)( +  void spineShowSiteConfig(O,T)(      O opt_action,      T config,    ) { @@ -246,7 +248,7 @@ writefln(  #+HEADER: :noweb yes  #+BEGIN_SRC d  template spineShowConfig() { -  @safe void spineShowConfig(T)( +  void spineShowConfig(T)(      T  doc_matters,    ) {      <<metadoc_show_summary_imports>> @@ -340,8 +342,9 @@ writefln(  #+BEGIN_SRC d  <<doc_header_including_copyright_and_license>>  module doc_reform.meta.metadoc_show_make; +@safe:  template spineShowMake() { -  @safe void spineShowMake(T)( +  void spineShowMake(T)(      T  doc_matters,    ) {      <<metadoc_show_summary_imports>> @@ -413,8 +416,9 @@ writefln(  #+BEGIN_SRC d  <<doc_header_including_copyright_and_license>>  module doc_reform.meta.metadoc_show_metadata; +@safe:  template spineShowMetaData() { -  @safe void spineShowMetaData(T)( +  void spineShowMetaData(T)(      T  doc_matters,    ) {      <<metadoc_show_summary_imports>> diff --git a/org/spine.org b/org/spine.org index cd6960b..30585a6 100644 --- a/org/spine.org +++ b/org/spine.org @@ -47,6 +47,7 @@ name        "spine"  description "A SiSU inspired document parser written in D."  homepage    "https://sisudoc.org"  +/ +@safe:  <<imports_spine>>  <<mixin_spine_version>>  <<mixin_spine_configuration>> @@ -965,20 +966,20 @@ OptActions _opt_action = OptActions();  #+NAME: spine_args_program_info  #+BEGIN_SRC d -@safe auto program_info() { +auto program_info() {    struct ProgramInfo { -    @safe string project() { +    string project() {        return project_name;      } -    @safe string name() { +    string name() {        return program_name;      } -    @safe string ver() { +    string ver() {        return format("%s.%s.%s",          _ver.major, _ver.minor, _ver.patch,        );      } -    @safe string compiler() { +    string compiler() {        return format ("%s D:%s, %s %s",          __VENDOR__, __VERSION__,          bits, os, @@ -990,7 +991,7 @@ OptActions _opt_action = OptActions();      @trusted string name_version_and_compiler() {        return format("%s-%s (%s)", name, ver, compiler);      } -    @safe auto time_output_generated() { +    auto time_output_generated() {        auto _st = Clock.currTime(UTC());        auto _t  = TimeOfDay(_st.hour, _st.minute, _st.second);        auto _time = _st.year.to!string @@ -1458,6 +1459,7 @@ break; // terminate, stop  #+BEGIN_SRC d  <<doc_header_including_copyright_and_license>>  module doc_reform.meta.metadoc; +@safe:  template spineAbstraction() {    <<imports_spine_metadoc>>    <<spine_metadoc_mixin>> @@ -1643,15 +1645,15 @@ struct DocumentMatters {  #+NAME: spine_each_file_do_document_matters_1_detail_program_time  #+BEGIN_SRC d -@safe auto generator_program() { +auto generator_program() {    struct Prog_ { -    @safe string project_name() { +    string project_name() {        return "spine";      } -    @safe string name() { +    string name() {        return program_info.name;      } -    @safe string ver() { +    string ver() {        return program_info.ver;      }      @trusted string name_and_version() { @@ -1660,22 +1662,22 @@ struct DocumentMatters {      @trusted string name_version_and_compiler() {        return program_info.name_version_and_compiler;      } -    @safe string url_home() { +    string url_home() {        return "https://sisudoc.org";      } -    @safe string url_git() { +    string url_git() {        return "https://git.sisudoc.org/projects/";      } -    @safe auto compiler() { +    auto compiler() {        return program_info.compiler;      } -    @safe auto time_output_generated() { +    auto time_output_generated() {        return program_info.time_output_generated;      }    }    return Prog_();  } -@safe auto generated_time() { +auto generated_time() {    auto _st = Clock.currTime(UTC());    auto _time = _st.year.to!string      ~ "-" ~ _st.month.to!int.to!string // prefer as month number @@ -1692,10 +1694,10 @@ struct DocumentMatters {  #+NAME: spine_each_file_do_document_matters_2_meta  #+BEGIN_SRC d -@safe auto conf_make_meta() { +auto conf_make_meta() {    return _make_and_meta_struct;  } -@safe auto has() { +auto has() {    return _doc_has_struct;  }  #+END_SRC @@ -1704,12 +1706,12 @@ struct DocumentMatters {  #+NAME: spine_each_file_do_document_matters_3_env  #+BEGIN_SRC d -@safe auto env() { +auto env() {    struct Env_ { -    @safe auto pwd() { +    auto pwd() {        return _manifest.env.pwd;      } -    @safe auto home() { +    auto home() {        return _manifest.env.home;      }    } @@ -1721,9 +1723,9 @@ struct DocumentMatters {  #+NAME: spine_each_file_do_document_matters_4_opt  #+BEGIN_SRC d -@safe auto opt() { +auto opt() {    struct Opt_ { -    @safe auto action() { +    auto action() {        /+ getopt options, commandline instructions, raw         - processing instructions --epub --html etc.         - command line config instructions --output @@ -1739,18 +1741,18 @@ struct DocumentMatters {  #+NAME: spine_each_file_do_document_matters_5_doc  #+BEGIN_SRC d -@safe auto src() { +auto src() {    return _manifest.src;  } -@safe auto src_path_info() { +auto src_path_info() {    return spinePathsSRC!()(_manifest.env.pwd, _manifest.src.file_with_absolute_path); // would like (to have and use) relative path  } -@safe auto pod() { +auto pod() {    return _manifest.pod;  } -@safe auto sqlite() { +auto sqlite() {    struct SQLite_ { -    @safe string filename() { +    string filename() {        string _fn = "";        string _pth = "";        if (_opt_action.sqliteDB_filename.length > 0) { @@ -1760,7 +1762,7 @@ struct DocumentMatters {        }        return _fn;      } -    @safe string path() { +    string path() {        string _pth = "";        if (_opt_action.sqliteDB_path.length > 0) {          _pth = _opt_action.sqliteDB_path; @@ -1769,7 +1771,7 @@ struct DocumentMatters {        }        return _pth;      } -    @safe string cgi_filename() { +    string cgi_filename() {        string _fn = "";        if (_opt_action.cgi_sqlite_search_filename.length > 0) {          _fn = _opt_action.cgi_sqlite_search_filename; @@ -1778,7 +1780,7 @@ struct DocumentMatters {        }        return _fn;      } -    @safe string cgi_filename_d() { +    string cgi_filename_d() {        string _fn = "";        if (_opt_action.cgi_sqlite_search_filename_d.length > 0) {          _fn = _opt_action.cgi_sqlite_search_filename_d; @@ -1790,10 +1792,10 @@ struct DocumentMatters {    }    return SQLite_();  } -@safe auto output_path() { +auto output_path() {    return _make_and_meta_struct.conf.output_path;  } -@safe auto srcs() { +auto srcs() {    struct SRC_ {      auto file_insert_list() {        return _header_body_insertfilelist_imagelist[headBody.insert_file_list]; diff --git a/src/doc_reform/conf/compile_time_info.d b/src/doc_reform/conf/compile_time_info.d index 481ba4a..79db3f2 100644 --- a/src/doc_reform/conf/compile_time_info.d +++ b/src/doc_reform/conf/compile_time_info.d @@ -51,6 +51,7 @@    compile_time_info  +/  module doc_reform.conf.compile_time_info; +@safe:  template CompileTimeInfo() {    version(Windows) {      pragma(msg, "[ Windows compilation ]"); diff --git a/src/doc_reform/io_in/paths_source.d b/src/doc_reform/io_in/paths_source.d index 2bb5c4d..8d12f98 100644 --- a/src/doc_reform/io_in/paths_source.d +++ b/src/doc_reform/io_in/paths_source.d @@ -53,6 +53,7 @@    meta_config_files.d  +/  module doc_reform.io_in.paths_source; +@safe:  import    std.array,    std.file, @@ -66,7 +67,7 @@ import  template PodManifest() {    mixin spineRgxFiles;    static auto rgx_files = RgxFiles(); -  @safe auto PodManifest(O)( +  auto PodManifest(O)(      O       _opt_action,      string  _pth=""    ) { @@ -74,7 +75,7 @@ template PodManifest() {        string pod_manifest_filename() {          return "pod.manifest";        } -      @safe string pod_manifest_path() { +      string pod_manifest_path() {          string _manifest_path;          if ((isValidPath(_pth) && exists(_pth) != 0 && _pth.isDir)          && (exists(_pth.chainPath(pod_manifest_filename).array) != 0 @@ -96,10 +97,10 @@ template PodManifest() {          }          return _manifest_path;        } -      @safe string pods_collection_root_path() { +      string pods_collection_root_path() {          return (pod_manifest_path.length > 0) ? ((chainPath(pod_manifest_path, "..")).asNormalizedPath).array.to!string : "";        } -      @safe string pod_manifest_file_with_path() { +      string pod_manifest_file_with_path() {          string _k;          if  (exists(pod_manifest_path.chainPath(pod_manifest_filename).array)!=0) {            _k = pod_manifest_path.chainPath(pod_manifest_filename).array; @@ -121,14 +122,14 @@ template PathMatters() {    mixin spineRgxFiles;    static auto rgx_files = RgxFiles();    static auto mkup = InlineMarkup(); -  @safe auto PathMatters(O,E)( +  auto PathMatters(O,E)(      O        _opt_action,      E        _env,      string   _pth,      string   _fns              = "",      char[][] _manifest_fn_list = [[]],    ) { -    @safe auto _manifested = PodManifest!()(_opt_action, _pth); +    auto _manifested = PodManifest!()(_opt_action, _pth);      struct ManifestMatters_ {        auto env() {          auto _env = _env; @@ -142,7 +143,7 @@ template PathMatters() {          }          return Env_();        } -      @safe auto opt() { +      auto opt() {          struct Opt_ {            auto action() {              return _opt_action; @@ -150,45 +151,45 @@ template PathMatters() {          }          return Opt_();        } -      @safe bool src_is_pod() { +      bool src_is_pod() {          return (_manifested.pod_manifest_path.length > 0) ? true : false;        } -      @safe auto pod() { +      auto pod() {          struct Pod_ { -          @safe bool src_is_pod() { +          bool src_is_pod() {              return (_manifested.pod_manifest_path.length > 0) ? true : false;            } -          @safe string collection_root() { +          string collection_root() {              return _manifested.pods_collection_root_path;            } -          @safe string manifest_filename() { +          string manifest_filename() {              return _manifested.pod_manifest_filename;            } -          @safe string manifest_path() { +          string manifest_path() {              return _manifested.pod_manifest_path;            } -          @safe string pod_name_with_path() { +          string pod_name_with_path() {              return _manifested.pod_manifest_path.baseName;            } -          @safe string manifest_file_with_path() { +          string manifest_file_with_path() {              return _manifested.pod_manifest_file_with_path;            } -          @safe string[] config_dr_document_make_dirs() { +          string[] config_dr_document_make_dirs() {              string[] _config_dirs;              return _config_dirs;            } -          @safe string[] config_local_site_dirs() { +          string[] config_local_site_dirs() {              string[] _config_dirs;              return _config_dirs;            } -          @safe string[] image_dirs() { +          string[] image_dirs() {              string[] _image_dirs;              return _image_dirs;            } -          @safe auto manifest_list_of_filenames() { +          auto manifest_list_of_filenames() {              return _manifest_fn_list;            } -          @safe string[] manifest_list_of_languages() { +          string[] manifest_list_of_languages() {              string[] _lngs;              foreach (filename_; manifest_list_of_filenames) {                string _k = "en"; @@ -202,43 +203,43 @@ template PathMatters() {          }          return Pod_();        } -      @safe auto src() { +      auto src() {          string _fns = _fns; // required here by dmd & not by ldc (for D:2078)          auto _opt_action = _opt_action;          auto _env = _env;          struct SRC_ { -          @safe bool is_pod() { +          bool is_pod() {              return (_manifested.pod_manifest_path.length > 0) ? true : false;            } -          @safe string path_and_fn() { +          string path_and_fn() {              return _fns;            } -          @safe string pod_name_with_path() { +          string pod_name_with_path() {              return (is_pod) ? _manifested.pod_manifest_path : "";            } -          @safe string pods_collection_root_path() { +          string pods_collection_root_path() {              return (is_pod) ? _manifested.pods_collection_root_path : "";            } -          @safe string pod_name() { +          string pod_name() {              return pod_name_with_path.baseName;            } -          @safe string filename() { +          string filename() {              return path_and_fn.baseName;            } -          @safe string filename_base() { +          string filename_base() {              return filename.stripExtension;            } -          @safe string filename_extension() { +          string filename_extension() {              return filename.match(rgx_files.src_pth_sst_or_ssm).captures["extension"];            } -          @safe string lng() { +          string lng() {              string _k;              if (auto m = path_and_fn.match(rgx_files.language_code_and_filename)) {                _k = m.captures[1];              } else {_k = "en"; }              return _k;            } -          @safe string doc_uid() { +          string doc_uid() {              string _uid;              if (is_pod && !(pod_name_with_path.empty)) {                if (pod_name_with_path.baseName == filename_base) { @@ -251,7 +252,7 @@ template PathMatters() {              }              return _uid;            } -          @safe string doc_uid_out() { +          string doc_uid_out() {              string _uid;              if (is_pod && !(pod_name_with_path.empty)) {                if (pod_name_with_path.baseName == filename_base) { @@ -264,7 +265,7 @@ template PathMatters() {              }              return _uid;            } -          @safe string docname_composite_unique_per_src_doc() { +          string docname_composite_unique_per_src_doc() {              string _fn;              if (pod_name_with_path.baseName == filename_base) {                _fn = filename_base ~ mkup.uid_sep ~ filename_extension ~ mkup.uid_sep ~ lng; @@ -275,7 +276,7 @@ template PathMatters() {              }              return _fn;            } -          @safe string docname_composite_unique_per_src_pod() { +          string docname_composite_unique_per_src_pod() {            /+              z pod name if any + src filename (without lng code)               filename ~ mkup.uid_sep ~ lng @@ -294,19 +295,19 @@ template PathMatters() {              }              return _fn;            } -          @safe string language() { +          string language() {              return lng();            } -          @safe string file_with_absolute_path() { +          string file_with_absolute_path() {              return _env["pwd"].chainPath(path_and_fn).array;            } -          @safe string absolute_path_to_src() { +          string absolute_path_to_src() {              return (_env["pwd"].chainPath(path_and_fn)).dirName.array;            } -          @safe string path_to_doc_root_path_to_lang_and_filename() { +          string path_to_doc_root_path_to_lang_and_filename() {              return _env["pwd"].chainPath(path_and_fn).array;            } -          @safe string base_dir() { +          string base_dir() {              string _dir;              if (                auto m = (absolute_path_to_src) @@ -324,7 +325,7 @@ template PathMatters() {              }              return _dir;            } -          @safe string base_parent_dir_path() { +          string base_parent_dir_path() {              string _dir;              if (                auto m = (absolute_path_to_src) @@ -336,7 +337,7 @@ template PathMatters() {              }              return _dir;            } -          @safe string base_dir_path() { +          string base_dir_path() {              string _dir;              if (                auto m = (absolute_path_to_src) @@ -356,11 +357,11 @@ template PathMatters() {              }              return _dir;            } -          @safe string media_dir_path() { +          string media_dir_path() {              string _dir = ((base_dir_path.chainPath("media")).asNormalizedPath).array;              return _dir;            } -          @safe string image_dir_path() { +          string image_dir_path() {              string _paths;              string[] _possible_img_pths = [ "./image", "../image", "../../image" ];              string _img_pth_found = ""; @@ -384,10 +385,10 @@ template PathMatters() {              }              return _img_pth_found;            } -          @safe auto conf_dir_path() { +          auto conf_dir_path() {              return ((base_dir_path.chainPath("conf")).asNormalizedPath).array;            } -          @safe auto base_parent_dir() { +          auto base_parent_dir() {              string _dir;              if (                auto m = (absolute_path_to_src) @@ -402,13 +403,13 @@ template PathMatters() {              }              return _dir;            } -          @safe string[] config_dirs() { +          string[] config_dirs() {              string[] _config_dirs;              if (is_pod) {              } else {}              return _config_dirs;            } -          @safe string[] image_dirs() { +          string[] image_dirs() {              string[] _image_dirs;              if (is_pod) {              } else {} @@ -417,7 +418,7 @@ template PathMatters() {          }          return SRC_();        } -      @safe auto output() { +      auto output() {          /+            - command line if output path set            - config file if found and set set @@ -431,7 +432,7 @@ template PathMatters() {          +/          auto _env = _env;          struct Out_ { -          @safe auto path() { +          auto path() {              auto _output_path = _env["pwd"];              if ((_opt_action.output_dir_set.length > 0)                && isValidPath(_opt_action.output_dir_set) @@ -459,21 +460,21 @@ template PathMatters() {    }  }  template configFilePaths() { -  @safe auto configFilePaths(M,E)( +  auto configFilePaths(M,E)(      M      _manifested,      E      _env,      string _cli_config_path_set = ""    ) {      struct ConfFilePaths { -      @safe string config_filename_document() { +      string config_filename_document() {          return "dr_document_make";        } -      @safe string config_filename_site() { +      string config_filename_site() {          return "config_local_site";        } -      @safe auto possible_config_path_locations() { +      auto possible_config_path_locations() {          struct _ConfFilePaths { -          @safe string[] dr_document_make() { +          string[] dr_document_make() {              /+ FIX clean up conf paths ↓ +/              /+ config local site (file system only, not in pod) +/              /+ return paths +/ @@ -521,7 +522,7 @@ template configFilePaths() {              +/              return _possible_config_path_locations;            } -          @safe string[] config_local_site() { +          string[] config_local_site() {              /+ FIX clean up conf paths ↓ +/              /+ config local site (file system only, not in pod) +/              string[] _possible_config_path_locations; @@ -580,15 +581,15 @@ template configFilePaths() {  template spinePathsSRC() {    mixin spineRgxFiles;    static auto rgx_files = RgxFiles(); -  @safe auto spinePathsSRC(D,Fn)( +  auto spinePathsSRC(D,Fn)(      D   _pwd,      Fn  _fn_src_and_path,    ) {      struct drSrcPaths { -      @safe auto pwd() { +      auto pwd() {          return _pwd;        } -      @safe string language() { +      string language() {          // use command line info as well?          string _k;          if (auto m = _fn_src_and_path.match(rgx_files.language_code_and_filename)) { @@ -598,28 +599,28 @@ template spinePathsSRC() {          }          return _k;        } -      @safe string doc_root() { +      string doc_root() {          return "dr_doc";        } -      @safe auto media_root() { +      auto media_root() {          return ((doc_root.chainPath("media")).asNormalizedPath).array;        } -      @safe auto conf_root() { +      auto conf_root() {          return ((doc_root.chainPath("conf")).asNormalizedPath).array;        } -      @safe auto text_root() { +      auto text_root() {          return ((media_root.chainPath("text")).asNormalizedPath).array;        } -      @safe auto image_root() { +      auto image_root() {          return ((media_root.chainPath("image")).asNormalizedPath).array;        } -      @safe auto doc_src_fn_with_path_for_text_root_and_lng() { +      auto doc_src_fn_with_path_for_text_root_and_lng() {          return ((text_root.chainPath(language)).asNormalizedPath).array;        } -      @safe auto doc_src_fn() { +      auto doc_src_fn() {          return ((_fn_src_and_path.baseName).asNormalizedPath).array;        } -      @safe auto doc_src_with_path() { +      auto doc_src_with_path() {          return ((pwd.chainPath(_fn_src_and_path)).asNormalizedPath).array;        }      } diff --git a/src/doc_reform/io_in/read_config_files.d b/src/doc_reform/io_in/read_config_files.d index 29dce0a..ac34074 100644 --- a/src/doc_reform/io_in/read_config_files.d +++ b/src/doc_reform/io_in/read_config_files.d @@ -53,6 +53,7 @@    meta_config_files.d  +/  module doc_reform.io_in.read_config_files; +@safe:  import    std.file,    std.path; @@ -61,7 +62,6 @@ import    doc_reform.io_in.paths_source,    doc_reform.meta.rgx_files,    doc_reform.meta.rgx; -  template readConfigSite() {    @system final auto readConfigSite(Cf,O,Cfg)(Cf _conf_file_details, O _opt_action, Cfg _cfg) {      mixin spineRgxIn; @@ -228,13 +228,13 @@ static template readConfigDoc() {        if (config_file_str.length > 0) { break; }      }      struct _ConfContent { -      @safe string filename() { +      string filename() {          return conf_filename;        } -      @safe string content() { +      string content() {          return config_file_str;        } -      @safe string filetype() { +      string filetype() {          string _ft = "";          if (content.match(rgx.yaml_config)) {            _ft = "yaml"; @@ -254,7 +254,7 @@ static template configReadSiteYAML() {      doc_reform.io_in.paths_source,      doc_reform.meta.rgx_files,      doc_reform.meta.rgx; -  @safe final YAMLDocument configReadSiteYAML(M,E)(M _manifested, E _env) { +  final YAMLDocument configReadSiteYAML(M,E)(M _manifested, E _env) {      string _configuration = configReadInSiteYAML!()(_manifested, _env);      auto _conf_file_details = configFilePaths!()(_manifested, _env);      string _conf_yaml_fn = _conf_file_details.config_filename_site; @@ -269,7 +269,7 @@ static template configReadDocYAML() {    import      doc_reform.meta,      doc_reform.io_in.paths_source; -  @safe final YAMLDocument configReadDocYAML(M,E)(M _manifested, E _env) { +  final YAMLDocument configReadDocYAML(M,E)(M _manifested, E _env) {      string _configuration = configReadInDocYAML!()(_manifested, _env);      auto _conf_file_details = configFilePaths!()(_manifested, _env);      string _conf_yaml_fn = _conf_file_details.config_filename_document; diff --git a/src/doc_reform/io_in/read_source_files.d b/src/doc_reform/io_in/read_source_files.d index 36de9f3..73785c0 100644 --- a/src/doc_reform/io_in/read_source_files.d +++ b/src/doc_reform/io_in/read_source_files.d @@ -53,6 +53,7 @@    - if master file scan for addional files to import/insert  +/  module doc_reform.io_in.read_source_files; +@safe:  template spineRawMarkupContent() {    import      std.file, @@ -67,7 +68,7 @@ template spineRawMarkupContent() {    mixin spineRgxFiles;    static auto rgx_files = RgxFiles();    string[] _images=[]; -  @safe string[] _extract_images(S)(S content_block) { +  string[] _extract_images(S)(S content_block) {      string[] images_;      string _content_block = content_block.to!string;      if (auto m = _content_block.matchAll(rgx.image)) { @@ -87,19 +88,19 @@ template spineRawMarkupContent() {      string[], "insert_files",      string[], "images"    ); -  @safe auto spineRawMarkupContent(O,Fn)(O _opt_action, Fn fn_src) { +  auto spineRawMarkupContent(O,Fn)(O _opt_action, Fn fn_src) {      auto _0_header_1_body_content_2_insert_filelist_tuple        = rawsrc.sourceContentSplitIntoHeaderAndBody(_opt_action, rawsrc.sourceContent(fn_src), fn_src);      return _0_header_1_body_content_2_insert_filelist_tuple;    }    struct RawMarkupContent { -    @safe final sourceContent(in string fn_src) { +    final sourceContent(in string fn_src) {        auto raw = MarkupRawUnit();        string source_txt_str          = raw.markupSourceReadIn(fn_src);        return source_txt_str;      } -    @safe final auto sourceContentSplitIntoHeaderAndBody(O)( +    final auto sourceContentSplitIntoHeaderAndBody(O)(        O         _opt_action,        in string source_txt_str,        in string fn_src="" @@ -136,7 +137,7 @@ template spineRawMarkupContent() {    }    struct MarkupRawUnit {      import std.file; -    @safe final private string readInMarkupSource(in char[] fn_src) { +    final private string readInMarkupSource(in char[] fn_src) {        enforce(          exists(fn_src) != 0,          "file not found: «" ~ @@ -177,7 +178,7 @@ template spineRawMarkupContent() {          = (cast(char[]) src_text).split(rgx.newline_eol_strip_preceding);        return source_line_arr;      } -    @safe string markupSourceReadIn(in string fn_src) { +    string markupSourceReadIn(in string fn_src) {        static auto rgx_files = RgxFiles();        enforce(          fn_src.match(rgx_files.src_pth_sst_or_ssm), @@ -187,7 +188,7 @@ template spineRawMarkupContent() {        string source_txt_str = readInMarkupSource(fn_src);        return source_txt_str;      } -    @safe HeaderContentInsertsImages markupSourceHeaderContentRawLineTupleArray(in string source_txt_str) { +    HeaderContentInsertsImages markupSourceHeaderContentRawLineTupleArray(in string source_txt_str) {        string[] file_insert_list = [];        string[] images_list = [];        char[][] hc = header0Content1(source_txt_str); @@ -202,7 +203,7 @@ template spineRawMarkupContent() {        );        return t;      } -    @safe final char[][] getInsertMarkupSourceContentRawLineArray( +    final char[][] getInsertMarkupSourceContentRawLineArray(        in char[]    fn_src_insert,        Regex!(char) rgx_file      ) { @@ -221,7 +222,7 @@ template spineRawMarkupContent() {        char[][], "insert_contents",        string[], "images"      ); -    @safe ContentsAndImages scan_subdoc_source(O)( +    ContentsAndImages scan_subdoc_source(O)(        O        _opt_action,        char[][] markup_sourcefile_insert_content,        string   fn_src @@ -294,7 +295,7 @@ template spineRawMarkupContent() {        );        return t;      } -    @safe ContentsInsertsImages scan_master_src_for_insert_files_and_import_content(O)( +    ContentsInsertsImages scan_master_src_for_insert_files_and_import_content(O)(        O        _opt_action,        char[][] sourcefile_body_content,        string   fn_src diff --git a/src/doc_reform/io_out/create_zip_file.d b/src/doc_reform/io_out/create_zip_file.d index b6feacf..63e243b 100644 --- a/src/doc_reform/io_out/create_zip_file.d +++ b/src/doc_reform/io_out/create_zip_file.d @@ -48,13 +48,14 @@  +/  module doc_reform.io_out.create_zip_file; +@safe:  template createZipFile() {    import      std.file,      std.outbuffer,      std.string,      std.zip; -  @safe void createZipFile( +  void createZipFile(      string zip_file_name,      void[] compressed_zip_data,    ) { diff --git a/src/doc_reform/io_out/defaults.d b/src/doc_reform/io_out/defaults.d index 0b21d20..2a51625 100644 --- a/src/doc_reform/io_out/defaults.d +++ b/src/doc_reform/io_out/defaults.d @@ -51,6 +51,7 @@    default settings  +/  module doc_reform.io_out.defaults; +@safe:  template InternalMarkup() {    import std.array; @@ -100,7 +101,7 @@ template InternalMarkup() {  template spineLanguageCodes() {    /+ language codes +/    struct Lang { -    @safe static 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"    ], @@ -167,15 +168,15 @@ template spineLanguageCodes() {        ];        return _lang_codes;      } -    @safe static string[] code_arr_ptr() { +    static string[] code_arr_ptr() {        string[] _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;      } -    @safe static string[] code_arr() { +    static string[] code_arr() {        string[] _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;      } -    @safe static auto codes_() { +    static auto codes_() {        return "(" ~ join(code_arr,"|") ~ ")";      }      static auto codes_regex() { diff --git a/src/doc_reform/io_out/epub3.d b/src/doc_reform/io_out/epub3.d index 808d9fb..cffc464 100644 --- a/src/doc_reform/io_out/epub3.d +++ b/src/doc_reform/io_out/epub3.d @@ -48,6 +48,7 @@  +/  module doc_reform.io_out.epub3; +@safe:  template outputEPub3() {    import      std.file, @@ -66,7 +67,7 @@ template outputEPub3() {    mixin outputXHTMLs;    static auto rgx = RgxO();    static auto rgx_xhtml = RgxXHTML(); -  @safe string special_characters_text(string _txt) { +  string special_characters_text(string _txt) {      _txt = _txt        .replaceAll(rgx_xhtml.ampersand,    "&")  // "&"        .replaceAll(rgx_xhtml.quotation,    """) // """ @@ -78,12 +79,12 @@ template outputEPub3() {        .replaceAll(rgx.nbsp_char,          " ");      return _txt;    } -  @safe string epub3_mimetypes() { +  string epub3_mimetypes() {      string o;      o = format(q"┃application/epub+zip┃") ~ "\n";      return o;    } -  @safe string epub3_container_xml() { +  string epub3_container_xml() {      string o;      o = format(q"┃<?xml version="1.0" encoding="utf-8"?>┃") ~ "\n";      o ~= format(q"┃<container version="1.0" @@ -94,7 +95,7 @@ template outputEPub3() {    </rootfiles>┃") ~ "\n</container>\n";      return o;    } -  @safe string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) { +  string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) {      auto xhtml_format = outputXHTMLs();      auto pth_epub3 = spinePathsEPUB!()(doc_matters.output_path, doc_matters.src.language);      string _uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO sort uuid in doc_matters! @@ -182,7 +183,7 @@ template outputEPub3() {      }      return content;    } -  @safe string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { +  string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) {      enum DomTags { none, open, close, close_and_open, open_still, }      auto markup = InlineMarkup();      static auto rgx = RgxO(); diff --git a/src/doc_reform/io_out/html.d b/src/doc_reform/io_out/html.d index 397cb95..e7e21c2 100644 --- a/src/doc_reform/io_out/html.d +++ b/src/doc_reform/io_out/html.d @@ -48,6 +48,7 @@  +/  module doc_reform.io_out.html; +@safe:  template outputHTML() {    import      std.file, @@ -63,7 +64,7 @@ template outputHTML() {      doc_reform.io_out.xmls,      doc_reform.io_out.xmls_css;    mixin outputXHTMLs; -  @safe void scroll(D,M)( +  void scroll(D,M)(      const        D    doc_abstraction,                   M    doc_matters,    ) { @@ -270,7 +271,7 @@ template outputHTML() {        writeln(" ", pth_html.fn_scroll(doc_matters.src.filename));      }    } -  @safe void seg(D,M)( +  void seg(D,M)(      const D    doc_abstraction,            M    doc_matters,    ) { @@ -557,7 +558,7 @@ template outputHTML() {        writeln(" ", pth_html.fn_seg(doc_matters.src.filename, "toc"));      }    } -  @safe void css(M)(M doc_matters) { +  void css(M)(M doc_matters) {      auto css = spineCss(doc_matters);      auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language);      try { diff --git a/src/doc_reform/io_out/html_snippet.d b/src/doc_reform/io_out/html_snippet.d index 73d861e..843f541 100644 --- a/src/doc_reform/io_out/html_snippet.d +++ b/src/doc_reform/io_out/html_snippet.d @@ -48,6 +48,7 @@  +/  module doc_reform.io_out.html_snippet; +@safe:  template htmlSnippet() {    import      std.file, @@ -83,7 +84,7 @@ template htmlSnippet() {      );      return html_blank_default;    } -  @safe string special_characters_text(string _txt) { +  string special_characters_text(string _txt) {      mixin spineRgxOut;      mixin spineRgxXHTML;      static auto rgx = RgxO(); diff --git a/src/doc_reform/io_out/hub.d b/src/doc_reform/io_out/hub.d index 16c866e..3be873e 100644 --- a/src/doc_reform/io_out/hub.d +++ b/src/doc_reform/io_out/hub.d @@ -52,6 +52,7 @@    check & generate output types requested  +/  module doc_reform.io_out.hub; +@safe:  template outputHub() {    import doc_reform.io_out,      doc_reform.io_out.metadata, diff --git a/src/doc_reform/io_out/latex.d b/src/doc_reform/io_out/latex.d index a47e81c..8c792ff 100644 --- a/src/doc_reform/io_out/latex.d +++ b/src/doc_reform/io_out/latex.d @@ -48,6 +48,7 @@  +/  module doc_reform.io_out.latex; +@safe:  template paperLaTeX() {    import      std.format, @@ -58,7 +59,7 @@ template paperLaTeX() {        return _mm;      }      struct PaperType { -      @safe auto a4() { +      auto a4() {          struct A4 {            auto portrait() {              struct V { @@ -109,7 +110,7 @@ template paperLaTeX() {          }          return A4();        } -      @safe auto a5() { +      auto a5() {          struct A5 {            auto portrait() {              struct V { @@ -160,7 +161,7 @@ template paperLaTeX() {          }          return A5();        } -      @safe auto b4() { +      auto b4() {          struct B4 {            auto portrait() {              struct V { @@ -211,7 +212,7 @@ template paperLaTeX() {          }          return B4();        } -      @safe auto letter() { +      auto letter() {          struct Letter {            auto portrait() {              struct V { @@ -262,7 +263,7 @@ template paperLaTeX() {          }          return Letter();        } -      @safe auto legal() { +      auto legal() {          struct Legal {            auto portrait() {              struct V { @@ -335,7 +336,7 @@ template outputLaTeX() {    mixin spineLanguageCodes;    auto lang = Lang();    auto paper = paperLaTeX; -  @safe string sp_char_ops()( +  string sp_char_ops()(      string      _txt,    ) {      string _unescape_sp_char_esc()(string _txt) { @@ -359,7 +360,7 @@ template outputLaTeX() {      _txt = replaceAll!(m => _unescape_fontface_esc(m[0]))(_txt, rgx_sc.latex_identify_inline_fontface);      return _txt;    } -  @safe string sp_char_esc(O)( +  string sp_char_esc(O)(      string      _txt,      const    O  obj,    ) { @@ -368,20 +369,20 @@ template outputLaTeX() {      }      return _txt;    } -  @safe string sp_char_esc_txt()( +  string sp_char_esc_txt()(      string      _txt,    ) {      _txt = _txt.sp_char_ops;      return _txt;    } -  @safe string marked_linebreaks_newlines()( +  string marked_linebreaks_newlines()(      string      _txt,    ) {      _txt = _txt.split(rgx.br_linebreaks_newlines).join("\\br\n").strip;      // _txt = replaceAll!(m => "\\br " ~ m[1])(_txt, rgx.br_linebreaks_newlines);      return _txt;    } -  @safe string fontface()( +  string fontface()(      string      _txt,    ) {    _txt = _txt @@ -397,7 +398,7 @@ template outputLaTeX() {      .replaceAll(rgx.inline_italics,     format(q"┃``%s''┃",                           "$1"));      return _txt;    } -  @safe string leading_hardspaces()( +  string leading_hardspaces()(      string      _txt,    ) {      string hardspaces(string _spaces) { @@ -408,7 +409,7 @@ template outputLaTeX() {      _txt = replaceAll!(m => hardspaces(m[0]))(_txt, rgx.spaces_line_start);      return _txt;    } -  @safe string nbsp_char()(string _txt) { +  string nbsp_char()(string _txt) {      if (_txt.match(rgx.nbsp_char)) {        foreach (m; _txt.matchAll(rgx.nbsp_chars)) {          int spaces_ = 0; @@ -420,7 +421,7 @@ template outputLaTeX() {      }      return _txt;    } -  @safe string spaces_to_nbsp()(string _txt) { +  string spaces_to_nbsp()(string _txt) {      if (_txt.match(rgx.spaces_keep)) {        foreach (m; _txt.matchAll(rgx.spaces_keep)) {          int spaces_ = 0; @@ -432,13 +433,13 @@ template outputLaTeX() {      }      return _txt;    } -  @safe string nbsp_char_to_space()(string _txt) { +  string nbsp_char_to_space()(string _txt) {      if (_txt.match(rgx.nbsp_char)) {        _txt  = _txt.replaceAll(rgx.nbsp_char, " ");      }      return _txt;    } -  @safe string links_and_images(O,M)( +  string links_and_images(O,M)(      string      _txt,      const    O  obj,               M  doc_matters, @@ -485,7 +486,7 @@ template outputLaTeX() {      }      return _txt;    } -  @safe string footnotes()( +  string footnotes()(      string      _txt,    ) {      if (_txt.match(rgx.inline_notes_al_gen)) { @@ -500,7 +501,7 @@ template outputLaTeX() {      }      return _txt;    } -  @safe string remove_footnotes()( +  string remove_footnotes()(      string      _txt,    ) {      if (_txt.match(rgx.inline_notes_al_gen)) { @@ -508,7 +509,7 @@ template outputLaTeX() {      }      return _txt;    } -  @safe string para(O)( +  string para(O)(      string      _txt,      O           obj,    ) { @@ -522,7 +523,7 @@ template outputLaTeX() {      }      return _txt;    } -  @safe string bookindex(O)( +  string bookindex(O)(      string      _txt,      O           obj,    ) { @@ -537,7 +538,7 @@ template outputLaTeX() {      }      return _txt;    } -  @safe string heading(O,M)( +  string heading(O,M)(      string      _txt,      O           obj,      M           doc_matters, @@ -932,7 +933,7 @@ template outputLaTeX() {      }      return _txt;    } -  @safe string bullets_and_indentation(O)( +  string bullets_and_indentation(O)(      string      _txt,      O           obj,    ) { diff --git a/src/doc_reform/io_out/metadata.d b/src/doc_reform/io_out/metadata.d index 029bd28..94bb9a9 100644 --- a/src/doc_reform/io_out/metadata.d +++ b/src/doc_reform/io_out/metadata.d @@ -48,9 +48,10 @@  +/  module doc_reform.io_out.metadata; +@safe:  template outputMetadata() { -  @safe void outputMetadata(T)( T  doc_matters) { -    @safe string inline_search_form(M)( +  void outputMetadata(T)( T  doc_matters) { +    string inline_search_form(M)(        M  doc_matters,      ) {        string o; @@ -363,7 +364,7 @@ string theme_light_1 = format(q"┃    doc_matters.opt.action.css_theme_default ? theme_light_0 : theme_dark_0,    doc_matters.opt.action.css_theme_default ? theme_light_1 : theme_dark_1,  ) ~ "\n"; -    @safe void metadata_write_output(M)(M doc_matters, string[] metadata_) { +    void metadata_write_output(M)(M doc_matters, string[] metadata_) {        auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language);        try {          if (!exists(pth_html.base)) { diff --git a/src/doc_reform/io_out/odt.d b/src/doc_reform/io_out/odt.d index 15e7e8e..c17158a 100644 --- a/src/doc_reform/io_out/odt.d +++ b/src/doc_reform/io_out/odt.d @@ -48,6 +48,7 @@  +/  module doc_reform.io_out.odt; +@safe:  template formatODT() {    import      doc_reform.io_out, @@ -69,7 +70,7 @@ template formatODT() {    struct formatODT {      static auto rgx = RgxO();      static auto rgx_xhtml = RgxXHTML(); -    @safe string _tags(O)(const O obj) { +    string _tags(O)(const O obj) {        string _tags = "";        if (obj.tags.anchor_tags.length > 0) {          foreach (tag_; obj.tags.anchor_tags) { @@ -87,7 +88,7 @@ template formatODT() {        }        return _tags;      } -    @safe string _xhtml_anchor_tags(O)(O obj) { +    string _xhtml_anchor_tags(O)(O obj) {        const(string[]) anchor_tags = obj.tags.anchor_tags;        string tags="";        if (anchor_tags.length > 0) { @@ -99,7 +100,7 @@ template formatODT() {        }        return tags;      } -    @safe string obj_num(O)(const O obj) { // TODO +    string obj_num(O)(const O obj) { // TODO        string _on;        _on = (obj.metainfo.object_number.empty)        ? "" @@ -109,7 +110,7 @@ template formatODT() {          ));        return _on;      } -    @safe string _footnotes()(string _txt) { +    string _footnotes()(string _txt) {        static auto rgx = RgxO();        static auto rgx_xhtml = RgxXHTML();        _txt = _txt.replaceAll( @@ -129,14 +130,14 @@ template formatODT() {        );        return _txt;      } -    @safe string _bullet(O)(const O obj) { +    string _bullet(O)(const O obj) {        string _b = "";        if (obj.attrib.bullet) {          _b = format(q"┃● ┃",);        }        return _b;      } -    @safe string _indent(O)(string _txt, const O obj) { // TODO +    string _indent(O)(string _txt, const O obj) { // TODO        // if (obj.attrib.indent_base > 0 ||        //   obj.attrib.indent_hang > 0        // ) { @@ -244,7 +245,7 @@ template formatODT() {        }        return _txt;      } -    @safe string _block_type_delimiters(O)(string[] _block_lines, const O obj) { // TODO +    string _block_type_delimiters(O)(string[] _block_lines, const O obj) { // TODO        string _block = "";        foreach (i, _line; _block_lines) {          _line = _footnotes(_line); @@ -277,7 +278,7 @@ template formatODT() {          obj_num(obj));        return _block;      } -    @safe string _special_characters(O)(string _txt, const O obj) { +    string _special_characters(O)(string _txt, const O obj) {        _txt = _txt          .replaceAll(rgx_xhtml.ampersand,    "&")          .replaceAll(rgx_xhtml.quotation,    """) @@ -286,7 +287,7 @@ template formatODT() {          .replaceAll(rgx.nbsp_char,          " ");        return _txt;      } -    @safe string _preserve_white_spaces(O)(string _txt, const O obj) { +    string _preserve_white_spaces(O)(string _txt, const O obj) {        if (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block") {          _txt = _txt            .replaceAll(rgx.space,      " "); @@ -307,9 +308,9 @@ template formatODT() {          .replaceAll(rgx.inline_mono,        format(q"┃<text:span text:style-name="Span_monospace">%s</text:span>┃",  "$1"));        return _txt;      } -    @safe auto _obj_num(O)(O obj) { // NOT USED YET +    auto _obj_num(O)(O obj) { // NOT USED YET        struct objNum { -        @safe string reference() { +        string reference() {            return format(q"┃<text:span text:style-name="Span_subscript">          <text:bookmark-start text:name="%s"/>          <text:bookmark-end text:name="%s"/> @@ -318,7 +319,7 @@ template formatODT() {              obj.object_number,            );          } -        @safe string display() { +        string display() {            return format(q"┃<text:span text:style-name="Span_subscript">        %s%s%s        </text:span>┃", @@ -330,20 +331,20 @@ template formatODT() {        }        return objNum();      } -    @safe string _break_page()() { +    string _break_page()() {        return format(q"┃      <text:p text:style-name="P_normal_page_new"/>      ┃",        );      } -    @safe string _empty_line_break(O)(string _txt, const O obj) { +    string _empty_line_break(O)(string _txt, const O obj) {        if (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block") {          _txt = _txt            .replaceAll(rgx.br_empty_line,    "<br />");        }        return _txt;      } -    @safe string _links(O)(string _txt, const O obj) { +    string _links(O)(string _txt, const O obj) {        if (obj.metainfo.is_a != "code") {          if (obj.metainfo.is_a == "toc") {            _txt = replaceAll!(m => @@ -383,7 +384,7 @@ template formatODT() {        }        return _txt;      } -    @safe string _images(O)(string _txt, const O obj) { +    string _images(O)(string _txt, const O obj) {        if (_txt.match(rgx.inline_image)) {          _txt = _txt            .replaceAll(rgx.inline_image, @@ -394,7 +395,7 @@ template formatODT() {        }        return _txt;      } -    @safe string markup(O)(const O obj) { +    string markup(O)(const O obj) {        /+ markup TODO +/        string _txt = obj.text;        _txt = _special_characters(_txt, obj);     // TODO & why both obj & obj.text, consider also in output_xmls.org @@ -408,7 +409,7 @@ template formatODT() {        _txt = _empty_line_break(_txt, obj);       // (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block")        return _txt;      } -    @safe string heading(O,M)( +    string heading(O,M)(        const        O  obj,        const        M  doc_matters,      ) { @@ -452,7 +453,7 @@ template formatODT() {        }        return _o_txt_odt;      } -    @safe string para(O,M)( +    string para(O,M)(        const        O  obj,        const        M  doc_matters,      ) { @@ -471,7 +472,7 @@ template formatODT() {        }        return _o_txt_odt;      } -    @safe string quote(O,M)( +    string quote(O,M)(        const        O  obj,        const        M  doc_matters,      ) { @@ -483,7 +484,7 @@ template formatODT() {        _o_txt_odt = _footnotes(_o_txt_odt); // decide        return _o_txt_odt;      } -    @safe string group(O,M)( +    string group(O,M)(        const        O  obj,        const        M  doc_matters,      ) { @@ -501,7 +502,7 @@ template formatODT() {        _o_txt_odt = _block_type_delimiters(_block_lines, obj);        return _o_txt_odt;      } -    @safe string block(O,M)( +    string block(O,M)(        const        O  obj,        const        M  doc_matters,      ) { @@ -514,7 +515,7 @@ template formatODT() {        _o_txt_odt = _block_type_delimiters(_block_lines, obj);        return _o_txt_odt;      } -    @safe string verse(O,M)( +    string verse(O,M)(        const        O  obj,        const        M  doc_matters,      ) { @@ -527,7 +528,7 @@ template formatODT() {        _o_txt_odt = _block_type_delimiters(_block_lines, obj);        return _o_txt_odt;      } -    @safe string code(O,M)( +    string code(O,M)(        const        O  obj,        const        M  doc_matters,      ) { @@ -574,7 +575,7 @@ template formatODT() {        _o_txt_odt = _block;        return _o_txt_odt;      } -    @safe Tuple!(string, string) tablarize(O)( +    Tuple!(string, string) tablarize(O)(        const        O    obj,        string            _txt,      ) { @@ -609,7 +610,7 @@ template formatODT() {        return t;      }      int _table_number = 0; -    @safe string table(O,M)( +    string table(O,M)(        const        O  obj,        const        M  doc_matters,      ) { @@ -666,7 +667,7 @@ template outputODT() {    static auto rgx = RgxO();    static auto rgx_xhtml = RgxXHTML();    // mixin outputXmlODT; -  @safe string odt_head(I)(I doc_matters) { +  string odt_head(I)(I doc_matters) {      string _has_tables = format(q"┃      <style:style style:name="Table1" style:family="table">        <style:table-properties style:width="16.999cm" table:align="margins"/> @@ -774,7 +775,7 @@ template outputODT() {    );      return _odt_head;    } -  @safe string odt_body(D,I)( +  string odt_body(D,I)(      const D    doc_abstraction,            I    doc_matters,    ) { @@ -900,12 +901,12 @@ template outputODT() {      return doc_odt;    } -  @safe string odt_tail() { +  string odt_tail() {      string _odt_tail = format(q"┃<text:p text:style-name="P_normal">spine: <<text:a xl:type="simple" xl:href="https://www.doc_reform.org">www.doc_reform.org</text:a>> and <<text:a xl:type="simple" xl:href="https://www.sisudoc.org">www.sisudoc.org</text:a>></text:p>    </office:text></office:body></office:document-content>┃",);      return _odt_tail;    } -  @safe string content_xml(D,I)( +  string content_xml(D,I)(      const D    doc_abstraction,            I    doc_matters,    ) { @@ -918,7 +919,7 @@ template outputODT() {      _content_xml ~= odt_tail;      return _content_xml;    } -  @safe string manifest_xml(M)( +  string manifest_xml(M)(      auto ref              M    doc_matters,    ) {      string _bullet = format(q"┃<manifest:file-entry manifest:media-type="" manifest:full-path="Pictures/bullet_09.png"/>┃"); @@ -942,7 +943,7 @@ template outputODT() {    );      return _manifest_xml;    } -  @safe void images_cp(M)( +  void images_cp(M)(      auto ref              M    doc_matters,    ) {      { /+ (copy odt images) +/ @@ -963,7 +964,7 @@ template outputODT() {      }      // return 0;    } -  @safe string meta_xml(M)( +  string meta_xml(M)(      auto ref              M    doc_matters,    ) {      /+ (meta_xml includes output time-stamp) +/ @@ -1011,11 +1012,11 @@ template outputODT() {      }      // return 0;    } -  @safe string mimetype() { +  string mimetype() {      string mimetype_ = format(q"┃application/vnd.oasis.opendocument.text┃");      return mimetype_;    } -  @safe string manifest_rdf() { +  string manifest_rdf() {      string _manifest_rdf = format(q"┃<?xml version="1.0" encoding="utf-8"?>    <rdf:RDF xmlns:rdf="https://www.w3.org/1999/02/22-rdf-syntax-ns#">      <rdf:Description rdf:about="styles.xml"> @@ -1037,7 +1038,7 @@ template outputODT() {    ┃");      return _manifest_rdf;    } -  @safe string settings_xml() { +  string settings_xml() {      string _settings_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?>    <office:document-settings xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xl="https://www.w3.org/1999/xlink" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="https://openoffice.org/2004/office" office:version="1.2">      <office:settings> @@ -1137,7 +1138,7 @@ template outputODT() {    ┃");      return _settings_xml;    } -  @safe string styles_xml() { +  string styles_xml() {      string _styles_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?>    <office:document-styles xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xl="https://www.w3.org/1999/xlink" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="https://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="https://openoffice.org/2004/office" xmlns:ooow="https://openoffice.org/2004/writer" xmlns:oooc="https://openoffice.org/2004/calc" xmlns:dom="https://www.w3.org/2001/xml-events" xmlns:rpt="https://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="https://www.w3.org/1999/xhtml" xmlns:grddl="https://www.w3.org/2003/g/data-view#" xmlns:tableooo="https://openoffice.org/2009/table" xmlns:css3t="https://www.w3.org/TR/css3-text/" office:version="1.2">      <office:font-face-decls> @@ -2033,7 +2034,7 @@ template outputODT() {    ┃");      return _styles_xml;    } -  void writeOutputODT(W,I)( +  @trusted void writeOutputODT(W,I)(      const W    odt_content,            I    doc_matters,    ) { @@ -2092,7 +2093,7 @@ template outputODT() {                  auto zip_arc_member_file = new ArchiveMember();                  zip_arc_member_file.name = fn_out;                  auto zip_data = new OutBuffer(); -                zip_data.write(cast(char[]) ((fn_src).read)); +                zip_data.write(cast(char[]) ((fn_src).read)); // trusted?                  zip_arc_member_file.expandedData = zip_data.toBytes();                  zip.addMember(zip_arc_member_file);                  createZipFile!()(fn_odt, zip.build()); diff --git a/src/doc_reform/io_out/paths_output.d b/src/doc_reform/io_out/paths_output.d index b11dbdb..a317896 100644 --- a/src/doc_reform/io_out/paths_output.d +++ b/src/doc_reform/io_out/paths_output.d @@ -51,6 +51,7 @@    default settings  +/  module doc_reform.io_out.paths_output; +@safe:  import    std.array,    std.path, diff --git a/src/doc_reform/io_out/rgx.d b/src/doc_reform/io_out/rgx.d index 524415a..212581f 100644 --- a/src/doc_reform/io_out/rgx.d +++ b/src/doc_reform/io_out/rgx.d @@ -51,6 +51,7 @@    regex: regular expressions used in sisu document parser  +/  module doc_reform.io_out.rgx; +@safe:  static template spineRgxOut() {    static struct RgxO {      static make_breakpage                           = ctRegex!(`new=(?P<breakpage>.+?)(?:;|$)`); diff --git a/src/doc_reform/io_out/rgx_latex.d b/src/doc_reform/io_out/rgx_latex.d index a69c903..2d43dc3 100644 --- a/src/doc_reform/io_out/rgx_latex.d +++ b/src/doc_reform/io_out/rgx_latex.d @@ -51,6 +51,7 @@    regex: regular expressions used in sisu document parser  +/  module doc_reform.io_out.rgx_latex; +@safe:  static template spineRgxLSC() {    static struct RgxLSC {      static latex_special_char                       = ctRegex!(`([%${}_#&\\])`); diff --git a/src/doc_reform/io_out/rgx_xhtml.d b/src/doc_reform/io_out/rgx_xhtml.d index 831bfdc..0bf8bb1 100644 --- a/src/doc_reform/io_out/rgx_xhtml.d +++ b/src/doc_reform/io_out/rgx_xhtml.d @@ -51,6 +51,7 @@    regex: regular expressions used in sisu document parser  +/  module doc_reform.io_out.rgx_xhtml; +@safe:  static template spineRgxXHTML() {    static struct RgxXHTML {      static ampersand                                = ctRegex!(`[&]`, "m");      // & diff --git a/src/doc_reform/io_out/source_pod.d b/src/doc_reform/io_out/source_pod.d index 7441f6b..3920d08 100644 --- a/src/doc_reform/io_out/source_pod.d +++ b/src/doc_reform/io_out/source_pod.d @@ -48,6 +48,7 @@  +/  module doc_reform.io_out.source_pod; +@system: // is not @safe: use: @system: or @trusted:  template spinePod() {    import      doc_reform.meta.rgx_files, diff --git a/src/doc_reform/io_out/xmls.d b/src/doc_reform/io_out/xmls.d index 5a8730e..ca7b9ea 100644 --- a/src/doc_reform/io_out/xmls.d +++ b/src/doc_reform/io_out/xmls.d @@ -48,6 +48,7 @@  +/  module doc_reform.io_out.xmls; +@safe:  template outputXHTMLs() {    import      std.file, @@ -67,7 +68,7 @@ template outputXHTMLs() {    struct outputXHTMLs {      static auto rgx = RgxO();      static auto rgx_xhtml = RgxXHTML(); -    @safe string div_delimit( +    string div_delimit(                   string  section,        return ref string  previous_section      ) { @@ -97,7 +98,7 @@ template outputXHTMLs() {        // you also need to close the last div, introduce a footer?        return delimit;      } -    @safe string special_characters_text(string _txt) { +    string special_characters_text(string _txt) {        _txt = _txt          .replaceAll(rgx_xhtml.ampersand,    "&")  // "&"          .replaceAll(rgx_xhtml.quotation,    """) // """ @@ -109,7 +110,7 @@ template outputXHTMLs() {          .replaceAll(rgx.nbsp_char,          " ");        return _txt;      } -    @safe string special_characters_date(string _txt) { +    string special_characters_date(string _txt) {        _txt = _txt          .replaceAll(regex(r"(?:-00)+"),     "")          .replaceAll(rgx.br_line,            "<br />") @@ -118,7 +119,7 @@ template outputXHTMLs() {          .replaceAll(rgx.nbsp_char,          " ");        return _txt;      } -    @safe string special_characters_breaks_indents_bullets(O)( +    string special_characters_breaks_indents_bullets(O)(        const  O         obj,      ) {        string _txt = special_characters_text(obj.text); @@ -169,7 +170,7 @@ template outputXHTMLs() {        }        return _txt;      } -    @safe string font_face(string _txt) { +    string font_face(string _txt) {        _txt = _txt          .replaceAll(rgx.inline_emphasis,    ("<em>$1</em>"))          .replaceAll(rgx.inline_bold,        ("<b>$1</b>")) @@ -183,7 +184,7 @@ template outputXHTMLs() {          .replaceAll(rgx.inline_cite,        ("<cite>$1</cite>"));        return _txt;      } -    @safe string _xhtml_anchor_tags(O)(O obj) { +    string _xhtml_anchor_tags(O)(O obj) {        string tags="";        if (obj.tags.anchor_tags.length > 0) {          foreach (tag; obj.tags.anchor_tags) { @@ -194,7 +195,7 @@ template outputXHTMLs() {        }        return tags;      } -    @safe string header_metadata(M)( +    string header_metadata(M)(        M  doc_matters,      ) {        string _publisher="Publisher"; // TODO @@ -231,7 +232,7 @@ template outputXHTMLs() {        );        return o;      } -    @safe string site_info_button(M)( +    string site_info_button(M)(        M  doc_matters,      ) {        string _locations; @@ -255,7 +256,7 @@ template outputXHTMLs() {        );        return o;      } -    @safe string inline_search_form(M)( +    string inline_search_form(M)(        M  doc_matters,      ) {        string o; @@ -314,7 +315,7 @@ template outputXHTMLs() {        }        return o;      } -    @safe string html_head(M)( +    string html_head(M)(        M  doc_matters,        string type,      ) { @@ -396,7 +397,7 @@ template outputXHTMLs() {        );        return o;      } -    @safe string epub3_seg_head(M)( +    string epub3_seg_head(M)(        M  doc_matters,      ) {        string html_base = format(q"┃<!DOCTYPE html> @@ -464,12 +465,12 @@ template outputXHTMLs() {        );        return o;      } -@safe string dom_close() { +string dom_close() {    string o;    o = format(q"┃</div>┃");    return o;  } -@safe string tail(M)(M doc_matters) { +string tail(M)(M doc_matters) {    string o;    o = format(q"┃<hr />    <div class="rights"> @@ -504,7 +505,7 @@ template outputXHTMLs() {    );    return o;  } -    @safe string inline_images(O,M)( +    string inline_images(O,M)(        string          _txt,        const        O  obj,                     M  doc_matters, @@ -530,7 +531,7 @@ template outputXHTMLs() {        }        return _txt;      } -    @safe string inline_links(O,M)( +    string inline_links(O,M)(        string          _txt,        const        O  obj,                     M  doc_matters, @@ -621,7 +622,7 @@ template outputXHTMLs() {        }        return _txt;      } -    @safe string inline_notes_scroll(O,M)( +    string inline_notes_scroll(O,M)(        string          _txt,        const        O  obj,                     M  doc_matters, @@ -652,7 +653,7 @@ template outputXHTMLs() {        }        return _txt;      } -    @safe Tuple!(string, string[]) inline_notes_seg(O,M)( +    Tuple!(string, string[]) inline_notes_seg(O,M)(                  string  _txt,        const     O       obj,                  M       doc_matters, @@ -716,7 +717,7 @@ template outputXHTMLs() {        );        return t;      } -    @safe string inline_markup_scroll(O,M)( +    string inline_markup_scroll(O,M)(        string          _txt,        const        O  obj,                     M  doc_matters, @@ -732,7 +733,7 @@ template outputXHTMLs() {        }        return _txt;      } -    @safe Tuple!(string, string[]) inline_markup_seg(O,M)( +    Tuple!(string, string[]) inline_markup_seg(O,M)(        string          _txt,        const        O  obj,                     M  doc_matters, @@ -752,7 +753,7 @@ template outputXHTMLs() {        Tuple!(string, string[]) t = inline_notes_seg(_txt, obj, doc_matters);        return t;      } -    @safe string lev4_heading_subtoc(O,M)( +    string lev4_heading_subtoc(O,M)(        const        O  obj,                     M  doc_matters,      ) { @@ -779,7 +780,7 @@ template outputXHTMLs() {        lev4_subtoc ~= "  </div>\n";        return lev4_subtoc.to!string;      } -    @safe auto nav_pre_next_svg(O,M)( +    auto nav_pre_next_svg(O,M)(        const        O  obj,                     M  doc_matters,      ) { @@ -849,7 +850,7 @@ template outputXHTMLs() {        }        return bar();      } -    @safe string heading(O,M)( +    string heading(O,M)(              string _txt,        const O      obj,              M      doc_matters, @@ -937,7 +938,7 @@ template outputXHTMLs() {          }        return o;      } -    @safe string heading_scroll(O,M)( +    string heading_scroll(O,M)(        string          _txt,        const        O  obj,                     M  doc_matters, @@ -947,7 +948,7 @@ template outputXHTMLs() {        string o = heading(_txt, obj, doc_matters);        return o;      } -    @safe Tuple!(string, string[]) heading_seg(O,M)( +    Tuple!(string, string[]) heading_seg(O,M)(        string          _txt,        const        O  obj,                     M  doc_matters, @@ -964,7 +965,7 @@ template outputXHTMLs() {        );        return u;      } -    @safe string para(O,M)( +    string para(O,M)(              string _txt,        const O      obj,              M      doc_matters, @@ -1014,7 +1015,7 @@ template outputXHTMLs() {        }        return o;      } -    @safe string para_scroll(O,M)( +    string para_scroll(O,M)(        string          _txt,        const        O  obj,                     M  doc_matters, @@ -1027,7 +1028,7 @@ template outputXHTMLs() {        string o = para(_txt, obj, doc_matters);        return o;      } -    @safe Tuple!(string, string[]) para_seg(O,M)( +    Tuple!(string, string[]) para_seg(O,M)(        string          _txt,        const        O  obj,                     M  doc_matters, @@ -1044,7 +1045,7 @@ template outputXHTMLs() {        );        return u;      } -    @safe string quote(O,M)( +    string quote(O,M)(              string _txt,        const O      obj,              M      doc_matters, @@ -1080,7 +1081,7 @@ template outputXHTMLs() {        }        return o;      } -    @safe string quote_scroll(O,M)( +    string quote_scroll(O,M)(        string          _txt,        const        O  obj,                     M  doc_matters, @@ -1090,7 +1091,7 @@ template outputXHTMLs() {        string o = quote(_txt, obj, doc_matters);        return o;      } -    @safe Tuple!(string, string[]) quote_seg(O,M)( +    Tuple!(string, string[]) quote_seg(O,M)(        string          _txt,        const        O  obj,                     M  doc_matters, @@ -1107,7 +1108,7 @@ template outputXHTMLs() {        );        return u;      } -    @safe string group(O,M)( +    string group(O,M)(              string _txt,        const O      obj,              M      doc_matters, @@ -1145,7 +1146,7 @@ template outputXHTMLs() {        }        return o;      } -    @safe string group_scroll(O,M)( +    string group_scroll(O,M)(        string          _txt,        const        O  obj,                     M  doc_matters, @@ -1156,7 +1157,7 @@ template outputXHTMLs() {        string o = group(_txt, obj, doc_matters);        return o;      } -    @safe Tuple!(string, string[]) group_seg(O,M)( +    Tuple!(string, string[]) group_seg(O,M)(        string          _txt,        const        O  obj,                     M  doc_matters, @@ -1173,7 +1174,7 @@ template outputXHTMLs() {        );        return u;      } -    @safe string block(O,M)( +    string block(O,M)(              string _txt,        const O      obj,              M      doc_matters, @@ -1207,7 +1208,7 @@ template outputXHTMLs() {        }        return o;      } -    @safe string block_scroll(O,M)( +    string block_scroll(O,M)(        string          _txt,        const        O  obj,                     M  doc_matters, @@ -1218,7 +1219,7 @@ template outputXHTMLs() {        string o = block(_txt, obj, doc_matters);        return o;      } -    @safe Tuple!(string, string[]) block_seg(O,M)( +    Tuple!(string, string[]) block_seg(O,M)(        string          _txt,        const        O  obj,                     M  doc_matters, @@ -1235,7 +1236,7 @@ template outputXHTMLs() {        );        return u;      } -    @safe string verse(O,M)( +    string verse(O,M)(              string _txt,        const O      obj,              M      doc_matters, @@ -1267,7 +1268,7 @@ template outputXHTMLs() {        }        return o;      } -    @safe string verse_scroll(O,M)( +    string verse_scroll(O,M)(        string          _txt,        const        O  obj,                     M  doc_matters, @@ -1278,7 +1279,7 @@ template outputXHTMLs() {        string o = verse(_txt, obj, doc_matters);        return o;      } -    @safe Tuple!(string, string[]) verse_seg(O,M)( +    Tuple!(string, string[]) verse_seg(O,M)(        string          _txt,        const        O  obj,                     M  doc_matters, @@ -1295,7 +1296,7 @@ template outputXHTMLs() {        );        return u;      } -    @safe Tuple!(string, string) tablarize(O)( +    Tuple!(string, string) tablarize(O)(        string            _txt,        const        O    obj,      ) { @@ -1328,7 +1329,7 @@ template outputXHTMLs() {        );        return t;      } -    @safe string table(O,M)( +    string table(O,M)(              string _txt,        const O      obj,              M      doc_matters, @@ -1362,7 +1363,7 @@ template outputXHTMLs() {        );        return o;      } -    @safe string code(O,M)( +    string code(O,M)(              string _txt,        const O      obj,              M      doc_matters, diff --git a/src/doc_reform/io_out/xmls_css.d b/src/doc_reform/io_out/xmls_css.d index 831a26d..712d79a 100644 --- a/src/doc_reform/io_out/xmls_css.d +++ b/src/doc_reform/io_out/xmls_css.d @@ -51,9 +51,10 @@    default css settings  +/  module doc_reform.io_out.xmls_css; +@safe:  template spineCss() {    import std.format; -  @safe auto spineCss(M)(M doc_matters) { +  auto spineCss(M)(M doc_matters) {    string _css_indent = format(q"┃  /* indent */  p.norm { } @@ -4427,7 +4428,7 @@ p.form {      _css_indent,      _color_ocn_dark,  ); -    @safe auto css_() { +    auto css_() {        struct _CSS {          string html_seg    = "/* spine css html seg stylesheet */\n";          string html_scroll = "/* spine css html scroll stylesheet */\n"; diff --git a/src/doc_reform/meta/conf_make_meta_json.d b/src/doc_reform/meta/conf_make_meta_json.d index b76f603..3a423ed 100644 --- a/src/doc_reform/meta/conf_make_meta_json.d +++ b/src/doc_reform/meta/conf_make_meta_json.d @@ -52,6 +52,7 @@    extract json header return json  +/  module doc_reform.meta.conf_make_meta_json; +@safe:  static template contentJSONtoSpineStruct() {    import      std.algorithm, @@ -69,7 +70,7 @@ static template contentJSONtoSpineStruct() {      doc_reform.meta.defaults,      doc_reform.meta.rgx;    ConfComposite _struct_composite; -  @safe auto contentJSONtoSpineStruct(C,J,M)(C _struct_composite, J _json, M _manifested, string _identifier) { +  auto contentJSONtoSpineStruct(C,J,M)(C _struct_composite, J _json, M _manifested, string _identifier) {      mixin spineRgxIn;      static auto rgx = RgxI();      debug (json) { diff --git a/src/doc_reform/meta/conf_make_meta_structs.d b/src/doc_reform/meta/conf_make_meta_structs.d index 6fdb322..ef39944 100644 --- a/src/doc_reform/meta/conf_make_meta_structs.d +++ b/src/doc_reform/meta/conf_make_meta_structs.d @@ -48,6 +48,7 @@  +/  module doc_reform.meta.conf_make_meta_structs; +@safe:  import    std.exception,    std.json, @@ -68,7 +69,7 @@ mixin spineRgxYamlTags;  static auto rgx_y = RgxYaml();  mixin InternalMarkup;  static auto mkup = InlineMarkup(); -@safe string url_markup(string line) { +string url_markup(string line) {    string line_ = line      .replaceAll(        rgx.smid_inline_link_markup_regular, @@ -110,7 +111,7 @@ struct ConfCompositeMakeStr {    string[][] substitute;    string     texpdf_font;  } -struct confCompositeMakeBuild { +@trusted struct confCompositeMakeBuild {    string[] bold(string _mk) {      string[] _out;      if (_mk) { diff --git a/src/doc_reform/meta/conf_make_meta_yaml.d b/src/doc_reform/meta/conf_make_meta_yaml.d index ed3364f..328ee96 100644 --- a/src/doc_reform/meta/conf_make_meta_yaml.d +++ b/src/doc_reform/meta/conf_make_meta_yaml.d @@ -52,6 +52,7 @@    extract yaml header return struct  +/  module doc_reform.meta.conf_make_meta_yaml; +@safe:  template contentYAMLtoSpineStruct() {    import      std.algorithm, diff --git a/src/doc_reform/meta/defaults.d b/src/doc_reform/meta/defaults.d index 7abf30a..75fa7d8 100644 --- a/src/doc_reform/meta/defaults.d +++ b/src/doc_reform/meta/defaults.d @@ -51,8 +51,9 @@    default settings  +/  module doc_reform.meta.defaults; +@safe:  template spineNode() { -  @safe static string[string] node_metadata_heading_str() { +  static string[string] node_metadata_heading_str() {      string[string] _node = [          "is"                            : "",          "ocn"                           : "", @@ -63,7 +64,7 @@ template spineNode() {      ];      return _node;    } -  @safe static int[string] node_metadata_heading_int() { +  static int[string] node_metadata_heading_int() {      int[string] _node = [          "ocn"                           : 0, // decide whether to use or keep?          "ptr_doc_object"                : 0, @@ -76,7 +77,7 @@ template spineNode() {      ];      return _node;    } -  @safe static string[string] node_metadata_para_str() { +  static string[string] node_metadata_para_str() {      string[string] _node = [          "is"                            : "",          "ocn"                           : "", @@ -84,7 +85,7 @@ template spineNode() {      ];      return _node;    } -  @safe static int[string] node_metadata_para_int() { +  static int[string] node_metadata_para_int() {      int[string] _node = [          "ocn"                           : 0,          "indent_base"                   : 0, @@ -95,7 +96,7 @@ template spineNode() {    }  }  template spineCurateMetadata() { -  @safe auto spineCurateMetadata() { +  auto spineCurateMetadata() {      struct _Curate {        struct Curate {          string   title                = ""; @@ -129,7 +130,7 @@ template spineCurateMetadata() {  template spineBiblio() {    // required: deemed_author (author || editor); year; fulltitle;    struct BibJsnStr { -    @safe static auto biblio_entry_tags_jsonstr() { +    static auto biblio_entry_tags_jsonstr() {        string x =  `{          "is"                               : "",          "sortby_deemed_author_year_title"  : "", @@ -211,7 +212,7 @@ template InternalMarkup() {  template spineLanguageCodes() {    /+ language codes +/    struct Lang { -    @safe static 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"    ], @@ -278,15 +279,15 @@ template spineLanguageCodes() {        ];        return _lang_codes;      } -    @safe static string[] code_arr_ptr() { +    static string[] code_arr_ptr() {        string[] _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;      } -    @safe static string[] code_arr() { +    static string[] code_arr() {        string[] _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;      } -    @safe static auto codes_() { +    static auto codes_() {        return "(" ~ join(code_arr,"|") ~ ")";      }      static auto codes_regex() { diff --git a/src/doc_reform/meta/metadoc.d b/src/doc_reform/meta/metadoc.d index 75e0b29..cc0726f 100644 --- a/src/doc_reform/meta/metadoc.d +++ b/src/doc_reform/meta/metadoc.d @@ -48,6 +48,7 @@  +/  module doc_reform.meta.metadoc; +@safe:  template spineAbstraction() {    import      std.datetime; @@ -145,15 +146,15 @@ template spineAbstraction() {        writeln("step4 commence → (doc_matters) [", _manifest.src.filename, "]");      }      struct DocumentMatters { -      @safe auto generator_program() { +      auto generator_program() {          struct Prog_ { -          @safe string project_name() { +          string project_name() {              return "spine";            } -          @safe string name() { +          string name() {              return program_info.name;            } -          @safe string ver() { +          string ver() {              return program_info.ver;            }            @trusted string name_and_version() { @@ -162,22 +163,22 @@ template spineAbstraction() {            @trusted string name_version_and_compiler() {              return program_info.name_version_and_compiler;            } -          @safe string url_home() { +          string url_home() {              return "https://sisudoc.org";            } -          @safe string url_git() { +          string url_git() {              return "https://git.sisudoc.org/projects/";            } -          @safe auto compiler() { +          auto compiler() {              return program_info.compiler;            } -          @safe auto time_output_generated() { +          auto time_output_generated() {              return program_info.time_output_generated;            }          }          return Prog_();        } -      @safe auto generated_time() { +      auto generated_time() {          auto _st = Clock.currTime(UTC());          auto _time = _st.year.to!string            ~ "-" ~ _st.month.to!int.to!string // prefer as month number @@ -188,26 +189,26 @@ template spineAbstraction() {            ~ ":" ~ _st.second.to!string;          return _time;        } -      @safe auto conf_make_meta() { +      auto conf_make_meta() {          return _make_and_meta_struct;        } -      @safe auto has() { +      auto has() {          return _doc_has_struct;        } -      @safe auto env() { +      auto env() {          struct Env_ { -          @safe auto pwd() { +          auto pwd() {              return _manifest.env.pwd;            } -          @safe auto home() { +          auto home() {              return _manifest.env.home;            }          }          return Env_();        } -      @safe auto opt() { +      auto opt() {          struct Opt_ { -          @safe auto action() { +          auto action() {              /+ getopt options, commandline instructions, raw               - processing instructions --epub --html etc.               - command line config instructions --output @@ -217,18 +218,18 @@ template spineAbstraction() {          }          return Opt_();        } -      @safe auto src() { +      auto src() {          return _manifest.src;        } -      @safe auto src_path_info() { +      auto src_path_info() {          return spinePathsSRC!()(_manifest.env.pwd, _manifest.src.file_with_absolute_path); // would like (to have and use) relative path        } -      @safe auto pod() { +      auto pod() {          return _manifest.pod;        } -      @safe auto sqlite() { +      auto sqlite() {          struct SQLite_ { -          @safe string filename() { +          string filename() {              string _fn = "";              string _pth = "";              if (_opt_action.sqliteDB_filename.length > 0) { @@ -238,7 +239,7 @@ template spineAbstraction() {              }              return _fn;            } -          @safe string path() { +          string path() {              string _pth = "";              if (_opt_action.sqliteDB_path.length > 0) {                _pth = _opt_action.sqliteDB_path; @@ -247,7 +248,7 @@ template spineAbstraction() {              }              return _pth;            } -          @safe string cgi_filename() { +          string cgi_filename() {              string _fn = "";              if (_opt_action.cgi_sqlite_search_filename.length > 0) {                _fn = _opt_action.cgi_sqlite_search_filename; @@ -256,7 +257,7 @@ template spineAbstraction() {              }              return _fn;            } -          @safe string cgi_filename_d() { +          string cgi_filename_d() {              string _fn = "";              if (_opt_action.cgi_sqlite_search_filename_d.length > 0) {                _fn = _opt_action.cgi_sqlite_search_filename_d; @@ -268,10 +269,10 @@ template spineAbstraction() {          }          return SQLite_();        } -      @safe auto output_path() { +      auto output_path() {          return _make_and_meta_struct.conf.output_path;        } -      @safe auto srcs() { +      auto srcs() {          struct SRC_ {            auto file_insert_list() {              return _header_body_insertfilelist_imagelist[headBody.insert_file_list]; diff --git a/src/doc_reform/meta/metadoc_curate.d b/src/doc_reform/meta/metadoc_curate.d index ffaef6f..3263015 100644 --- a/src/doc_reform/meta/metadoc_curate.d +++ b/src/doc_reform/meta/metadoc_curate.d @@ -48,8 +48,9 @@  +/  module doc_reform.meta.metadoc_curate; +@safe:  template spineMetaDocCurate() { -  @safe auto spineMetaDocCurate(T,H)( +  auto spineMetaDocCurate(T,H)(      T  doc_matters,      H  hvst,    ) { diff --git a/src/doc_reform/meta/metadoc_curate_authors.d b/src/doc_reform/meta/metadoc_curate_authors.d index 589431c..8757b26 100644 --- a/src/doc_reform/meta/metadoc_curate_authors.d +++ b/src/doc_reform/meta/metadoc_curate_authors.d @@ -48,6 +48,7 @@  +/  module doc_reform.meta.metadoc_curate_authors; +@safe:    import      std.algorithm,      std.array, @@ -68,7 +69,7 @@ template spineMetaDocCuratesAuthors() {      M  _make_and_meta_struct,      O  _opt_action,    ) { -      @safe string inline_search_form(M)( +      string inline_search_form(M)(          M  _make_and_meta_truct,        ) {          string o; diff --git a/src/doc_reform/meta/metadoc_curate_topics.d b/src/doc_reform/meta/metadoc_curate_topics.d index 4cb75d9..9fc7604 100644 --- a/src/doc_reform/meta/metadoc_curate_topics.d +++ b/src/doc_reform/meta/metadoc_curate_topics.d @@ -48,6 +48,7 @@  +/  module doc_reform.meta.metadoc_curate_topics; +@safe:    import      std.algorithm,      std.array, @@ -68,7 +69,7 @@ template spineMetaDocCuratesTopics() {      M  _make_and_meta_struct,      O  _opt_action,    ) { -      @safe string inline_search_form(M)( +      string inline_search_form(M)(          M  _make_and_meta_truct,        ) {          string o; diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index a05edf4..cf4a7cc 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -51,6 +51,7 @@  // abstraction of sisu markup for downstream processing  // metadoc_from_src.d  module doc_reform.meta.metadoc_from_src; +@safe:  template docAbstraction() {    // ↓ abstraction imports    import @@ -1490,7 +1491,7 @@ template docAbstraction() {          return tag_assoc;        }      } -    @safe auto doc_has() { +    auto doc_has() {        return DocHas_();      }      // the doc to be returned diff --git a/src/doc_reform/meta/metadoc_from_src_functions.d b/src/doc_reform/meta/metadoc_from_src_functions.d index 557bfef..56d5db5 100644 --- a/src/doc_reform/meta/metadoc_from_src_functions.d +++ b/src/doc_reform/meta/metadoc_from_src_functions.d @@ -51,6 +51,7 @@  // abstraction of sisu markup for downstream processing  // metadoc_from_src.d  module doc_reform.meta.metadoc_from_src_functions; +@safe:  template docAbstractionFunctions() {    // ↓ abstraction imports    import @@ -111,11 +112,11 @@ template docAbstractionFunctions() {    auto node_construct = NodeStructureMetadata();    // ↓ abstraction function emitters    // ↓ - emitters -  @safe pure struct OCNemitter { +  pure struct OCNemitter {      int ocn_digit, ocn_object_number, ocn_on_, ocn_off_, ocn_bkidx, ocn_bkidx_;      string object_identifier;      bool ocn_is_off; -    @safe auto ocn_emitter(int ocn_status_flag) { +    auto ocn_emitter(int ocn_status_flag) {        OCNset ocn;        assert(ocn_status_flag <= eN.ocn.reset);        ocn_object_number              = ocn_bkidx = 0; @@ -159,7 +160,7 @@ template docAbstractionFunctions() {      invariant() {      }    } -  @safe pure ObjGenericComposite obj_heading_ancestors()( +  pure ObjGenericComposite obj_heading_ancestors()(      ObjGenericComposite  obj,      string[]             lv_ancestors_txt,    ) { @@ -200,10 +201,10 @@ template docAbstractionFunctions() {      }      return obj;    } -  @safe static  OCNset ocn_emit(int ocn_status_flag) { +  static  OCNset ocn_emit(int ocn_status_flag) {      return object_citation_number.ocn_emitter(ocn_status_flag);    } -  @safe static uint[string] _check_ocn_status_()( +  static uint[string] _check_ocn_status_()(      char[]       line,      uint[string] pith,    ) { @@ -272,7 +273,7 @@ template docAbstractionFunctions() {      return ret;    }    // ↓ - reset object -  @safe static string[string] object_reset()(string[string] an_object) { +  static string[string] object_reset()(string[string] an_object) {      an_object.remove("body_nugget");      an_object.remove("substantive");      an_object.remove("is"); @@ -282,7 +283,7 @@ template docAbstractionFunctions() {    }    // ↑ - resets    // ↓ - markup text by line -  @safe char[] font_faces_line()(char[] textline) { +  char[] font_faces_line()(char[] textline) {      static auto rgx = RgxI();      static auto mkup = InlineMarkup();      if (textline.match(rgx.inline_faces_line)) { @@ -302,7 +303,7 @@ template docAbstractionFunctions() {      }      return textline;    } -  @safe auto inline_markup_faces(L)(L line) { +  auto inline_markup_faces(L)(L line) {      static auto rgx = RgxI();      static auto mkup = InlineMarkup();      line = replaceAll!(m => mkup.quote_o ~ m[1] ~ mkup.quote_c)(line, rgx.within_quotes); @@ -313,7 +314,7 @@ template docAbstractionFunctions() {      }      return line;    } -  @safe static string links_and_images()(string obj_txt) { +  static string links_and_images()(string obj_txt) {      static auto rgx = RgxI();      static auto mkup = InlineMarkup();      if (obj_txt.match(rgx.smid_inline_url_generic)) { @@ -353,7 +354,7 @@ template docAbstractionFunctions() {      }      return obj_txt;    } -  @safe char[] _doc_header_and_make_substitutions_(CMM)( +  char[] _doc_header_and_make_substitutions_(CMM)(      char[]  line,      CMM     conf_make_meta,    ) { @@ -368,7 +369,7 @@ template docAbstractionFunctions() {      }      return line;    } -  @safe char[] _doc_header_and_make_substitutions_fontface_(CMM)( +  char[] _doc_header_and_make_substitutions_fontface_(CMM)(      char[]  line,      CMM     conf_make_meta,    ) { @@ -395,7 +396,7 @@ template docAbstractionFunctions() {    }    // ↑ - markup by line    // ↓ - text by line (blocks etc.) -  @safe ST_txt_by_line_block_start txt_by_line_block_start()( +  ST_txt_by_line_block_start txt_by_line_block_start()(      char[]         line,      uint[string]   pith,      uint[string]   dochas, @@ -529,7 +530,7 @@ template docAbstractionFunctions() {      }      return ret;    } -  @safe ST_txt_by_line_block_generic txt_by_line_block_group()( +  ST_txt_by_line_block_generic txt_by_line_block_group()(      char[]          line,      string[string]  an_object,      uint[string]    pith, @@ -567,7 +568,7 @@ template docAbstractionFunctions() {      }      return ret;    } -  @safe ST_txt_by_line_block_generic txt_by_line_block_block()( +  ST_txt_by_line_block_generic txt_by_line_block_block()(      char[]          line,      string[string]  an_object,      uint[string]    pith, @@ -605,7 +606,7 @@ template docAbstractionFunctions() {      }      return ret;    } -  @safe ST_txt_by_line_block_poem txt_by_line_block_poem(CMM)( +  ST_txt_by_line_block_poem txt_by_line_block_poem(CMM)(      char[]          line,      string[string]  an_object,      uint[string]    pith, @@ -807,7 +808,7 @@ template docAbstractionFunctions() {      }      return ret;    } -  @safe ST_txt_by_line_block_generic txt_by_line_block_code()( +  ST_txt_by_line_block_generic txt_by_line_block_code()(      char[]          line,      string[string]  an_object,      uint[string]    pith, @@ -920,7 +921,7 @@ template docAbstractionFunctions() {      }      return ret;    } -  @safe ST_txt_by_line_block_generic txt_by_line_block_quote()( +  ST_txt_by_line_block_generic txt_by_line_block_quote()(      char[]          line,      string[string]  an_object,      uint[string]    pith, @@ -1095,7 +1096,7 @@ template docAbstractionFunctions() {    }    // ↑ - text by line    // ↓ - para -  @safe string[string][string] inline_para_link_anchor()( +  string[string][string] inline_para_link_anchor()(      string[string]          an_object,      string[string]          tag_in_seg,      string[string][string]  tag_assoc @@ -1111,7 +1112,7 @@ template docAbstractionFunctions() {      }      return tag_assoc;    } -  @safe ST_flow_para_match flow_para_match_()( +  ST_flow_para_match flow_para_match_()(      char[]         line,      string[string]  an_object,      string          an_object_key, @@ -1167,7 +1168,7 @@ template docAbstractionFunctions() {    }    // ↑ - para    // ↓ - heading -  @safe ST_flow_heading_found flow_heading_found_()( +  ST_flow_heading_found flow_heading_found_()(      char[]                line,      string[string]        heading_match_str,      string[]              _make_unmarked_headings, @@ -1252,7 +1253,7 @@ template docAbstractionFunctions() {      }      return ret;    } -  @safe ST_flow_heading_make_set flow_heading_make_set_()( +  ST_flow_heading_make_set flow_heading_make_set_()(                 char[]                line,                 int[string]           line_occur,      return ref Regex!(char)[string]  heading_match_rgx, @@ -1300,7 +1301,7 @@ template docAbstractionFunctions() {      }      return ret;    } -  @safe auto flow_heading_matched_(CMM)( +  auto flow_heading_matched_(CMM)(      char[]          line,      string[string]  an_object,      int[string]     line_occur, @@ -1491,7 +1492,7 @@ template docAbstractionFunctions() {    }    // ↑ - heading    // ↓ - table -  @safe ObjGenericComposite flow_table_instructions(H)( +  ObjGenericComposite flow_table_instructions(H)(      ObjGenericComposite  table_object,      H                    table_head,    ) { @@ -1516,7 +1517,7 @@ template docAbstractionFunctions() {      }      return table_object;    } -  @safe ST_flow_table_array_munge flow_table_array_munge()( +  ST_flow_table_array_munge flow_table_array_munge()(      ObjGenericComposite  table_object,      string[][]           table_array,    ) { @@ -2045,7 +2046,7 @@ template docAbstractionFunctions() {      return ret;    }    // ↓ - object set -  @safe ObjGenericComposite set_object_heading()( +  ObjGenericComposite set_object_heading()(      string level,      string part,      string section, @@ -2076,7 +2077,7 @@ template docAbstractionFunctions() {      }      return comp_obj;    } -  @safe ObjGenericComposite set_object_generic()( +  ObjGenericComposite set_object_generic()(      string part,      string section,      string type, @@ -2098,7 +2099,7 @@ template docAbstractionFunctions() {    }    // ↑ - object set    // ↓ - object inline munge -  @safe static 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_, plus_; @@ -2112,7 +2113,7 @@ template docAbstractionFunctions() {        n_foot_sp_asterisk              = 0;        n_foot_sp_plus                  = 0;      } -    @safe static auto images()(string obj_txt_in) { +    static auto images()(string obj_txt_in) {        static auto mng = InlineMarkup();        // url matched        obj_txt_in = obj_txt_in.replaceAll(rgx.inline_notes_al_special, ""); // TODO reinstate when special footnotes are implemented @@ -2136,7 +2137,7 @@ template docAbstractionFunctions() {        }        return obj_txt_in;      } -    @safe ST_txtPlusHasFootnotes footnotes_endnotes_markup_and_number_or_stars()(string obj_txt_in, bool reset_note_numbers) { +    ST_txtPlusHasFootnotes footnotes_endnotes_markup_and_number_or_stars()(string obj_txt_in, bool reset_note_numbers) {        // endnotes (regular)        bool flg_notes_reg  = false;        bool flg_notes_star = false; @@ -2208,7 +2209,7 @@ template docAbstractionFunctions() {        }        return ret;      } -    @safe private ST_txtPlusHasFootnotesUrlsImages object_notes_and_links_()( +    private ST_txtPlusHasFootnotesUrlsImages object_notes_and_links_()(        string obj_txt_in,        bool reset_note_numbers = false      ) { @@ -2263,7 +2264,7 @@ template docAbstractionFunctions() {        }        return ret;      } -    @safe private ST_txtPlusHasFootnotesUrlsImages object_only_()( +    private ST_txtPlusHasFootnotesUrlsImages object_only_()(        string obj_txt_in,        bool reset_note_numbers = false      ) { @@ -2284,7 +2285,7 @@ template docAbstractionFunctions() {      }      invariant() {      } -    @safe ST_txtPlusHasFootnotesUrlsImages munge_heading()( +    ST_txtPlusHasFootnotesUrlsImages munge_heading()(        string obj_txt_in,        bool reset_note_numbers = false      ) { @@ -2299,7 +2300,7 @@ template docAbstractionFunctions() {      }      invariant() {      } -    @safe ST_txtPlusHasFootnotesUrlsImages munge_para()(string obj_txt_in) { +    ST_txtPlusHasFootnotesUrlsImages munge_para()(string obj_txt_in) {        obj_txt["munge"] = (obj_txt_in)          .replaceFirst(rgx.para_attribs, "")          .replaceFirst(rgx.object_number_off_all, "") @@ -2311,44 +2312,44 @@ template docAbstractionFunctions() {        }        return ret;      } -    @safe ST_txtPlusHasFootnotesUrlsImages munge_quote()(string obj_txt_in) { +    ST_txtPlusHasFootnotesUrlsImages munge_quote()(string obj_txt_in) {        ST_txtPlusHasFootnotesUrlsImages ret = object_notes_and_links_(obj_txt_in.split("\n\n").join(" \\\\\n \\\\\n"));        return ret;      }      invariant() {      } -    @safe ST_txtPlusHasFootnotesUrlsImages munge_group(string obj_txt_in) { +    ST_txtPlusHasFootnotesUrlsImages munge_group(string obj_txt_in) {        ST_txtPlusHasFootnotesUrlsImages ret = object_notes_and_links_(obj_txt_in.split("\n\n").join("\n" ~ mkup.br_line_spaced ~ "\n"));        return ret;      }      invariant() {      } -    @safe ST_txtPlusHasFootnotesUrlsImages munge_block()(string obj_txt_in) { +    ST_txtPlusHasFootnotesUrlsImages munge_block()(string obj_txt_in) {        ST_txtPlusHasFootnotesUrlsImages ret = object_notes_and_links_(obj_txt_in);        return ret;      }      invariant() {      } -    @safe auto munge_verse()(string obj_txt_in) { +    auto munge_verse()(string obj_txt_in) {        ST_txtPlusHasFootnotesUrlsImages ret = object_notes_and_links_(obj_txt_in);        return ret;      }      invariant() {      } -    @safe ST_txtPlusHasFootnotesUrlsImages munge_code()(string obj_txt_in) { +    ST_txtPlusHasFootnotesUrlsImages munge_code()(string obj_txt_in) {        obj_txt_in = obj_txt_in.replaceAll(rgx.space, mkup.nbsp);        ST_txtPlusHasFootnotesUrlsImages ret = object_only_(obj_txt_in);        return ret;      }      invariant() {      } -    @safe ST_txtPlusHasFootnotesUrlsImages munge_table()(string obj_txt_in) { +    ST_txtPlusHasFootnotesUrlsImages munge_table()(string obj_txt_in) {        ST_txtPlusHasFootnotesUrlsImages ret = object_notes_and_links_(obj_txt_in);        return ret;      }      invariant() {      } -    @safe ST_txtPlusHasFootnotesUrlsImages munge_comment()(string obj_txt_in) { +    ST_txtPlusHasFootnotesUrlsImages munge_comment()(string obj_txt_in) {        ST_txtPlusHasFootnotesUrlsImages ret = object_only_(obj_txt_in);        return ret;      } @@ -2362,7 +2363,7 @@ template docAbstractionFunctions() {      static auto munge = ObjInlineMarkupMunge();      string[string] obj_txt;      string anchor_tag = ""; -    @safe ST_txtAndAnchorTagPlusHasFootnotesUrlsImages obj_inline_markup_and_anchor_tags_and_misc(CMM)( +    ST_txtAndAnchorTagPlusHasFootnotesUrlsImages obj_inline_markup_and_anchor_tags_and_misc(CMM)(        string[string]   obj_,        string           obj_key_,        CMM              conf_make_meta, @@ -2451,14 +2452,14 @@ template docAbstractionFunctions() {      }      invariant() {      } -    @safe auto _clean_heading_toc_()( +    auto _clean_heading_toc_()(        char[] heading_toc_,      ) {       auto m = (cast(char[]) heading_toc_).matchFirst(rgx.heading);       heading_toc_ = (m.post).replaceAll(rgx.inline_notes_curly_gen, "");       return heading_toc_;      }; -    @safe ST_flow_table_of_contents_gather_headings flow_table_of_contents_gather_headings(CMM)( // +    ST_flow_table_of_contents_gather_headings flow_table_of_contents_gather_headings(CMM)( //        string[string]         obj_,        CMM                    conf_make_meta,        string[string]         tag_in_seg, @@ -2549,7 +2550,7 @@ template docAbstractionFunctions() {      static string heading_number_auto_composite = "";      static string heading_number_auto_composite_segname = "";      static bool[] auto_heading_numbering = [ true, true, true, true]; -    @safe static string _configured_auto_heading_numbering_and_segment_anchor_tags(CMM)( +    static string _configured_auto_heading_numbering_and_segment_anchor_tags(CMM)(        string           munge_,        string[string]   obj_,        CMM              conf_make_meta, @@ -2691,7 +2692,7 @@ template docAbstractionFunctions() {        return munge_;      }      static int heading_num_lev1 = 0; -    @safe static string _make_segment_anchor_tags_if_none_provided()( +    static string _make_segment_anchor_tags_if_none_provided()(        string munge_,        string lev_,        bool   _new_doc @@ -2729,7 +2730,7 @@ template docAbstractionFunctions() {    // ↓ - object attributes    struct ObjAttributes {      string[string] _obj_attrib; -    @safe string obj_attributes()( +    string obj_attributes()(        string              obj_is_,        string              obj_raw,        ObjGenericComposite comp_obj_, @@ -2792,7 +2793,7 @@ template docAbstractionFunctions() {      }      private:      string _obj_attributes; -    @safe string txt_para_and_blocks()(string obj_txt_in) { +    string txt_para_and_blocks()(string obj_txt_in) {        if (obj_txt_in.matchFirst(rgx.para_bullet)) {          _obj_attributes =" \"bullet\": \"true\","          ~ " \"indent_hang\": 0," @@ -2816,7 +2817,7 @@ template docAbstractionFunctions() {        }        return _obj_attributes;      } -    @safe string txt_heading()(string obj_txt_in) { +    string txt_heading()(string obj_txt_in) {        _obj_attributes = " \"use\": \"content\","        ~ " \"of\": \"para\","        ~ " \"is\": \"heading\""; @@ -2824,7 +2825,7 @@ template docAbstractionFunctions() {      }      invariant() {      } -    @safe string txt_para()(string obj_txt_in) { +    string txt_para()(string obj_txt_in) {        _obj_attributes = " \"use\": \"content\","        ~ " \"of\": \"para\","        ~ " \"is\": \"para\""; @@ -2832,7 +2833,7 @@ template docAbstractionFunctions() {      }      invariant() {      } -    @safe string txt_quote()(string obj_txt_in) { +    string txt_quote()(string obj_txt_in) {        _obj_attributes = " \"use\": \"content\","        ~ " \"of\": \"block\","        ~ " \"is\": \"quote\""; @@ -2840,7 +2841,7 @@ template docAbstractionFunctions() {      }      invariant() {      } -    @safe string txt_group()(string obj_txt_in) { +    string txt_group()(string obj_txt_in) {        _obj_attributes = " \"use\": \"content\","        ~ " \"of\": \"block\","        ~ " \"is\": \"group\""; @@ -2848,7 +2849,7 @@ template docAbstractionFunctions() {      }      invariant() {      } -    @safe string txt_block()(string obj_txt_in) { +    string txt_block()(string obj_txt_in) {        _obj_attributes = " \"use\": \"content\","        ~ " \"of\": \"block\","        ~ " \"is\": \"block\""; @@ -2856,7 +2857,7 @@ template docAbstractionFunctions() {      }      invariant() {      } -    @safe string txt_verse()(string obj_txt_in) { +    string txt_verse()(string obj_txt_in) {        _obj_attributes = " \"use\": \"content\","        ~ " \"of\": \"block\","        ~ " \"is\": \"verse\""; @@ -2864,7 +2865,7 @@ template docAbstractionFunctions() {      }      invariant() {      } -    @safe string txt_code()(string obj_txt_in) { +    string txt_code()(string obj_txt_in) {        _obj_attributes = " \"use\": \"content\","        ~ " \"of\": \"block\","        ~ " \"is\": \"code\""; @@ -2872,7 +2873,7 @@ template docAbstractionFunctions() {      }      invariant() {      } -    @safe string txt_table()(string obj_txt_in) { +    string txt_table()(string obj_txt_in) {        _obj_attributes = " \"use\": \"content\","        ~ " \"of\": \"block\","        ~ " \"is\": \"table\""; @@ -2880,7 +2881,7 @@ template docAbstractionFunctions() {      }      invariant() {      } -    @safe string txt_comment()(string obj_txt_in) { +    string txt_comment()(string obj_txt_in) {        _obj_attributes = " \"use\": \"comment\","        ~ " \"of\": \"comment\","        ~ " \"is\": \"comment\""; @@ -2888,7 +2889,7 @@ template docAbstractionFunctions() {      }      invariant() {      } -    @safe string _set_additional_values_parse_as_json()( +    string _set_additional_values_parse_as_json()(        string              _obj_attrib,        string              obj_is_,        ObjGenericComposite comp_obj_, @@ -2912,7 +2913,7 @@ template docAbstractionFunctions() {    }    // ↑ - object attributes    // ↓ - object tags -  @safe pure ObjGenericComposite obj_dom_structure_set_markup_tags()( +  pure ObjGenericComposite obj_dom_structure_set_markup_tags()(      ObjGenericComposite  obj,      int[]                dom,      int                  lev @@ -2954,7 +2955,7 @@ template docAbstractionFunctions() {      obj.metainfo.dom_structure_markedup_tags_status = dom.dup;      return obj;    } -  @safe pure ObjGenericComposite obj_dom_set_collapsed_tags()( +  pure ObjGenericComposite obj_dom_set_collapsed_tags()(      ObjGenericComposite  obj,      int[]                dom,      int                  lev @@ -3105,7 +3106,7 @@ template docAbstractionFunctions() {      int previous_count;      int mkn;      static auto rgx = RgxI(); -    @safe private auto gather_notes_for_endnote_section( +    private auto gather_notes_for_endnote_section(        ObjGenericComposite[] contents_am,        string[string]        tag_in_seg,        int                   cntr, @@ -3183,7 +3184,7 @@ template docAbstractionFunctions() {        }        return object_notes;      } -    @safe private auto gathered_notes() { +    private auto gathered_notes() {        string[][string] endnotes_;        if (object_notes.length > 1) {          endnotes_["notes"] = (object_notes["notes"].split(rgx.break_string))[0..$-1]; @@ -3194,7 +3195,7 @@ template docAbstractionFunctions() {        }        return endnotes_;      } -    @safe private ST_endnotes backmatter_endnote_objects(O)( +    private ST_endnotes backmatter_endnote_objects(O)(        OCNset         obj_cite_digits,        O              opt_action,      ) { @@ -3327,7 +3328,7 @@ template docAbstractionFunctions() {      string[] object_numbers;      string[][string][string] bi_hash_nugget;      string[] bi_main_terms_split_arr; -    @safe string[][string][string] bookindex_nugget_hash(S)( +    string[][string][string] bookindex_nugget_hash(S)(        string bookindex_section,        OCNset obj_cite_digits,        S      tag_in_seg, @@ -3395,7 +3396,7 @@ template docAbstractionFunctions() {    }    struct BookIndexReportIndent {      int mkn, skn; -    @safe void bookindex_report_indented()( +    void bookindex_report_indented()(        string[][string][string] bookindex_unordered_hashes      ) {        auto mainkeys @@ -3421,7 +3422,7 @@ template docAbstractionFunctions() {      int  mkn, skn;      static auto rgx = RgxI();      static auto munge = ObjInlineMarkupMunge(); -    @safe void bookindex_write_section()( +    void bookindex_write_section()(        string[][string][string] bookindex_unordered_hashes      ) {        auto mainkeys = @@ -3957,7 +3958,7 @@ template docAbstractionFunctions() {    }    // ↑ - section blurb    // ↓ - images -  @safe string[] extract_images()(string content_block) { +  string[] extract_images()(string content_block) {      static auto rgx = RgxI();      string[] images_;      if (auto m = content_block.matchAll(rgx.image)) { @@ -4005,7 +4006,7 @@ template docAbstractionFunctions() {    }    // ↑ - images    // ↓ - links -  @safe auto _links(O)(O obj) { +  auto _links(O)(O obj) {      static auto rgx = RgxI();      if (auto m = obj.text.match(rgx.inline_link_stow_uri)) {        debug(links) { @@ -4126,7 +4127,7 @@ template docAbstractionFunctions() {      int obj_cite_digit;      int[string] p_; // p_ parent_      static auto rgx = RgxI(); -    @safe ObjGenericComposite node_location_emitter(La,Ta)( +    ObjGenericComposite node_location_emitter(La,Ta)(        string         lev_markup_number,        string[string] tag_in_seg,        La             lev_anchor_tag, @@ -4175,7 +4176,7 @@ template docAbstractionFunctions() {      }      invariant() {      } -    @safe ObjGenericComposite node_emitter_heading(O,TaL,TA,SOAT)( +    ObjGenericComposite node_emitter_heading(O,TaL,TA,SOAT)(        O              an_object,        string[string] tag_in_seg,        TaL            lev_anchor_tag, @@ -4374,7 +4375,7 @@ template docAbstractionFunctions() {      ObjGenericComposite[] the_document_bookindex_section,      ObjGenericComposite[] the_document_blurb_section,    ) { -    @safe int[] _get_ancestors_markup(ObjGenericComposite obj, int[] _ancestors_markup) { +    int[] _get_ancestors_markup(ObjGenericComposite obj, int[] _ancestors_markup) {        if (obj.metainfo.is_a == "heading") {          debug(dom) { writeln(obj.text); }          if (obj.metainfo.heading_lev_markup == 1) { @@ -4457,7 +4458,7 @@ template docAbstractionFunctions() {        debug(ancestor_markup) { writeln("marked up: ", _ancestors_markup); }        return _ancestors_markup;      } -    @safe int[] _get_ancestors_collapsed(ObjGenericComposite obj, int[] _ancestors_collapsed) { +    int[] _get_ancestors_collapsed(ObjGenericComposite obj, int[] _ancestors_collapsed) {        if (obj.metainfo.is_a == "heading") {          if (obj.metainfo.heading_lev_collapsed == 1) {            _ancestors_collapsed = [ @@ -4573,7 +4574,7 @@ template docAbstractionFunctions() {    // ↑ - ancestors    // ↓ - descendants    // descendants -  @safe auto after_doc_get_descendants()(ObjGenericComposite[] document_sections) { +  auto after_doc_get_descendants()(ObjGenericComposite[] document_sections) {      int[string] _heading_ocn_descendants;      string[] _ocn_open_key = ["","","","","","","",""];      auto _doc_sect_length = document_sections.length - 1; @@ -4622,7 +4623,7 @@ template docAbstractionFunctions() {    }    // ↑ - descendants    // ↓ - assertions -  @safe pure void assertions_doc_structure()( +  pure void assertions_doc_structure()(      string[string]  an_object,      string          an_object_key,      int[string]     lv @@ -5195,7 +5196,7 @@ template docAbstractionFunctions() {    // ↑ - assertions  }  template docSectKeysSeq() { -  @safe auto docSectKeysSeq(string[][string] document_section_keys_sequenced) { +  auto docSectKeysSeq(string[][string] document_section_keys_sequenced) {      struct doc_sect_keys_seq {        string[] scroll() {          return document_section_keys_sequenced["scroll"]; diff --git a/src/doc_reform/meta/metadoc_object_setter.d b/src/doc_reform/meta/metadoc_object_setter.d index 29d527b..7bfaebf 100644 --- a/src/doc_reform/meta/metadoc_object_setter.d +++ b/src/doc_reform/meta/metadoc_object_setter.d @@ -53,6 +53,7 @@    metadoc_object_setter.d  +/  module doc_reform.meta.metadoc_object_setter; +@safe:  template ObjectSetter() {    /+ structs +/    struct DocObj_TxtAttrib_ { @@ -118,25 +119,25 @@ template ObjectSetter() {      int                    o_n_bibliography                     = 0;      int                    o_n_book_index                       = 0;      int                    o_n_blurb                            = 0; -    @safe  string object_number_substantive() const @property { +     string object_number_substantive() const @property {        return (o_n_substantive == 0) ? "" : o_n_substantive.to!string;      } -    @safe string object_number_non_substantive() const @property { +    string object_number_non_substantive() const @property {        return (o_n_non_substantive == 0) ? "" : o_n_non_substantive.to!string;      } -    @safe string object_number_glossary() const @property { +    string object_number_glossary() const @property {        return (o_n_glossary == 0) ? "" : o_n_glossary.to!string;      } -    @safe string object_number_bibliography() const @property { +    string object_number_bibliography() const @property {        return (o_n_bibliography == 0) ? "" : o_n_bibliography.to!string;      } -    @safe string object_number_book_index() const @property { +    string object_number_book_index() const @property {        return (o_n_book_index == 0) ? "" : o_n_book_index.to!string;      } -    @safe string object_number_blurb() const @property { +    string object_number_blurb() const @property {        return (o_n_blurb == 0) ? "" : o_n_blurb.to!string;      } -    @safe string marked_up_level() const @property { +    string marked_up_level() const @property {        string _out;        switch (heading_lev_markup) {        case 0  : _out = "A"; break; @@ -151,7 +152,7 @@ template ObjectSetter() {        }        return _out;      } -    @safe string object_number() const @property { +    string object_number() const @property {        return (ocn == 0) ? "" : ocn.to!string;      }      bool                   object_number_off                    = false; @@ -370,7 +371,7 @@ template ObjectSetter() {    enum OCNtype { ocn, non, bkidx, }    enum DomTags { none, open, close, close_and_open, open_still, }    enum Substitute { match, markup, } -  @safe static auto eN() { +  static auto eN() {      struct _e {        enum bi {          off, diff --git a/src/doc_reform/meta/metadoc_show_config.d b/src/doc_reform/meta/metadoc_show_config.d index ed3afe0..b75bd2b 100644 --- a/src/doc_reform/meta/metadoc_show_config.d +++ b/src/doc_reform/meta/metadoc_show_config.d @@ -48,8 +48,9 @@  +/  module doc_reform.meta.metadoc_show_config; +@safe:  template spineShowSiteConfig() { -  @safe void spineShowSiteConfig(O,T)( +  void spineShowSiteConfig(O,T)(      O opt_action,      T config,    ) { @@ -136,7 +137,7 @@ template spineShowSiteConfig() {    }  }  template spineShowConfig() { -  @safe void spineShowConfig(T)( +  void spineShowConfig(T)(      T  doc_matters,    ) {      import diff --git a/src/doc_reform/meta/metadoc_show_make.d b/src/doc_reform/meta/metadoc_show_make.d index 3a7b67a..516bc65 100644 --- a/src/doc_reform/meta/metadoc_show_make.d +++ b/src/doc_reform/meta/metadoc_show_make.d @@ -48,8 +48,9 @@  +/  module doc_reform.meta.metadoc_show_make; +@safe:  template spineShowMake() { -  @safe void spineShowMake(T)( +  void spineShowMake(T)(      T  doc_matters,    ) {      import diff --git a/src/doc_reform/meta/metadoc_show_metadata.d b/src/doc_reform/meta/metadoc_show_metadata.d index 0804a6d..1c95c12 100644 --- a/src/doc_reform/meta/metadoc_show_metadata.d +++ b/src/doc_reform/meta/metadoc_show_metadata.d @@ -48,8 +48,9 @@  +/  module doc_reform.meta.metadoc_show_metadata; +@safe:  template spineShowMetaData() { -  @safe void spineShowMetaData(T)( +  void spineShowMetaData(T)(      T  doc_matters,    ) {      import diff --git a/src/doc_reform/meta/metadoc_show_summary.d b/src/doc_reform/meta/metadoc_show_summary.d index aea875a..54c3f8c 100644 --- a/src/doc_reform/meta/metadoc_show_summary.d +++ b/src/doc_reform/meta/metadoc_show_summary.d @@ -48,8 +48,9 @@  +/  module doc_reform.meta.metadoc_show_summary; +@safe:  template spineMetaDocSummary() { -  @safe void spineMetaDocSummary(S,T)( +  void spineMetaDocSummary(S,T)(      const S  doc_abstraction,            T  doc_matters,    ) { diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d index aace769..e00867a 100644 --- a/src/doc_reform/meta/rgx.d +++ b/src/doc_reform/meta/rgx.d @@ -51,6 +51,7 @@    regex: regular expressions used in sisu document parser  +/  module doc_reform.meta.rgx; +@safe:  static template spineRgxIn() {    static struct RgxI {      /+ misc +/ diff --git a/src/doc_reform/meta/rgx_files.d b/src/doc_reform/meta/rgx_files.d index 46d0d7f..98dcbd2 100644 --- a/src/doc_reform/meta/rgx_files.d +++ b/src/doc_reform/meta/rgx_files.d @@ -51,6 +51,7 @@    regex: regular expressions used in sisu document parser  +/  module doc_reform.meta.rgx_files; +@safe:  static template spineRgxFiles() {    static struct RgxFiles {      static src_pth_sst_or_ssm                       = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.](?P<extension>ss[tm]))$`); diff --git a/src/doc_reform/meta/rgx_yaml_tags.d b/src/doc_reform/meta/rgx_yaml_tags.d index d2f21da..86f3e99 100644 --- a/src/doc_reform/meta/rgx_yaml_tags.d +++ b/src/doc_reform/meta/rgx_yaml_tags.d @@ -51,6 +51,7 @@    regex: regular expressions used in sisu document parser  +/  module doc_reform.meta.rgx_yaml; +@safe:  static template spineRgxYamlTags() {    static struct RgxYaml {      static yaml_tag_is_str                          = ctRegex!(`:str$`); diff --git a/src/doc_reform/share/defaults.d b/src/doc_reform/share/defaults.d index 13cf69f..e3f0a0c 100644 --- a/src/doc_reform/share/defaults.d +++ b/src/doc_reform/share/defaults.d @@ -51,9 +51,10 @@    shared default settings  +/  module doc_reform.share.defaults; +@safe:  template Msg() {    import std.stdio; -  @safe auto Msg(I)(I doc_matters) { +  auto Msg(I)(I doc_matters) {      struct Msg_ {        void v()(string message) {          if (doc_matters.opt.action.vox_gt1) { diff --git a/src/doc_reform/spine.d b/src/doc_reform/spine.d index fc9d903..ef1a484 100755 --- a/src/doc_reform/spine.d +++ b/src/doc_reform/spine.d @@ -54,6 +54,7 @@ name        "spine"  description "A SiSU inspired document parser written in D."  homepage    "https://sisudoc.org"  +/ +@safe:  import    std.algorithm,    std.datetime, @@ -768,20 +769,20 @@ string program_name = "spine";      }    }    OptActions _opt_action = OptActions(); -  @safe auto program_info() { +  auto program_info() {      struct ProgramInfo { -      @safe string project() { +      string project() {          return project_name;        } -      @safe string name() { +      string name() {          return program_name;        } -      @safe string ver() { +      string ver() {          return format("%s.%s.%s",            _ver.major, _ver.minor, _ver.patch,          );        } -      @safe string compiler() { +      string compiler() {          return format ("%s D:%s, %s %s",            __VENDOR__, __VERSION__,            bits, os, @@ -793,7 +794,7 @@ string program_name = "spine";        @trusted string name_version_and_compiler() {          return format("%s-%s (%s)", name, ver, compiler);        } -      @safe auto time_output_generated() { +      auto time_output_generated() {          auto _st = Clock.currTime(UTC());          auto _t  = TimeOfDay(_st.hour, _st.minute, _st.second);          auto _time = _st.year.to!string | 
