summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2016-11-01 16:24:20 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2016-11-01 16:24:20 (GMT)
commit01a7bd6f00177d8e841f5d5e9e8877f3b5f678e8 (patch)
tree03d16bed60ee6140a2052855739deaf96895fd82
parent36678eecf72d0186e915bac30b5481027cae746d (diff)
downloadtabellioOOo-01a7bd6f00177d8e841f5d5e9e8877f3b5f678e8.zip
tabellioOOo-01a7bd6f00177d8e841f5d5e9e8877f3b5f678e8.tar.gz
tabellioOOo-01a7bd6f00177d8e841f5d5e9e8877f3b5f678e8.tar.bz2
add support for new "texte adopté" document (#10328)
-rw-r--r--legi2pdf/xsl/section.xsl23
-rw-r--r--odf2legi/odf2legi.py2
2 files changed, 24 insertions, 1 deletions
diff --git a/legi2pdf/xsl/section.xsl b/legi2pdf/xsl/section.xsl
index ebd106c..65b381a 100644
--- a/legi2pdf/xsl/section.xsl
+++ b/legi2pdf/xsl/section.xsl
@@ -253,10 +253,31 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
</xsl:if>
<xsl:call-template name="content-templates"/>
<xsl:if test="not($parchemin)">
- <xsl:text>\end{multicols}&#10;</xsl:text>
+ <xsl:choose>
+ <!-- if it's a document getting straight to a legistic level we keep
+ the columns open and they'll get closed when the end-of-document
+ processing instruction will be met.
+ -->
+ <xsl:when test="not(following-sibling::legistic_title)"></xsl:when>
+ <xsl:when test="not(following-sibling::legistic_chapter)"></xsl:when>
+ <xsl:when test="not(following-sibling::legistic_section)"></xsl:when>
+ <xsl:otherwise>
+ <xsl:text>\end{multicols}&#10;</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:if>
</xsl:template>
+<xsl:template match="processing-instruction('end-of-document')">
+ <xsl:if test="not($parchemin)">
+ <!-- columns have been left open after <nosection/>, they must be closed
+ now that the end of the document has been reached.
+ -->
+ <xsl:if test="//nosection/following-sibling::legistic_title"><xsl:text>\end{multicols}&#10;</xsl:text></xsl:if>
+ <xsl:if test="//nosection/following-sibling::legistic_chapter"><xsl:text>\end{multicols}&#10;</xsl:text></xsl:if>
+ <xsl:if test="//nosection/following-sibling::legistic_section"><xsl:text>\end{multicols}&#10;</xsl:text></xsl:if>
+ </xsl:if>
+</xsl:template>
<xsl:template match="part">
<xsl:param name="bridgehead" select="ancestor::preface|ancestor::colophon|ancestor::dedication"/>
diff --git a/odf2legi/odf2legi.py b/odf2legi/odf2legi.py
index 8d704f1..ceca26a 100644
--- a/odf2legi/odf2legi.py
+++ b/odf2legi/odf2legi.py
@@ -1140,6 +1140,8 @@ def convert_to_legi_xml(content, metadata=None, styles=None):
# clear it.
offstructure.remove(offstructure.getchildren()[0])
+ legi.append(ET.ProcessingInstruction('end-of-document'))
+
# get content as an XML tree
out = StringIO()
ET.ElementTree(legi).write(out)