diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2024-03-12 22:39:09 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2024-03-12 22:56:34 -0400 |
commit | e9e17be24eba558c30fcdc41ea5bb9a1da7fd4e7 (patch) | |
tree | 1ed3c4b528b0a8e54d0eb9babc391e562578c7b4 /src/doc_reform/io_out | |
parent | nix flake & env upkeep (diff) |
mark modules as @safe: (& identify what is not)
Diffstat (limited to 'src/doc_reform/io_out')
-rw-r--r-- | src/doc_reform/io_out/create_zip_file.d | 3 | ||||
-rw-r--r-- | src/doc_reform/io_out/defaults.d | 9 | ||||
-rw-r--r-- | src/doc_reform/io_out/epub3.d | 11 | ||||
-rw-r--r-- | src/doc_reform/io_out/html.d | 7 | ||||
-rw-r--r-- | src/doc_reform/io_out/html_snippet.d | 3 | ||||
-rw-r--r-- | src/doc_reform/io_out/hub.d | 1 | ||||
-rw-r--r-- | src/doc_reform/io_out/latex.d | 43 | ||||
-rw-r--r-- | src/doc_reform/io_out/metadata.d | 7 | ||||
-rw-r--r-- | src/doc_reform/io_out/odt.d | 79 | ||||
-rw-r--r-- | src/doc_reform/io_out/paths_output.d | 1 | ||||
-rw-r--r-- | src/doc_reform/io_out/rgx.d | 1 | ||||
-rw-r--r-- | src/doc_reform/io_out/rgx_latex.d | 1 | ||||
-rw-r--r-- | src/doc_reform/io_out/rgx_xhtml.d | 1 | ||||
-rw-r--r-- | src/doc_reform/io_out/source_pod.d | 1 | ||||
-rw-r--r-- | src/doc_reform/io_out/xmls.d | 85 | ||||
-rw-r--r-- | src/doc_reform/io_out/xmls_css.d | 5 |
16 files changed, 137 insertions, 121 deletions
diff --git a/src/doc_reform/io_out/create_zip_file.d b/src/doc_reform/io_out/create_zip_file.d index b6feacf..63e243b 100644 --- a/src/doc_reform/io_out/create_zip_file.d +++ b/src/doc_reform/io_out/create_zip_file.d @@ -48,13 +48,14 @@ +/ module doc_reform.io_out.create_zip_file; +@safe: template createZipFile() { import std.file, std.outbuffer, std.string, std.zip; - @safe void createZipFile( + void createZipFile( string zip_file_name, void[] compressed_zip_data, ) { diff --git a/src/doc_reform/io_out/defaults.d b/src/doc_reform/io_out/defaults.d index 0b21d20..2a51625 100644 --- a/src/doc_reform/io_out/defaults.d +++ b/src/doc_reform/io_out/defaults.d @@ -51,6 +51,7 @@ default settings +/ module doc_reform.io_out.defaults; +@safe: template InternalMarkup() { import std.array; @@ -100,7 +101,7 @@ template InternalMarkup() { template spineLanguageCodes() { /+ language codes +/ struct Lang { - @safe static string[string][string] codes() { + static string[string][string] codes() { auto _lang_codes = [ "am": [ "c": "am", "n": "Amharic", "t": "Amharic", "xlp": "amharic" ], "bg": [ "c": "bg", "n": "Bulgarian", "t": "Български (Bəlgarski)", "xlp": "bulgarian" ], @@ -167,15 +168,15 @@ template spineLanguageCodes() { ]; return _lang_codes; } - @safe static string[] code_arr_ptr() { + static string[] code_arr_ptr() { string[] _lang_codes = ["am", "bg", "bn", "br", "ca", "cs", "cy", "da", "de", "el", "en", "eo", "es", "et", "eu", "fi", "fr", "ga", "gl", "he", "hi", "hr", "hy", "ia", "is", "it", "ja", "ko", "la", "lo", "lt", "lv", "ml", "mr", "nl", "no", "nn", "oc", "pl", "pt", "pt_BR", "ro", "ru", "sa", "se", "sk", "sl", "sq", "sr", "sv", "ta", "te", "th", "tk", "tr", "uk", "ur", "us", "vi", "zh", "en", "xx",]; return _lang_codes; } - @safe static string[] code_arr() { + static string[] code_arr() { string[] _lang_codes = ["am", "bg", "bn", "br", "ca", "cs", "cy", "da", "de", "el", "en", "eo", "es", "et", "eu", "fi", "fr", "ga", "gl", "he", "hi", "hr", "hy", "ia", "is", "it", "ja", "ko", "la", "lo", "lt", "lv", "ml", "mr", "nl", "no", "nn", "oc", "pl", "pt", "pt_BR", "ro", "ru", "sa", "se", "sk", "sl", "sq", "sr", "sv", "ta", "te", "th", "tk", "tr", "uk", "ur", "vi", "zh"]; return _lang_codes; } - @safe static auto codes_() { + static auto codes_() { return "(" ~ join(code_arr,"|") ~ ")"; } static auto codes_regex() { diff --git a/src/doc_reform/io_out/epub3.d b/src/doc_reform/io_out/epub3.d index 808d9fb..cffc464 100644 --- a/src/doc_reform/io_out/epub3.d +++ b/src/doc_reform/io_out/epub3.d @@ -48,6 +48,7 @@ +/ module doc_reform.io_out.epub3; +@safe: template outputEPub3() { import std.file, @@ -66,7 +67,7 @@ template outputEPub3() { mixin outputXHTMLs; static auto rgx = RgxO(); static auto rgx_xhtml = RgxXHTML(); - @safe string special_characters_text(string _txt) { + string special_characters_text(string _txt) { _txt = _txt .replaceAll(rgx_xhtml.ampersand, "&") // "&" .replaceAll(rgx_xhtml.quotation, """) // """ @@ -78,12 +79,12 @@ template outputEPub3() { .replaceAll(rgx.nbsp_char, " "); return _txt; } - @safe string epub3_mimetypes() { + string epub3_mimetypes() { string o; o = format(q"┃application/epub+zip┃") ~ "\n"; return o; } - @safe string epub3_container_xml() { + string epub3_container_xml() { string o; o = format(q"┃<?xml version="1.0" encoding="utf-8"?>┃") ~ "\n"; o ~= format(q"┃<container version="1.0" @@ -94,7 +95,7 @@ template outputEPub3() { </rootfiles>┃") ~ "\n</container>\n"; return o; } - @safe string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) { + string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) { auto xhtml_format = outputXHTMLs(); auto pth_epub3 = spinePathsEPUB!()(doc_matters.output_path, doc_matters.src.language); string _uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO sort uuid in doc_matters! @@ -182,7 +183,7 @@ template outputEPub3() { } return content; } - @safe string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { + string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { enum DomTags { none, open, close, close_and_open, open_still, } auto markup = InlineMarkup(); static auto rgx = RgxO(); diff --git a/src/doc_reform/io_out/html.d b/src/doc_reform/io_out/html.d index 397cb95..e7e21c2 100644 --- a/src/doc_reform/io_out/html.d +++ b/src/doc_reform/io_out/html.d @@ -48,6 +48,7 @@ +/ module doc_reform.io_out.html; +@safe: template outputHTML() { import std.file, @@ -63,7 +64,7 @@ template outputHTML() { doc_reform.io_out.xmls, doc_reform.io_out.xmls_css; mixin outputXHTMLs; - @safe void scroll(D,M)( + void scroll(D,M)( const D doc_abstraction, M doc_matters, ) { @@ -270,7 +271,7 @@ template outputHTML() { writeln(" ", pth_html.fn_scroll(doc_matters.src.filename)); } } - @safe void seg(D,M)( + void seg(D,M)( const D doc_abstraction, M doc_matters, ) { @@ -557,7 +558,7 @@ template outputHTML() { writeln(" ", pth_html.fn_seg(doc_matters.src.filename, "toc")); } } - @safe void css(M)(M doc_matters) { + void css(M)(M doc_matters) { auto css = spineCss(doc_matters); auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language); try { diff --git a/src/doc_reform/io_out/html_snippet.d b/src/doc_reform/io_out/html_snippet.d index 73d861e..843f541 100644 --- a/src/doc_reform/io_out/html_snippet.d +++ b/src/doc_reform/io_out/html_snippet.d @@ -48,6 +48,7 @@ +/ module doc_reform.io_out.html_snippet; +@safe: template htmlSnippet() { import std.file, @@ -83,7 +84,7 @@ template htmlSnippet() { ); return html_blank_default; } - @safe string special_characters_text(string _txt) { + string special_characters_text(string _txt) { mixin spineRgxOut; mixin spineRgxXHTML; static auto rgx = RgxO(); diff --git a/src/doc_reform/io_out/hub.d b/src/doc_reform/io_out/hub.d index 16c866e..3be873e 100644 --- a/src/doc_reform/io_out/hub.d +++ b/src/doc_reform/io_out/hub.d @@ -52,6 +52,7 @@ check & generate output types requested +/ module doc_reform.io_out.hub; +@safe: template outputHub() { import doc_reform.io_out, doc_reform.io_out.metadata, diff --git a/src/doc_reform/io_out/latex.d b/src/doc_reform/io_out/latex.d index a47e81c..8c792ff 100644 --- a/src/doc_reform/io_out/latex.d +++ b/src/doc_reform/io_out/latex.d @@ -48,6 +48,7 @@ +/ module doc_reform.io_out.latex; +@safe: template paperLaTeX() { import std.format, @@ -58,7 +59,7 @@ template paperLaTeX() { return _mm; } struct PaperType { - @safe auto a4() { + auto a4() { struct A4 { auto portrait() { struct V { @@ -109,7 +110,7 @@ template paperLaTeX() { } return A4(); } - @safe auto a5() { + auto a5() { struct A5 { auto portrait() { struct V { @@ -160,7 +161,7 @@ template paperLaTeX() { } return A5(); } - @safe auto b4() { + auto b4() { struct B4 { auto portrait() { struct V { @@ -211,7 +212,7 @@ template paperLaTeX() { } return B4(); } - @safe auto letter() { + auto letter() { struct Letter { auto portrait() { struct V { @@ -262,7 +263,7 @@ template paperLaTeX() { } return Letter(); } - @safe auto legal() { + auto legal() { struct Legal { auto portrait() { struct V { @@ -335,7 +336,7 @@ template outputLaTeX() { mixin spineLanguageCodes; auto lang = Lang(); auto paper = paperLaTeX; - @safe string sp_char_ops()( + string sp_char_ops()( string _txt, ) { string _unescape_sp_char_esc()(string _txt) { @@ -359,7 +360,7 @@ template outputLaTeX() { _txt = replaceAll!(m => _unescape_fontface_esc(m[0]))(_txt, rgx_sc.latex_identify_inline_fontface); return _txt; } - @safe string sp_char_esc(O)( + string sp_char_esc(O)( string _txt, const O obj, ) { @@ -368,20 +369,20 @@ template outputLaTeX() { } return _txt; } - @safe string sp_char_esc_txt()( + string sp_char_esc_txt()( string _txt, ) { _txt = _txt.sp_char_ops; return _txt; } - @safe string marked_linebreaks_newlines()( + string marked_linebreaks_newlines()( string _txt, ) { _txt = _txt.split(rgx.br_linebreaks_newlines).join("\\br\n").strip; // _txt = replaceAll!(m => "\\br " ~ m[1])(_txt, rgx.br_linebreaks_newlines); return _txt; } - @safe string fontface()( + string fontface()( string _txt, ) { _txt = _txt @@ -397,7 +398,7 @@ template outputLaTeX() { .replaceAll(rgx.inline_italics, format(q"┃``%s''┃", "$1")); return _txt; } - @safe string leading_hardspaces()( + string leading_hardspaces()( string _txt, ) { string hardspaces(string _spaces) { @@ -408,7 +409,7 @@ template outputLaTeX() { _txt = replaceAll!(m => hardspaces(m[0]))(_txt, rgx.spaces_line_start); return _txt; } - @safe string nbsp_char()(string _txt) { + string nbsp_char()(string _txt) { if (_txt.match(rgx.nbsp_char)) { foreach (m; _txt.matchAll(rgx.nbsp_chars)) { int spaces_ = 0; @@ -420,7 +421,7 @@ template outputLaTeX() { } return _txt; } - @safe string spaces_to_nbsp()(string _txt) { + string spaces_to_nbsp()(string _txt) { if (_txt.match(rgx.spaces_keep)) { foreach (m; _txt.matchAll(rgx.spaces_keep)) { int spaces_ = 0; @@ -432,13 +433,13 @@ template outputLaTeX() { } return _txt; } - @safe string nbsp_char_to_space()(string _txt) { + string nbsp_char_to_space()(string _txt) { if (_txt.match(rgx.nbsp_char)) { _txt = _txt.replaceAll(rgx.nbsp_char, " "); } return _txt; } - @safe string links_and_images(O,M)( + string links_and_images(O,M)( string _txt, const O obj, M doc_matters, @@ -485,7 +486,7 @@ template outputLaTeX() { } return _txt; } - @safe string footnotes()( + string footnotes()( string _txt, ) { if (_txt.match(rgx.inline_notes_al_gen)) { @@ -500,7 +501,7 @@ template outputLaTeX() { } return _txt; } - @safe string remove_footnotes()( + string remove_footnotes()( string _txt, ) { if (_txt.match(rgx.inline_notes_al_gen)) { @@ -508,7 +509,7 @@ template outputLaTeX() { } return _txt; } - @safe string para(O)( + string para(O)( string _txt, O obj, ) { @@ -522,7 +523,7 @@ template outputLaTeX() { } return _txt; } - @safe string bookindex(O)( + string bookindex(O)( string _txt, O obj, ) { @@ -537,7 +538,7 @@ template outputLaTeX() { } return _txt; } - @safe string heading(O,M)( + string heading(O,M)( string _txt, O obj, M doc_matters, @@ -932,7 +933,7 @@ template outputLaTeX() { } return _txt; } - @safe string bullets_and_indentation(O)( + string bullets_and_indentation(O)( string _txt, O obj, ) { diff --git a/src/doc_reform/io_out/metadata.d b/src/doc_reform/io_out/metadata.d index 029bd28..94bb9a9 100644 --- a/src/doc_reform/io_out/metadata.d +++ b/src/doc_reform/io_out/metadata.d @@ -48,9 +48,10 @@ +/ module doc_reform.io_out.metadata; +@safe: template outputMetadata() { - @safe void outputMetadata(T)( T doc_matters) { - @safe string inline_search_form(M)( + void outputMetadata(T)( T doc_matters) { + string inline_search_form(M)( M doc_matters, ) { string o; @@ -363,7 +364,7 @@ string theme_light_1 = format(q"┃ doc_matters.opt.action.css_theme_default ? theme_light_0 : theme_dark_0, doc_matters.opt.action.css_theme_default ? theme_light_1 : theme_dark_1, ) ~ "\n"; - @safe void metadata_write_output(M)(M doc_matters, string[] metadata_) { + void metadata_write_output(M)(M doc_matters, string[] metadata_) { auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language); try { if (!exists(pth_html.base)) { diff --git a/src/doc_reform/io_out/odt.d b/src/doc_reform/io_out/odt.d index 15e7e8e..c17158a 100644 --- a/src/doc_reform/io_out/odt.d +++ b/src/doc_reform/io_out/odt.d @@ -48,6 +48,7 @@ +/ module doc_reform.io_out.odt; +@safe: template formatODT() { import doc_reform.io_out, @@ -69,7 +70,7 @@ template formatODT() { struct formatODT { static auto rgx = RgxO(); static auto rgx_xhtml = RgxXHTML(); - @safe string _tags(O)(const O obj) { + string _tags(O)(const O obj) { string _tags = ""; if (obj.tags.anchor_tags.length > 0) { foreach (tag_; obj.tags.anchor_tags) { @@ -87,7 +88,7 @@ template formatODT() { } return _tags; } - @safe string _xhtml_anchor_tags(O)(O obj) { + string _xhtml_anchor_tags(O)(O obj) { const(string[]) anchor_tags = obj.tags.anchor_tags; string tags=""; if (anchor_tags.length > 0) { @@ -99,7 +100,7 @@ template formatODT() { } return tags; } - @safe string obj_num(O)(const O obj) { // TODO + string obj_num(O)(const O obj) { // TODO string _on; _on = (obj.metainfo.object_number.empty) ? "" @@ -109,7 +110,7 @@ template formatODT() { )); return _on; } - @safe string _footnotes()(string _txt) { + string _footnotes()(string _txt) { static auto rgx = RgxO(); static auto rgx_xhtml = RgxXHTML(); _txt = _txt.replaceAll( @@ -129,14 +130,14 @@ template formatODT() { ); return _txt; } - @safe string _bullet(O)(const O obj) { + string _bullet(O)(const O obj) { string _b = ""; if (obj.attrib.bullet) { _b = format(q"┃● ┃",); } return _b; } - @safe string _indent(O)(string _txt, const O obj) { // TODO + string _indent(O)(string _txt, const O obj) { // TODO // if (obj.attrib.indent_base > 0 || // obj.attrib.indent_hang > 0 // ) { @@ -244,7 +245,7 @@ template formatODT() { } return _txt; } - @safe string _block_type_delimiters(O)(string[] _block_lines, const O obj) { // TODO + string _block_type_delimiters(O)(string[] _block_lines, const O obj) { // TODO string _block = ""; foreach (i, _line; _block_lines) { _line = _footnotes(_line); @@ -277,7 +278,7 @@ template formatODT() { obj_num(obj)); return _block; } - @safe string _special_characters(O)(string _txt, const O obj) { + string _special_characters(O)(string _txt, const O obj) { _txt = _txt .replaceAll(rgx_xhtml.ampersand, "&") .replaceAll(rgx_xhtml.quotation, """) @@ -286,7 +287,7 @@ template formatODT() { .replaceAll(rgx.nbsp_char, " "); return _txt; } - @safe string _preserve_white_spaces(O)(string _txt, const O obj) { + string _preserve_white_spaces(O)(string _txt, const O obj) { if (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block") { _txt = _txt .replaceAll(rgx.space, " "); @@ -307,9 +308,9 @@ template formatODT() { .replaceAll(rgx.inline_mono, format(q"┃<text:span text:style-name="Span_monospace">%s</text:span>┃", "$1")); return _txt; } - @safe auto _obj_num(O)(O obj) { // NOT USED YET + auto _obj_num(O)(O obj) { // NOT USED YET struct objNum { - @safe string reference() { + string reference() { return format(q"┃<text:span text:style-name="Span_subscript"> <text:bookmark-start text:name="%s"/> <text:bookmark-end text:name="%s"/> @@ -318,7 +319,7 @@ template formatODT() { obj.object_number, ); } - @safe string display() { + string display() { return format(q"┃<text:span text:style-name="Span_subscript"> %s%s%s </text:span>┃", @@ -330,20 +331,20 @@ template formatODT() { } return objNum(); } - @safe string _break_page()() { + string _break_page()() { return format(q"┃ <text:p text:style-name="P_normal_page_new"/> ┃", ); } - @safe string _empty_line_break(O)(string _txt, const O obj) { + string _empty_line_break(O)(string _txt, const O obj) { if (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block") { _txt = _txt .replaceAll(rgx.br_empty_line, "<br />"); } return _txt; } - @safe string _links(O)(string _txt, const O obj) { + string _links(O)(string _txt, const O obj) { if (obj.metainfo.is_a != "code") { if (obj.metainfo.is_a == "toc") { _txt = replaceAll!(m => @@ -383,7 +384,7 @@ template formatODT() { } return _txt; } - @safe string _images(O)(string _txt, const O obj) { + string _images(O)(string _txt, const O obj) { if (_txt.match(rgx.inline_image)) { _txt = _txt .replaceAll(rgx.inline_image, @@ -394,7 +395,7 @@ template formatODT() { } return _txt; } - @safe string markup(O)(const O obj) { + string markup(O)(const O obj) { /+ markup TODO +/ string _txt = obj.text; _txt = _special_characters(_txt, obj); // TODO & why both obj & obj.text, consider also in output_xmls.org @@ -408,7 +409,7 @@ template formatODT() { _txt = _empty_line_break(_txt, obj); // (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block") return _txt; } - @safe string heading(O,M)( + string heading(O,M)( const O obj, const M doc_matters, ) { @@ -452,7 +453,7 @@ template formatODT() { } return _o_txt_odt; } - @safe string para(O,M)( + string para(O,M)( const O obj, const M doc_matters, ) { @@ -471,7 +472,7 @@ template formatODT() { } return _o_txt_odt; } - @safe string quote(O,M)( + string quote(O,M)( const O obj, const M doc_matters, ) { @@ -483,7 +484,7 @@ template formatODT() { _o_txt_odt = _footnotes(_o_txt_odt); // decide return _o_txt_odt; } - @safe string group(O,M)( + string group(O,M)( const O obj, const M doc_matters, ) { @@ -501,7 +502,7 @@ template formatODT() { _o_txt_odt = _block_type_delimiters(_block_lines, obj); return _o_txt_odt; } - @safe string block(O,M)( + string block(O,M)( const O obj, const M doc_matters, ) { @@ -514,7 +515,7 @@ template formatODT() { _o_txt_odt = _block_type_delimiters(_block_lines, obj); return _o_txt_odt; } - @safe string verse(O,M)( + string verse(O,M)( const O obj, const M doc_matters, ) { @@ -527,7 +528,7 @@ template formatODT() { _o_txt_odt = _block_type_delimiters(_block_lines, obj); return _o_txt_odt; } - @safe string code(O,M)( + string code(O,M)( const O obj, const M doc_matters, ) { @@ -574,7 +575,7 @@ template formatODT() { _o_txt_odt = _block; return _o_txt_odt; } - @safe Tuple!(string, string) tablarize(O)( + Tuple!(string, string) tablarize(O)( const O obj, string _txt, ) { @@ -609,7 +610,7 @@ template formatODT() { return t; } int _table_number = 0; - @safe string table(O,M)( + string table(O,M)( const O obj, const M doc_matters, ) { @@ -666,7 +667,7 @@ template outputODT() { static auto rgx = RgxO(); static auto rgx_xhtml = RgxXHTML(); // mixin outputXmlODT; - @safe string odt_head(I)(I doc_matters) { + string odt_head(I)(I doc_matters) { string _has_tables = format(q"┃ <style:style style:name="Table1" style:family="table"> <style:table-properties style:width="16.999cm" table:align="margins"/> @@ -774,7 +775,7 @@ template outputODT() { ); return _odt_head; } - @safe string odt_body(D,I)( + string odt_body(D,I)( const D doc_abstraction, I doc_matters, ) { @@ -900,12 +901,12 @@ template outputODT() { return doc_odt; } - @safe string odt_tail() { + string odt_tail() { string _odt_tail = format(q"┃<text:p text:style-name="P_normal">spine: <<text:a xl:type="simple" xl:href="https://www.doc_reform.org">www.doc_reform.org</text:a>> and <<text:a xl:type="simple" xl:href="https://www.sisudoc.org">www.sisudoc.org</text:a>></text:p> </office:text></office:body></office:document-content>┃",); return _odt_tail; } - @safe string content_xml(D,I)( + string content_xml(D,I)( const D doc_abstraction, I doc_matters, ) { @@ -918,7 +919,7 @@ template outputODT() { _content_xml ~= odt_tail; return _content_xml; } - @safe string manifest_xml(M)( + string manifest_xml(M)( auto ref M doc_matters, ) { string _bullet = format(q"┃<manifest:file-entry manifest:media-type="" manifest:full-path="Pictures/bullet_09.png"/>┃"); @@ -942,7 +943,7 @@ template outputODT() { ); return _manifest_xml; } - @safe void images_cp(M)( + void images_cp(M)( auto ref M doc_matters, ) { { /+ (copy odt images) +/ @@ -963,7 +964,7 @@ template outputODT() { } // return 0; } - @safe string meta_xml(M)( + string meta_xml(M)( auto ref M doc_matters, ) { /+ (meta_xml includes output time-stamp) +/ @@ -1011,11 +1012,11 @@ template outputODT() { } // return 0; } - @safe string mimetype() { + string mimetype() { string mimetype_ = format(q"┃application/vnd.oasis.opendocument.text┃"); return mimetype_; } - @safe string manifest_rdf() { + string manifest_rdf() { string _manifest_rdf = format(q"┃<?xml version="1.0" encoding="utf-8"?> <rdf:RDF xmlns:rdf="https://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="styles.xml"> @@ -1037,7 +1038,7 @@ template outputODT() { ┃"); return _manifest_rdf; } - @safe string settings_xml() { + string settings_xml() { string _settings_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?> <office:document-settings xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xl="https://www.w3.org/1999/xlink" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="https://openoffice.org/2004/office" office:version="1.2"> <office:settings> @@ -1137,7 +1138,7 @@ template outputODT() { ┃"); return _settings_xml; } - @safe string styles_xml() { + string styles_xml() { string _styles_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?> <office:document-styles xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xl="https://www.w3.org/1999/xlink" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="https://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="https://openoffice.org/2004/office" xmlns:ooow="https://openoffice.org/2004/writer" xmlns:oooc="https://openoffice.org/2004/calc" xmlns:dom="https://www.w3.org/2001/xml-events" xmlns:rpt="https://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="https://www.w3.org/1999/xhtml" xmlns:grddl="https://www.w3.org/2003/g/data-view#" xmlns:tableooo="https://openoffice.org/2009/table" xmlns:css3t="https://www.w3.org/TR/css3-text/" office:version="1.2"> <office:font-face-decls> @@ -2033,7 +2034,7 @@ template outputODT() { ┃"); return _styles_xml; } - void writeOutputODT(W,I)( + @trusted void writeOutputODT(W,I)( const W odt_content, I doc_matters, ) { @@ -2092,7 +2093,7 @@ template outputODT() { auto zip_arc_member_file = new ArchiveMember(); zip_arc_member_file.name = fn_out; auto zip_data = new OutBuffer(); - zip_data.write(cast(char[]) ((fn_src).read)); + zip_data.write(cast(char[]) ((fn_src).read)); // trusted? zip_arc_member_file.expandedData = zip_data.toBytes(); zip.addMember(zip_arc_member_file); createZipFile!()(fn_odt, zip.build()); diff --git a/src/doc_reform/io_out/paths_output.d b/src/doc_reform/io_out/paths_output.d index b11dbdb..a317896 100644 --- a/src/doc_reform/io_out/paths_output.d +++ b/src/doc_reform/io_out/paths_output.d @@ -51,6 +51,7 @@ default settings +/ module doc_reform.io_out.paths_output; +@safe: import std.array, std.path, diff --git a/src/doc_reform/io_out/rgx.d b/src/doc_reform/io_out/rgx.d index 524415a..212581f 100644 --- a/src/doc_reform/io_out/rgx.d +++ b/src/doc_reform/io_out/rgx.d @@ -51,6 +51,7 @@ regex: regular expressions used in sisu document parser +/ module doc_reform.io_out.rgx; +@safe: static template spineRgxOut() { static struct RgxO { static make_breakpage = ctRegex!(`new=(?P<breakpage>.+?)(?:;|$)`); diff --git a/src/doc_reform/io_out/rgx_latex.d b/src/doc_reform/io_out/rgx_latex.d index a69c903..2d43dc3 100644 --- a/src/doc_reform/io_out/rgx_latex.d +++ b/src/doc_reform/io_out/rgx_latex.d @@ -51,6 +51,7 @@ regex: regular expressions used in sisu document parser +/ module doc_reform.io_out.rgx_latex; +@safe: static template spineRgxLSC() { static struct RgxLSC { static latex_special_char = ctRegex!(`([%${}_#&\\])`); diff --git a/src/doc_reform/io_out/rgx_xhtml.d b/src/doc_reform/io_out/rgx_xhtml.d index 831bfdc..0bf8bb1 100644 --- a/src/doc_reform/io_out/rgx_xhtml.d +++ b/src/doc_reform/io_out/rgx_xhtml.d @@ -51,6 +51,7 @@ regex: regular expressions used in sisu document parser +/ module doc_reform.io_out.rgx_xhtml; +@safe: static template spineRgxXHTML() { static struct RgxXHTML { static ampersand = ctRegex!(`[&]`, "m"); // & diff --git a/src/doc_reform/io_out/source_pod.d b/src/doc_reform/io_out/source_pod.d index 7441f6b..3920d08 100644 --- a/src/doc_reform/io_out/source_pod.d +++ b/src/doc_reform/io_out/source_pod.d @@ -48,6 +48,7 @@ +/ module doc_reform.io_out.source_pod; +@system: // is not @safe: use: @system: or @trusted: template spinePod() { import doc_reform.meta.rgx_files, diff --git a/src/doc_reform/io_out/xmls.d b/src/doc_reform/io_out/xmls.d index 5a8730e..ca7b9ea 100644 --- a/src/doc_reform/io_out/xmls.d +++ b/src/doc_reform/io_out/xmls.d @@ -48,6 +48,7 @@ +/ module doc_reform.io_out.xmls; +@safe: template outputXHTMLs() { import std.file, @@ -67,7 +68,7 @@ template outputXHTMLs() { struct outputXHTMLs { static auto rgx = RgxO(); static auto rgx_xhtml = RgxXHTML(); - @safe string div_delimit( + string div_delimit( string section, return ref string previous_section ) { @@ -97,7 +98,7 @@ template outputXHTMLs() { // you also need to close the last div, introduce a footer? return delimit; } - @safe string special_characters_text(string _txt) { + string special_characters_text(string _txt) { _txt = _txt .replaceAll(rgx_xhtml.ampersand, "&") // "&" .replaceAll(rgx_xhtml.quotation, """) // """ @@ -109,7 +110,7 @@ template outputXHTMLs() { .replaceAll(rgx.nbsp_char, " "); return _txt; } - @safe string special_characters_date(string _txt) { + string special_characters_date(string _txt) { _txt = _txt .replaceAll(regex(r"(?:-00)+"), "") .replaceAll(rgx.br_line, "<br />") @@ -118,7 +119,7 @@ template outputXHTMLs() { .replaceAll(rgx.nbsp_char, " "); return _txt; } - @safe string special_characters_breaks_indents_bullets(O)( + string special_characters_breaks_indents_bullets(O)( const O obj, ) { string _txt = special_characters_text(obj.text); @@ -169,7 +170,7 @@ template outputXHTMLs() { } return _txt; } - @safe string font_face(string _txt) { + string font_face(string _txt) { _txt = _txt .replaceAll(rgx.inline_emphasis, ("<em>$1</em>")) .replaceAll(rgx.inline_bold, ("<b>$1</b>")) @@ -183,7 +184,7 @@ template outputXHTMLs() { .replaceAll(rgx.inline_cite, ("<cite>$1</cite>")); return _txt; } - @safe string _xhtml_anchor_tags(O)(O obj) { + string _xhtml_anchor_tags(O)(O obj) { string tags=""; if (obj.tags.anchor_tags.length > 0) { foreach (tag; obj.tags.anchor_tags) { @@ -194,7 +195,7 @@ template outputXHTMLs() { } return tags; } - @safe string header_metadata(M)( + string header_metadata(M)( M doc_matters, ) { string _publisher="Publisher"; // TODO @@ -231,7 +232,7 @@ template outputXHTMLs() { ); return o; } - @safe string site_info_button(M)( + string site_info_button(M)( M doc_matters, ) { string _locations; @@ -255,7 +256,7 @@ template outputXHTMLs() { ); return o; } - @safe string inline_search_form(M)( + string inline_search_form(M)( M doc_matters, ) { string o; @@ -314,7 +315,7 @@ template outputXHTMLs() { } return o; } - @safe string html_head(M)( + string html_head(M)( M doc_matters, string type, ) { @@ -396,7 +397,7 @@ template outputXHTMLs() { ); return o; } - @safe string epub3_seg_head(M)( + string epub3_seg_head(M)( M doc_matters, ) { string html_base = format(q"┃<!DOCTYPE html> @@ -464,12 +465,12 @@ template outputXHTMLs() { ); return o; } -@safe string dom_close() { +string dom_close() { string o; o = format(q"┃</div>┃"); return o; } -@safe string tail(M)(M doc_matters) { +string tail(M)(M doc_matters) { string o; o = format(q"┃<hr /> <div class="rights"> @@ -504,7 +505,7 @@ template outputXHTMLs() { ); return o; } - @safe string inline_images(O,M)( + string inline_images(O,M)( string _txt, const O obj, M doc_matters, @@ -530,7 +531,7 @@ template outputXHTMLs() { } return _txt; } - @safe string inline_links(O,M)( + string inline_links(O,M)( string _txt, const O obj, M doc_matters, @@ -621,7 +622,7 @@ template outputXHTMLs() { } return _txt; } - @safe string inline_notes_scroll(O,M)( + string inline_notes_scroll(O,M)( string _txt, const O obj, M doc_matters, @@ -652,7 +653,7 @@ template outputXHTMLs() { } return _txt; } - @safe Tuple!(string, string[]) inline_notes_seg(O,M)( + Tuple!(string, string[]) inline_notes_seg(O,M)( string _txt, const O obj, M doc_matters, @@ -716,7 +717,7 @@ template outputXHTMLs() { ); return t; } - @safe string inline_markup_scroll(O,M)( + string inline_markup_scroll(O,M)( string _txt, const O obj, M doc_matters, @@ -732,7 +733,7 @@ template outputXHTMLs() { } return _txt; } - @safe Tuple!(string, string[]) inline_markup_seg(O,M)( + Tuple!(string, string[]) inline_markup_seg(O,M)( string _txt, const O obj, M doc_matters, @@ -752,7 +753,7 @@ template outputXHTMLs() { Tuple!(string, string[]) t = inline_notes_seg(_txt, obj, doc_matters); return t; } - @safe string lev4_heading_subtoc(O,M)( + string lev4_heading_subtoc(O,M)( const O obj, M doc_matters, ) { @@ -779,7 +780,7 @@ template outputXHTMLs() { lev4_subtoc ~= " </div>\n"; return lev4_subtoc.to!string; } - @safe auto nav_pre_next_svg(O,M)( + auto nav_pre_next_svg(O,M)( const O obj, M doc_matters, ) { @@ -849,7 +850,7 @@ template outputXHTMLs() { } return bar(); } - @safe string heading(O,M)( + string heading(O,M)( string _txt, const O obj, M doc_matters, @@ -937,7 +938,7 @@ template outputXHTMLs() { } return o; } - @safe string heading_scroll(O,M)( + string heading_scroll(O,M)( string _txt, const O obj, M doc_matters, @@ -947,7 +948,7 @@ template outputXHTMLs() { string o = heading(_txt, obj, doc_matters); return o; } - @safe Tuple!(string, string[]) heading_seg(O,M)( + Tuple!(string, string[]) heading_seg(O,M)( string _txt, const O obj, M doc_matters, @@ -964,7 +965,7 @@ template outputXHTMLs() { ); return u; } - @safe string para(O,M)( + string para(O,M)( string _txt, const O obj, M doc_matters, @@ -1014,7 +1015,7 @@ template outputXHTMLs() { } return o; } - @safe string para_scroll(O,M)( + string para_scroll(O,M)( string _txt, const O obj, M doc_matters, @@ -1027,7 +1028,7 @@ template outputXHTMLs() { string o = para(_txt, obj, doc_matters); return o; } - @safe Tuple!(string, string[]) para_seg(O,M)( + Tuple!(string, string[]) para_seg(O,M)( string _txt, const O obj, M doc_matters, @@ -1044,7 +1045,7 @@ template outputXHTMLs() { ); return u; } - @safe string quote(O,M)( + string quote(O,M)( string _txt, const O obj, M doc_matters, @@ -1080,7 +1081,7 @@ template outputXHTMLs() { } return o; } - @safe string quote_scroll(O,M)( + string quote_scroll(O,M)( string _txt, const O obj, M doc_matters, @@ -1090,7 +1091,7 @@ template outputXHTMLs() { string o = quote(_txt, obj, doc_matters); return o; } - @safe Tuple!(string, string[]) quote_seg(O,M)( + Tuple!(string, string[]) quote_seg(O,M)( string _txt, const O obj, M doc_matters, @@ -1107,7 +1108,7 @@ template outputXHTMLs() { ); return u; } - @safe string group(O,M)( + string group(O,M)( string _txt, const O obj, M doc_matters, @@ -1145,7 +1146,7 @@ template outputXHTMLs() { } return o; } - @safe string group_scroll(O,M)( + string group_scroll(O,M)( string _txt, const O obj, M doc_matters, @@ -1156,7 +1157,7 @@ template outputXHTMLs() { string o = group(_txt, obj, doc_matters); return o; } - @safe Tuple!(string, string[]) group_seg(O,M)( + Tuple!(string, string[]) group_seg(O,M)( string _txt, const O obj, M doc_matters, @@ -1173,7 +1174,7 @@ template outputXHTMLs() { ); return u; } - @safe string block(O,M)( + string block(O,M)( string _txt, const O obj, M doc_matters, @@ -1207,7 +1208,7 @@ template outputXHTMLs() { } return o; } - @safe string block_scroll(O,M)( + string block_scroll(O,M)( string _txt, const O obj, M doc_matters, @@ -1218,7 +1219,7 @@ template outputXHTMLs() { string o = block(_txt, obj, doc_matters); return o; } - @safe Tuple!(string, string[]) block_seg(O,M)( + Tuple!(string, string[]) block_seg(O,M)( string _txt, const O obj, M doc_matters, @@ -1235,7 +1236,7 @@ template outputXHTMLs() { ); return u; } - @safe string verse(O,M)( + string verse(O,M)( string _txt, const O obj, M doc_matters, @@ -1267,7 +1268,7 @@ template outputXHTMLs() { } return o; } - @safe string verse_scroll(O,M)( + string verse_scroll(O,M)( string _txt, const O obj, M doc_matters, @@ -1278,7 +1279,7 @@ template outputXHTMLs() { string o = verse(_txt, obj, doc_matters); return o; } - @safe Tuple!(string, string[]) verse_seg(O,M)( + Tuple!(string, string[]) verse_seg(O,M)( string _txt, const O obj, M doc_matters, @@ -1295,7 +1296,7 @@ template outputXHTMLs() { ); return u; } - @safe Tuple!(string, string) tablarize(O)( + Tuple!(string, string) tablarize(O)( string _txt, const O obj, ) { @@ -1328,7 +1329,7 @@ template outputXHTMLs() { ); return t; } - @safe string table(O,M)( + string table(O,M)( string _txt, const O obj, M doc_matters, @@ -1362,7 +1363,7 @@ template outputXHTMLs() { ); return o; } - @safe string code(O,M)( + string code(O,M)( string _txt, const O obj, M doc_matters, diff --git a/src/doc_reform/io_out/xmls_css.d b/src/doc_reform/io_out/xmls_css.d index 831a26d..712d79a 100644 --- a/src/doc_reform/io_out/xmls_css.d +++ b/src/doc_reform/io_out/xmls_css.d @@ -51,9 +51,10 @@ default css settings +/ module doc_reform.io_out.xmls_css; +@safe: template spineCss() { import std.format; - @safe auto spineCss(M)(M doc_matters) { + auto spineCss(M)(M doc_matters) { string _css_indent = format(q"┃ /* indent */ p.norm { } @@ -4427,7 +4428,7 @@ p.form { _css_indent, _color_ocn_dark, ); - @safe auto css_() { + auto css_() { struct _CSS { string html_seg = "/* spine css html seg stylesheet */\n"; string html_scroll = "/* spine css html scroll stylesheet */\n"; |