aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/out_odt.org
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2019-12-05 11:41:09 -0500
committerRalph Amissah <ralph.amissah@gmail.com>2020-01-13 16:06:43 -0500
commit9a91485c10e059dee1374e152e4b068cd9d3866c (patch)
tree4eaa00d4e7e8fb5d576142d364657d5b67d3b766 /org/out_odt.org
parentyaml config, provide default if not read (diff)
0.9.2 @safe & @trusted first pass
Diffstat (limited to 'org/out_odt.org')
-rw-r--r--org/out_odt.org76
1 files changed, 38 insertions, 38 deletions
diff --git a/org/out_odt.org b/org/out_odt.org
index 61879a3..59e731c 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){
+string _tags(O)(const O obj) @safe {
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){
#+name: odt_format_objects
#+BEGIN_SRC d
-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) {
@@ -131,7 +131,7 @@ string _xhtml_anchor_tags(O)(O obj) {
#+name: odt_format_objects
#+BEGIN_SRC d
-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)
? ""
@@ -147,7 +147,7 @@ string obj_num(O)(const O obj){ // TODO
#+name: odt_format_objects
#+begin_src d
-string _footnotes()(string _txt){
+string _footnotes()(string _txt) @safe {
static auto rgx = Rgx();
_txt = _txt.replaceAll(
rgx.inline_notes_al_regular_number_note,
@@ -172,7 +172,7 @@ string _footnotes()(string _txt){
#+name: odt_format_objects
#+BEGIN_SRC d
-string _bullet(O)(const O obj){
+string _bullet(O)(const O obj) @safe {
string _b = "";
if (obj.attrib.bullet) {
_b = format(q"┃● ┃",);
@@ -185,7 +185,7 @@ string _bullet(O)(const O obj){
#+name: odt_format_objects
#+BEGIN_SRC d
-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
// ) {
@@ -299,7 +299,7 @@ string _indent(O)(string _txt, const O obj) { // TODO
#+name: odt_format_objects
#+BEGIN_SRC d
-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);
@@ -340,7 +340,7 @@ string _block_type_delimiters(O)(string[] _block_lines, const O obj) { // TODO
#+name: odt_format_objects
#+BEGIN_SRC d
-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, "&amp;")
.replaceAll(rgx.xhtml_quotation, "&#34;")
@@ -355,7 +355,7 @@ string _special_characters(O)(string _txt, const O obj) {
#+name: odt_format_objects
#+BEGIN_SRC d
-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, "&#160;");
@@ -388,9 +388,9 @@ string _font_face(string _txt){
#+name: odt_format_objects
#+BEGIN_SRC d
-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"┃<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) { // NOT USED YET
obj.object_number,
);
}
- string display() {
+ string display() @safe {
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) { // NOT USED YET
#+name: odt_format_objects
#+BEGIN_SRC d
-string _break_page()() {
+string _break_page()() @safe {
return format(q"┃
<text:p text:style-name="P_normal_page_new"/>
┃",
@@ -426,7 +426,7 @@ string _break_page()() {
#+END_SRC
#+BEGIN_SRC d
-string _break_page()() {
+string _break_page()() @safe {
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()() {
#+name: odt_format_objects
#+BEGIN_SRC d
-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, "<br />");
@@ -451,7 +451,7 @@ string _empty_line_break(O)(string _txt, const O obj) {
#+name: odt_format_objects
#+BEGIN_SRC d
-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 =>
@@ -497,7 +497,7 @@ string _links(O)(string _txt, const O obj) {
#+name: odt_format_objects
#+BEGIN_SRC d
-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,
@@ -514,7 +514,7 @@ string _images(O)(string _txt, const O obj) {
#+name: odt_format_objects
#+BEGIN_SRC d
-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
@@ -539,7 +539,7 @@ string markup(O)(const O obj) {
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");
@@ -589,7 +589,7 @@ string heading(O,M)(
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");
@@ -615,7 +615,7 @@ string para(O,M)(
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");
@@ -636,7 +636,7 @@ string quote(O,M)(
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");
@@ -671,7 +671,7 @@ string group(O,M)(
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");
@@ -694,7 +694,7 @@ string block(O,M)(
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");
@@ -713,7 +713,7 @@ string verse(O,M)(
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");
@@ -767,7 +767,7 @@ string code(O,M)(
auto tablarize(O)(
const O obj,
string _txt,
-) {
+) @safe {
string[] _table_rows = (_txt).split(rgx.table_delimiter_row);
string[] _table_cols;
string _table;
@@ -808,7 +808,7 @@ int _table_number = 0;
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() {
+string mimetype() @safe {
string mimetype_ = format(q"┃application/vnd.oasis.opendocument.text┃");
return mimetype_;
}
@@ -1021,7 +1021,7 @@ string mimetype() {
#+name: output_odt_fixed_manifest_rdf
#+BEGIN_SRC d
-string manifest_rdf() {
+string manifest_rdf() @safe {
string _manifest_rdf = format(q"┃<?xml version="1.0" encoding="utf-8"?>
#+END_SRC
@@ -1057,7 +1057,7 @@ string manifest_rdf() {
#+name: output_odt_fixed_settings_xml
#+BEGIN_SRC d
-string settings_xml() {
+string settings_xml() @safe {
string _settings_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?>
#+END_SRC
@@ -1171,7 +1171,7 @@ string settings_xml() {
#+name: output_odt_fixed_styles_xml
#+BEGIN_SRC d
-string styles_xml() {
+string styles_xml() @safe {
string _styles_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?>
#+END_SRC
@@ -2084,7 +2084,7 @@ string styles_xml() {
#+name: output_odt_variable_content_xml
#+BEGIN_SRC d
-string odt_head(I)(I doc_matters) {
+string odt_head(I)(I doc_matters) @safe {
string _has_tables = format(q"┃
#+END_SRC
@@ -2226,7 +2226,7 @@ string odt_head(I)(I doc_matters) {
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() {
+string odt_tail() @safe {
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;
@@ -2404,7 +2404,7 @@ string odt_tail() {
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"/>┃",);
@@ -2424,7 +2424,7 @@ string content_xml(D,I)(
#+BEGIN_SRC d
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) {
@@ -2462,7 +2462,7 @@ _images.join("\n"),
#+BEGIN_SRC d
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
@@ -2496,7 +2496,7 @@ doc_matters.generated_time,
#+BEGIN_SRC d
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) {