From 9a91485c10e059dee1374e152e4b068cd9d3866c Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 5 Dec 2019 11:41:09 -0500 Subject: 0.9.2 @safe & @trusted first pass --- src/doc_reform/io_in/read_source_files.d | 16 ++-- src/doc_reform/io_out/epub3.d | 14 ++-- src/doc_reform/io_out/html.d | 12 +-- src/doc_reform/io_out/latex.d | 36 ++++---- src/doc_reform/io_out/odt.d | 74 ++++++++--------- src/doc_reform/io_out/xmls.d | 80 +++++++++--------- src/doc_reform/io_out/xmls_css.d | 4 +- src/doc_reform/meta/conf_make_meta_json.d | 2 +- src/doc_reform/meta/conf_make_meta_structs.d | 2 +- src/doc_reform/meta/metadoc.d | 2 +- src/doc_reform/meta/metadoc_from_src.d | 118 +++++++++++++-------------- src/doc_reform/meta/metadoc_harvest.d | 2 +- src/doc_reform/spine.d | 104 +++++++++++------------ 13 files changed, 235 insertions(+), 231 deletions(-) (limited to 'src') diff --git a/src/doc_reform/io_in/read_source_files.d b/src/doc_reform/io_in/read_source_files.d index e443b01..aeb2382 100644 --- a/src/doc_reform/io_in/read_source_files.d +++ b/src/doc_reform/io_in/read_source_files.d @@ -15,7 +15,7 @@ static template spineRawMarkupContent() { mixin spineRgxInit; static auto rgx = Rgx(); string[] _images=[]; - auto _extract_images(S)(S content_block) { + auto _extract_images(S)(S content_block) @safe { string[] images_; string _content_block = content_block.to!string; if (auto m = _content_block.matchAll(rgx.image)) { @@ -24,7 +24,7 @@ static template spineRawMarkupContent() { return images_; } auto rawsrc = RawMarkupContent(); - auto spineRawMarkupContent(O,Fn)(O _opt_action, Fn fn_src) { + auto spineRawMarkupContent(O,Fn)(O _opt_action, Fn fn_src) @safe { 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; @@ -36,7 +36,11 @@ static template spineRawMarkupContent() { = raw.markupSourceReadIn(fn_src); return source_txt_str; } - final auto sourceContentSplitIntoHeaderAndBody(O)(O _opt_action, in string source_txt_str, in string fn_src="") { + final auto sourceContentSplitIntoHeaderAndBody(O)( + O _opt_action, + in string source_txt_str, + in string fn_src="" + ) { auto raw = MarkupRawUnit(); string[] insert_file_list; string[] images_list; @@ -99,7 +103,7 @@ static template spineRawMarkupContent() { std.utf.validate(source_txt_str); return source_txt_str; } - final private char[][] header0Content1(in string src_text) { + final private char[][] header0Content1(in string src_text) @trusted { // cast(char[]) /+ split string on _first_ match of "^:?A~\s" into [header, content] array/tuple +/ char[][] header_and_content; auto m = (cast(char[]) src_text).matchFirst(rgx.heading_a); @@ -112,7 +116,7 @@ static template spineRawMarkupContent() { ); return header_and_content; } - final private char[][] markupSourceLineArray(in char[] src_text) { + final private char[][] markupSourceLineArray(in char[] src_text) @trusted { // cast(char[]) char[][] source_line_arr = (cast(char[]) src_text).split(rgx.newline_eol_strip_preceding); return source_line_arr; @@ -127,7 +131,7 @@ static template spineRawMarkupContent() { auto source_txt_str = readInMarkupSource(fn_src); return source_txt_str; } - auto markupSourceHeaderContentRawLineTupleArray(in string source_txt_str) { + auto markupSourceHeaderContentRawLineTupleArray(in string source_txt_str) @safe { string[] file_insert_list = []; string[] images_list = []; char[][] hc = header0Content1(source_txt_str); diff --git a/src/doc_reform/io_out/epub3.d b/src/doc_reform/io_out/epub3.d index 14038a8..35a31cd 100644 --- a/src/doc_reform/io_out/epub3.d +++ b/src/doc_reform/io_out/epub3.d @@ -14,12 +14,12 @@ template outputEPub3() { doc_reform.io_out.xmls_css; mixin InternalMarkup; mixin outputXHTMLs; - string epub3_mimetypes() { + string epub3_mimetypes() @safe { string o; o = format(q"┃application/epub+zip┃") ~ "\n"; return o; } - string epub3_container_xml() { + string epub3_container_xml() @safe { string o; o = format(q"┃┃") ~ "\n"; o ~= format(q"┃┃") ~ "\n\n"; return o; } - 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) @safe { 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! @@ -128,7 +128,7 @@ template outputEPub3() { } return content; } - 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) @safe { enum DomTags { none, open, close, close_and_open, open_still, } auto markup = InlineMarkup(); auto rgx = Rgx(); @@ -207,7 +207,7 @@ template outputEPub3() { \n"; return toc; } - string epub2_oebps_toc_ncx(D,I)(D doc_abstraction, I doc_matters) { + string epub2_oebps_toc_ncx(D,I)(D doc_abstraction, I doc_matters) @safe { int counter = 0; string _uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO shared elsewhere auto markup = InlineMarkup(); @@ -300,7 +300,7 @@ template outputEPub3() { void outputEPub3(D,I)( const D doc_abstraction, I doc_matters, - ) { + ) { // @trusted mixin spineOutputRgxInit; auto xhtml_format = outputXHTMLs(); auto rgx = Rgx(); @@ -609,7 +609,7 @@ template outputEPub3() { void epub3_write_output_files(W,M)( W epub_write, M doc_matters, - ) { + ) { // @trusted debug(asserts) { static assert(is(typeof(epub_write.doc_epub3) == string[][string])); static assert(is(typeof(epub_write.mimetypes) == string)); diff --git a/src/doc_reform/io_out/html.d b/src/doc_reform/io_out/html.d index 36e0219..458533c 100644 --- a/src/doc_reform/io_out/html.d +++ b/src/doc_reform/io_out/html.d @@ -16,7 +16,7 @@ template outputHTML() { void scroll(D,M)( const D doc_abstraction, M doc_matters, - ) { + ) @safe { mixin spineOutputRgxInit; auto xhtml_format = outputXHTMLs(); auto rgx = Rgx(); @@ -186,7 +186,7 @@ template outputHTML() { void scroll_write_output(D,M)( D doc, M doc_matters, - ) { + ) @trusted { debug(asserts) { static assert(is(typeof(doc) == string[])); } @@ -209,7 +209,7 @@ template outputHTML() { void seg(D,M)( const D doc_abstraction, M doc_matters, - ) { + ) @safe { mixin spineOutputRgxInit; auto rgx = Rgx(); auto xhtml_format = outputXHTMLs(); @@ -463,7 +463,7 @@ template outputHTML() { D doc_html, E doc_html_endnotes, M doc_matters, - ) { + ) @trusted { // @system? debug(asserts) { static assert(is(typeof(doc_html) == string[][string])); } @@ -493,7 +493,7 @@ template outputHTML() { writeln(" ", pth_html.fn_seg(doc_matters.src.filename, "toc")); } } - void css(M)(M doc_matters) { + void css(M)(M doc_matters) @safe { auto css = spineCss(doc_matters); auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language); try { @@ -510,7 +510,7 @@ template outputHTML() { } void images_cp(M)( M doc_matters, - ) { + ) @trusted { // @system { /+ (copy html images) +/ auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language); diff --git a/src/doc_reform/io_out/latex.d b/src/doc_reform/io_out/latex.d index 6e651dd..a97a697 100644 --- a/src/doc_reform/io_out/latex.d +++ b/src/doc_reform/io_out/latex.d @@ -14,7 +14,7 @@ template outputLaTeX() { auto lang = Lang(); auto paper() { struct PaperType { - auto a4() { + auto a4() @safe { struct A4 { auto portrait() { struct V { @@ -35,7 +35,7 @@ template outputLaTeX() { } return A4(); } - auto a5() { + auto a5() @safe { struct A5 { auto portrait() { struct V { @@ -56,7 +56,7 @@ template outputLaTeX() { } return A5(); } - auto b4() { + auto b4() @safe { struct B4 { auto portrait() { struct V { @@ -77,7 +77,7 @@ template outputLaTeX() { } return B4(); } - auto letter() { + auto letter() @safe { struct Letter { auto portrait() { struct V { @@ -98,7 +98,7 @@ template outputLaTeX() { } return Letter(); } - auto legal() { + auto legal() @safe { struct Legal { auto portrait() { struct V { @@ -125,7 +125,7 @@ template outputLaTeX() { string sp_char_esc(O)( string _txt, const O obj, - ) { + ) @safe { string _unescape_sp_char_esc()(string _txt) { _txt = _txt .replaceAll(rgx.latex_special_char_escaped, @@ -149,7 +149,7 @@ template outputLaTeX() { } string sp_char_esc_txt()( string _txt, - ) { + ) @safe { string _unescape_sp_char_esc()(string _txt) { _txt = _txt .replaceAll(rgx.latex_special_char_escaped, @@ -171,7 +171,7 @@ template outputLaTeX() { } string fontface()( string _txt, - ) { + ) @safe { _txt = _txt .replaceAll(rgx.inline_emphasis, format(q"┃\begin{bfseries}%s\end{bfseries}┃", "$1")) .replaceAll(rgx.inline_bold, format(q"┃\begin{bfseries}%s\end{bfseries}┃", "$1")) @@ -187,7 +187,7 @@ template outputLaTeX() { } string leading_hardspaces()( string _txt, - ) { + ) @safe { string hardspaces(string _spaces) { _spaces = _spaces .replaceAll(rgx.space, "\\hardspace "); @@ -196,13 +196,13 @@ template outputLaTeX() { _txt = replaceAll!(m => hardspaces(m[0]))(_txt, rgx.spaces_line_start); return _txt; } - string nbsp_char()(string _txt) { + string nbsp_char()(string _txt) @safe { if (_txt.match(rgx.nbsp_char)) { _txt = _txt.replaceAll(rgx.nbsp_char, "\\hardspace "); } return _txt; } - string nbsp_char_to_space()(string _txt) { + string nbsp_char_to_space()(string _txt) @safe { if (_txt.match(rgx.nbsp_char)) { _txt = _txt.replaceAll(rgx.nbsp_char, " "); } @@ -212,7 +212,7 @@ template outputLaTeX() { string _txt, const O obj, M doc_matters, - ) { + ) @safe { if (obj.has.inline_links) { // TODO some images do not have inline links ... image without link string _width_adjust(string _width) { if (_width.to!int > 300) { _width = "300"; } // will need to vary max with papersize & orientation @@ -255,7 +255,7 @@ template outputLaTeX() { } string footnotes()( string _txt, - ) { + ) @safe { if (_txt.match(rgx.inline_notes_al_gen)) { string _tex_note = q"┃\hypertarget{noteref_%s}{}\footnote[%s]{%% \label{note_%s}%s}┃"; @@ -270,7 +270,7 @@ template outputLaTeX() { } string remove_footnotes()( string _txt, - ) { + ) @safe { if (_txt.match(rgx.inline_notes_al_gen)) { _txt = replaceAll!(m => "")(_txt, rgx.inline_notes_al_gen); } @@ -279,7 +279,7 @@ template outputLaTeX() { string para(O)( string _txt, O obj, - ) { + ) @safe { if (obj.metainfo.is_of_type == "para") { string _tex_para; _tex_para = q"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}%s┃"; @@ -294,7 +294,7 @@ template outputLaTeX() { string bookindex(O)( string _txt, O obj, - ) { + ) @safe { if (obj.metainfo.is_of_type == "para" && obj.metainfo.is_a == "bookindex" ) { @@ -311,7 +311,7 @@ template outputLaTeX() { O obj, M doc_matters, string _part = "" - ) { + ) @safe { if (obj.metainfo.is_a == "heading") { string _tex_para; string _pg_break; @@ -642,7 +642,7 @@ string table(O,M)( string bullets_and_indentation(O)( string _txt, O obj, - ) { + ) @safe { string _tex_para; string _hang; string _indent; int _paper_margin = -10; diff --git a/src/doc_reform/io_out/odt.d b/src/doc_reform/io_out/odt.d index dbb8e5d..6e792a5 100644 --- a/src/doc_reform/io_out/odt.d +++ b/src/doc_reform/io_out/odt.d @@ -15,7 +15,7 @@ template formatODT() { mixin spineOutputRgxInit; struct formatODT { static auto rgx = Rgx(); - string _tags(O)(const O obj){ + string _tags(O)(const O obj) @safe { string _tags = ""; if (obj.tags.anchor_tags.length > 0) { foreach (tag_; obj.tags.anchor_tags) { @@ -33,7 +33,7 @@ template formatODT() { } return _tags; } - string _xhtml_anchor_tags(O)(O obj) { + string _xhtml_anchor_tags(O)(O obj) @safe { const(string[]) anchor_tags = obj.tags.anchor_tags; string tags=""; if (anchor_tags.length > 0) { @@ -45,7 +45,7 @@ template formatODT() { } return tags; } - string obj_num(O)(const O obj){ // TODO + string obj_num(O)(const O obj) @safe { // TODO string _on; _on = (obj.metainfo.object_number.empty) ? "" @@ -55,7 +55,7 @@ template formatODT() { )); return _on; } - string _footnotes()(string _txt){ + string _footnotes()(string _txt) @safe { static auto rgx = Rgx(); _txt = _txt.replaceAll( rgx.inline_notes_al_regular_number_note, @@ -74,14 +74,14 @@ template formatODT() { ); return _txt; } - string _bullet(O)(const O obj){ + string _bullet(O)(const O obj) @safe { string _b = ""; if (obj.attrib.bullet) { _b = format(q"┃● ┃",); } return _b; } - string _indent(O)(string _txt, const O obj) { // TODO + string _indent(O)(string _txt, const O obj) @safe { // TODO // if (obj.attrib.indent_base > 0 || // obj.attrib.indent_hang > 0 // ) { @@ -189,7 +189,7 @@ template formatODT() { } return _txt; } - string _block_type_delimiters(O)(string[] _block_lines, const O obj) { // TODO + string _block_type_delimiters(O)(string[] _block_lines, const O obj) @safe { // TODO string _block = ""; foreach (i, _line; _block_lines) { _line = _footnotes(_line); @@ -222,7 +222,7 @@ template formatODT() { obj_num(obj)); return _block; } - string _special_characters(O)(string _txt, const O obj) { + string _special_characters(O)(string _txt, const O obj) @safe { _txt = _txt .replaceAll(rgx.xhtml_ampersand, "&") .replaceAll(rgx.xhtml_quotation, """) @@ -231,7 +231,7 @@ template formatODT() { .replaceAll(rgx.nbsp_char, " "); return _txt; } - string _preserve_white_spaces(O)(string _txt, const O obj) { + string _preserve_white_spaces(O)(string _txt, const O obj) @safe { if (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block") { _txt = _txt .replaceAll(rgx.space, " "); @@ -252,9 +252,9 @@ template formatODT() { .replaceAll(rgx.inline_mono, format(q"┃%s┃","$1")); return _txt; } - auto _obj_num(O)(O obj) { // NOT USED YET + auto _obj_num(O)(O obj) @safe { // NOT USED YET struct objNum { - string reference() { + string reference() @safe { return format(q"┃ @@ -263,7 +263,7 @@ template formatODT() { obj.object_number, ); } - string display() { + string display() @safe { return format(q"┃ %s%s%s ┃", @@ -275,20 +275,20 @@ template formatODT() { } return objNum(); } - string _break_page()() { + string _break_page()() @safe { return format(q"┃ ┃", ); } - string _empty_line_break(O)(string _txt, const O obj) { + string _empty_line_break(O)(string _txt, const O obj) @safe { if (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block") { _txt = _txt .replaceAll(rgx.br_empty_line, "
"); } return _txt; } - string _links(O)(string _txt, const O obj) { + string _links(O)(string _txt, const O obj) @safe { if (obj.metainfo.is_a != "code") { if (obj.metainfo.is_a == "toc") { _txt = replaceAll!(m => @@ -328,7 +328,7 @@ template formatODT() { } return _txt; } - string _images(O)(string _txt, const O obj) { + string _images(O)(string _txt, const O obj) @safe { if (_txt.match(rgx.inline_image)) { _txt = _txt .replaceAll(rgx.inline_image, @@ -339,7 +339,7 @@ template formatODT() { } return _txt; } - string markup(O)(const O obj) { + string markup(O)(const O obj) @safe { /+ markup TODO +/ string _txt = obj.text; _txt = _special_characters(_txt, obj); // TODO & why both obj & obj.text, consider also in output_xmls.org @@ -356,7 +356,7 @@ template formatODT() { string heading(O,M)( const O obj, const M doc_matters, - ) { + ) @safe { assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter"); assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb"); assert(obj.metainfo.is_of_type == "para"); @@ -400,7 +400,7 @@ template formatODT() { string para(O,M)( const O obj, const M doc_matters, - ) { + ) @safe { assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter"); assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb"); assert(obj.metainfo.is_of_type == "para"); @@ -419,7 +419,7 @@ template formatODT() { string quote(O,M)( const O obj, const M doc_matters, - ) { + ) @safe { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); assert(obj.metainfo.is_of_type == "block"); @@ -431,7 +431,7 @@ template formatODT() { string group(O,M)( const O obj, const M doc_matters, - ) { + ) @safe { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); assert(obj.metainfo.is_of_type == "block"); @@ -449,7 +449,7 @@ template formatODT() { string block(O,M)( const O obj, const M doc_matters, - ) { + ) @safe { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); assert(obj.metainfo.is_of_type == "block"); @@ -462,7 +462,7 @@ template formatODT() { string verse(O,M)( const O obj, const M doc_matters, - ) { + ) @safe { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); assert(obj.metainfo.is_of_type == "block"); @@ -475,7 +475,7 @@ template formatODT() { string code(O,M)( const O obj, const M doc_matters, - ) { + ) @safe { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body"); assert(obj.metainfo.is_of_type == "block"); @@ -522,7 +522,7 @@ template formatODT() { auto tablarize(O)( const O obj, string _txt, - ) { + ) @safe { string[] _table_rows = (_txt).split(rgx.table_delimiter_row); string[] _table_cols; string _table; @@ -557,7 +557,7 @@ template formatODT() { string table(O,M)( const O obj, const M doc_matters, - ) { + ) @safe { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body"); assert(obj.metainfo.is_of_type == "block"); @@ -606,7 +606,7 @@ template outputODT() { mixin spineOutputRgxInit; auto rgx = Rgx(); // mixin outputXmlODT; - string odt_head(I)(I doc_matters) { + string odt_head(I)(I doc_matters) @safe { string _has_tables = format(q"┃ @@ -717,7 +717,7 @@ template outputODT() { string odt_body(D,I)( const D doc_abstraction, I doc_matters, - ) { + ) @safe { mixin formatODT; auto odt_format = formatODT(); string delimit = ""; @@ -840,7 +840,7 @@ template outputODT() { return doc_odt; } - string odt_tail() { + string odt_tail() @safe { string _odt_tail = format(q"┃spine: <www.doc_reform.org> and <www.sisudoc.org> ┃",); return _odt_tail; @@ -848,7 +848,7 @@ template outputODT() { string content_xml(D,I)( const D doc_abstraction, I doc_matters, - ) { + ) @safe { string _content_xml; string break_line = (doc_matters.opt.action.debug_do) ? "\n" : ""; string odt_break_page = format(q"┃┃",); @@ -860,7 +860,7 @@ template outputODT() { } string manifest_xml(M)( auto ref M doc_matters, - ) { + ) @safe { string _bullet = format(q"┃┃"); string[] _images = [ _bullet ]; foreach (image; doc_matters.srcs.image_list) { @@ -884,7 +884,7 @@ template outputODT() { } void images_cp(M)( auto ref M doc_matters, - ) { + ) @safe { { /+ (copy odt images) +/ auto pth_odt = spinePathsODT!()(doc_matters); foreach (image; doc_matters.srcs.image_list) { @@ -904,7 +904,7 @@ template outputODT() { } string meta_xml(M)( auto ref M doc_matters, - ) { + ) @safe { /+ (meta_xml includes output time-stamp) +/ string _meta_xml = format(q"┃ @@ -939,11 +939,11 @@ template outputODT() { } // return 0; } - string mimetype() { + string mimetype() @safe { string mimetype_ = format(q"┃application/vnd.oasis.opendocument.text┃"); return mimetype_; } - string manifest_rdf() { + string manifest_rdf() @safe { string _manifest_rdf = format(q"┃ @@ -965,7 +965,7 @@ template outputODT() { ┃"); return _manifest_rdf; } - string settings_xml() { + string settings_xml() @safe { string _settings_xml = format(q"┃ @@ -1065,7 +1065,7 @@ template outputODT() { ┃"); return _settings_xml; } - string styles_xml() { + string styles_xml() @safe { string _styles_xml = format(q"┃ diff --git a/src/doc_reform/io_out/xmls.d b/src/doc_reform/io_out/xmls.d index a88dced..74ebf82 100644 --- a/src/doc_reform/io_out/xmls.d +++ b/src/doc_reform/io_out/xmls.d @@ -18,7 +18,7 @@ template outputXHTMLs() { string div_delimit( string part, return ref string previous_part - ){ + ) @safe { string delimit = ""; string delimit_ = ""; if (part != previous_part) { @@ -45,7 +45,7 @@ template outputXHTMLs() { // you also need to close the last div, introduce a footer? return delimit; } - string special_characters_text(string _txt){ + string special_characters_text(string _txt) @safe { _txt = _txt .replaceAll(rgx.xhtml_ampersand, "&") .replaceAll(rgx.xhtml_quotation, """) @@ -56,7 +56,7 @@ template outputXHTMLs() { } string special_characters(O)( const O obj, - ){ + ) @safe { string _txt = special_characters_text(obj.text); if (!(obj.metainfo.is_a == "code")) { _txt = (_txt) @@ -64,7 +64,7 @@ template outputXHTMLs() { } return _txt; } - string font_face(string _txt){ + string font_face(string _txt) @safe { _txt = _txt .replaceAll(rgx.inline_emphasis, ("$1")) .replaceAll(rgx.inline_bold, ("$1")) @@ -78,7 +78,7 @@ template outputXHTMLs() { .replaceAll(rgx.inline_cite, ("$1")); return _txt; } - string _xhtml_anchor_tags(O)(O obj) { + string _xhtml_anchor_tags(O)(O obj) @safe { const(string[]) anchor_tags = obj.tags.anchor_tags; string tags=""; if (anchor_tags.length > 0) { @@ -92,7 +92,7 @@ template outputXHTMLs() { } string header_metadata(M)( M doc_matters, - ) { + ) @safe { string _publisher="Publisher"; // TODO string o; o = format(q"┃ @@ -129,7 +129,7 @@ template outputXHTMLs() { } string site_info_button(M)( M doc_matters, - ) { + ) @safe { string _locations; if (doc_matters.conf_make_meta.make.home_button_text.length > 0) { _locations = (doc_matters.conf_make_meta.make.home_button_text) @@ -153,7 +153,7 @@ template outputXHTMLs() { } string inline_search_form(M)( M doc_matters, - ) { + ) @safe { string _action="http://www.sisudoc.org/cgi-bin/search.cgi"; string _db="spine.7a.manual"; string o; @@ -189,7 +189,7 @@ template outputXHTMLs() { string html_head(M)( M doc_matters, string type, - ) { + ) @safe { string _manifest = ""; if (doc_matters.opt.action.workon) { _manifest = format(q"┃ @@ -243,7 +243,7 @@ template outputXHTMLs() { } string epub3_seg_head(M)( M doc_matters, - ) { + ) @safe { string html_base = format(q"┃ ┃", ); @@ -309,7 +309,7 @@ template outputXHTMLs() { ); return o; } - string tail() { + string tail() @safe { string o; o = format(q"┃ @@ -324,7 +324,7 @@ template outputXHTMLs() { M doc_matters, string _suffix = ".html", string _xml_type = "seg", - ) { + ) @safe { string _img_pth; if (_xml_type == "epub") { _img_pth = "image/"; @@ -351,7 +351,7 @@ template outputXHTMLs() { M doc_matters, string _suffix = ".html", string _xml_type = "seg", - ) { + ) @safe { string seg_lvs; if (obj.has.inline_links) { if (obj.metainfo.is_a != "code") { @@ -440,7 +440,7 @@ template outputXHTMLs() { string _txt, const O obj, M doc_matters, - ) { + ) @safe { if (obj.has.inline_notes_reg) { _txt = font_face(_txt); _txt = _txt.replaceAll( @@ -471,7 +471,7 @@ template outputXHTMLs() { string _txt, const O obj, M doc_matters, - ) { + ) @safe { string[] _endnotes; if (obj.has.inline_notes_star) { _txt = font_face(_txt); @@ -536,7 +536,7 @@ template outputXHTMLs() { const O obj, M doc_matters, string _suffix = ".html", - ) { + ) @safe { if (obj.metainfo.dummy_heading && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading")) { _txt = ""; @@ -553,7 +553,7 @@ template outputXHTMLs() { M doc_matters, string _suffix = ".html", string _xml_type = "seg", - ) { + ) @safe { if (obj.metainfo.dummy_heading && ((_xml_type == "epub" && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading")) @@ -570,7 +570,7 @@ template outputXHTMLs() { string lev4_heading_subtoc(O,M)( const O obj, M doc_matters, - ) { + ) @safe { char[] lev4_subtoc; lev4_subtoc ~= "
\n"; foreach (subtoc; obj.tags.lev4_subtoc) { @@ -597,7 +597,7 @@ template outputXHTMLs() { auto nav_pre_next_svg(O,M)( const O obj, M doc_matters, - ) { + ) @safe { string prev, next, toc; string harvest_link = (doc_matters.opt.action.harvest_link) ? format(q"┃

[ T | A ]

┃") @@ -684,7 +684,7 @@ template outputXHTMLs() { const O obj, M doc_matters, string _xml_type = "html", - ) { + ) @safe { assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter"); assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb"); assert(obj.metainfo.is_of_type == "para"); @@ -749,7 +749,7 @@ template outputXHTMLs() { const O obj, M doc_matters, string _suffix = ".html", - ) { + ) @safe { _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); string o = heading(_txt, obj, doc_matters); return o; @@ -760,7 +760,7 @@ template outputXHTMLs() { M doc_matters, string _suffix = ".html", string _xml_type = "html", - ) { + ) @safe { auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0]; string[] _endnotes = t[1]; @@ -775,7 +775,7 @@ template outputXHTMLs() { string _txt, const O obj, M doc_matters, - ) { + ) @safe { assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter"); assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb"); assert(obj.metainfo.is_of_type == "para"); @@ -822,7 +822,7 @@ template outputXHTMLs() { const O obj, M doc_matters, string _suffix = ".html", - ) { + ) @safe { if (obj.metainfo.is_a == "toc" && _txt.match(rgx.inline_link_toc_to_backmatter)) { _txt = _txt.replaceAll(rgx.inline_link_toc_to_backmatter, "┤#section_$1├"); } @@ -836,7 +836,7 @@ template outputXHTMLs() { M doc_matters, string _suffix = ".html", string _xml_type = "html", - ) { + ) @safe { auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; @@ -851,7 +851,7 @@ template outputXHTMLs() { string _txt, const O obj, M doc_matters, - ) { + ) @safe { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); assert(obj.metainfo.is_of_type == "block"); @@ -888,7 +888,7 @@ template outputXHTMLs() { const O obj, M doc_matters, string _suffix = ".html", - ) { + ) @safe { _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); string o = quote(_txt, obj, doc_matters); return o; @@ -899,7 +899,7 @@ template outputXHTMLs() { M doc_matters, string _suffix = ".html", string _xml_type = "html", - ) { + ) @safe { auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; @@ -914,7 +914,7 @@ template outputXHTMLs() { string _txt, const O obj, M doc_matters, - ) { + ) @safe { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); assert(obj.metainfo.is_of_type == "block"); @@ -952,7 +952,7 @@ template outputXHTMLs() { M doc_matters, string _suffix = ".html", string _xml_type = "html", - ) { + ) @safe { _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); string o = group(_txt, obj, doc_matters); return o; @@ -963,7 +963,7 @@ template outputXHTMLs() { M doc_matters, string _suffix = ".html", string _xml_type = "html", - ) { + ) @safe { auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; @@ -978,7 +978,7 @@ template outputXHTMLs() { string _txt, const O obj, M doc_matters, - ) { + ) @safe { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); assert(obj.metainfo.is_of_type == "block"); @@ -1012,7 +1012,7 @@ template outputXHTMLs() { M doc_matters, string _suffix = ".html", string _xml_type = "html", - ) { + ) @safe { _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); string o = block(_txt, obj, doc_matters); return o; @@ -1023,7 +1023,7 @@ template outputXHTMLs() { M doc_matters, string _suffix = ".html", string _xml_type = "html", - ) { + ) @safe { auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; @@ -1038,7 +1038,7 @@ template outputXHTMLs() { string _txt, const O obj, M doc_matters, - ) { + ) @safe { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); assert(obj.metainfo.is_of_type == "block"); @@ -1072,7 +1072,7 @@ template outputXHTMLs() { M doc_matters, string _suffix = ".html", string _xml_type = "html", - ) { + ) @safe { _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); string o = verse(_txt, obj, doc_matters); return o; @@ -1083,7 +1083,7 @@ template outputXHTMLs() { M doc_matters, string _suffix = ".html", string _xml_type = "html", - ) { + ) @safe { auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; @@ -1097,7 +1097,7 @@ template outputXHTMLs() { auto tablarize(O)( string _txt, const O obj, - ) { + ) @safe { string[] _table_rows = (_txt).split(rgx.table_delimiter_row); string[] _table_cols; string _table; @@ -1131,7 +1131,7 @@ template outputXHTMLs() { string _txt, const O obj, M doc_matters, - ) { + ) @safe { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body"); assert(obj.metainfo.is_of_type == "block"); @@ -1165,7 +1165,7 @@ template outputXHTMLs() { string _txt, const O obj, M doc_matters, - ) { + ) @safe { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body"); assert(obj.metainfo.is_of_type == "block"); diff --git a/src/doc_reform/io_out/xmls_css.d b/src/doc_reform/io_out/xmls_css.d index 2c3eb77..0974637 100644 --- a/src/doc_reform/io_out/xmls_css.d +++ b/src/doc_reform/io_out/xmls_css.d @@ -4,7 +4,7 @@ module doc_reform.io_out.xmls_css; template spineCss() { import std.format; - auto spineCss(M)(M doc_matters) { + auto spineCss(M)(M doc_matters) @safe { string _css_indent = format(q"┃ /* indent */ p.norm { } @@ -4162,7 +4162,7 @@ template spineCss() { _css_indent, _color_ocn_dark, ); - auto css_() { + auto css_() @safe { struct _CSS { string html_seg = "/* spine css html seg stylesheet */\n"; string html_scroll = "/* spine css html scroll stylesheet */\n"; diff --git a/src/doc_reform/meta/conf_make_meta_json.d b/src/doc_reform/meta/conf_make_meta_json.d index b80ea4f..95f9c2a 100644 --- a/src/doc_reform/meta/conf_make_meta_json.d +++ b/src/doc_reform/meta/conf_make_meta_json.d @@ -21,7 +21,7 @@ static template contentJSONtoSpineStruct() { doc_reform.meta.defaults, doc_reform.meta.rgx; ConfComposite _struct_composite; - 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) @safe { mixin spineRgxInit; static auto rgx = Rgx(); 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 7875777..10a754a 100644 --- a/src/doc_reform/meta/conf_make_meta_structs.d +++ b/src/doc_reform/meta/conf_make_meta_structs.d @@ -17,7 +17,7 @@ mixin spineRgxInit; static auto rgx = Rgx(); mixin InternalMarkup; auto mkup = InlineMarkup(); -string url_markup(string line) { +string url_markup(string line) @safe { string line_ = line .replaceAll( rgx.smid_inline_link_markup_regular, diff --git a/src/doc_reform/meta/metadoc.d b/src/doc_reform/meta/metadoc.d index 1620281..b81dfb2 100644 --- a/src/doc_reform/meta/metadoc.d +++ b/src/doc_reform/meta/metadoc.d @@ -125,7 +125,7 @@ template spineAbstraction() { string ver() { return program_info.ver; } - string name_and_version() { + string name_and_version() @trusted { return format( "%s-%s", name, diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index ab87eb2..35d70d5 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -309,7 +309,7 @@ template docAbstraction() { return tag_assoc; } /+ ↓ abstract marked up document +/ - auto docAbstraction(CMM,Opt,Mf)( + auto docAbstraction(CMM,Opt,Mf) ( char[][] markup_sourcefile_content, CMM conf_make_meta, Opt opt_action, @@ -2381,7 +2381,7 @@ template docAbstraction() { /+ post loop markup document/text ↑ +/ } /+ ← closed: abstract doc source +/ /+ ↓ abstraction functions +/ - static string[string] object_reset()(string[string] an_object) { + static string[string] object_reset()(string[string] an_object) @safe { an_object.remove("body_nugget"); an_object.remove("substantive"); an_object.remove("is"); @@ -2403,7 +2403,7 @@ template docAbstraction() { static int[string] _check_ocn_status_()( char[] line, int[string] obj_type_status, - ) { + ) @safe { static auto rgx = Rgx(); if (!(line.empty) && (obj_type_status["ocn_status_off_for_multiple_objects"] == OCN_off_block_status.off) @@ -2462,7 +2462,7 @@ template docAbstraction() { char[] _doc_header_and_make_substitutions_(CMM)( char[] line, CMM conf_make_meta, - ) { + ) @safe { enum Substitute { match, markup, } if (conf_make_meta.make.substitute) { foreach(substitution_pair; conf_make_meta.make.substitute) { @@ -2477,7 +2477,7 @@ template docAbstraction() { char[] _doc_header_and_make_substitutions_fontface_(CMM)( char[] line, CMM conf_make_meta, - ) { + ) @safe { enum Substitute { match, markup, } if ( conf_make_meta.make.bold) { line = line.replaceAll( @@ -2504,7 +2504,7 @@ template docAbstraction() { return ref int[string] obj_type_status, return ref uint[string] dochas, return ref string[string] object_number_poem - ) { + ) @safe { static auto rgx = Rgx(); if (auto m = line.matchFirst(rgx.block_curly_code_open)) { dochas["codeblock"]++; @@ -2689,7 +2689,7 @@ template docAbstraction() { char[] line, string[string] an_object, return ref int[string] obj_type_status - ) { + ) @safe { static auto rgx = Rgx(); if (obj_type_status["curly_quote"] == TriState.on) { if (line.matchFirst(rgx.block_curly_quote_close)) { @@ -2728,7 +2728,7 @@ template docAbstraction() { char[] line, string[string] an_object, return ref int[string] obj_type_status - ) { + ) @safe { static auto rgx = Rgx(); if (obj_type_status["curly_group"] == State.on) { if (line.matchFirst(rgx.block_curly_group_close)) { @@ -2767,7 +2767,7 @@ template docAbstraction() { char[] line, string[string] an_object, return ref int[string] obj_type_status - ) { + ) @safe { static auto rgx = Rgx(); if (obj_type_status["curly_block"] == TriState.on) { if (line.matchFirst(rgx.block_curly_block_close)) { @@ -2810,7 +2810,7 @@ template docAbstraction() { string[string] object_number_poem, CMM conf_make_meta, string[string] tag_in_seg, - ) { + ) @safe { static auto rgx = Rgx(); if (obj_type_status["curly_poem"] == TriState.on) { if (line.matchFirst(rgx.block_curly_poem_close)) { @@ -3048,7 +3048,7 @@ template docAbstraction() { char[] line, return ref string[string] an_object, return ref int[string] obj_type_status - ) { + ) @safe { static auto rgx = Rgx(); if (obj_type_status["curly_code"] == TriState.on) { if (line.matchFirst(rgx.block_curly_code_close)) { @@ -3699,7 +3699,7 @@ template docAbstraction() { string[] _make_unmarked_headings, return ref Regex!(char)[string] heading_match_rgx, return ref int[string] obj_type_status - ) { + ) @safe { static auto rgx = Rgx(); if ((_make_unmarked_headings.length > 2) && (obj_type_status["make_headings"] == State.off)) { /+ headings found +/ @@ -3779,7 +3779,7 @@ template docAbstraction() { int[string] line_occur, return ref Regex!(char)[string] heading_match_rgx, return ref int[string] obj_type_status - ) { + ) @safe { if ((obj_type_status["make_headings"] == State.on) && ((line_occur["para"] == State.off) && (line_occur["heading"] == State.off)) @@ -3839,7 +3839,7 @@ template docAbstraction() { return ref int[string] collapsed_lev, return ref int[string] obj_type_status, return ref CMM conf_make_meta, - ) { + ) @safe { static auto rgx = Rgx(); if (auto m = line.match(rgx.heading)) { /+ heading match +/ ++line_occur["heading"]; @@ -3991,7 +3991,7 @@ template docAbstraction() { return ref bool bullet, return ref int[string] obj_type_status, return ref int[string] line_occur, - ) { + ) @safe { static auto rgx = Rgx(); if (line_occur["para"] == State.off) { line = font_faces_line(line); @@ -4038,7 +4038,7 @@ template docAbstraction() { } char[] font_faces_line()( char[] textline, - ) { + ) @safe { static auto rgx = Rgx(); static auto mkup = InlineMarkup(); if (textline.match(rgx.inline_faces_line)) { @@ -4053,7 +4053,7 @@ template docAbstraction() { ObjGenericComposite flow_table_instructions(H)( return ref ObjGenericComposite table_object, H table_head, - ) { + ) @safe { static auto rgx = Rgx(); table_object.metainfo.is_of_part = "body"; table_object.metainfo.is_of_section = "body"; @@ -4078,7 +4078,7 @@ template docAbstraction() { ObjGenericComposite flow_table_array_munge(T)( return ref ObjGenericComposite table_object, return ref T table_array, - ) { + ) @safe { static auto rgx = Rgx(); static auto mng = InlineMarkup(); string _table_substantive; @@ -4237,7 +4237,7 @@ template docAbstraction() { int ocn_digit, ocn_object_number, ocn_on_, ocn_off_, ocn_bkidx, ocn_bkidx_; string object_identifier; bool ocn_is_off; - auto ocn_emitter(int ocn_status_flag) { + auto ocn_emitter(int ocn_status_flag) @safe { OCNset ocn; assert(ocn_status_flag <= OCNstatus.reset); ocn_object_number = ocn_bkidx = 0; @@ -4290,13 +4290,13 @@ template docAbstraction() { static auto rgx = Rgx(); static auto mkup = InlineMarkup(); int stage_reset_note_numbers = true; - private auto initialize_note_numbers() { + private auto initialize_note_numbers() @safe { n_foot = 0; n_foot_reg = 0; n_foot_sp_asterisk = 0; n_foot_sp_plus = 0; } - static auto images()(string obj_txt_in) { + static auto images()(string obj_txt_in) @safe { 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 @@ -4326,7 +4326,7 @@ template docAbstraction() { } return obj_txt_in; } - auto footnotes_endnotes_markup_and_number_or_stars()(string obj_txt_in, bool reset_note_numbers) { + auto footnotes_endnotes_markup_and_number_or_stars()(string obj_txt_in, bool reset_note_numbers) @safe { /+ endnotes (regular) +/ bool flg_notes_reg = false; bool flg_notes_star = false; @@ -4393,7 +4393,7 @@ template docAbstraction() { private auto object_notes_and_links_()( string obj_txt_in, bool reset_note_numbers=false - ) { + ) @safe { obj_txt_out = ""; bool urls = false; bool images_without_dimensions = false; @@ -4456,7 +4456,7 @@ template docAbstraction() { auto munge_heading()( string obj_txt_in, bool reset_note_numbers=false - ) { + ) @safe { obj_txt["munge"] = obj_txt_in .replaceFirst(rgx.heading, "") .replaceFirst(rgx.object_number_off_all, "") @@ -4472,7 +4472,7 @@ template docAbstraction() { } invariant() { } - auto munge_para()(string obj_txt_in) { + auto munge_para()(string obj_txt_in) @safe { obj_txt["munge"]=(obj_txt_in) .replaceFirst(rgx.para_attribs, "") .replaceFirst(rgx.object_number_off_all, ""); @@ -4485,47 +4485,47 @@ template docAbstraction() { } return t; } - string munge_quote()(string obj_txt_in) { + string munge_quote()(string obj_txt_in) @safe { obj_txt["munge"]=obj_txt_in; return obj_txt["munge"]; } invariant() { } - auto munge_group(string obj_txt_in) { + auto munge_group(string obj_txt_in) @safe { obj_txt["munge"]=obj_txt_in; auto t = object_notes_and_links_(obj_txt["munge"]); return t; } invariant() { } - auto munge_block()(string obj_txt_in) { + auto munge_block()(string obj_txt_in) @safe { obj_txt["munge"]=obj_txt_in; auto t = object_notes_and_links_(obj_txt["munge"]); return t; } invariant() { } - auto munge_verse()(string obj_txt_in) { + auto munge_verse()(string obj_txt_in) @safe { obj_txt["munge"]=obj_txt_in; auto t = object_notes_and_links_(obj_txt["munge"]); return t; } invariant() { } - string munge_code()(string obj_txt_in) { + string munge_code()(string obj_txt_in) @safe { obj_txt_in = obj_txt_in.replaceAll(rgx.space, mkup.nbsp); obj_txt["munge"] = obj_txt_in; return obj_txt["munge"]; } invariant() { } - string munge_table()(string obj_txt_in) { + string munge_table()(string obj_txt_in) @safe { obj_txt["munge"]=obj_txt_in; return obj_txt["munge"]; } invariant() { } - string munge_comment()(string obj_txt_in) { + string munge_comment()(string obj_txt_in) @safe { obj_txt["munge"]=obj_txt_in; return obj_txt["munge"]; } @@ -4542,7 +4542,7 @@ template docAbstraction() { string obj_key_, CMM conf_make_meta, Flag!"_new_doc" _new_doc - ) { + ) @safe { obj_txt["munge"] = obj_[obj_key_].dup; obj_txt["munge"] = (obj_["is"].match(ctRegex!(`verse|code`))) ? obj_txt["munge"] @@ -4632,7 +4632,7 @@ template docAbstraction() { } auto _clean_heading_toc_()( char[] heading_toc_, - ) { + ) @safe { auto m = (cast(char[]) heading_toc_).matchFirst(rgx.heading); heading_toc_ = (m.post).replaceAll( rgx.inline_notes_curly_gen, @@ -4646,7 +4646,7 @@ template docAbstraction() { string _anchor_tag, return ref string[][string] lev4_subtoc, ObjGenericComposite[] the_table_of_contents_section, - ) { + ) @safe { ObjGenericComposite comp_obj_toc; mixin InternalMarkup; static auto mkup = InlineMarkup(); @@ -4729,7 +4729,7 @@ template docAbstraction() { string[string] obj_, CMM conf_make_meta, bool _new_doc, - ) { + ) @safe { if (_new_doc) { heading_num = [ 0, 0, 0, 0 ]; heading_number_auto_composite = ""; @@ -4872,7 +4872,7 @@ template docAbstraction() { string munge_, string lev_, bool _new_doc - ) { + ) @safe { if (!(munge_.match(rgx.heading_anchor_tag))) { if (munge_.match(rgx.heading_identify_anchor_tag)) { if (auto m = munge_.match(rgx.heading_extract_named_anchor_tag)) { @@ -4909,7 +4909,7 @@ template docAbstraction() { string obj_is_, string obj_raw, ObjGenericComposite _comp_obj_heading, - ) { + ) @safe { scope(exit) { destroy(obj_is_); destroy(obj_raw); @@ -4992,7 +4992,7 @@ template docAbstraction() { } return _obj_attributes; } - string txt_heading()(string obj_txt_in) { + string txt_heading()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"para\"," ~ " \"is\": \"heading\""; @@ -5000,7 +5000,7 @@ template docAbstraction() { } invariant() { } - string txt_para()(string obj_txt_in) { + string txt_para()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"para\"," ~ " \"is\": \"para\""; @@ -5008,7 +5008,7 @@ template docAbstraction() { } invariant() { } - string txt_quote()(string obj_txt_in) { + string txt_quote()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"quote\""; @@ -5016,7 +5016,7 @@ template docAbstraction() { } invariant() { } - string txt_group()(string obj_txt_in) { + string txt_group()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"group\""; @@ -5024,7 +5024,7 @@ template docAbstraction() { } invariant() { } - string txt_block()(string obj_txt_in) { + string txt_block()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"block\""; @@ -5032,7 +5032,7 @@ template docAbstraction() { } invariant() { } - string txt_verse()(string obj_txt_in) { + string txt_verse()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"verse\""; @@ -5040,7 +5040,7 @@ template docAbstraction() { } invariant() { } - string txt_code()(string obj_txt_in) { + string txt_code()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"code\""; @@ -5048,7 +5048,7 @@ template docAbstraction() { } invariant() { } - string txt_table()(string obj_txt_in) { + string txt_table()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"table\""; @@ -5056,7 +5056,7 @@ template docAbstraction() { } invariant() { } - string txt_comment()(string obj_txt_in) { + string txt_comment()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"comment\"," ~ " \"of\": \"comment\"," ~ " \"is\": \"comment\""; @@ -5068,7 +5068,7 @@ template docAbstraction() { string _obj_attrib, string obj_is_, ObjGenericComposite _comp_obj_heading, - ) { + ) @safe { JSONValue oa_j = parseJSON(_obj_attrib); assert( (oa_j.type == JSON_TYPE.OBJECT) @@ -5099,7 +5099,7 @@ template docAbstraction() { string bookindex_section, N obj_cite_digits, S tag_in_seg, - ) { + ) @safe { debug(asserts) { static assert(is(typeof(obj_cite_digits.object_number) == int)); } @@ -5167,7 +5167,7 @@ template docAbstraction() { int mkn, skn; void bookindex_report_indented()( string[][string][string] bookindex_unordered_hashes - ) { + ) @safe { auto mainkeys = bookindex_unordered_hashes.byKey.array.sort().release; foreach (mainkey; mainkeys) { @@ -5195,7 +5195,7 @@ template docAbstraction() { static auto munge = ObjInlineMarkupMunge(); void bookindex_write_section()( string[][string][string] bookindex_unordered_hashes - ) { + ) @safe { auto mainkeys = bookindex_unordered_hashes.byKey.array .sort!("toUpper(a) < toUpper(b)", SwapStrategy.stable).release; @@ -5390,7 +5390,7 @@ template docAbstraction() { ObjGenericComposite[] contents_am, string[string] tag_in_seg, int cntr, - ) { + ) @safe { assert((contents_am[cntr].metainfo.is_a == "para") || (contents_am[cntr].metainfo.is_a == "heading") || (contents_am[cntr].metainfo.is_a == "quote") @@ -5466,7 +5466,7 @@ template docAbstraction() { } return object_notes; } - private auto gathered_notes() { + private auto gathered_notes() @safe { string[][string] endnotes_; if (object_notes.length > 1) { endnotes_["notes"] = (object_notes["notes"].split(rgx.break_string))[0..$-1]; @@ -5480,7 +5480,7 @@ template docAbstraction() { private auto endnote_objects(N,O)( N obj_cite_digits, O opt_action, - ) { + ) @safe { mixin spineNode; ObjGenericComposite[] the_endnotes_section; auto endnotes_ = gathered_notes(); @@ -5683,7 +5683,7 @@ template docAbstraction() { int cntr_, int ptr_, string is_ - ) { + ) @safe { debug(asserts) { static assert(is(typeof(obj_cite_digits.object_number) == int)); } @@ -5745,7 +5745,7 @@ template docAbstraction() { fNr flag_notes_reg, fNs flag_notes_star, fL flag_links, - ) { + ) @safe { debug(asserts) { static assert(is(typeof(lev) == string)); static assert(is(typeof(obj_cite_digits.object_number) == int)); @@ -5930,7 +5930,7 @@ template docAbstraction() { pure void assertions_doc_structure()( string[string] an_object, int[string] lv - ) { + ) @safe { if (lv["h3"] > State.off) { assert(lv["h0"] > State.off); assert(lv["h1"] > State.off); @@ -6102,7 +6102,7 @@ template docAbstraction() { break; } } - pure void assertions_flag_types_block_status_none_or_closed()(int[string] obj_type_status) { + pure void assertions_flag_types_block_status_none_or_closed()(int[string] obj_type_status) @safe { assert( (obj_type_status["code"] == TriState.off) || (obj_type_status["code"] == TriState.closing), @@ -6127,7 +6127,7 @@ template docAbstraction() { /+ abstraction functions assertions ↑ +/ } /+ ← closed: template docAbstraction +/ template docSectKeysSeq() { - auto docSectKeysSeq(string[][string] document_section_keys_sequenced) { + auto docSectKeysSeq(string[][string] document_section_keys_sequenced) @safe { struct doc_sect_keys_seq { string[] scroll() { return document_section_keys_sequenced["scroll"]; diff --git a/src/doc_reform/meta/metadoc_harvest.d b/src/doc_reform/meta/metadoc_harvest.d index ca9801f..704e960 100644 --- a/src/doc_reform/meta/metadoc_harvest.d +++ b/src/doc_reform/meta/metadoc_harvest.d @@ -3,7 +3,7 @@ template spineMetaDocHarvest() { auto spineMetaDocHarvest(T,H)( T doc_matters, H hvst, - ) { + ) @safe { import doc_reform.meta.defaults, doc_reform.meta.rgx; diff --git a/src/doc_reform/spine.d b/src/doc_reform/spine.d index 4476b6d..b30773a 100755 --- a/src/doc_reform/spine.d +++ b/src/doc_reform/spine.d @@ -244,16 +244,16 @@ void main(string[] args) { } enum outTask { source_or_pod, sqlite, sqlite_multi, latex, odt, epub, html_scroll, html_seg, html_stuff } struct OptActions { - bool assertions() { + bool assertions() @trusted { return opts["assertions"]; } - bool concordance() { + bool concordance() @trusted { return opts["concordance"]; } auto config_path_set() { return settings["config"]; } - bool css_theme_default() { + bool css_theme_default() @trusted { bool _is_light; if (opts["light"] || opts["theme-light"]) { _is_light = true; @@ -264,94 +264,94 @@ void main(string[] args) { } return _is_light; } - bool debug_do() { + bool debug_do() @trusted { return opts["debug"]; } - bool digest() { + bool digest() @trusted { return opts["digest"]; } - bool epub() { + bool epub() @trusted { return opts["epub"]; } - bool harvest_link() { + bool harvest_link() @trusted { return (opts["harvest-link"]) ? true : false; } - bool harvest() { + bool harvest() @trusted { return (opts["harvest"] || opts["harvest-authors"] || opts["harvest-topics"]) ? true : false; } - bool harvest_authors() { + bool harvest_authors() @trusted { return (opts["harvest"] || opts["harvest-authors"]) ? true : false; } - bool harvest_topics() { + bool harvest_topics() @trusted { return (opts["harvest"] || opts["harvest-topics"]) ? true : false; } - bool html() { + bool html() @trusted { return (opts["html"] || opts["html-seg"] || opts["html-scroll"]) ? true : false; } - bool html_seg() { + bool html_seg() @trusted { return (opts["html"] || opts["html-seg"]) ? true : false; } - bool html_scroll() { + bool html_scroll() @trusted { return (opts["html"] || opts["html-scroll"]) ? true : false; } - bool html_stuff() { + bool html_stuff() @trusted { return (opts["html"] || opts["html-scroll"] || opts["html-seg"]) ? true : false; } - bool latex() { + bool latex() @trusted { return (opts["latex"] || opts["pdf"]) ? true : false; } - bool odt() { + bool odt() @trusted { return (opts["odf"] || opts["odt"]) ? true : false; } - bool manifest() { + bool manifest() @trusted { return opts["manifest"]; } - bool ocn_hidden() { + bool ocn_hidden() @trusted { return opts["hide-ocn"]; } - bool ocn_off() { + bool ocn_off() @trusted { return opts["ocn-off"]; } - bool quiet() { + bool quiet() @trusted { return opts["quiet"]; } - bool pod() { + bool pod() @trusted { return opts["pod"]; } - bool show_summary() { + bool show_summary() @trusted { return opts["show-summary"]; } - bool show_make() { + bool show_make() @trusted { return opts["show-make"]; } - bool show_metadata() { + bool show_metadata() @trusted { return opts["show-metadata"]; } - bool show_config() { + bool show_config() @trusted { return opts["show-config"]; } - bool source() { + bool source() @trusted { return opts["source"]; } - bool source_or_pod() { + bool source_or_pod() @trusted { return (opts["pod"] || opts["source"]) ? true : false; } - bool sqlite_discrete() { + bool sqlite_discrete() @trusted { return opts["sqlite-discrete"]; } - bool sqlite_db_drop() { + bool sqlite_db_drop() @trusted { return (opts["sqlite-db-recreate"] || opts["sqlite-db-drop"]) ? true : false; } - bool sqlite_db_create() { + bool sqlite_db_create() @trusted { return (opts["sqlite-db-recreate"] || opts["sqlite-db-create"]) ? true : false; } - bool sqlite_delete() { + bool sqlite_delete() @trusted { return opts["sqlite-delete"]; } - bool sqlite_update() { + bool sqlite_update() @trusted { return (opts["sqlite-update"] || opts["sqlite-insert"]) ? true : false; } - bool sqlite_shared_db_action() { + bool sqlite_shared_db_action() @trusted { return ( opts["sqlite-db-recreate"] || opts["sqlite-db-create"] @@ -360,46 +360,46 @@ void main(string[] args) { || opts["sqlite-update"] ) ? true : false; } - bool text() { + bool text() @trusted { return opts["text"]; } - bool verbose() { + bool verbose() @trusted { return (opts["verbose"] || opts["very-verbose"]) ? true : false; } - bool very_verbose() { + bool very_verbose() @trusted { return opts["very-verbose"]; } - bool xhtml() { + bool xhtml() @trusted { return opts["xhtml"]; } - bool section_toc() { + bool section_toc() @trusted { return opts["section_toc"]; } - bool section_body() { + bool section_body() @trusted { return opts["section_body"]; } - bool section_endnotes() { + bool section_endnotes() @trusted { return opts["section_endnotes"]; } - bool section_glossary() { + bool section_glossary() @trusted { return opts["section_glossary"]; } - bool section_biblio() { + bool section_biblio() @trusted { return opts["section_biblio"]; } - bool section_bookindex() { + bool section_bookindex() @trusted { return opts["section_bookindex"]; } - bool section_blurb() { + bool section_blurb() @trusted { return opts["section_blurb"]; } - bool backmatter() { + bool backmatter() @trusted { return opts["backmatter"]; } - bool skip_output() { + bool skip_output() @trusted { return opts["skip-output"]; } - bool workon() { + bool workon() @trusted { return opts["workon"]; } auto languages_set() { @@ -411,7 +411,7 @@ void main(string[] args) { auto sqlite_filename() { return settings["sqlite-filename"]; } - bool parallelise() { + bool parallelise() @trusted { bool _is; if (opts["parallel"] == true) { _is = true; @@ -435,7 +435,7 @@ void main(string[] args) { } else { _is = false; } return _is; } - bool parallelise_subprocesses() { + bool parallelise_subprocesses() @trusted { return opts["parallel-subprocesses"]; } auto output_task_scheduler() { @@ -466,7 +466,7 @@ void main(string[] args) { } return schedule.sort().uniq; } - bool abstraction() { + bool abstraction() @trusted { return ( opts["abstraction"] || concordance @@ -482,7 +482,7 @@ void main(string[] args) { || sqlite_update ) ? true : false; } - bool meta_processing_general() { + bool meta_processing_general() @trusted { return ( opts["abstraction"] || html @@ -493,7 +493,7 @@ void main(string[] args) { || sqlite_update ) ? true :false; } - bool meta_processing_xml_dom() { + bool meta_processing_xml_dom() @trusted { return ( opts["abstraction"] || html -- cgit v1.2.3