From e9e17be24eba558c30fcdc41ea5bb9a1da7fd4e7 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 12 Mar 2024 22:39:09 -0400 Subject: mark modules as @safe: (& identify what is not) --- org/compile_time_info.org | 1 + org/default_misc.org | 22 +++--- org/default_paths.org | 134 ++++++++++++++++++------------------ org/default_regex.org | 6 ++ org/default_shared_snippets.org | 6 +- org/in_source_files.org | 33 ++++----- org/meta_conf_make_meta.org | 9 ++- org/ocda.org | 3 +- org/ocda_functions.org | 149 ++++++++++++++++++++-------------------- org/ocda_obj_setter.org | 19 ++--- org/out_curate_metadata.org | 7 +- org/out_latex.org | 47 ++++++------- org/out_metadata.org | 7 +- org/out_odt.org | 81 +++++++++++----------- org/out_src_pod.org | 1 + org/out_xmls.org | 102 +++++++++++++-------------- org/out_xmls_css.org | 5 +- org/out_zip.org | 3 +- org/output_hub.org | 1 + org/output_show.org | 14 ++-- org/spine.org | 66 +++++++++--------- 21 files changed, 377 insertions(+), 339 deletions(-) (limited to 'org') 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() { <> <> 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: <> <> <> @@ -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: <> <> <> @@ -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 { <> @@ -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 { <> @@ -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 { <> @@ -697,6 +700,7 @@ static src_formalised_file_path_parts = ctRegex!(`(?P(?:[/a-zA-Z0 regex: regular expressions used in sisu document parser +/ module doc_reform.meta.rgx_yaml; +@safe: static template spineRgxYamlTags() { static struct RgxYaml { <> @@ -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 { <> @@ -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 { <> 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 <> 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: <> #+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; -<> <> <> <> @@ -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 <> } - @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 <> module doc_reform.meta.conf_make_meta_structs; +@safe: <> <> <> @@ -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() { <> @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() { <> <> @@ -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 +/ <> @@ -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 <> 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 <> module doc_reform.meta.metadoc_curate_topics; +@safe: import std.algorithm, std.array, @@ -469,6 +471,7 @@ try { #+BEGIN_SRC d <> 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 <> module doc_reform.io_out.latex; +@safe: <> <> <> @@ -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 <> module doc_reform.io_out.metadata; +@safe: template outputMetadata() { - @safe void outputMetadata(T)( T doc_matters) { + void outputMetadata(T)( T doc_matters) { <> <> <> @@ -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 <> module doc_reform.io_out.odt; +@safe: template formatODT() { <> 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"┃ @@ -456,7 +457,7 @@ string _font_face(string _txt){ obj.object_number, ); } - @safe string display() { + string display() { return format(q"┃ %s%s%s ┃", @@ -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"┃ ┃", @@ -483,7 +484,7 @@ string _font_face(string _txt){ #+END_SRC #+BEGIN_SRC d -@safe string _break_page()() { +string _break_page()() { return format(q"┃ ┃", @@ -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, "
"); @@ -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"┃ #+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"┃ #+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"┃ #+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"┃spine: <www.doc_reform.org> and <www.sisudoc.org> ┃",); 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"┃┃"); @@ -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 <> module doc_reform.io_out.source_pod; +@system: // is not @safe: use: @system: or @trusted: template spinePod() { <> 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 <> module doc_reform.io_out.xmls; +@safe: template outputXHTMLs() { <> 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, "
") @@ -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, ("$1")) .replaceAll(rgx.inline_bold, ("$1")) @@ -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"┃ @@ -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"┃┃"); 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"┃
@@ -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 <> module doc_reform.io_out.html; +@safe: template outputHTML() { <> mixin outputXHTMLs; - @safe void scroll(D,M)( + void scroll(D,M)( const D doc_abstraction, M doc_matters, ) { @@ -1777,7 +1778,7 @@ template outputHTML() { <> } <> - @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 <> module doc_reform.io_out.epub3; +@safe: template outputEPub3() { <> 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"┃┃") ~ "\n"; o ~= format(q"┃ #+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) { <> <> 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 <> 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() { <> @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 <> 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, ) { <> @@ -340,8 +342,9 @@ writefln( #+BEGIN_SRC d <> module doc_reform.meta.metadoc_show_make; +@safe: template spineShowMake() { - @safe void spineShowMake(T)( + void spineShowMake(T)( T doc_matters, ) { <> @@ -413,8 +416,9 @@ writefln( #+BEGIN_SRC d <> module doc_reform.meta.metadoc_show_metadata; +@safe: template spineShowMetaData() { - @safe void spineShowMetaData(T)( + void spineShowMetaData(T)( T doc_matters, ) { <> 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: <> <> <> @@ -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 <> module doc_reform.meta.metadoc; +@safe: template spineAbstraction() { <> <> @@ -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]; -- cgit v1.2.3