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_out/odt.d | 74 ++++++++++++++++++++++----------------------- 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'src/doc_reform/io_out/odt.d') 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"┃ -- cgit v1.2.3