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) --- src/doc_reform/meta/conf_make_meta_json.d | 3 +- src/doc_reform/meta/conf_make_meta_structs.d | 5 +- src/doc_reform/meta/conf_make_meta_yaml.d | 1 + src/doc_reform/meta/defaults.d | 21 ++-- src/doc_reform/meta/metadoc.d | 53 ++++---- src/doc_reform/meta/metadoc_curate.d | 3 +- src/doc_reform/meta/metadoc_curate_authors.d | 3 +- src/doc_reform/meta/metadoc_curate_topics.d | 3 +- src/doc_reform/meta/metadoc_from_src.d | 3 +- src/doc_reform/meta/metadoc_from_src_functions.d | 149 ++++++++++++----------- src/doc_reform/meta/metadoc_object_setter.d | 19 +-- src/doc_reform/meta/metadoc_show_config.d | 5 +- src/doc_reform/meta/metadoc_show_make.d | 3 +- src/doc_reform/meta/metadoc_show_metadata.d | 3 +- src/doc_reform/meta/metadoc_show_summary.d | 3 +- src/doc_reform/meta/rgx.d | 1 + src/doc_reform/meta/rgx_files.d | 1 + src/doc_reform/meta/rgx_yaml_tags.d | 1 + 18 files changed, 149 insertions(+), 131 deletions(-) (limited to 'src/doc_reform/meta') diff --git a/src/doc_reform/meta/conf_make_meta_json.d b/src/doc_reform/meta/conf_make_meta_json.d index 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[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.](?Pss[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$`); -- cgit v1.2.3