Update XML classes and tests
This commit is contained in:
@@ -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/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
|
||||||
import logging
|
import logging
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
|
|
||||||
@@ -561,10 +560,7 @@ class ProjectXMLWriter:
|
|||||||
backFile = saveFile.with_suffix(".bak")
|
backFile = saveFile.with_suffix(".bak")
|
||||||
try:
|
try:
|
||||||
xml = ET.ElementTree(xRoot)
|
xml = ET.ElementTree(xRoot)
|
||||||
if sys.hexversion < 0x030900f0:
|
xmlIndent(xml)
|
||||||
xmlIndent(xml, space=" ")
|
|
||||||
else:
|
|
||||||
ET.indent(xml, space=" ")
|
|
||||||
xml.write(tempFile, encoding="utf-8", xml_declaration=True)
|
xml.write(tempFile, encoding="utf-8", xml_declaration=True)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
self._error = exc
|
self._error = exc
|
||||||
|
|||||||
+16
-17
@@ -92,20 +92,20 @@ class ToOdt(Tokenizer):
|
|||||||
|
|
||||||
self._isFlat = isFlat # Flat: .fodt, otherwise .odt
|
self._isFlat = isFlat # Flat: .fodt, otherwise .odt
|
||||||
|
|
||||||
self._dFlat = None # FODT file XML root
|
self._dFlat = ET.Element("") # FODT file XML root
|
||||||
self._dCont = None # ODT content.xml root
|
self._dCont = ET.Element("") # ODT content.xml root
|
||||||
self._dMeta = None # ODT meta.xml root
|
self._dMeta = ET.Element("") # ODT meta.xml root
|
||||||
self._dStyl = None # ODT styles.xml root
|
self._dStyl = ET.Element("") # ODT styles.xml root
|
||||||
|
|
||||||
self._xMeta = None # Office meta root
|
self._xMeta = ET.Element("") # Office meta root
|
||||||
self._xFont = None # Office font face declaration
|
self._xFont = ET.Element("") # Office font face declaration
|
||||||
self._xFnt2 = None # Office font face declaration, secondary
|
self._xFnt2 = ET.Element("") # Office font face declaration, secondary
|
||||||
self._xStyl = None # Office styles root
|
self._xStyl = ET.Element("") # Office styles root
|
||||||
self._xAuto = None # Office auto-styles root
|
self._xAuto = ET.Element("") # Office auto-styles root
|
||||||
self._xAut2 = None # Office auto-styles root, secondary
|
self._xAut2 = ET.Element("") # Office auto-styles root, secondary
|
||||||
self._xMast = None # Office master-styles root
|
self._xMast = ET.Element("") # Office master-styles root
|
||||||
self._xBody = None # Office body root
|
self._xBody = ET.Element("") # Office body root
|
||||||
self._xText = None # Office text root
|
self._xText = ET.Element("") # Office text root
|
||||||
|
|
||||||
self._mainPara = {} # User-accessible paragraph styles
|
self._mainPara = {} # User-accessible paragraph styles
|
||||||
self._autoPara = {} # Auto-generated paragraph styles
|
self._autoPara = {} # Auto-generated paragraph styles
|
||||||
@@ -502,7 +502,7 @@ class ToOdt(Tokenizer):
|
|||||||
"""
|
"""
|
||||||
with open(savePath, mode="wb") as outFile:
|
with open(savePath, mode="wb") as outFile:
|
||||||
xml = ET.ElementTree(self._dFlat)
|
xml = ET.ElementTree(self._dFlat)
|
||||||
xmlIndent(xml, space=" ")
|
xmlIndent(xml)
|
||||||
xml.write(outFile, encoding="utf-8", xml_declaration=True)
|
xml.write(outFile, encoding="utf-8", xml_declaration=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -529,7 +529,6 @@ class ToOdt(Tokenizer):
|
|||||||
def putInZip(name, xObj, zipObj):
|
def putInZip(name, xObj, zipObj):
|
||||||
with zipObj.open(name, mode="w") as fObj:
|
with zipObj.open(name, mode="w") as fObj:
|
||||||
xml = ET.ElementTree(xObj)
|
xml = ET.ElementTree(xObj)
|
||||||
xmlIndent(xml, space=" ")
|
|
||||||
xml.write(fObj, encoding="utf-8", xml_declaration=True)
|
xml.write(fObj, encoding="utf-8", xml_declaration=True)
|
||||||
|
|
||||||
with ZipFile(savePath, mode="w") as outZip:
|
with ZipFile(savePath, mode="w") as outZip:
|
||||||
@@ -1337,8 +1336,8 @@ class XMLParagraph:
|
|||||||
def __init__(self, xRoot):
|
def __init__(self, xRoot):
|
||||||
|
|
||||||
self._xRoot = xRoot
|
self._xRoot = xRoot
|
||||||
self._xTail = None
|
self._xTail = ET.Element("")
|
||||||
self._xSing = None
|
self._xSing = ET.Element("")
|
||||||
|
|
||||||
self._nState = X_ROOT_TEXT
|
self._nState = X_ROOT_TEXT
|
||||||
self._chrPos = 0
|
self._chrPos = 0
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<novelWriterXML appVersion="2.0.7" hexVersion="0x020007f0" fileVersion="1.5" timeStamp="2023-05-29 16:50:14">
|
<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="1483" autoCount="237" editTime="74603">
|
<project id="e2be99af-f9bf-4403-857a-c3d1ac25abea" saveCount="1505" autoCount="237" editTime="74902">
|
||||||
<name>Sample Project</name>
|
<name>Sample Project</name>
|
||||||
<title>Sample Project</title>
|
<title>Sample Project</title>
|
||||||
<author>Jane Smith</author>
|
<author>Jane Smith</author>
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
<name status="sf24ce6" import="ia857f0" active="yes">Chapter One</name>
|
<name status="sf24ce6" import="ia857f0" active="yes">Chapter One</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="636b6aa9b697b" parent="6a2d6d5f4f401" root="7031beac91f75" order="0" type="FILE" class="NOVEL" layout="DOCUMENT">
|
<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>
|
<name status="s90e6c9" import="ia857f0" active="yes">Making a Scene</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="bc0cbd2a407f3" parent="6a2d6d5f4f401" root="7031beac91f75" order="1" type="FILE" class="NOVEL" layout="DOCUMENT">
|
<item handle="bc0cbd2a407f3" parent="6a2d6d5f4f401" root="7031beac91f75" order="1" type="FILE" class="NOVEL" layout="DOCUMENT">
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?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: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>
|
<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:generator>novelWriter/2.0.7</meta:generator>
|
||||||
<meta:initial-creator>lipsum.com</meta:initial-creator>
|
<meta:initial-creator>lipsum.com</meta:initial-creator>
|
||||||
<meta:editing-cycles>40</meta:editing-cycles>
|
<meta:editing-cycles>40</meta:editing-cycles>
|
||||||
<meta:editing-duration>P0DT0H31M45S</meta:editing-duration>
|
<meta:editing-duration>P0DT0H31M45S</meta:editing-duration>
|
||||||
<dc:title>Lorem Ipsum</dc:title>
|
<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>
|
<dc:creator>lipsum.com</dc:creator>
|
||||||
</office:meta>
|
</office:meta>
|
||||||
<office:font-face-decls>
|
<office:font-face-decls>
|
||||||
@@ -95,16 +95,13 @@
|
|||||||
<office:body>
|
<office:body>
|
||||||
<office:text>
|
<office:text>
|
||||||
<text:p text:style-name="Title">Lorem Ipsum</text:p>
|
<text:p text:style-name="Title">Lorem Ipsum</text:p>
|
||||||
<text:p text:style-name="P1">
|
<text:p text:style-name="P1"><text:span text:style-name="T1">By lipsum.com</text:span></text:p>
|
||||||
<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">“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="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">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: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:h text:style-name="P2" text:outline-level="2">Prologue</text:h>
|
||||||
<text:p text:style-name="Text_20_body">
|
<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: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: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: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>
|
<text:h text:style-name="P2" text:outline-level="2">Chapter 1: Chapter One</text:h>
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?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>
|
<office:meta>
|
||||||
<meta:creation-date>2023-02-12T15:00:22</meta:creation-date>
|
<meta:creation-date>2023-05-29T20:57:00</meta:creation-date>
|
||||||
<meta:generator>novelWriter/2.0.4</meta:generator>
|
<meta:generator>novelWriter/2.0.7</meta:generator>
|
||||||
<meta:initial-creator>lipsum.com</meta:initial-creator>
|
<meta:initial-creator>lipsum.com</meta:initial-creator>
|
||||||
<meta:editing-cycles>38</meta:editing-cycles>
|
<meta:editing-cycles>40</meta:editing-cycles>
|
||||||
<meta:editing-duration>P0DT0H31M40S</meta:editing-duration>
|
<meta:editing-duration>P0DT0H31M45S</meta:editing-duration>
|
||||||
<dc:title>Lorem Ipsum</dc:title>
|
<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>
|
<dc:creator>lipsum.com</dc:creator>
|
||||||
</office:meta>
|
</office:meta>
|
||||||
<office:font-face-decls>
|
<office:font-face-decls>
|
||||||
@@ -96,7 +96,8 @@
|
|||||||
<office:master-styles>
|
<office:master-styles>
|
||||||
<style:master-page style:name="Standard" style:page-layout-name="PM1">
|
<style:master-page style:name="Standard" style:page-layout-name="PM1">
|
||||||
<style:header>
|
<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>
|
||||||
<style:header-first>
|
<style:header-first>
|
||||||
<text:p text:style-name="Header" />
|
<text:p text:style-name="Header" />
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?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>
|
<office:meta>
|
||||||
<meta:creation-date>2023-02-12T15:01:25</meta:creation-date>
|
<meta:creation-date>2023-05-29T21:06:32</meta:creation-date>
|
||||||
<meta:generator>novelWriter/2.0.4</meta:generator>
|
<meta:generator>novelWriter/2.0.7</meta:generator>
|
||||||
<meta:initial-creator>lipsum.com</meta:initial-creator>
|
<meta:initial-creator>lipsum.com</meta:initial-creator>
|
||||||
<meta:editing-cycles>38</meta:editing-cycles>
|
<meta:editing-cycles>40</meta:editing-cycles>
|
||||||
<meta:editing-duration>P0DT0H31M40S</meta:editing-duration>
|
<meta:editing-duration>P0DT0H31M45S</meta:editing-duration>
|
||||||
<dc:title>Lorem Ipsum</dc:title>
|
<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>
|
<dc:creator>lipsum.com</dc:creator>
|
||||||
</office:meta>
|
</office:meta>
|
||||||
<office:font-face-decls>
|
<office:font-face-decls>
|
||||||
@@ -96,7 +96,8 @@
|
|||||||
<office:master-styles>
|
<office:master-styles>
|
||||||
<style:master-page style:name="Standard" style:page-layout-name="PM1">
|
<style:master-page style:name="Standard" style:page-layout-name="PM1">
|
||||||
<style:header>
|
<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>
|
||||||
<style:header-first>
|
<style:header-first>
|
||||||
<text:p text:style-name="Header" />
|
<text:p text:style-name="Header" />
|
||||||
|
|||||||
@@ -64,21 +64,21 @@ def testCoreToOdt_Init(mockGUI):
|
|||||||
theDoc.initDocument()
|
theDoc.initDocument()
|
||||||
|
|
||||||
# Document XML
|
# Document XML
|
||||||
assert theDoc._dFlat is not None
|
assert theDoc._dFlat.tag == _mkTag("office", "document")
|
||||||
assert theDoc._dCont is None
|
assert theDoc._dCont.tag == ""
|
||||||
assert theDoc._dMeta is None
|
assert theDoc._dMeta.tag == ""
|
||||||
assert theDoc._dStyl is None
|
assert theDoc._dStyl.tag == ""
|
||||||
|
|
||||||
# Content XML
|
# Content XML
|
||||||
assert theDoc._xMeta is not None
|
assert theDoc._xMeta.tag == _mkTag("office", "meta")
|
||||||
assert theDoc._xFont is not None
|
assert theDoc._xFont.tag == _mkTag("office", "font-face-decls")
|
||||||
assert theDoc._xFnt2 is None
|
assert theDoc._xFnt2.tag == ""
|
||||||
assert theDoc._xStyl is not None
|
assert theDoc._xStyl.tag == _mkTag("office", "styles")
|
||||||
assert theDoc._xAuto is not None
|
assert theDoc._xAuto.tag == _mkTag("office", "automatic-styles")
|
||||||
assert theDoc._xAut2 is None
|
assert theDoc._xAut2.tag == ""
|
||||||
assert theDoc._xMast is not None
|
assert theDoc._xMast.tag == _mkTag("office", "master-styles")
|
||||||
assert theDoc._xBody is not None
|
assert theDoc._xBody.tag == _mkTag("office", "body")
|
||||||
assert theDoc._xText is not None
|
assert theDoc._xText.tag == _mkTag("office", "text")
|
||||||
|
|
||||||
# ODT Doc
|
# ODT Doc
|
||||||
# =======
|
# =======
|
||||||
@@ -87,21 +87,22 @@ def testCoreToOdt_Init(mockGUI):
|
|||||||
theDoc.initDocument()
|
theDoc.initDocument()
|
||||||
|
|
||||||
# Document XML
|
# Document XML
|
||||||
assert theDoc._dFlat is None
|
assert theDoc._dFlat.tag == ""
|
||||||
assert theDoc._dCont is not None
|
assert theDoc._dCont.tag == _mkTag("office", "document-content")
|
||||||
assert theDoc._dMeta is not None
|
assert theDoc._dMeta.tag == _mkTag("office", "document-meta")
|
||||||
assert theDoc._dStyl is not None
|
assert theDoc._dStyl.tag == _mkTag("office", "document-styles")
|
||||||
|
|
||||||
# Content XML
|
# Content XML
|
||||||
assert theDoc._xMeta is not None
|
assert theDoc._xMeta.tag == _mkTag("office", "meta")
|
||||||
assert theDoc._xFont is not None
|
assert theDoc._xFont.tag == _mkTag("office", "font-face-decls")
|
||||||
assert theDoc._xFnt2 is not None
|
assert theDoc._xFnt2.tag == _mkTag("office", "font-face-decls")
|
||||||
assert theDoc._xStyl is not None
|
assert theDoc._xStyl.tag == _mkTag("office", "styles")
|
||||||
assert theDoc._xAuto is not None
|
assert theDoc._xAuto.tag == _mkTag("office", "automatic-styles")
|
||||||
assert theDoc._xAut2 is not None
|
assert theDoc._xAut2.tag == _mkTag("office", "automatic-styles")
|
||||||
assert theDoc._xMast is not None
|
assert theDoc._xMast.tag == _mkTag("office", "master-styles")
|
||||||
assert theDoc._xBody is not None
|
assert theDoc._xBody.tag == _mkTag("office", "body")
|
||||||
assert theDoc._xText is not None
|
assert theDoc._xText.tag == _mkTag("office", "text")
|
||||||
|
|
||||||
|
|
||||||
# END Test testCoreToOdt_Init
|
# END Test testCoreToOdt_Init
|
||||||
|
|
||||||
@@ -726,7 +727,7 @@ def testCoreToOdt_SaveFull(mockGUI, fncPath, tstPaths):
|
|||||||
def prettifyXml(inFile, outFile):
|
def prettifyXml(inFile, outFile):
|
||||||
with open(outFile, mode="wb") as fStream:
|
with open(outFile, mode="wb") as fStream:
|
||||||
xml = ET.parse(inFile)
|
xml = ET.parse(inFile)
|
||||||
xmlIndent(xml, space=" ")
|
xmlIndent(xml)
|
||||||
xml.write(fStream, encoding="utf-8", xml_declaration=True)
|
xml.write(fStream, encoding="utf-8", xml_declaration=True)
|
||||||
|
|
||||||
prettifyXml(maniOut, maniFile)
|
prettifyXml(maniOut, maniFile)
|
||||||
|
|||||||
Reference in New Issue
Block a user