Update XML classes and tests

This commit is contained in:
Veronica Berglyd Olsen
2023-05-29 21:47:13 +02:00
parent a40275c431
commit 1d90d6d385
7 changed files with 143 additions and 148 deletions
+1 -5
View File
@@ -25,7 +25,6 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import sys
import logging
import xml.etree.ElementTree as ET
@@ -561,10 +560,7 @@ class ProjectXMLWriter:
backFile = saveFile.with_suffix(".bak")
try:
xml = ET.ElementTree(xRoot)
if sys.hexversion < 0x030900f0:
xmlIndent(xml, space=" ")
else:
ET.indent(xml, space=" ")
xmlIndent(xml)
xml.write(tempFile, encoding="utf-8", xml_declaration=True)
except Exception as exc:
self._error = exc
+16 -17
View File
@@ -92,20 +92,20 @@ class ToOdt(Tokenizer):
self._isFlat = isFlat # Flat: .fodt, otherwise .odt
self._dFlat = None # FODT file XML root
self._dCont = None # ODT content.xml root
self._dMeta = None # ODT meta.xml root
self._dStyl = None # ODT styles.xml root
self._dFlat = ET.Element("") # FODT file XML root
self._dCont = ET.Element("") # ODT content.xml root
self._dMeta = ET.Element("") # ODT meta.xml root
self._dStyl = ET.Element("") # ODT styles.xml root
self._xMeta = None # Office meta root
self._xFont = None # Office font face declaration
self._xFnt2 = None # Office font face declaration, secondary
self._xStyl = None # Office styles root
self._xAuto = None # Office auto-styles root
self._xAut2 = None # Office auto-styles root, secondary
self._xMast = None # Office master-styles root
self._xBody = None # Office body root
self._xText = None # Office text root
self._xMeta = ET.Element("") # Office meta root
self._xFont = ET.Element("") # Office font face declaration
self._xFnt2 = ET.Element("") # Office font face declaration, secondary
self._xStyl = ET.Element("") # Office styles root
self._xAuto = ET.Element("") # Office auto-styles root
self._xAut2 = ET.Element("") # Office auto-styles root, secondary
self._xMast = ET.Element("") # Office master-styles root
self._xBody = ET.Element("") # Office body root
self._xText = ET.Element("") # Office text root
self._mainPara = {} # User-accessible paragraph styles
self._autoPara = {} # Auto-generated paragraph styles
@@ -502,7 +502,7 @@ class ToOdt(Tokenizer):
"""
with open(savePath, mode="wb") as outFile:
xml = ET.ElementTree(self._dFlat)
xmlIndent(xml, space=" ")
xmlIndent(xml)
xml.write(outFile, encoding="utf-8", xml_declaration=True)
return
@@ -529,7 +529,6 @@ class ToOdt(Tokenizer):
def putInZip(name, xObj, zipObj):
with zipObj.open(name, mode="w") as fObj:
xml = ET.ElementTree(xObj)
xmlIndent(xml, space=" ")
xml.write(fObj, encoding="utf-8", xml_declaration=True)
with ZipFile(savePath, mode="w") as outZip:
@@ -1337,8 +1336,8 @@ class XMLParagraph:
def __init__(self, xRoot):
self._xRoot = xRoot
self._xTail = None
self._xSing = None
self._xTail = ET.Element("")
self._xSing = ET.Element("")
self._nState = X_ROOT_TEXT
self._chrPos = 0
+4 -4
View File
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="2.0.7" hexVersion="0x020007f0" fileVersion="1.5" timeStamp="2023-05-29 16:50:14">
<project id="e2be99af-f9bf-4403-857a-c3d1ac25abea" saveCount="1483" autoCount="237" editTime="74603">
<novelWriterXML appVersion="2.0.7" hexVersion="0x020007f0" fileVersion="1.5" timeStamp="2023-05-29 21:29:35">
<project id="e2be99af-f9bf-4403-857a-c3d1ac25abea" saveCount="1505" autoCount="237" editTime="74902">
<name>Sample Project</name>
<title>Sample Project</title>
<author>Jane Smith</author>
@@ -65,7 +65,7 @@
<name status="sf24ce6" import="ia857f0" active="yes">Chapter One</name>
</item>
<item handle="636b6aa9b697b" parent="6a2d6d5f4f401" root="7031beac91f75" order="0" type="FILE" class="NOVEL" layout="DOCUMENT">
<meta expanded="no" heading="H3" charCount="2687" wordCount="479" paraCount="14" cursorPos="1090" />
<meta expanded="no" heading="H3" charCount="2687" wordCount="479" paraCount="14" cursorPos="1369" />
<name status="s90e6c9" import="ia857f0" active="yes">Making a Scene</name>
</item>
<item handle="bc0cbd2a407f3" parent="6a2d6d5f4f401" root="7031beac91f75" order="1" type="FILE" class="NOVEL" layout="DOCUMENT">
@@ -153,4 +153,4 @@
<name status="sf12341" import="ia857f0" active="yes">Delete Me!</name>
</item>
</content>
</novelWriterXML>
</novelWriterXML>
@@ -1,13 +1,13 @@
<?xml version='1.0' encoding='utf-8'?>
<office:document xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 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" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
<office:meta>
<meta:creation-date>2023-05-29T20:00:01</meta:creation-date>
<meta:creation-date>2023-05-29T20:51:32</meta:creation-date>
<meta:generator>novelWriter/2.0.7</meta:generator>
<meta:initial-creator>lipsum.com</meta:initial-creator>
<meta:editing-cycles>40</meta:editing-cycles>
<meta:editing-duration>P0DT0H31M45S</meta:editing-duration>
<dc:title>Lorem Ipsum</dc:title>
<dc:date>2023-05-29T20:00:01</dc:date>
<dc:date>2023-05-29T20:51:32</dc:date>
<dc:creator>lipsum.com</dc:creator>
</office:meta>
<office:font-face-decls>
@@ -95,16 +95,13 @@
<office:body>
<office:text>
<text:p text:style-name="Title">Lorem Ipsum</text:p>
<text:p text:style-name="P1">
<text:span text:style-name="T1">By lipsum.com</text:span>
</text:p>
<text:p text:style-name="P1"><text:span text:style-name="T1">By lipsum.com</text:span></text:p>
<text:p text:style-name="P1">“Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit…”</text:p>
<text:p text:style-name="P1">“There is no one who loves pain itself, who seeks after it and wants to have it, simply because it is pain…”</text:p>
<text:p text:style-name="Text_20_body">Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of “de Finibus Bonorum et Malorum” (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, “Lorem ipsum dolor sit amet..”, comes from a line in section 1.10.32.</text:p>
<text:p text:style-name="Text_20_body">The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from “de Finibus Bonorum et Malorum” by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.</text:p>
<text:h text:style-name="P2" text:outline-level="2">Prologue</text:h>
<text:p text:style-name="Text_20_body">
<text:span text:style-name="T2">Lorem Ipsum</text:span> is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</text:p>
<text:p text:style-name="Text_20_body"><text:span text:style-name="T2">Lorem Ipsum</text:span> is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</text:p>
<text:h text:style-name="P3" text:outline-level="1">Act One</text:h>
<text:p text:style-name="P1">“Fusce maximus felis libero”</text:p>
<text:h text:style-name="P2" text:outline-level="2">Chapter 1: Chapter One</text:h>
@@ -1,105 +1,106 @@
<?xml version='1.0' encoding='utf-8'?>
<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
<office:document xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 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" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
<office:meta>
<meta:creation-date>2023-02-12T15:00:22</meta:creation-date>
<meta:generator>novelWriter/2.0.4</meta:generator>
<meta:creation-date>2023-05-29T20:57:00</meta:creation-date>
<meta:generator>novelWriter/2.0.7</meta:generator>
<meta:initial-creator>lipsum.com</meta:initial-creator>
<meta:editing-cycles>38</meta:editing-cycles>
<meta:editing-duration>P0DT0H31M40S</meta:editing-duration>
<meta:editing-cycles>40</meta:editing-cycles>
<meta:editing-duration>P0DT0H31M45S</meta:editing-duration>
<dc:title>Lorem Ipsum</dc:title>
<dc:date>2023-02-12T15:00:22</dc:date>
<dc:date>2023-05-29T20:57:00</dc:date>
<dc:creator>lipsum.com</dc:creator>
</office:meta>
<office:font-face-decls>
<style:font-face style:name="DejaVu Sans" style:font-pitch="variable"/>
<style:font-face style:name="DejaVu Sans" style:font-pitch="variable" />
</office:font-face-decls>
<office:styles>
<style:default-style style:family="paragraph">
<style:paragraph-properties style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="11pt" fo:language="en" fo:country="GB"/>
<style:paragraph-properties style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page" />
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="11pt" fo:language="en" fo:country="GB" />
</style:default-style>
<style:style style:name="Standard" style:family="paragraph" style:class="text">
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="11pt"/>
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="11pt" />
</style:style>
<style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text">
<style:paragraph-properties fo:margin-top="0.227cm" fo:margin-bottom="0.194cm" fo:keep-with-next="always"/>
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="13pt"/>
<style:paragraph-properties fo:margin-top="0.227cm" fo:margin-bottom="0.194cm" fo:keep-with-next="always" />
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="13pt" />
</style:style>
<style:style style:name="Header_20_and_20_Footer" style:display-name="Header and Footer" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"/>
<style:style style:name="Header_20_and_20_Footer" style:display-name="Header and Footer" style:family="paragraph" style:parent-style-name="Standard" style:class="extra" />
<style:style style:name="Text_20_body" style:family="paragraph" style:display-name="Text body" style:parent-style-name="Standard" style:class="text">
<style:paragraph-properties fo:margin-top="0.000cm" fo:margin-bottom="0.227cm" fo:line-height="115%" fo:text-align="justify"/>
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="11pt"/>
<style:paragraph-properties fo:margin-top="0.000cm" fo:margin-bottom="0.227cm" fo:line-height="115%" fo:text-align="justify" />
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="11pt" />
</style:style>
<style:style style:name="Text_20_Meta" style:family="paragraph" style:display-name="Text Meta" style:parent-style-name="Standard" style:class="text">
<style:paragraph-properties fo:margin-top="0.000cm" fo:margin-bottom="0.227cm" fo:line-height="115%"/>
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="11pt" fo:color="#813709" loext:opacity="100%"/>
<style:paragraph-properties fo:margin-top="0.000cm" fo:margin-bottom="0.227cm" fo:line-height="115%" />
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="11pt" fo:color="#813709" loext:opacity="100%" />
</style:style>
<style:style style:name="Title" style:family="paragraph" style:display-name="Title" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="chapter">
<style:paragraph-properties fo:margin-top="0.388cm" fo:margin-bottom="0.194cm" fo:text-align="center"/>
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="28pt" fo:font-weight="bold"/>
<style:paragraph-properties fo:margin-top="0.388cm" fo:margin-bottom="0.194cm" fo:text-align="center" />
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="28pt" fo:font-weight="bold" />
</style:style>
<style:style style:name="Heading_20_1" style:family="paragraph" style:display-name="Heading 1" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="1" style:class="text">
<style:paragraph-properties fo:margin-top="0.388cm" fo:margin-bottom="0.194cm"/>
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="22pt" fo:font-weight="bold" fo:color="#2a6099" loext:opacity="100%"/>
<style:paragraph-properties fo:margin-top="0.388cm" fo:margin-bottom="0.194cm" />
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="22pt" fo:font-weight="bold" fo:color="#2a6099" loext:opacity="100%" />
</style:style>
<style:style style:name="Heading_20_2" style:family="paragraph" style:display-name="Heading 2" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="2" style:class="text">
<style:paragraph-properties fo:margin-top="0.324cm" fo:margin-bottom="0.194cm"/>
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="18pt" fo:font-weight="bold" fo:color="#2a6099" loext:opacity="100%"/>
<style:paragraph-properties fo:margin-top="0.324cm" fo:margin-bottom="0.194cm" />
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="18pt" fo:font-weight="bold" fo:color="#2a6099" loext:opacity="100%" />
</style:style>
<style:style style:name="Heading_20_3" style:family="paragraph" style:display-name="Heading 3" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="3" style:class="text">
<style:paragraph-properties fo:margin-top="0.227cm" fo:margin-bottom="0.194cm"/>
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="14pt" fo:font-weight="bold" fo:color="#444444" loext:opacity="100%"/>
<style:paragraph-properties fo:margin-top="0.227cm" fo:margin-bottom="0.194cm" />
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="14pt" fo:font-weight="bold" fo:color="#444444" loext:opacity="100%" />
</style:style>
<style:style style:name="Heading_20_4" style:family="paragraph" style:display-name="Heading 4" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="4" style:class="text">
<style:paragraph-properties fo:margin-top="0.227cm" fo:margin-bottom="0.194cm"/>
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="13pt" fo:font-weight="bold" fo:color="#444444" loext:opacity="100%"/>
<style:paragraph-properties fo:margin-top="0.227cm" fo:margin-bottom="0.194cm" />
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="13pt" fo:font-weight="bold" fo:color="#444444" loext:opacity="100%" />
</style:style>
<style:style style:name="Header" style:family="paragraph" style:display-name="Header" style:parent-style-name="Header_20_and_20_Footer">
<style:paragraph-properties fo:text-align="right"/>
<style:paragraph-properties fo:text-align="right" />
</style:style>
</office:styles>
<office:automatic-styles>
<style:page-layout style:name="PM1">
<style:page-layout-properties fo:margin-top="2.000cm" fo:margin-bottom="2.000cm" fo:margin-left="2.000cm" fo:margin-right="2.000cm"/>
<style:page-layout-properties fo:margin-top="2.000cm" fo:margin-bottom="2.000cm" fo:margin-left="2.000cm" fo:margin-right="2.000cm" />
<style:header-style>
<style:header-footer-properties fo:min-height="0.600cm" fo:margin-left="0.000cm" fo:margin-right="0.000cm" fo:margin-bottom="0.500cm"/>
<style:header-footer-properties fo:min-height="0.600cm" fo:margin-left="0.000cm" fo:margin-right="0.000cm" fo:margin-bottom="0.500cm" />
</style:header-style>
</style:page-layout>
<style:style style:name="P1" style:family="paragraph" style:parent-style-name="Text_20_body">
<style:paragraph-properties fo:text-align="center"/>
<style:paragraph-properties fo:text-align="center" />
</style:style>
<style:style style:name="P2" style:family="paragraph" style:parent-style-name="Text_20_Meta">
<style:paragraph-properties fo:break-before="page"/>
<style:paragraph-properties fo:break-before="page" />
</style:style>
<style:style style:name="P3" style:family="paragraph" style:parent-style-name="Heading_20_2">
<style:paragraph-properties fo:break-before="page"/>
<style:paragraph-properties fo:break-before="page" />
</style:style>
<style:style style:name="P4" style:family="paragraph" style:parent-style-name="Heading_20_1">
<style:paragraph-properties fo:text-align="center" fo:break-before="page"/>
<style:paragraph-properties fo:text-align="center" fo:break-before="page" />
</style:style>
<style:style style:name="P5" style:family="paragraph" style:parent-style-name="Text_20_Meta">
<style:paragraph-properties fo:margin-bottom="0.000cm"/>
<style:paragraph-properties fo:margin-bottom="0.000cm" />
</style:style>
<style:style style:name="P6" style:family="paragraph" style:parent-style-name="Text_20_Meta">
<style:paragraph-properties fo:margin-top="0.000cm" fo:margin-bottom="0.000cm"/>
<style:paragraph-properties fo:margin-top="0.000cm" fo:margin-bottom="0.000cm" />
</style:style>
<style:style style:name="P7" style:family="paragraph" style:parent-style-name="Title">
<style:paragraph-properties fo:text-align="center" fo:break-before="page"/>
<style:paragraph-properties fo:text-align="center" fo:break-before="page" />
</style:style>
<style:style style:name="T1" style:family="text">
<style:text-properties fo:font-weight="bold"/>
<style:text-properties fo:font-weight="bold" />
</style:style>
<style:style style:name="T2" style:family="text">
<style:text-properties fo:font-style="italic"/>
<style:text-properties fo:font-style="italic" />
</style:style>
</office:automatic-styles>
<office:master-styles>
<style:master-page style:name="Standard" style:page-layout-name="PM1">
<style:header>
<text:p text:style-name="Header">Lorem Ipsum / lipsum.com / <text:page-number text:select-page="current">2</text:page-number></text:p>
<text:p text:style-name="Header">Lorem Ipsum / lipsum.com / <text:page-number text:select-page="current">2</text:page-number>
</text:p>
</style:header>
<style:header-first>
<text:p text:style-name="Header"/>
<text:p text:style-name="Header" />
</style:header-first>
</style:master-page>
</office:master-styles>
@@ -147,9 +148,9 @@
<text:p text:style-name="Text_20_body">Ut et consequat enim, quis ornare nibh. In lectus neque, mollis et suscipit et, vestibulum vitae augue. Praesent id ante sit amet odio venenatis placerat a at erat. Sed sed metus sed nisi dictum varius. Integer tincidunt fermentum purus ac porta. Fusce porttitor non risus eget tristique. Donec augue nunc, maximus at fermentum vel, varius et neque. Ut sed consectetur mauris. Quisque ipsum enim, porttitor vitae imperdiet sit amet, tempor et mauris. Aliquam malesuada tincidunt lectus quis blandit. Sed commodo orci felis, quis ultrices tellus facilisis sed. Nunc vel varius est. Duis ullamcorper eu metus in pulvinar. Morbi at sapien dictum, rutrum mauris eget, interdum tellus.</text:p>
<text:h text:style-name="P3" text:outline-level="2">Why do we use it?</text:h>
<text:p text:style-name="Text_20_Meta"><text:span text:style-name="T1">Comment:</text:span> Exctracted from the lipsum.com website.</text:p>
<text:p text:style-name="Text_20_body"><text:tab/>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.</text:p>
<text:p text:style-name="Text_20_body"><text:tab/>The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English.</text:p>
<text:p text:style-name="Text_20_body"><text:tab/>Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</text:p>
<text:p text:style-name="Text_20_body"><text:tab />It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.</text:p>
<text:p text:style-name="Text_20_body"><text:tab />The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English.</text:p>
<text:p text:style-name="Text_20_body"><text:tab />Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</text:p>
<text:h text:style-name="P3" text:outline-level="2">Chapter Two: Chapter Two</text:h>
<text:p text:style-name="P5"><text:span text:style-name="T1">Point of View:</text:span> Bod</text:p>
<text:p text:style-name="P6"><text:span text:style-name="T1">Plot:</text:span> Main</text:p>
@@ -1,105 +1,106 @@
<?xml version='1.0' encoding='utf-8'?>
<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
<office:document xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 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" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
<office:meta>
<meta:creation-date>2023-02-12T15:01:25</meta:creation-date>
<meta:generator>novelWriter/2.0.4</meta:generator>
<meta:creation-date>2023-05-29T21:06:32</meta:creation-date>
<meta:generator>novelWriter/2.0.7</meta:generator>
<meta:initial-creator>lipsum.com</meta:initial-creator>
<meta:editing-cycles>38</meta:editing-cycles>
<meta:editing-duration>P0DT0H31M40S</meta:editing-duration>
<meta:editing-cycles>40</meta:editing-cycles>
<meta:editing-duration>P0DT0H31M45S</meta:editing-duration>
<dc:title>Lorem Ipsum</dc:title>
<dc:date>2023-02-12T15:01:25</dc:date>
<dc:date>2023-05-29T21:06:32</dc:date>
<dc:creator>lipsum.com</dc:creator>
</office:meta>
<office:font-face-decls>
<style:font-face style:name="DejaVu Sans" style:font-pitch="variable"/>
<style:font-face style:name="DejaVu Sans" style:font-pitch="variable" />
</office:font-face-decls>
<office:styles>
<style:default-style style:family="paragraph">
<style:paragraph-properties style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="11pt" fo:language="en" fo:country="GB"/>
<style:paragraph-properties style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page" />
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="11pt" fo:language="en" fo:country="GB" />
</style:default-style>
<style:style style:name="Standard" style:family="paragraph" style:class="text">
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="11pt"/>
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="11pt" />
</style:style>
<style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text">
<style:paragraph-properties fo:margin-top="0.227cm" fo:margin-bottom="0.194cm" fo:keep-with-next="always"/>
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="13pt"/>
<style:paragraph-properties fo:margin-top="0.227cm" fo:margin-bottom="0.194cm" fo:keep-with-next="always" />
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="13pt" />
</style:style>
<style:style style:name="Header_20_and_20_Footer" style:display-name="Header and Footer" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"/>
<style:style style:name="Header_20_and_20_Footer" style:display-name="Header and Footer" style:family="paragraph" style:parent-style-name="Standard" style:class="extra" />
<style:style style:name="Text_20_body" style:family="paragraph" style:display-name="Text body" style:parent-style-name="Standard" style:class="text">
<style:paragraph-properties fo:margin-top="0.000cm" fo:margin-bottom="0.227cm" fo:line-height="115%" fo:text-align="justify"/>
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="11pt"/>
<style:paragraph-properties fo:margin-top="0.000cm" fo:margin-bottom="0.227cm" fo:line-height="115%" fo:text-align="justify" />
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="11pt" />
</style:style>
<style:style style:name="Text_20_Meta" style:family="paragraph" style:display-name="Text Meta" style:parent-style-name="Standard" style:class="text">
<style:paragraph-properties fo:margin-top="0.000cm" fo:margin-bottom="0.227cm" fo:line-height="115%"/>
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="11pt" fo:color="#813709" loext:opacity="100%"/>
<style:paragraph-properties fo:margin-top="0.000cm" fo:margin-bottom="0.227cm" fo:line-height="115%" />
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="11pt" fo:color="#813709" loext:opacity="100%" />
</style:style>
<style:style style:name="Title" style:family="paragraph" style:display-name="Title" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="chapter">
<style:paragraph-properties fo:margin-top="0.388cm" fo:margin-bottom="0.194cm" fo:text-align="center"/>
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="28pt" fo:font-weight="bold"/>
<style:paragraph-properties fo:margin-top="0.388cm" fo:margin-bottom="0.194cm" fo:text-align="center" />
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="28pt" fo:font-weight="bold" />
</style:style>
<style:style style:name="Heading_20_1" style:family="paragraph" style:display-name="Heading 1" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="1" style:class="text">
<style:paragraph-properties fo:margin-top="0.388cm" fo:margin-bottom="0.194cm"/>
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="22pt" fo:font-weight="bold" fo:color="#2a6099" loext:opacity="100%"/>
<style:paragraph-properties fo:margin-top="0.388cm" fo:margin-bottom="0.194cm" />
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="22pt" fo:font-weight="bold" fo:color="#2a6099" loext:opacity="100%" />
</style:style>
<style:style style:name="Heading_20_2" style:family="paragraph" style:display-name="Heading 2" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="2" style:class="text">
<style:paragraph-properties fo:margin-top="0.324cm" fo:margin-bottom="0.194cm"/>
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="18pt" fo:font-weight="bold" fo:color="#2a6099" loext:opacity="100%"/>
<style:paragraph-properties fo:margin-top="0.324cm" fo:margin-bottom="0.194cm" />
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="18pt" fo:font-weight="bold" fo:color="#2a6099" loext:opacity="100%" />
</style:style>
<style:style style:name="Heading_20_3" style:family="paragraph" style:display-name="Heading 3" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="3" style:class="text">
<style:paragraph-properties fo:margin-top="0.227cm" fo:margin-bottom="0.194cm"/>
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="14pt" fo:font-weight="bold" fo:color="#444444" loext:opacity="100%"/>
<style:paragraph-properties fo:margin-top="0.227cm" fo:margin-bottom="0.194cm" />
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="14pt" fo:font-weight="bold" fo:color="#444444" loext:opacity="100%" />
</style:style>
<style:style style:name="Heading_20_4" style:family="paragraph" style:display-name="Heading 4" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="4" style:class="text">
<style:paragraph-properties fo:margin-top="0.227cm" fo:margin-bottom="0.194cm"/>
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="13pt" fo:font-weight="bold" fo:color="#444444" loext:opacity="100%"/>
<style:paragraph-properties fo:margin-top="0.227cm" fo:margin-bottom="0.194cm" />
<style:text-properties style:font-name="DejaVu Sans" fo:font-family="'DejaVu Sans'" fo:font-size="13pt" fo:font-weight="bold" fo:color="#444444" loext:opacity="100%" />
</style:style>
<style:style style:name="Header" style:family="paragraph" style:display-name="Header" style:parent-style-name="Header_20_and_20_Footer">
<style:paragraph-properties fo:text-align="right"/>
<style:paragraph-properties fo:text-align="right" />
</style:style>
</office:styles>
<office:automatic-styles>
<style:page-layout style:name="PM1">
<style:page-layout-properties fo:margin-top="2.000cm" fo:margin-bottom="2.000cm" fo:margin-left="2.000cm" fo:margin-right="2.000cm"/>
<style:page-layout-properties fo:margin-top="2.000cm" fo:margin-bottom="2.000cm" fo:margin-left="2.000cm" fo:margin-right="2.000cm" />
<style:header-style>
<style:header-footer-properties fo:min-height="0.600cm" fo:margin-left="0.000cm" fo:margin-right="0.000cm" fo:margin-bottom="0.500cm"/>
<style:header-footer-properties fo:min-height="0.600cm" fo:margin-left="0.000cm" fo:margin-right="0.000cm" fo:margin-bottom="0.500cm" />
</style:header-style>
</style:page-layout>
<style:style style:name="P1" style:family="paragraph" style:parent-style-name="Text_20_body">
<style:paragraph-properties fo:text-align="center"/>
<style:paragraph-properties fo:text-align="center" />
</style:style>
<style:style style:name="P2" style:family="paragraph" style:parent-style-name="Text_20_Meta">
<style:paragraph-properties fo:break-before="page"/>
<style:paragraph-properties fo:break-before="page" />
</style:style>
<style:style style:name="P3" style:family="paragraph" style:parent-style-name="Heading_20_2">
<style:paragraph-properties fo:break-before="page"/>
<style:paragraph-properties fo:break-before="page" />
</style:style>
<style:style style:name="P4" style:family="paragraph" style:parent-style-name="Heading_20_1">
<style:paragraph-properties fo:text-align="center" fo:break-before="page"/>
<style:paragraph-properties fo:text-align="center" fo:break-before="page" />
</style:style>
<style:style style:name="P5" style:family="paragraph" style:parent-style-name="Text_20_Meta">
<style:paragraph-properties fo:margin-bottom="0.000cm"/>
<style:paragraph-properties fo:margin-bottom="0.000cm" />
</style:style>
<style:style style:name="P6" style:family="paragraph" style:parent-style-name="Text_20_Meta">
<style:paragraph-properties fo:margin-top="0.000cm" fo:margin-bottom="0.000cm"/>
<style:paragraph-properties fo:margin-top="0.000cm" fo:margin-bottom="0.000cm" />
</style:style>
<style:style style:name="P7" style:family="paragraph" style:parent-style-name="Title">
<style:paragraph-properties fo:text-align="center" fo:break-before="page"/>
<style:paragraph-properties fo:text-align="center" fo:break-before="page" />
</style:style>
<style:style style:name="T1" style:family="text">
<style:text-properties fo:font-weight="bold"/>
<style:text-properties fo:font-weight="bold" />
</style:style>
<style:style style:name="T2" style:family="text">
<style:text-properties fo:font-style="italic"/>
<style:text-properties fo:font-style="italic" />
</style:style>
</office:automatic-styles>
<office:master-styles>
<style:master-page style:name="Standard" style:page-layout-name="PM1">
<style:header>
<text:p text:style-name="Header">Lorem Ipsum / lipsum.com / <text:page-number text:select-page="current">2</text:page-number></text:p>
<text:p text:style-name="Header">Lorem Ipsum / lipsum.com / <text:page-number text:select-page="current">2</text:page-number>
</text:p>
</style:header>
<style:header-first>
<text:p text:style-name="Header"/>
<text:p text:style-name="Header" />
</style:header-first>
</style:master-page>
</office:master-styles>
@@ -147,9 +148,9 @@
<text:p text:style-name="Text_20_body">Ut et consequat enim, quis ornare nibh. In lectus neque, mollis et suscipit et, vestibulum vitae augue. Praesent id ante sit amet odio venenatis placerat a at erat. Sed sed metus sed nisi dictum varius. Integer tincidunt fermentum purus ac porta. Fusce porttitor non risus eget tristique. Donec augue nunc, maximus at fermentum vel, varius et neque. Ut sed consectetur mauris. Quisque ipsum enim, porttitor vitae imperdiet sit amet, tempor et mauris. Aliquam malesuada tincidunt lectus quis blandit. Sed commodo orci felis, quis ultrices tellus facilisis sed. Nunc vel varius est. Duis ullamcorper eu metus in pulvinar. Morbi at sapien dictum, rutrum mauris eget, interdum tellus.</text:p>
<text:h text:style-name="P3" text:outline-level="2">Why do we use it?</text:h>
<text:p text:style-name="Text_20_Meta"><text:span text:style-name="T1">Comment:</text:span> Exctracted from the lipsum.com website.</text:p>
<text:p text:style-name="Text_20_body"><text:tab/>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.</text:p>
<text:p text:style-name="Text_20_body"><text:tab/>The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English.</text:p>
<text:p text:style-name="Text_20_body"><text:tab/>Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</text:p>
<text:p text:style-name="Text_20_body"><text:tab />It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.</text:p>
<text:p text:style-name="Text_20_body"><text:tab />The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English.</text:p>
<text:p text:style-name="Text_20_body"><text:tab />Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</text:p>
<text:h text:style-name="P3" text:outline-level="2">Chapter Two: Chapter Two</text:h>
<text:p text:style-name="P5"><text:span text:style-name="T1">Point of View:</text:span> Bod</text:p>
<text:p text:style-name="P6"><text:span text:style-name="T1">Plot:</text:span> Main</text:p>
+28 -27
View File
@@ -64,21 +64,21 @@ def testCoreToOdt_Init(mockGUI):
theDoc.initDocument()
# Document XML
assert theDoc._dFlat is not None
assert theDoc._dCont is None
assert theDoc._dMeta is None
assert theDoc._dStyl is None
assert theDoc._dFlat.tag == _mkTag("office", "document")
assert theDoc._dCont.tag == ""
assert theDoc._dMeta.tag == ""
assert theDoc._dStyl.tag == ""
# Content XML
assert theDoc._xMeta is not None
assert theDoc._xFont is not None
assert theDoc._xFnt2 is None
assert theDoc._xStyl is not None
assert theDoc._xAuto is not None
assert theDoc._xAut2 is None
assert theDoc._xMast is not None
assert theDoc._xBody is not None
assert theDoc._xText is not None
assert theDoc._xMeta.tag == _mkTag("office", "meta")
assert theDoc._xFont.tag == _mkTag("office", "font-face-decls")
assert theDoc._xFnt2.tag == ""
assert theDoc._xStyl.tag == _mkTag("office", "styles")
assert theDoc._xAuto.tag == _mkTag("office", "automatic-styles")
assert theDoc._xAut2.tag == ""
assert theDoc._xMast.tag == _mkTag("office", "master-styles")
assert theDoc._xBody.tag == _mkTag("office", "body")
assert theDoc._xText.tag == _mkTag("office", "text")
# ODT Doc
# =======
@@ -87,21 +87,22 @@ def testCoreToOdt_Init(mockGUI):
theDoc.initDocument()
# Document XML
assert theDoc._dFlat is None
assert theDoc._dCont is not None
assert theDoc._dMeta is not None
assert theDoc._dStyl is not None
assert theDoc._dFlat.tag == ""
assert theDoc._dCont.tag == _mkTag("office", "document-content")
assert theDoc._dMeta.tag == _mkTag("office", "document-meta")
assert theDoc._dStyl.tag == _mkTag("office", "document-styles")
# Content XML
assert theDoc._xMeta is not None
assert theDoc._xFont is not None
assert theDoc._xFnt2 is not None
assert theDoc._xStyl is not None
assert theDoc._xAuto is not None
assert theDoc._xAut2 is not None
assert theDoc._xMast is not None
assert theDoc._xBody is not None
assert theDoc._xText is not None
assert theDoc._xMeta.tag == _mkTag("office", "meta")
assert theDoc._xFont.tag == _mkTag("office", "font-face-decls")
assert theDoc._xFnt2.tag == _mkTag("office", "font-face-decls")
assert theDoc._xStyl.tag == _mkTag("office", "styles")
assert theDoc._xAuto.tag == _mkTag("office", "automatic-styles")
assert theDoc._xAut2.tag == _mkTag("office", "automatic-styles")
assert theDoc._xMast.tag == _mkTag("office", "master-styles")
assert theDoc._xBody.tag == _mkTag("office", "body")
assert theDoc._xText.tag == _mkTag("office", "text")
# END Test testCoreToOdt_Init
@@ -726,7 +727,7 @@ def testCoreToOdt_SaveFull(mockGUI, fncPath, tstPaths):
def prettifyXml(inFile, outFile):
with open(outFile, mode="wb") as fStream:
xml = ET.parse(inFile)
xmlIndent(xml, space=" ")
xmlIndent(xml)
xml.write(fStream, encoding="utf-8", xml_declaration=True)
prettifyXml(maniOut, maniFile)