aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/out_odt.org
diff options
context:
space:
mode:
Diffstat (limited to 'org/out_odt.org')
-rw-r--r--org/out_odt.org81
1 files changed, 41 insertions, 40 deletions
diff --git a/org/out_odt.org b/org/out_odt.org
index 935b040..022fdc7 100644
--- a/org/out_odt.org
+++ b/org/out_odt.org
@@ -51,6 +51,7 @@
#+BEGIN_SRC d
<<doc_header_including_copyright_and_license>>
module doc_reform.io_out.odt;
+@safe:
template formatODT() {
<<output_imports>>
mixin spineRgxOut;
@@ -145,7 +146,7 @@ template outputODT() {
#+NAME: odt_format_objects_0
#+BEGIN_SRC d
-@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) {
@@ -169,7 +170,7 @@ template outputODT() {
#+NAME: odt_format_objects_1
#+BEGIN_SRC d
-@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) {
@@ -187,7 +188,7 @@ template outputODT() {
#+NAME: odt_format_objects_2
#+BEGIN_SRC d
-@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)
? ""
@@ -203,7 +204,7 @@ template outputODT() {
#+NAME: odt_format_objects_3
#+BEGIN_SRC d
-@safe string _footnotes()(string _txt) {
+string _footnotes()(string _txt) {
static auto rgx = RgxO();
static auto rgx_xhtml = RgxXHTML();
_txt = _txt.replaceAll(
@@ -229,7 +230,7 @@ template outputODT() {
#+NAME: odt_format_objects_4
#+BEGIN_SRC d
-@safe string _bullet(O)(const O obj) {
+string _bullet(O)(const O obj) {
string _b = "";
if (obj.attrib.bullet) {
_b = format(q"┃● ┃",);
@@ -242,7 +243,7 @@ template outputODT() {
#+NAME: odt_format_objects_5
#+BEGIN_SRC d
-@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
// ) {
@@ -356,7 +357,7 @@ template outputODT() {
#+NAME: odt_format_objects_6
#+BEGIN_SRC d
-@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);
@@ -397,7 +398,7 @@ template outputODT() {
#+NAME: odt_format_objects_7
#+BEGIN_SRC d
-@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, "&amp;")
.replaceAll(rgx_xhtml.quotation, "&#34;")
@@ -412,7 +413,7 @@ template outputODT() {
#+NAME: odt_format_objects_8
#+BEGIN_SRC d
-@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, "&#160;");
@@ -445,9 +446,9 @@ string _font_face(string _txt){
#+NAME: odt_format_objects_10
#+BEGIN_SRC d
-@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"/>
@@ -456,7 +457,7 @@ string _font_face(string _txt){
obj.object_number,
);
}
- @safe string display() {
+ string display() {
return format(q"┃<text:span text:style-name="Span_subscript">
%s%s%s
</text:span>┃",
@@ -474,7 +475,7 @@ string _font_face(string _txt){
#+NAME: odt_format_objects_11
#+BEGIN_SRC d
-@safe string _break_page()() {
+string _break_page()() {
return format(q"┃
<text:p text:style-name="P_normal_page_new"/>
┃",
@@ -483,7 +484,7 @@ string _font_face(string _txt){
#+END_SRC
#+BEGIN_SRC d
-@safe string _break_page()() {
+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"/>┃",
@@ -495,7 +496,7 @@ string _font_face(string _txt){
#+NAME: odt_format_objects_12
#+BEGIN_SRC d
-@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 />");
@@ -508,7 +509,7 @@ string _font_face(string _txt){
#+NAME: odt_format_objects_13
#+BEGIN_SRC d
-@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 =>
@@ -554,7 +555,7 @@ string _font_face(string _txt){
#+NAME: odt_format_objects_14
#+BEGIN_SRC d
-@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,
@@ -571,7 +572,7 @@ string _font_face(string _txt){
#+NAME: odt_format_objects_15
#+BEGIN_SRC d
-@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
@@ -593,7 +594,7 @@ string _font_face(string _txt){
#+NAME: odt_format_objects_16
#+BEGIN_SRC d
-@safe string heading(O,M)(
+string heading(O,M)(
const O obj,
const M doc_matters,
) {
@@ -643,7 +644,7 @@ string _font_face(string _txt){
#+NAME: odt_format_objects_17
#+BEGIN_SRC d
-@safe string para(O,M)(
+string para(O,M)(
const O obj,
const M doc_matters,
) {
@@ -669,7 +670,7 @@ string _font_face(string _txt){
#+NAME: odt_format_objects_18
#+BEGIN_SRC d
-@safe string quote(O,M)(
+string quote(O,M)(
const O obj,
const M doc_matters,
) {
@@ -690,7 +691,7 @@ string _font_face(string _txt){
#+NAME: odt_format_objects_19
#+BEGIN_SRC d
-@safe string group(O,M)(
+string group(O,M)(
const O obj,
const M doc_matters,
) {
@@ -725,7 +726,7 @@ string _font_face(string _txt){
#+NAME: odt_format_objects_20
#+BEGIN_SRC d
-@safe string block(O,M)(
+string block(O,M)(
const O obj,
const M doc_matters,
) {
@@ -748,7 +749,7 @@ string _font_face(string _txt){
#+NAME: odt_format_objects_21
#+BEGIN_SRC d
-@safe string verse(O,M)(
+string verse(O,M)(
const O obj,
const M doc_matters,
) {
@@ -767,7 +768,7 @@ string _font_face(string _txt){
#+NAME: odt_format_objects_22
#+BEGIN_SRC d
-@safe string code(O,M)(
+string code(O,M)(
const O obj,
const M doc_matters,
) {
@@ -821,7 +822,7 @@ string _font_face(string _txt){
#+NAME: odt_format_objects_23
#+BEGIN_SRC d
-@safe Tuple!(string, string) tablarize(O)(
+Tuple!(string, string) tablarize(O)(
const O obj,
string _txt,
) {
@@ -862,7 +863,7 @@ string _font_face(string _txt){
#+NAME: odt_format_objects_24
#+BEGIN_SRC d
int _table_number = 0;
-@safe string table(O,M)(
+string table(O,M)(
const O obj,
const M doc_matters,
) {
@@ -901,7 +902,7 @@ int _table_number = 0;
#+NAME: output_odt_0
#+BEGIN_SRC d
-void writeOutputODT(W,I)(
+@trusted void writeOutputODT(W,I)(
const W odt_content,
I doc_matters,
) {
@@ -960,7 +961,7 @@ void writeOutputODT(W,I)(
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());
@@ -1096,7 +1097,7 @@ void dirtree(I)(
#+NAME: output_odt_fixed_mimetype
#+BEGIN_SRC d
-@safe string mimetype() {
+string mimetype() {
string mimetype_ = format(q"┃application/vnd.oasis.opendocument.text┃");
return mimetype_;
}
@@ -1106,7 +1107,7 @@ void dirtree(I)(
#+NAME: output_odt_fixed_manifest_rdf_0
#+BEGIN_SRC d
-@safe string manifest_rdf() {
+string manifest_rdf() {
string _manifest_rdf = format(q"┃<?xml version="1.0" encoding="utf-8"?>
#+END_SRC
@@ -1142,7 +1143,7 @@ void dirtree(I)(
#+NAME: output_odt_fixed_settings_xml_0
#+BEGIN_SRC d
-@safe string settings_xml() {
+string settings_xml() {
string _settings_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?>
#+END_SRC
@@ -1256,7 +1257,7 @@ void dirtree(I)(
#+NAME: output_odt_fixed_styles_xml_0
#+BEGIN_SRC d
-@safe string styles_xml() {
+string styles_xml() {
string _styles_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?>
#+END_SRC
@@ -2169,7 +2170,7 @@ void dirtree(I)(
#+NAME: output_odt_variable_content_xml_0
#+BEGIN_SRC d
-@safe string odt_head(I)(I doc_matters) {
+string odt_head(I)(I doc_matters) {
string _has_tables = format(q"┃
#+END_SRC
@@ -2308,7 +2309,7 @@ void dirtree(I)(
#+NAME: output_odt_variable_content_xml_5
#+BEGIN_SRC d
-@safe string odt_body(D,I)(
+string odt_body(D,I)(
const D doc_abstraction,
I doc_matters,
) {
@@ -2475,7 +2476,7 @@ void dirtree(I)(
#+NAME: output_odt_variable_content_xml_12
#+BEGIN_SRC d
-@safe string odt_tail() {
+string odt_tail() {
string _odt_tail = format(q"┃<text:p text:style-name="P_normal">spine: &lt;<text:a xl:type="simple" xl:href="https://www.doc_reform.org">www.doc_reform.org</text:a>&gt; and &lt;<text:a xl:type="simple" xl:href="https://www.sisudoc.org">www.sisudoc.org</text:a>&gt;</text:p>
</office:text></office:body></office:document-content>┃",);
return _odt_tail;
@@ -2486,7 +2487,7 @@ void dirtree(I)(
#+NAME: output_odt_variable_content_xml_13
#+BEGIN_SRC d
-@safe string content_xml(D,I)(
+string content_xml(D,I)(
const D doc_abstraction,
I doc_matters,
) {
@@ -2507,7 +2508,7 @@ void dirtree(I)(
#+NAME: output_odt_variable_manifest_xml_0
#+BEGIN_SRC d
-@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"/>┃");
@@ -2545,7 +2546,7 @@ _images.join("\n"),
#+NAME: output_odt_variable_meta_xml_0
#+BEGIN_SRC d
-@safe string meta_xml(M)(
+string meta_xml(M)(
auto ref M doc_matters,
) {
/+ (meta_xml includes output time-stamp) +/
@@ -2579,7 +2580,7 @@ doc_matters.generated_time,
#+NAME: output_odt_variable_copy_odt_images
#+BEGIN_SRC d
-@safe void images_cp(M)(
+void images_cp(M)(
auto ref M doc_matters,
) {
{ /+ (copy odt images) +/