Update ODT and DocX to work with new chapter headers
This commit is contained in:
@@ -271,7 +271,7 @@ class ToDocX(Tokenizer):
|
|||||||
if tType == BlockTyp.TEXT:
|
if tType == BlockTyp.TEXT:
|
||||||
self._processFragments(par, S_NORM, tText, tFormat)
|
self._processFragments(par, S_NORM, tText, tFormat)
|
||||||
|
|
||||||
elif tType == BlockTyp.TITLE:
|
elif tType in (BlockTyp.TITLE, BlockTyp.PART):
|
||||||
self._processFragments(par, S_TITLE, tText, tFormat)
|
self._processFragments(par, S_TITLE, tText, tFormat)
|
||||||
|
|
||||||
elif tType == BlockTyp.HEAD1:
|
elif tType == BlockTyp.HEAD1:
|
||||||
|
|||||||
@@ -363,7 +363,7 @@ class ToOdt(Tokenizer):
|
|||||||
else:
|
else:
|
||||||
self._addTextPar(xText, S_TEXT, oStyle, tText, tFmt=tFormat)
|
self._addTextPar(xText, S_TEXT, oStyle, tText, tFmt=tFormat)
|
||||||
|
|
||||||
elif tType == BlockTyp.TITLE:
|
elif tType in (BlockTyp.TITLE, BlockTyp.PART):
|
||||||
# Title must be text:p
|
# Title must be text:p
|
||||||
self._addTextPar(xText, S_TITLE, oStyle, tText, isHead=False)
|
self._addTextPar(xText, S_TITLE, oStyle, tText, isHead=False)
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,7 @@
|
|||||||
</w:p>
|
</w:p>
|
||||||
<w:p>
|
<w:p>
|
||||||
<w:pPr>
|
<w:pPr>
|
||||||
<w:pStyle w:val="Heading2" />
|
<w:pStyle w:val="Heading1" />
|
||||||
</w:pPr>
|
</w:pPr>
|
||||||
<w:r>
|
<w:r>
|
||||||
<w:rPr />
|
<w:rPr />
|
||||||
@@ -198,7 +198,7 @@
|
|||||||
</w:p>
|
</w:p>
|
||||||
<w:p>
|
<w:p>
|
||||||
<w:pPr>
|
<w:pPr>
|
||||||
<w:pStyle w:val="Heading1" />
|
<w:pStyle w:val="Title" />
|
||||||
<w:jc w:val="center" />
|
<w:jc w:val="center" />
|
||||||
</w:pPr>
|
</w:pPr>
|
||||||
<w:r>
|
<w:r>
|
||||||
@@ -221,7 +221,7 @@
|
|||||||
</w:p>
|
</w:p>
|
||||||
<w:p>
|
<w:p>
|
||||||
<w:pPr>
|
<w:pPr>
|
||||||
<w:pStyle w:val="Heading2" />
|
<w:pStyle w:val="Heading1" />
|
||||||
</w:pPr>
|
</w:pPr>
|
||||||
<w:r>
|
<w:r>
|
||||||
<w:rPr />
|
<w:rPr />
|
||||||
@@ -624,7 +624,7 @@
|
|||||||
</w:p>
|
</w:p>
|
||||||
<w:p>
|
<w:p>
|
||||||
<w:pPr>
|
<w:pPr>
|
||||||
<w:pStyle w:val="Heading2" />
|
<w:pStyle w:val="Heading1" />
|
||||||
</w:pPr>
|
</w:pPr>
|
||||||
<w:r>
|
<w:r>
|
||||||
<w:rPr />
|
<w:rPr />
|
||||||
|
|||||||
@@ -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:number="urn:oasis:names:tc:opendocument:xmlns:datastyle: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" xmlns:xlink="http://www.w3.org/1999/xlink" 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:number="urn:oasis:names:tc:opendocument:xmlns:datastyle: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" xmlns:xlink="http://www.w3.org/1999/xlink" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
|
||||||
<office:meta>
|
<office:meta>
|
||||||
<meta:creation-date>2024-11-29T00:34:11</meta:creation-date>
|
<meta:creation-date>2025-01-25T16:05:30</meta:creation-date>
|
||||||
<meta:generator>novelWriter/2.6b1</meta:generator>
|
<meta:generator>novelWriter/2.6rc1</meta:generator>
|
||||||
<meta:initial-creator>Jane Smith</meta:initial-creator>
|
<meta:initial-creator>Jane Smith</meta:initial-creator>
|
||||||
<meta:editing-cycles>1234</meta:editing-cycles>
|
<meta:editing-cycles>1234</meta:editing-cycles>
|
||||||
<meta:editing-duration>P42DT12H34M56S</meta:editing-duration>
|
<meta:editing-duration>P42DT12H34M56S</meta:editing-duration>
|
||||||
<dc:title>Test Project</dc:title>
|
<dc:title>Test Project</dc:title>
|
||||||
<dc:date>2024-11-29T00:34:11</dc:date>
|
<dc:date>2025-01-25T16:05:30</dc:date>
|
||||||
<dc:creator>Jane Smith</dc:creator>
|
<dc:creator>Jane Smith</dc:creator>
|
||||||
</office:meta>
|
</office:meta>
|
||||||
<office:font-face-decls>
|
<office:font-face-decls>
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
<style:header-footer-properties fo:min-height="0.635cm" fo:margin-left="0.000cm" fo:margin-right="0.000cm" fo:margin-bottom="0.212cm" />
|
<style:header-footer-properties fo:min-height="0.635cm" fo:margin-left="0.000cm" fo:margin-right="0.000cm" fo:margin-bottom="0.212cm" />
|
||||||
</style:header-style>
|
</style:header-style>
|
||||||
</style:page-layout>
|
</style:page-layout>
|
||||||
<style:style style:name="P1" style:family="paragraph" style:parent-style-name="Heading_20_2">
|
<style:style style:name="P1" style:family="paragraph" style:parent-style-name="Heading_20_1">
|
||||||
<style:paragraph-properties fo:break-before="page" />
|
<style:paragraph-properties fo:break-before="page" />
|
||||||
</style:style>
|
</style:style>
|
||||||
<style:style style:name="T1" style:family="text">
|
<style:style style:name="T1" style:family="text">
|
||||||
@@ -116,9 +116,9 @@
|
|||||||
</text:user-field-decls>
|
</text:user-field-decls>
|
||||||
<text:p text:style-name="Title">My Novel</text:p>
|
<text:p text:style-name="Title">My Novel</text:p>
|
||||||
<text:p text:style-name="Text_20_body"><text:span text:style-name="T1">Word Count: </text:span><text:span text:style-name="T1"><text:user-field-get style:data-style-name="N0" text:name="ManuscriptAllWords">0</text:user-field-get></text:span><text:line-break /><text:user-field-get style:data-style-name="N0" text:name="ManuscriptParagraphCount">0</text:user-field-get> paragrphs<text:line-break />Web: <text:a xlink:type="simple" xlink:href="http://example.com" text:style-name="T2">http://example.com</text:a></text:p>
|
<text:p text:style-name="Text_20_body"><text:span text:style-name="T1">Word Count: </text:span><text:span text:style-name="T1"><text:user-field-get style:data-style-name="N0" text:name="ManuscriptAllWords">0</text:user-field-get></text:span><text:line-break /><text:user-field-get style:data-style-name="N0" text:name="ManuscriptParagraphCount">0</text:user-field-get> paragrphs<text:line-break />Web: <text:a xlink:type="simple" xlink:href="http://example.com" text:style-name="T2">http://example.com</text:a></text:p>
|
||||||
<text:h text:style-name="P1" text:outline-level="2">Chapter One</text:h>
|
<text:h text:style-name="P1" text:outline-level="1">Chapter One</text:h>
|
||||||
<text:p text:style-name="Text_20_body">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc maximus justo non dictum commodo. Curabitur lacinia tempor orci vel luctus. Phasellus porta metus eu massa luctus, eget euismod risus rhoncus. Vestibulum sed arcu nisi. Maecenas pretium facilisis velit, vel semper lacus aliquam sit amet. Vestibulum vulputate neque ligula, rhoncus blandit turpis consequat id. Mauris sagittis vehicula imperdiet. Duis sed nunc pretium, ornare purus vel, sodales augue. Maecenas a suscipit risus. Quisque volutpat justo eleifend est ullamcorper fermentum. Donec ullamcorper et tortor a laoreet. Nam id risus nisi. Vivamus non imperdiet erat, sit amet imperdiet felis. Mauris vitae neque et est aliquam scelerisque non non ipsum.</text:p>
|
<text:p text:style-name="Text_20_body">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc maximus justo non dictum commodo. Curabitur lacinia tempor orci vel luctus. Phasellus porta metus eu massa luctus, eget euismod risus rhoncus. Vestibulum sed arcu nisi. Maecenas pretium facilisis velit, vel semper lacus aliquam sit amet. Vestibulum vulputate neque ligula, rhoncus blandit turpis consequat id. Mauris sagittis vehicula imperdiet. Duis sed nunc pretium, ornare purus vel, sodales augue. Maecenas a suscipit risus. Quisque volutpat justo eleifend est ullamcorper fermentum. Donec ullamcorper et tortor a laoreet. Nam id risus nisi. Vivamus non imperdiet erat, sit amet imperdiet felis. Mauris vitae neque et est aliquam scelerisque non non ipsum.</text:p>
|
||||||
<text:h text:style-name="P1" text:outline-level="2">Chapter Two</text:h>
|
<text:h text:style-name="P1" text:outline-level="1">Chapter Two</text:h>
|
||||||
<text:p text:style-name="Text_20_body">Nullam laoreet lorem nec malesuada vehicula. Vivamus tempus sodales lectus sed viverra. Aenean lacinia sollicitudin quam, quis tempus eros suscipit id. Duis sed rutrum nisi, ut pulvinar magna. Nam et cursus tortor. Phasellus ac odio tellus. Nullam in iaculis ipsum. Vivamus ante sem, ultricies sed varius quis, tristique nec tellus. Nullam eu urna vitae lacus hendrerit gravida. Quisque pulvinar erat ex, id efficitur velit sodales vitae. Proin vestibulum, sapien eget mattis euismod, tortor quam viverra risus, at congue mauris tortor eu nunc. Mauris pellentesque elit leo, quis eleifend sem placerat a. Vivamus iaculis dui eget tellus volutpat, ac varius nisi facilisis.<text:note text:id="ftn1" text:note-class="footnote">
|
<text:p text:style-name="Text_20_body">Nullam laoreet lorem nec malesuada vehicula. Vivamus tempus sodales lectus sed viverra. Aenean lacinia sollicitudin quam, quis tempus eros suscipit id. Duis sed rutrum nisi, ut pulvinar magna. Nam et cursus tortor. Phasellus ac odio tellus. Nullam in iaculis ipsum. Vivamus ante sem, ultricies sed varius quis, tristique nec tellus. Nullam eu urna vitae lacus hendrerit gravida. Quisque pulvinar erat ex, id efficitur velit sodales vitae. Proin vestibulum, sapien eget mattis euismod, tortor quam viverra risus, at congue mauris tortor eu nunc. Mauris pellentesque elit leo, quis eleifend sem placerat a. Vivamus iaculis dui eget tellus volutpat, ac varius nisi facilisis.<text:note text:id="ftn1" text:note-class="footnote">
|
||||||
<text:note-citation>1</text:note-citation>
|
<text:note-citation>1</text:note-citation>
|
||||||
<text:note-body>
|
<text:note-body>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<style:font-face style:name="Liberation Serif" style:font-pitch="variable" />
|
<style:font-face style:name="Liberation Serif" style:font-pitch="variable" />
|
||||||
</office:font-face-decls>
|
</office:font-face-decls>
|
||||||
<office:automatic-styles>
|
<office:automatic-styles>
|
||||||
<style:style style:name="P1" style:family="paragraph" style:parent-style-name="Heading_20_2">
|
<style:style style:name="P1" style:family="paragraph" style:parent-style-name="Heading_20_1">
|
||||||
<style:paragraph-properties fo:break-before="page" />
|
<style:paragraph-properties fo:break-before="page" />
|
||||||
</style:style>
|
</style:style>
|
||||||
<style:style style:name="T1" style:family="text">
|
<style:style style:name="T1" style:family="text">
|
||||||
@@ -38,9 +38,9 @@
|
|||||||
<text:line-break />
|
<text:line-break />
|
||||||
<text:user-field-get style:data-style-name="N0" text:name="ManuscriptParagraphCount">0</text:user-field-get> paragrphs<text:line-break />Web: <text:a xlink:type="simple" xlink:href="http://example.com" text:style-name="T2">http://example.com</text:a>
|
<text:user-field-get style:data-style-name="N0" text:name="ManuscriptParagraphCount">0</text:user-field-get> paragrphs<text:line-break />Web: <text:a xlink:type="simple" xlink:href="http://example.com" text:style-name="T2">http://example.com</text:a>
|
||||||
</text:p>
|
</text:p>
|
||||||
<text:h text:style-name="P1" text:outline-level="2">Chapter One</text:h>
|
<text:h text:style-name="P1" text:outline-level="1">Chapter One</text:h>
|
||||||
<text:p text:style-name="Text_20_body">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc maximus justo non dictum commodo. Curabitur lacinia tempor orci vel luctus. Phasellus porta metus eu massa luctus, eget euismod risus rhoncus. Vestibulum sed arcu nisi. Maecenas pretium facilisis velit, vel semper lacus aliquam sit amet. Vestibulum vulputate neque ligula, rhoncus blandit turpis consequat id. Mauris sagittis vehicula imperdiet. Duis sed nunc pretium, ornare purus vel, sodales augue. Maecenas a suscipit risus. Quisque volutpat justo eleifend est ullamcorper fermentum. Donec ullamcorper et tortor a laoreet. Nam id risus nisi. Vivamus non imperdiet erat, sit amet imperdiet felis. Mauris vitae neque et est aliquam scelerisque non non ipsum.</text:p>
|
<text:p text:style-name="Text_20_body">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc maximus justo non dictum commodo. Curabitur lacinia tempor orci vel luctus. Phasellus porta metus eu massa luctus, eget euismod risus rhoncus. Vestibulum sed arcu nisi. Maecenas pretium facilisis velit, vel semper lacus aliquam sit amet. Vestibulum vulputate neque ligula, rhoncus blandit turpis consequat id. Mauris sagittis vehicula imperdiet. Duis sed nunc pretium, ornare purus vel, sodales augue. Maecenas a suscipit risus. Quisque volutpat justo eleifend est ullamcorper fermentum. Donec ullamcorper et tortor a laoreet. Nam id risus nisi. Vivamus non imperdiet erat, sit amet imperdiet felis. Mauris vitae neque et est aliquam scelerisque non non ipsum.</text:p>
|
||||||
<text:h text:style-name="P1" text:outline-level="2">Chapter Two</text:h>
|
<text:h text:style-name="P1" text:outline-level="1">Chapter Two</text:h>
|
||||||
<text:p text:style-name="Text_20_body">Nullam laoreet lorem nec malesuada vehicula. Vivamus tempus sodales lectus sed viverra. Aenean lacinia sollicitudin quam, quis tempus eros suscipit id. Duis sed rutrum nisi, ut pulvinar magna. Nam et cursus tortor. Phasellus ac odio tellus. Nullam in iaculis ipsum. Vivamus ante sem, ultricies sed varius quis, tristique nec tellus. Nullam eu urna vitae lacus hendrerit gravida. Quisque pulvinar erat ex, id efficitur velit sodales vitae. Proin vestibulum, sapien eget mattis euismod, tortor quam viverra risus, at congue mauris tortor eu nunc. Mauris pellentesque elit leo, quis eleifend sem placerat a. Vivamus iaculis dui eget tellus volutpat, ac varius nisi facilisis.<text:note text:id="ftn1" text:note-class="footnote">
|
<text:p text:style-name="Text_20_body">Nullam laoreet lorem nec malesuada vehicula. Vivamus tempus sodales lectus sed viverra. Aenean lacinia sollicitudin quam, quis tempus eros suscipit id. Duis sed rutrum nisi, ut pulvinar magna. Nam et cursus tortor. Phasellus ac odio tellus. Nullam in iaculis ipsum. Vivamus ante sem, ultricies sed varius quis, tristique nec tellus. Nullam eu urna vitae lacus hendrerit gravida. Quisque pulvinar erat ex, id efficitur velit sodales vitae. Proin vestibulum, sapien eget mattis euismod, tortor quam viverra risus, at congue mauris tortor eu nunc. Mauris pellentesque elit leo, quis eleifend sem placerat a. Vivamus iaculis dui eget tellus volutpat, ac varius nisi facilisis.<text:note text:id="ftn1" text:note-class="footnote">
|
||||||
<text:note-citation>1</text:note-citation>
|
<text:note-citation>1</text:note-citation>
|
||||||
<text:note-body>
|
<text:note-body>
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ def testFmtToDocX_HeadingStyles(mockGUI):
|
|||||||
'<w:r><w:rPr /><w:t>Hello World</w:t></w:r></w:p></w:body>'
|
'<w:r><w:rPr /><w:t>Hello World</w:t></w:r></w:p></w:body>'
|
||||||
)
|
)
|
||||||
|
|
||||||
# Heading Level 1
|
# Partition
|
||||||
# ===============
|
# =========
|
||||||
doc._text = "# Hello World"
|
doc._text = "# Hello World"
|
||||||
|
|
||||||
# Plain
|
# Plain
|
||||||
@@ -68,7 +68,7 @@ def testFmtToDocX_HeadingStyles(mockGUI):
|
|||||||
doc.doConvert()
|
doc.doConvert()
|
||||||
doc._pars[-1].toXml(xTest)
|
doc._pars[-1].toXml(xTest)
|
||||||
assert xmlToText(xTest) == (
|
assert xmlToText(xTest) == (
|
||||||
'<w:body><w:p><w:pPr><w:pStyle w:val="Heading1" /><w:jc w:val="center" /></w:pPr>'
|
'<w:body><w:p><w:pPr><w:pStyle w:val="Title" /><w:jc w:val="center" /></w:pPr>'
|
||||||
'<w:r><w:br w:type="page" /></w:r>'
|
'<w:r><w:br w:type="page" /></w:r>'
|
||||||
'<w:r><w:rPr /><w:t>Hello World</w:t></w:r></w:p></w:body>'
|
'<w:r><w:rPr /><w:t>Hello World</w:t></w:r></w:p></w:body>'
|
||||||
)
|
)
|
||||||
@@ -80,13 +80,13 @@ def testFmtToDocX_HeadingStyles(mockGUI):
|
|||||||
doc.doConvert()
|
doc.doConvert()
|
||||||
doc._pars[-1].toXml(xTest)
|
doc._pars[-1].toXml(xTest)
|
||||||
assert xmlToText(xTest) == (
|
assert xmlToText(xTest) == (
|
||||||
'<w:body><w:p><w:pPr><w:pStyle w:val="Heading1" /><w:jc w:val="center" /></w:pPr>'
|
'<w:body><w:p><w:pPr><w:pStyle w:val="Title" /><w:jc w:val="center" /></w:pPr>'
|
||||||
'<w:r><w:br w:type="page" /></w:r>'
|
'<w:r><w:br w:type="page" /></w:r>'
|
||||||
'<w:r><w:rPr /><w:t>Part</w:t><w:br /><w:t>Hello World</w:t></w:r></w:p></w:body>'
|
'<w:r><w:rPr /><w:t>Part</w:t><w:br /><w:t>Hello World</w:t></w:r></w:p></w:body>'
|
||||||
)
|
)
|
||||||
|
|
||||||
# Heading Level 2
|
# Chapter
|
||||||
# ===============
|
# =======
|
||||||
doc._text = "## Hello World"
|
doc._text = "## Hello World"
|
||||||
|
|
||||||
# Plain
|
# Plain
|
||||||
@@ -95,7 +95,7 @@ def testFmtToDocX_HeadingStyles(mockGUI):
|
|||||||
doc.doConvert()
|
doc.doConvert()
|
||||||
doc._pars[-1].toXml(xTest)
|
doc._pars[-1].toXml(xTest)
|
||||||
assert xmlToText(xTest) == (
|
assert xmlToText(xTest) == (
|
||||||
'<w:body><w:p><w:pPr><w:pStyle w:val="Heading2" /></w:pPr>'
|
'<w:body><w:p><w:pPr><w:pStyle w:val="Heading1" /></w:pPr>'
|
||||||
'<w:r><w:br w:type="page" /></w:r>'
|
'<w:r><w:br w:type="page" /></w:r>'
|
||||||
'<w:r><w:rPr /><w:t>Hello World</w:t></w:r></w:p></w:body>'
|
'<w:r><w:rPr /><w:t>Hello World</w:t></w:r></w:p></w:body>'
|
||||||
)
|
)
|
||||||
@@ -107,13 +107,13 @@ def testFmtToDocX_HeadingStyles(mockGUI):
|
|||||||
doc.doConvert()
|
doc.doConvert()
|
||||||
doc._pars[-1].toXml(xTest)
|
doc._pars[-1].toXml(xTest)
|
||||||
assert xmlToText(xTest) == (
|
assert xmlToText(xTest) == (
|
||||||
'<w:body><w:p><w:pPr><w:pStyle w:val="Heading2" /></w:pPr>'
|
'<w:body><w:p><w:pPr><w:pStyle w:val="Heading1" /></w:pPr>'
|
||||||
'<w:r><w:br w:type="page" /></w:r>'
|
'<w:r><w:br w:type="page" /></w:r>'
|
||||||
'<w:r><w:rPr /><w:t>Chapter 2</w:t><w:br /><w:t>Hello World</w:t></w:r></w:p></w:body>'
|
'<w:r><w:rPr /><w:t>Chapter 2</w:t><w:br /><w:t>Hello World</w:t></w:r></w:p></w:body>'
|
||||||
)
|
)
|
||||||
|
|
||||||
# Heading Level 3
|
# Scene
|
||||||
# ===============
|
# =====
|
||||||
doc._text = "### Hello World"
|
doc._text = "### Hello World"
|
||||||
|
|
||||||
# Plain
|
# Plain
|
||||||
@@ -122,7 +122,7 @@ def testFmtToDocX_HeadingStyles(mockGUI):
|
|||||||
doc.doConvert()
|
doc.doConvert()
|
||||||
doc._pars[-1].toXml(xTest)
|
doc._pars[-1].toXml(xTest)
|
||||||
assert xmlToText(xTest) == (
|
assert xmlToText(xTest) == (
|
||||||
'<w:body><w:p><w:pPr><w:pStyle w:val="Heading3" /></w:pPr><w:r><w:rPr />'
|
'<w:body><w:p><w:pPr><w:pStyle w:val="Heading2" /></w:pPr><w:r><w:rPr />'
|
||||||
'<w:t>Hello World</w:t></w:r></w:p></w:body>'
|
'<w:t>Hello World</w:t></w:r></w:p></w:body>'
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -133,12 +133,12 @@ def testFmtToDocX_HeadingStyles(mockGUI):
|
|||||||
doc.doConvert()
|
doc.doConvert()
|
||||||
doc._pars[-1].toXml(xTest)
|
doc._pars[-1].toXml(xTest)
|
||||||
assert xmlToText(xTest) == (
|
assert xmlToText(xTest) == (
|
||||||
'<w:body><w:p><w:pPr><w:pStyle w:val="Heading3" /></w:pPr>'
|
'<w:body><w:p><w:pPr><w:pStyle w:val="Heading2" /></w:pPr>'
|
||||||
'<w:r><w:rPr /><w:t>Scene 2</w:t><w:br /><w:t>Hello World</w:t></w:r></w:p></w:body>'
|
'<w:r><w:rPr /><w:t>Scene 2</w:t><w:br /><w:t>Hello World</w:t></w:r></w:p></w:body>'
|
||||||
)
|
)
|
||||||
|
|
||||||
# Heading Level 4
|
# Section
|
||||||
# ===============
|
# =======
|
||||||
doc._text = "#### Hello World"
|
doc._text = "#### Hello World"
|
||||||
|
|
||||||
xTest = ET.Element(_wTag("body"))
|
xTest = ET.Element(_wTag("body"))
|
||||||
@@ -146,7 +146,7 @@ def testFmtToDocX_HeadingStyles(mockGUI):
|
|||||||
doc.doConvert()
|
doc.doConvert()
|
||||||
doc._pars[-1].toXml(xTest)
|
doc._pars[-1].toXml(xTest)
|
||||||
assert xmlToText(xTest) == (
|
assert xmlToText(xTest) == (
|
||||||
'<w:body><w:p><w:pPr><w:pStyle w:val="Heading4" /></w:pPr><w:r><w:rPr />'
|
'<w:body><w:p><w:pPr><w:pStyle w:val="Heading3" /></w:pPr><w:r><w:rPr />'
|
||||||
'<w:t>Hello World</w:t></w:r></w:p></w:body>'
|
'<w:t>Hello World</w:t></w:r></w:p></w:body>'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -311,8 +311,7 @@ def testFmtToOdt_ConvertHeaders(mockGUI):
|
|||||||
assert odt.errData == []
|
assert odt.errData == []
|
||||||
assert xmlToText(odt._xText) == (
|
assert xmlToText(odt._xText) == (
|
||||||
'<office:text>'
|
'<office:text>'
|
||||||
'<text:h text:style-name="P1" text:outline-level="1">Part'
|
'<text:p text:style-name="Title">Part<text:line-break />Title</text:p>'
|
||||||
'<text:line-break />Title</text:h>'
|
|
||||||
'</office:text>'
|
'</office:text>'
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -326,7 +325,7 @@ def testFmtToOdt_ConvertHeaders(mockGUI):
|
|||||||
assert odt.errData == []
|
assert odt.errData == []
|
||||||
assert xmlToText(odt._xText) == (
|
assert xmlToText(odt._xText) == (
|
||||||
'<office:text>'
|
'<office:text>'
|
||||||
'<text:h text:style-name="P2" text:outline-level="2">Chapter 1'
|
'<text:h text:style-name="P1" text:outline-level="1">Chapter 1'
|
||||||
'<text:line-break />Title</text:h>'
|
'<text:line-break />Title</text:h>'
|
||||||
'</office:text>'
|
'</office:text>'
|
||||||
)
|
)
|
||||||
@@ -341,7 +340,7 @@ def testFmtToOdt_ConvertHeaders(mockGUI):
|
|||||||
assert odt.errData == []
|
assert odt.errData == []
|
||||||
assert xmlToText(odt._xText) == (
|
assert xmlToText(odt._xText) == (
|
||||||
'<office:text>'
|
'<office:text>'
|
||||||
'<text:h text:style-name="Heading_20_3" text:outline-level="3">Scene 1'
|
'<text:h text:style-name="Heading_20_2" text:outline-level="2">Scene 1'
|
||||||
'<text:line-break />Title</text:h>'
|
'<text:line-break />Title</text:h>'
|
||||||
'</office:text>'
|
'</office:text>'
|
||||||
)
|
)
|
||||||
@@ -355,7 +354,7 @@ def testFmtToOdt_ConvertHeaders(mockGUI):
|
|||||||
assert odt.errData == []
|
assert odt.errData == []
|
||||||
assert xmlToText(odt._xText) == (
|
assert xmlToText(odt._xText) == (
|
||||||
'<office:text>'
|
'<office:text>'
|
||||||
'<text:h text:style-name="Heading_20_4" text:outline-level="4">Title</text:h>'
|
'<text:h text:style-name="Heading_20_3" text:outline-level="3">Title</text:h>'
|
||||||
'</office:text>'
|
'</office:text>'
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -382,7 +381,7 @@ def testFmtToOdt_ConvertHeaders(mockGUI):
|
|||||||
assert odt.errData == []
|
assert odt.errData == []
|
||||||
assert xmlToText(odt._xText) == (
|
assert xmlToText(odt._xText) == (
|
||||||
'<office:text>'
|
'<office:text>'
|
||||||
'<text:h text:style-name="P2" text:outline-level="2">Prologue</text:h>'
|
'<text:h text:style-name="P1" text:outline-level="1">Prologue</text:h>'
|
||||||
'</office:text>'
|
'</office:text>'
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -522,7 +521,7 @@ def testFmtToOdt_ConvertParagraphs(mockGUI):
|
|||||||
assert odt.errData == []
|
assert odt.errData == []
|
||||||
assert xmlToText(odt._xText) == (
|
assert xmlToText(odt._xText) == (
|
||||||
'<office:text>'
|
'<office:text>'
|
||||||
'<text:h text:style-name="Heading_20_3" text:outline-level="3">Scene</text:h>'
|
'<text:h text:style-name="Heading_20_2" text:outline-level="2">Scene</text:h>'
|
||||||
'<text:p text:style-name="Text_20_body">Hello World</text:p>'
|
'<text:p text:style-name="Text_20_body">Hello World</text:p>'
|
||||||
'<text:p text:style-name="Text_20_body">Hello <text:s />World</text:p>'
|
'<text:p text:style-name="Text_20_body">Hello <text:s />World</text:p>'
|
||||||
'<text:p text:style-name="Text_20_body">Hello <text:s text:c="2" />World</text:p>'
|
'<text:p text:style-name="Text_20_body">Hello <text:s text:c="2" />World</text:p>'
|
||||||
@@ -547,7 +546,7 @@ def testFmtToOdt_ConvertParagraphs(mockGUI):
|
|||||||
assert odt.errData == []
|
assert odt.errData == []
|
||||||
assert xmlToText(odt._xText) == (
|
assert xmlToText(odt._xText) == (
|
||||||
'<office:text>'
|
'<office:text>'
|
||||||
'<text:h text:style-name="Heading_20_3" text:outline-level="3">Scene</text:h>'
|
'<text:h text:style-name="Heading_20_2" text:outline-level="2">Scene</text:h>'
|
||||||
'<text:p text:style-name="Text_20_Meta"><text:span text:style-name="T10">'
|
'<text:p text:style-name="Text_20_Meta"><text:span text:style-name="T10">'
|
||||||
'Point of View:</text:span> <text:span text:style-name="T11">Jane</text:span></text:p>'
|
'Point of View:</text:span> <text:span text:style-name="T11">Jane</text:span></text:p>'
|
||||||
'<text:p text:style-name="Text_20_Meta"><text:span text:style-name="T12">'
|
'<text:p text:style-name="Text_20_Meta"><text:span text:style-name="T12">'
|
||||||
@@ -617,7 +616,7 @@ def testFmtToOdt_ConvertParagraphs(mockGUI):
|
|||||||
assert odt.errData == []
|
assert odt.errData == []
|
||||||
assert xmlToText(odt._xText) == (
|
assert xmlToText(odt._xText) == (
|
||||||
'<office:text>'
|
'<office:text>'
|
||||||
'<text:h text:style-name="Heading_20_3" text:outline-level="3">Scene</text:h>'
|
'<text:h text:style-name="Heading_20_2" text:outline-level="2">Scene</text:h>'
|
||||||
'<text:p text:style-name="P1"><text:span text:style-name="T10">'
|
'<text:p text:style-name="P1"><text:span text:style-name="T10">'
|
||||||
'Point of View:</text:span> <text:span text:style-name="T11">Jane</text:span></text:p>'
|
'Point of View:</text:span> <text:span text:style-name="T11">Jane</text:span></text:p>'
|
||||||
'<text:p text:style-name="P2"><text:span text:style-name="T10">'
|
'<text:p text:style-name="P2"><text:span text:style-name="T10">'
|
||||||
@@ -655,7 +654,7 @@ def testFmtToOdt_ConvertParagraphs(mockGUI):
|
|||||||
assert odt.errData == []
|
assert odt.errData == []
|
||||||
assert xmlToText(odt._xText) == (
|
assert xmlToText(odt._xText) == (
|
||||||
'<office:text>'
|
'<office:text>'
|
||||||
'<text:h text:style-name="Heading_20_3" text:outline-level="3">Scene</text:h>'
|
'<text:h text:style-name="Heading_20_2" text:outline-level="2">Scene</text:h>'
|
||||||
'<text:p text:style-name="P7">Regular paragraph</text:p>'
|
'<text:p text:style-name="P7">Regular paragraph</text:p>'
|
||||||
'<text:p text:style-name="Text_20_body">with<text:line-break />break</text:p>'
|
'<text:p text:style-name="Text_20_body">with<text:line-break />break</text:p>'
|
||||||
'<text:p text:style-name="Text_20_body">Left Align</text:p>'
|
'<text:p text:style-name="Text_20_body">Left Align</text:p>'
|
||||||
@@ -677,9 +676,9 @@ def testFmtToOdt_ConvertParagraphs(mockGUI):
|
|||||||
assert odt.errData == []
|
assert odt.errData == []
|
||||||
assert xmlToText(odt._xText) == (
|
assert xmlToText(odt._xText) == (
|
||||||
'<office:text>'
|
'<office:text>'
|
||||||
'<text:h text:style-name="P8" text:outline-level="2">Chapter One</text:h>'
|
'<text:h text:style-name="P8" text:outline-level="1">Chapter One</text:h>'
|
||||||
'<text:p text:style-name="Text_20_body">Text</text:p>'
|
'<text:p text:style-name="Text_20_body">Text</text:p>'
|
||||||
'<text:h text:style-name="P8" text:outline-level="2">Chapter Two</text:h>'
|
'<text:h text:style-name="P8" text:outline-level="1">Chapter Two</text:h>'
|
||||||
'<text:p text:style-name="Text_20_body">Text</text:p>'
|
'<text:p text:style-name="Text_20_body">Text</text:p>'
|
||||||
'</office:text>'
|
'</office:text>'
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user