diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2019-12-05 11:41:09 -0500 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2020-01-13 16:06:43 -0500 |
commit | 9a91485c10e059dee1374e152e4b068cd9d3866c (patch) | |
tree | 4eaa00d4e7e8fb5d576142d364657d5b67d3b766 /src/doc_reform/io_out | |
parent | yaml config, provide default if not read (diff) |
0.9.2 @safe & @trusted first pass
Diffstat (limited to 'src/doc_reform/io_out')
-rw-r--r-- | src/doc_reform/io_out/epub3.d | 14 | ||||
-rw-r--r-- | src/doc_reform/io_out/html.d | 12 | ||||
-rw-r--r-- | src/doc_reform/io_out/latex.d | 36 | ||||
-rw-r--r-- | src/doc_reform/io_out/odt.d | 74 | ||||
-rw-r--r-- | src/doc_reform/io_out/xmls.d | 80 | ||||
-rw-r--r-- | src/doc_reform/io_out/xmls_css.d | 4 |
6 files changed, 110 insertions, 110 deletions
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"┃<?xml version='1.0' encoding='utf-8'?>┃") ~ "\n"; o ~= format(q"┃<container version="1.0" @@ -30,7 +30,7 @@ template outputEPub3() { </rootfiles>┃") ~ "\n</container>\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() { </html>\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"┃<text:span text:style-name="Span_monospace">%s</text:span>┃","$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"┃<text:span text:style-name="Span_subscript"> <text:bookmark-start text:name="%s"/> <text:bookmark-end text:name="%s"/> @@ -263,7 +263,7 @@ template formatODT() { obj.object_number, ); } - string display() { + string display() @safe { return format(q"┃<text:span text:style-name="Span_subscript"> %s%s%s </text:span>┃", @@ -275,20 +275,20 @@ template formatODT() { } return objNum(); } - string _break_page()() { + string _break_page()() @safe { return format(q"┃ <text:p text:style-name="P_normal_page_new"/> ┃", ); } - 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 />"); } 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"┃ <style:style style:name="Table1" style:family="table"> <style:table-properties style:width="16.999cm" table:align="margins"/> @@ -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"┃<text:p text:style-name="P_normal">spine: <<text:a xl:type="simple" xl:href="http://www.doc_reform.org">www.doc_reform.org</text:a>> and <<text:a xl:type="simple" xl:href="http://www.sisudoc.org">www.sisudoc.org</text:a>></text:p> </office:text></office:body></office:document-content>┃",); 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"┃<text:p text:style-name="P_normal_page_new"/>┃",); @@ -860,7 +860,7 @@ template outputODT() { } 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) { @@ -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"┃<?xml version="1.0" encoding="UTF-8"?> <office:document-meta xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xl="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:grddl="http://www.w3.org/2003/g/data-view#" office:version="1.2"> @@ -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"┃<?xml version="1.0" encoding="utf-8"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="styles.xml"> @@ -965,7 +965,7 @@ template outputODT() { ┃"); return _manifest_rdf; } - string settings_xml() { + string settings_xml() @safe { string _settings_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?> <office:document-settings xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xl="http://www.w3.org/1999/xlink" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" office:version="1.2"> <office:settings> @@ -1065,7 +1065,7 @@ template outputODT() { ┃"); return _settings_xml; } - string styles_xml() { + string styles_xml() @safe { string _styles_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?> <office:document-styles xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xl="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2"> <office:font-face-decls> 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, ("<em>$1</em>")) .replaceAll(rgx.inline_bold, ("<b>$1</b>")) @@ -78,7 +78,7 @@ template outputXHTMLs() { .replaceAll(rgx.inline_cite, ("<cite>$1</cite>")); 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"┃<!-- spine header metadata --> @@ -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"┃<!DOCTYPE html> <html>┃", ); @@ -309,7 +309,7 @@ template outputXHTMLs() { ); return o; } - string tail() { + string tail() @safe { string o; o = format(q"┃ <a name="bottom" id="bottom"></a> @@ -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 ~= " <div class=\"nav\">\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"┃<p class="tiny">[<a href="../../../topics.html"> T </a>|<a href="../../../authors.html"> A </a>]</p>┃") @@ -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"; |