diff options
Diffstat (limited to 'org/out_odt.org')
-rw-r--r-- | org/out_odt.org | 139 |
1 files changed, 70 insertions, 69 deletions
diff --git a/org/out_odt.org b/org/out_odt.org index 224f303..c2ec6e0 100644 --- a/org/out_odt.org +++ b/org/out_odt.org @@ -4,14 +4,15 @@ #+FILETAGS: :spine:output:xml:odt: #+AUTHOR: Ralph Amissah #+EMAIL: [[mailto:ralph.amissah@gmail.com][ralph.amissah@gmail.com]] -#+COPYRIGHT: Copyright (C) 2015 - 2019 Ralph Amissah +#+COPYRIGHT: Copyright (C) 2015 - 2020 Ralph Amissah #+LANGUAGE: en -#+STARTUP: indent content hideblocks hidestars -#+OPTIONS: H:3 num:nil toc:t \n:nil @:t ::t |:t ^:nil _:nil -:t f:t *:t <:t -#+OPTIONS: TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc -#+OPTIONS: author:nil email:nil creator:nil timestamp:nil -#+PROPERTY: header-args :results silent :padline no :exports code :cache no :noweb yes -#+EXPORT_SELECT_TAGS: export +#+STARTUP: content hideblocks hidestars noindent entitiespretty +#+PROPERTY: header-args :exports code +#+PROPERTY: header-args+ :noweb yes +#+PROPERTY: header-args+ :eval no +#+PROPERTY: header-args+ :results no +#+PROPERTY: header-args+ :cache no +#+PROPERTY: header-args+ :padline no - [[./spine.org][spine]] [[./][org/]] - [[./output_hub.org][output_hub]] @@ -87,7 +88,7 @@ template outputODT() { **** object attrib ***** tags -#+name: odt_format_objects +#+NAME: odt_format_objects #+BEGIN_SRC d @safe string _tags(O)(const O obj) { string _tags = ""; @@ -111,7 +112,7 @@ template outputODT() { ****** anchor tags -#+name: odt_format_objects +#+NAME: odt_format_objects #+BEGIN_SRC d @safe string _xhtml_anchor_tags(O)(O obj) { const(string[]) anchor_tags = obj.tags.anchor_tags; @@ -129,7 +130,7 @@ template outputODT() { ***** ocn object number display -#+name: odt_format_objects +#+NAME: odt_format_objects #+BEGIN_SRC d @safe string obj_num(O)(const O obj) { // TODO string _on; @@ -145,8 +146,8 @@ template outputODT() { ***** footnotes -#+name: odt_format_objects -#+begin_src d +#+NAME: odt_format_objects +#+BEGIN_SRC d @safe string _footnotes()(string _txt) { static auto rgx = Rgx(); _txt = _txt.replaceAll( @@ -166,11 +167,11 @@ template outputODT() { ); return _txt; } -#+end_src +#+END_SRC ***** bullet -#+name: odt_format_objects +#+NAME: odt_format_objects #+BEGIN_SRC d @safe string _bullet(O)(const O obj) { string _b = ""; @@ -183,7 +184,7 @@ template outputODT() { ***** para (with bullet, indent levels, footnotes extracted) -#+name: odt_format_objects +#+NAME: odt_format_objects #+BEGIN_SRC d @safe string _indent(O)(string _txt, const O obj) { // TODO // if (obj.attrib.indent_base > 0 || @@ -297,7 +298,7 @@ template outputODT() { ***** block type -#+name: odt_format_objects +#+NAME: odt_format_objects #+BEGIN_SRC d @safe string _block_type_delimiters(O)(string[] _block_lines, const O obj) { // TODO string _block = ""; @@ -338,7 +339,7 @@ template outputODT() { ***** special characters -#+name: odt_format_objects +#+NAME: odt_format_objects #+BEGIN_SRC d @safe string _special_characters(O)(string _txt, const O obj) { _txt = _txt @@ -353,7 +354,7 @@ template outputODT() { ***** preserve white space -#+name: odt_format_objects +#+NAME: odt_format_objects #+BEGIN_SRC d @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") { @@ -366,7 +367,7 @@ template outputODT() { ***** font_face -#+name: odt_format_objects +#+NAME: odt_format_objects #+BEGIN_SRC d string _font_face(string _txt){ _txt = _txt @@ -386,7 +387,7 @@ string _font_face(string _txt){ ***** object number -#+name: odt_format_objects +#+NAME: odt_format_objects #+BEGIN_SRC d @safe auto _obj_num(O)(O obj) { // NOT USED YET struct objNum { @@ -415,7 +416,7 @@ string _font_face(string _txt){ ***** break page -#+name: odt_format_objects +#+NAME: odt_format_objects #+BEGIN_SRC d @safe string _break_page()() { return format(q"┃ @@ -436,7 +437,7 @@ string _font_face(string _txt){ ***** empty lines break -#+name: odt_format_objects +#+NAME: odt_format_objects #+BEGIN_SRC d @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") { @@ -449,7 +450,7 @@ string _font_face(string _txt){ ***** links: url, mail -#+name: odt_format_objects +#+NAME: odt_format_objects #+BEGIN_SRC d @safe string _links(O)(string _txt, const O obj) { if (obj.metainfo.is_a != "code") { @@ -495,7 +496,7 @@ string _font_face(string _txt){ ***** image -#+name: odt_format_objects +#+NAME: odt_format_objects #+BEGIN_SRC d @safe string _images(O)(string _txt, const O obj) { if (_txt.match(rgx.inline_image)) { @@ -512,7 +513,7 @@ string _font_face(string _txt){ **** markup hub (including font face) -#+name: odt_format_objects +#+NAME: odt_format_objects #+BEGIN_SRC d @safe string markup(O)(const O obj) { /+ markup TODO +/ @@ -534,7 +535,7 @@ string _font_face(string _txt){ **** para type ***** heading -#+name: odt_format_objects +#+NAME: odt_format_objects #+BEGIN_SRC d @safe string heading(O,M)( const O obj, @@ -584,7 +585,7 @@ string _font_face(string _txt){ ***** para -#+name: odt_format_objects +#+NAME: odt_format_objects #+BEGIN_SRC d @safe string para(O,M)( const O obj, @@ -610,7 +611,7 @@ string _font_face(string _txt){ **** block type ***** quote -#+name: odt_format_objects +#+NAME: odt_format_objects #+BEGIN_SRC d @safe string quote(O,M)( const O obj, @@ -631,7 +632,7 @@ string _font_face(string _txt){ - preserves double newlines (paragraph delimiter) - the "group" delimiter is different from the "block" delimiter in that groups do not preserve whitespace, the "block" mark does -#+name: odt_format_objects +#+NAME: odt_format_objects #+BEGIN_SRC d @safe string group(O,M)( const O obj, @@ -666,7 +667,7 @@ string _font_face(string _txt){ - "^[ ]"   - count number only at beginning of line and replace each -#+name: odt_format_objects +#+NAME: odt_format_objects #+BEGIN_SRC d @safe string block(O,M)( const O obj, @@ -689,7 +690,7 @@ string _font_face(string _txt){ - preserves spaces - preserves newlines -#+name: odt_format_objects +#+NAME: odt_format_objects #+BEGIN_SRC d @safe string verse(O,M)( const O obj, @@ -708,7 +709,7 @@ string _font_face(string _txt){ ***** code -#+name: odt_format_objects +#+NAME: odt_format_objects #+BEGIN_SRC d @safe string code(O,M)( const O obj, @@ -762,7 +763,7 @@ string _font_face(string _txt){ ***** table ****** tablarize -#+name: odt_format_objects +#+NAME: odt_format_objects #+BEGIN_SRC d @safe Tuple!(string, string) tablarize(O)( const O obj, @@ -802,7 +803,7 @@ string _font_face(string _txt){ ****** table -#+name: odt_format_objects +#+NAME: odt_format_objects #+BEGIN_SRC d int _table_number = 0; @safe string table(O,M)( @@ -842,7 +843,7 @@ int _table_number = 0; ** write odt output :odf:odt:out: -#+name: output_odt +#+NAME: output_odt #+BEGIN_SRC d void writeOutputODT(W,I)( const W odt_content, @@ -931,7 +932,7 @@ void writeOutputODT(W,I)( ** odt output hub [#A] :odf:odt:out: -#+name: output_odt +#+NAME: output_odt #+BEGIN_SRC d void outputODT(D,I)( const D doc_abstraction, @@ -967,7 +968,7 @@ void outputODT(D,I)( ** shared *** output imports -#+name: output_imports +#+NAME: output_imports #+BEGIN_SRC d import doc_reform.io_out; import @@ -985,7 +986,7 @@ import *** make directory tree -#+name: output_odt_fixed_dirtree +#+NAME: output_odt_fixed_dirtree #+BEGIN_SRC d void dirtree(I)( I doc_matters, @@ -1009,7 +1010,7 @@ void dirtree(I)( ** fixed items *** mimetype :mimetype: -#+name: output_odt_fixed_mimetype +#+NAME: output_odt_fixed_mimetype #+BEGIN_SRC d @safe string mimetype() { string mimetype_ = format(q"┃application/vnd.oasis.opendocument.text┃"); @@ -1019,13 +1020,13 @@ void dirtree(I)( *** manifest.rdf :manifest_rdf: -#+name: output_odt_fixed_manifest_rdf +#+NAME: output_odt_fixed_manifest_rdf #+BEGIN_SRC d @safe string manifest_rdf() { string _manifest_rdf = format(q"┃<?xml version="1.0" encoding="utf-8"?> #+END_SRC -#+name: output_odt_fixed_manifest_rdf +#+NAME: output_odt_fixed_manifest_rdf #+BEGIN_SRC xml <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="styles.xml"> @@ -1046,7 +1047,7 @@ void dirtree(I)( </rdf:RDF> #+END_SRC -#+name: output_odt_fixed_manifest_rdf +#+NAME: output_odt_fixed_manifest_rdf #+BEGIN_SRC d ┃"); return _manifest_rdf; @@ -1055,13 +1056,13 @@ void dirtree(I)( *** settings.xml :settings: -#+name: output_odt_fixed_settings_xml +#+NAME: output_odt_fixed_settings_xml #+BEGIN_SRC d @safe string settings_xml() { string _settings_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?> #+END_SRC -#+name: output_odt_fixed_settings_xml +#+NAME: output_odt_fixed_settings_xml #+BEGIN_SRC xml <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> @@ -1160,7 +1161,7 @@ void dirtree(I)( </office:document-settings> #+END_SRC -#+name: output_odt_fixed_settings_xml +#+NAME: output_odt_fixed_settings_xml #+BEGIN_SRC d ┃"); return _settings_xml; @@ -1169,13 +1170,13 @@ void dirtree(I)( *** styles.xml :styles_xml: -#+name: output_odt_fixed_styles_xml +#+NAME: output_odt_fixed_styles_xml #+BEGIN_SRC d @safe string styles_xml() { string _styles_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?> #+END_SRC -#+name: output_odt_fixed_styles_xml +#+NAME: output_odt_fixed_styles_xml #+BEGIN_SRC xml <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> @@ -2070,7 +2071,7 @@ void dirtree(I)( </office:document-styles> #+END_SRC -#+name: output_odt_fixed_styles_xml +#+NAME: output_odt_fixed_styles_xml #+BEGIN_SRC d ┃"); return _styles_xml; @@ -2082,7 +2083,7 @@ void dirtree(I)( **** content head ***** head open -#+name: output_odt_variable_content_xml +#+NAME: output_odt_variable_content_xml #+BEGIN_SRC d @safe string odt_head(I)(I doc_matters) { string _has_tables = format(q"┃ @@ -2090,7 +2091,7 @@ void dirtree(I)( ***** if table include within head -#+name: output_odt_variable_content_xml +#+NAME: output_odt_variable_content_xml #+BEGIN_SRC xml <style:style style:name="Table1" style:family="table"> <style:table-properties style:width="16.999cm" table:align="margins"/> @@ -2168,7 +2169,7 @@ void dirtree(I)( ***** head -#+name: output_odt_variable_content_xml +#+NAME: output_odt_variable_content_xml #+BEGIN_SRC d ┃",); string _odt_head = format(q"┃<?xml version="1.0" encoding="UTF-8"?> @@ -2176,7 +2177,7 @@ void dirtree(I)( ***** head xml -#+name: output_odt_variable_content_xml +#+NAME: output_odt_variable_content_xml #+BEGIN_SRC xml <office:document-content 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:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2"> <office:scripts/> @@ -2209,7 +2210,7 @@ void dirtree(I)( ***** head close -#+name: output_odt_variable_content_xml +#+NAME: output_odt_variable_content_xml #+BEGIN_SRC d ┃", (doc_matters.has.tables > 0) ? _has_tables : "", @@ -2221,7 +2222,7 @@ void dirtree(I)( **** ↻ content body ***** body open -#+name: output_odt_variable_content_xml +#+NAME: output_odt_variable_content_xml #+BEGIN_SRC d @safe string odt_body(D,I)( const D doc_abstraction, @@ -2236,7 +2237,7 @@ void dirtree(I)( ***** ↻ the loop & outer switch (sections & objects) format output -#+name: output_odt_variable_content_xml +#+NAME: output_odt_variable_content_xml #+BEGIN_SRC d foreach (part; doc_matters.has.keys_seq.scroll) { foreach (obj; doc_abstraction[part]) { @@ -2245,7 +2246,7 @@ void dirtree(I)( ****** frontmatter -#+name: output_odt_variable_content_xml +#+NAME: output_odt_variable_content_xml #+BEGIN_SRC d case "frontmatter": assert(part == "head" || "toc"); switch (obj.metainfo.is_of_type) { @@ -2270,7 +2271,7 @@ void dirtree(I)( ****** body -#+name: output_odt_variable_content_xml +#+NAME: output_odt_variable_content_xml #+BEGIN_SRC d case "body": assert(part == "body" || "head"); // surprise switch (obj.metainfo.is_of_type) { @@ -2321,7 +2322,7 @@ void dirtree(I)( ****** backmatter -#+name: output_odt_variable_content_xml +#+NAME: output_odt_variable_content_xml #+BEGIN_SRC d case "backmatter": assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); @@ -2371,7 +2372,7 @@ void dirtree(I)( ***** closings & post loop -#+name: output_odt_variable_content_xml +#+NAME: output_odt_variable_content_xml #+BEGIN_SRC d } } @@ -2382,13 +2383,13 @@ void dirtree(I)( **** content book index? -#+name: output_odt_variable_content_xml +#+NAME: output_odt_variable_content_xml #+BEGIN_SRC d #+END_SRC **** content tail -#+name: output_odt_variable_content_xml +#+NAME: output_odt_variable_content_xml #+BEGIN_SRC d @safe string odt_tail() { 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> @@ -2399,7 +2400,7 @@ void dirtree(I)( **** hub -#+name: output_odt_variable_content_xml +#+NAME: output_odt_variable_content_xml #+BEGIN_SRC d @safe string content_xml(D,I)( const D doc_abstraction, @@ -2420,7 +2421,7 @@ void dirtree(I)( - META-INF/manifest.xml - image list changes -#+name: output_odt_variable_manifest_xml +#+NAME: output_odt_variable_manifest_xml #+BEGIN_SRC d @safe string manifest_xml(M)( auto ref M doc_matters, @@ -2433,7 +2434,7 @@ void dirtree(I)( string _manifest_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?> #+END_SRC -#+name: output_odt_variable_manifest_xml +#+NAME: output_odt_variable_manifest_xml #+BEGIN_SRC xml <manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" manifest:version="1.2"> <manifest:file-entry manifest:media-type="application/vnd.oasis.opendocument.text" manifest:version="1.2" manifest:full-path="/"/> @@ -2447,7 +2448,7 @@ void dirtree(I)( </manifest:manifest> #+END_SRC -#+name: output_odt_variable_manifest_xml +#+NAME: output_odt_variable_manifest_xml #+BEGIN_SRC d ┃", _images.join("\n"), @@ -2458,7 +2459,7 @@ _images.join("\n"), *** meta.xml (time stamp) :meta_xml: -#+name: output_odt_variable_meta_xml +#+NAME: output_odt_variable_meta_xml #+BEGIN_SRC d @safe string meta_xml(M)( auto ref M doc_matters, @@ -2467,7 +2468,7 @@ _images.join("\n"), string _meta_xml = format(q"┃<?xml version="1.0" encoding="UTF-8"?> #+END_SRC -#+name: output_odt_variable_meta_xml +#+NAME: output_odt_variable_meta_xml #+BEGIN_SRC xml <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"> <office:meta> @@ -2479,7 +2480,7 @@ _images.join("\n"), </office:document-meta> #+END_SRC -#+name: output_odt_variable_meta_xml +#+NAME: output_odt_variable_meta_xml #+BEGIN_SRC d ┃", doc_matters.generator_program.name_and_version, @@ -2492,7 +2493,7 @@ doc_matters.generated_time, *** copy images :images: -#+name: output_odt_variable_copy_odt_images +#+NAME: output_odt_variable_copy_odt_images #+BEGIN_SRC d @safe void images_cp(M)( auto ref M doc_matters, |