Files
md_to_gost/md2fodt/styles.py
T
Igor20264 516abe7b83
Python application / build (push) Has been cancelled
BigUpdate
2026-09-03 10:44:08 +03:00

160 lines
8.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""GOST-ish office:styles / automatic-styles fragments for FODT."""
from __future__ import annotations
# Page: A4, left 30mm, right 10mm, top/bottom 20mm
# Body: Times New Roman 14pt, first-line indent 1.25cm, 1.5 line spacing
def styles_xml() -> str:
return """\
<office:styles>
<style:default-style style:family="paragraph">
<style:paragraph-properties fo:text-align="justify" style:justify-single-word="false"
fo:orphans="2" fo:widows="2"/>
<style:text-properties style:font-name="Times New Roman" fo:font-size="14pt"
style:font-name-asian="Times New Roman" style:font-size-asian="14pt"
style:font-name-complex="Times New Roman" style:font-size-complex="14pt"/>
</style:default-style>
<style:style style:name="Standard" style:family="paragraph" style:class="text">
<style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm"
fo:line-height="150%" fo:text-align="justify"
fo:text-indent="1.25cm"/>
<style:text-properties style:font-name="Times New Roman" fo:font-size="14pt"/>
</style:style>
<style:style style:name="Heading" style:family="paragraph" style:class="text"/>
<style:style style:name="Heading_20_1" style:display-name="Heading 1"
style:family="paragraph" style:parent-style-name="Heading" style:default-outline-level="1"
style:class="text">
<style:paragraph-properties fo:margin-top="0.4cm" fo:margin-bottom="0.3cm"
fo:text-align="left" fo:text-indent="1.25cm" fo:line-height="150%"
fo:keep-with-next="always"/>
<style:text-properties fo:font-weight="bold" style:font-name="Times New Roman"
fo:font-size="14pt"/>
</style:style>
<style:style style:name="Heading_20_2" style:display-name="Heading 2"
style:family="paragraph" style:parent-style-name="Heading" style:default-outline-level="2"
style:class="text">
<style:paragraph-properties fo:margin-top="0.3cm" fo:margin-bottom="0.2cm"
fo:text-align="left" fo:text-indent="1.25cm" fo:line-height="150%"
fo:keep-with-next="always"/>
<style:text-properties fo:font-weight="bold" style:font-name="Times New Roman"
fo:font-size="14pt"/>
</style:style>
<style:style style:name="Heading_20_3" style:display-name="Heading 3"
style:family="paragraph" style:parent-style-name="Heading" style:default-outline-level="3"
style:class="text">
<style:paragraph-properties fo:margin-top="0.2cm" fo:margin-bottom="0.2cm"
fo:text-align="left" fo:text-indent="1.25cm" fo:line-height="150%"
fo:keep-with-next="always"/>
<style:text-properties fo:font-weight="bold" style:font-name="Times New Roman"
fo:font-size="14pt"/>
</style:style>
<style:style style:name="Caption" style:family="paragraph" style:class="extra">
<style:paragraph-properties fo:text-align="center" fo:text-indent="0cm"
fo:margin-top="0.2cm" fo:margin-bottom="0.2cm" fo:line-height="150%"/>
<style:text-properties style:font-name="Times New Roman" fo:font-size="14pt"/>
</style:style>
<style:style style:name="Preformatted_20_Text" style:display-name="Preformatted Text"
style:family="paragraph" style:class="html">
<style:paragraph-properties fo:text-align="left" fo:text-indent="0cm"
fo:margin-left="0cm" fo:line-height="100%"/>
<style:text-properties style:font-name="Courier New" fo:font-size="12pt"/>
</style:style>
<style:style style:name="Centered" style:family="paragraph" style:parent-style-name="Standard">
<style:paragraph-properties fo:text-align="center" fo:text-indent="0cm"/>
</style:style>
<text:outline-style>
<text:outline-level-style text:level="1" style:num-format="">
<style:list-level-properties text:min-label-distance="0.4cm"/>
</text:outline-level-style>
<text:outline-level-style text:level="2" style:num-format="">
<style:list-level-properties text:min-label-distance="0.4cm"/>
</text:outline-level-style>
<text:outline-level-style text:level="3" style:num-format="">
<style:list-level-properties text:min-label-distance="0.4cm"/>
</text:outline-level-style>
</text:outline-style>
</office:styles>
"""
def automatic_styles_xml() -> str:
return """\
<office:automatic-styles>
<style:page-layout style:name="pm1">
<style:page-layout-properties fo:page-width="21.0cm" fo:page-height="29.7cm"
style:num-format="1" style:print-orientation="portrait"
fo:margin-top="2.0cm" fo:margin-bottom="2.0cm"
fo:margin-left="3.0cm" fo:margin-right="1.0cm"
style:writing-mode="lr-tb"/>
</style:page-layout>
<style:style style:name="Tbold" style:family="text">
<style:text-properties fo:font-weight="bold"/>
</style:style>
<style:style style:name="Titalic" style:family="text">
<style:text-properties fo:font-style="italic"/>
</style:style>
<style:style style:name="Tcode" style:family="text">
<style:text-properties style:font-name="Courier New" fo:font-size="12pt"/>
</style:style>
<style:style style:name="fr1" style:family="graphic" style:parent-style-name="Graphics">
<style:graphic-properties style:horizontal-pos="center" style:horizontal-rel="paragraph"
style:mirror="none" fo:clip="rect(0cm, 0cm, 0cm, 0cm)" draw:luminance="0%"
draw:contrast="0%" draw:red="0%" draw:green="0%" draw:blue="0%" draw:gamma="100%"
draw:color-inversion="false" draw:image-opacity="100%" draw:color-mode="standard"/>
</style:style>
<style:style style:name="Table1" style:family="table">
<style:table-properties table:border-model="collapsing" style:rel-width="100%"
table:align="margins"/>
</style:style>
<style:style style:name="Table1.A" style:family="table-column">
<style:table-column-properties style:rel-column-width="1000*"/>
</style:style>
<style:style style:name="Table1.1" style:family="table-cell">
<style:table-cell-properties fo:padding="0.1cm" fo:border="0.5pt solid #000000"/>
</style:style>
<style:style style:name="Pcell" style:family="paragraph" style:parent-style-name="Standard">
<style:paragraph-properties fo:text-indent="0cm" fo:text-align="left" fo:line-height="100%"/>
</style:style>
<style:style style:name="L1" style:family="list">
<text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols"
text:bullet-char="">
<style:list-level-properties text:space-before="0cm" text:min-label-width="0.75cm"/>
</text:list-level-style-bullet>
<text:list-level-style-number text:level="1" text:style-name="Numbering_20_Symbols"
style:num-suffix="." style:num-format="1">
<style:list-level-properties text:space-before="0cm" text:min-label-width="0.75cm"/>
</text:list-level-style-number>
</style:style>
</office:automatic-styles>
<office:master-styles>
<style:master-page style:name="Standard" style:page-layout-name="pm1"/>
</office:master-styles>
"""
FODT_NS = """\
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
xmlns:math="http://www.w3.org/1998/Math/MathML"
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
xmlns:dom="http://www.w3.org/2001/xml-events"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
office:version="1.3"
office:mimetype="application/vnd.oasis.opendocument.text"
"""