aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/out_odt.org
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2020-01-05 20:17:17 -0500
committerRalph Amissah <ralph.amissah@gmail.com>2020-02-11 13:08:49 -0500
commitde02319cfa7b4bbff8c111bda02be1a7c6591555 (patch)
tree732c11d10bc2699cd1b72d00b3be943284eea130 /org/out_odt.org
parentreduce use of auto, much with tuples (diff)
dlang safe default imminent, look ahead
- @safe @trusted & @system, reconsider @trusted
Diffstat (limited to 'org/out_odt.org')
-rw-r--r--org/out_odt.org104
1 files changed, 52 insertions, 52 deletions
diff --git a/org/out_odt.org b/org/out_odt.org
index e843a48..224f303 100644
--- a/org/out_odt.org
+++ b/org/out_odt.org
@@ -89,7 +89,7 @@ template outputODT() {
#+name: odt_format_objects
#+BEGIN_SRC d
-string _tags(O)(const O obj) @safe {
+@safe string _tags(O)(const O obj) {
string _tags = "";
if (obj.tags.anchor_tags.length > 0) {
foreach (tag_; obj.tags.anchor_tags) {
@@ -113,7 +113,7 @@ string _tags(O)(const O obj) @safe {
#+name: odt_format_objects
#+BEGIN_SRC d
-string _xhtml_anchor_tags(O)(O obj) @safe {
+@safe string _xhtml_anchor_tags(O)(O obj) {
const(string[]) anchor_tags = obj.tags.anchor_tags;
string tags="";
if (anchor_tags.length > 0) {
@@ -131,7 +131,7 @@ string _xhtml_anchor_tags(O)(O obj) @safe {
#+name: odt_format_objects
#+BEGIN_SRC d
-string obj_num(O)(const O obj) @safe { // TODO
+@safe string obj_num(O)(const O obj) { // TODO
string _on;
_on = (obj.metainfo.object_number.empty)
? ""
@@ -147,7 +147,7 @@ string obj_num(O)(const O obj) @safe { // TODO
#+name: odt_format_objects
#+begin_src d
-string _footnotes()(string _txt) @safe {
+@safe string _footnotes()(string _txt) {
static auto rgx = Rgx();
_txt = _txt.replaceAll(
rgx.inline_notes_al_regular_number_note,
@@ -172,7 +172,7 @@ string _footnotes()(string _txt) @safe {
#+name: odt_format_objects
#+BEGIN_SRC d
-string _bullet(O)(const O obj) @safe {
+@safe string _bullet(O)(const O obj) {
string _b = "";
if (obj.attrib.bullet) {
_b = format(q"┃● ┃",);
@@ -185,7 +185,7 @@ string _bullet(O)(const O obj) @safe {
#+name: odt_format_objects
#+BEGIN_SRC d
-string _indent(O)(string _txt, const O obj) @safe { // TODO
+@safe string _indent(O)(string _txt, const O obj) { // TODO
// if (obj.attrib.indent_base > 0 ||
// obj.attrib.indent_hang > 0
// ) {
@@ -299,7 +299,7 @@ string _indent(O)(string _txt, const O obj) @safe { // TODO
#+name: odt_format_objects
#+BEGIN_SRC d
-string _block_type_delimiters(O)(string[] _block_lines, const O obj) @safe { // TODO
+@safe string _block_type_delimiters(O)(string[] _block_lines, const O obj) { // TODO
string _block = "";
foreach (i, _line; _block_lines) {
_line = _footnotes(_line);
@@ -340,7 +340,7 @@ string _block_type_delimiters(O)(string[] _block_lines, const O obj) @safe { //
#+name: odt_format_objects
#+BEGIN_SRC d
-string _special_characters(O)(string _txt, const O obj) @safe {
+@safe string _special_characters(O)(string _txt, const O obj) {
_txt = _txt
.replaceAll(rgx.xhtml_ampersand, "&amp;")
.replaceAll(rgx.xhtml_quotation, "&#34;")
@@ -355,7 +355,7 @@ string _special_characters(O)(string _txt, const O obj) @safe {
#+name: odt_format_objects
#+BEGIN_SRC d
-string _preserve_white_spaces(O)(string _txt, const O obj) @safe {
+@safe 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, "&#160;");
@@ -388,9 +388,9 @@ string _font_face(string _txt){
#+name: odt_format_objects
#+BEGIN_SRC d
-auto _obj_num(O)(O obj) @safe { // NOT USED YET
+@safe auto _obj_num(O)(O obj) { // NOT USED YET
struct objNum {
- string reference() @safe {
+ @safe string reference() {
return format(q"┃<text:span text:style-name="Span_subscript">
<text:bookmark-start text:name="%s"/>
<text:bookmark-end text:name="%s"/>
@@ -399,7 +399,7 @@ auto _obj_num(O)(O obj) @safe { // NOT USED YET
obj.object_number,
);
}
- string display() @safe {
+ @safe string display() {
return format(q"┃<text:span text:style-name="Span_subscript">
%s%s%s
</text:span>┃",
@@ -417,7 +417,7 @@ auto _obj_num(O)(O obj) @safe { // NOT USED YET
#+name: odt_format_objects
#+BEGIN_SRC d
-string _break_page()() @safe {
+@safe string _break_page()() {
return format(q"┃
<text:p text:style-name="P_normal_page_new"/>
┃",
@@ -426,7 +426,7 @@ string _break_page()() @safe {
#+END_SRC
#+BEGIN_SRC d
-string _break_page()() @safe {
+@safe string _break_page()() {
return format(q"┃
<text:p text:style-name="P_page_break"> </text:p>
<text:p text:style-name="P_normal_page_new"/>┃",
@@ -438,7 +438,7 @@ string _break_page()() @safe {
#+name: odt_format_objects
#+BEGIN_SRC d
-string _empty_line_break(O)(string _txt, const O obj) @safe {
+@safe 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 />");
@@ -451,7 +451,7 @@ string _empty_line_break(O)(string _txt, const O obj) @safe {
#+name: odt_format_objects
#+BEGIN_SRC d
-string _links(O)(string _txt, const O obj) @safe {
+@safe string _links(O)(string _txt, const O obj) {
if (obj.metainfo.is_a != "code") {
if (obj.metainfo.is_a == "toc") {
_txt = replaceAll!(m =>
@@ -497,7 +497,7 @@ string _links(O)(string _txt, const O obj) @safe {
#+name: odt_format_objects
#+BEGIN_SRC d
-string _images(O)(string _txt, const O obj) @safe {
+@safe string _images(O)(string _txt, const O obj) {
if (_txt.match(rgx.inline_image)) {
_txt = _txt
.replaceAll(rgx.inline_image,
@@ -514,7 +514,7 @@ string _images(O)(string _txt, const O obj) @safe {
#+name: odt_format_objects
#+BEGIN_SRC d
-string markup(O)(const O obj) @safe {
+@safe 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
@@ -536,10 +536,10 @@ string markup(O)(const O obj) @safe {
#+name: odt_format_objects
#+BEGIN_SRC d
-string heading(O,M)(
+@safe 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");
@@ -586,10 +586,10 @@ string heading(O,M)(
#+name: odt_format_objects
#+BEGIN_SRC d
-string para(O,M)(
+@safe 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");
@@ -612,10 +612,10 @@ string para(O,M)(
#+name: odt_format_objects
#+BEGIN_SRC d
-string quote(O,M)(
+@safe 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");
@@ -633,10 +633,10 @@ string quote(O,M)(
#+name: odt_format_objects
#+BEGIN_SRC d
-string group(O,M)(
+@safe 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");
@@ -668,10 +668,10 @@ string group(O,M)(
#+name: odt_format_objects
#+BEGIN_SRC d
-string block(O,M)(
+@safe 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");
@@ -691,10 +691,10 @@ string block(O,M)(
#+name: odt_format_objects
#+BEGIN_SRC d
-string verse(O,M)(
+@safe 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");
@@ -710,10 +710,10 @@ string verse(O,M)(
#+name: odt_format_objects
#+BEGIN_SRC d
-string code(O,M)(
+@safe 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");
@@ -764,10 +764,10 @@ string code(O,M)(
#+name: odt_format_objects
#+BEGIN_SRC d
-Tuple!(string, string) tablarize(O)(
+@safe Tuple!(string, string) tablarize(O)(
const O obj,
string _txt,
-) @safe {
+) {
string[] _table_rows = (_txt).split(rgx.table_delimiter_row);
string[] _table_cols;
string _table;
@@ -805,10 +805,10 @@ Tuple!(string, string) tablarize(O)(
#+name: odt_format_objects
#+BEGIN_SRC d
int _table_number = 0;
-string table(O,M)(
+@safe 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");
@@ -1011,7 +1011,7 @@ void dirtree(I)(
#+name: output_odt_fixed_mimetype
#+BEGIN_SRC d
-string mimetype() @safe {
+@safe string mimetype() {
string mimetype_ = format(q"┃application/vnd.oasis.opendocument.text┃");
return mimetype_;
}
@@ -1021,7 +1021,7 @@ string mimetype() @safe {
#+name: output_odt_fixed_manifest_rdf
#+BEGIN_SRC d
-string manifest_rdf() @safe {
+@safe string manifest_rdf() {
string _manifest_rdf = format(q"┃<?xml version="1.0" encoding="utf-8"?>
#+END_SRC
@@ -1057,7 +1057,7 @@ string manifest_rdf() @safe {
#+name: output_odt_fixed_settings_xml
#+BEGIN_SRC d
-string settings_xml() @safe {
+@safe string settings_xml() {
string _settings_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?>
#+END_SRC
@@ -1171,7 +1171,7 @@ string settings_xml() @safe {
#+name: output_odt_fixed_styles_xml
#+BEGIN_SRC d
-string styles_xml() @safe {
+@safe string styles_xml() {
string _styles_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?>
#+END_SRC
@@ -2084,7 +2084,7 @@ string styles_xml() @safe {
#+name: output_odt_variable_content_xml
#+BEGIN_SRC d
-string odt_head(I)(I doc_matters) @safe {
+@safe string odt_head(I)(I doc_matters) {
string _has_tables = format(q"┃
#+END_SRC
@@ -2223,10 +2223,10 @@ string odt_head(I)(I doc_matters) @safe {
#+name: output_odt_variable_content_xml
#+BEGIN_SRC d
-string odt_body(D,I)(
+@safe string odt_body(D,I)(
const D doc_abstraction,
I doc_matters,
-) @safe {
+) {
mixin formatODT;
auto odt_format = formatODT();
string delimit = "";
@@ -2390,7 +2390,7 @@ string odt_body(D,I)(
#+name: output_odt_variable_content_xml
#+BEGIN_SRC d
-string odt_tail() @safe {
+@safe string odt_tail() {
string _odt_tail = format(q"┃<text:p text:style-name="P_normal">spine: &lt;<text:a xl:type="simple" xl:href="http://www.doc_reform.org">www.doc_reform.org</text:a>&gt; and &lt;<text:a xl:type="simple" xl:href="http://www.sisudoc.org">www.sisudoc.org</text:a>&gt;</text:p>
</office:text></office:body></office:document-content>┃",);
return _odt_tail;
@@ -2401,10 +2401,10 @@ string odt_tail() @safe {
#+name: output_odt_variable_content_xml
#+BEGIN_SRC d
-string content_xml(D,I)(
+@safe 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"┃<text:p text:style-name="P_normal_page_new"/>┃",);
@@ -2422,9 +2422,9 @@ string content_xml(D,I)(
#+name: output_odt_variable_manifest_xml
#+BEGIN_SRC d
-string manifest_xml(M)(
+@safe string manifest_xml(M)(
auto ref M doc_matters,
-) @safe {
+) {
string _bullet = format(q"┃<manifest:file-entry manifest:media-type="" manifest:full-path="Pictures/bullet_09.png"/>┃");
string[] _images = [ _bullet ];
foreach (image; doc_matters.srcs.image_list) {
@@ -2460,9 +2460,9 @@ _images.join("\n"),
#+name: output_odt_variable_meta_xml
#+BEGIN_SRC d
-string meta_xml(M)(
+@safe string meta_xml(M)(
auto ref M doc_matters,
-) @safe {
+) {
/+ (meta_xml includes output time-stamp) +/
string _meta_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?>
#+END_SRC
@@ -2494,9 +2494,9 @@ doc_matters.generated_time,
#+name: output_odt_variable_copy_odt_images
#+BEGIN_SRC d
-void images_cp(M)(
+@safe 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) {