fix handling of level 4 sections (#4854)

This commit is contained in:
Frédéric Péters 2014-05-27 20:55:53 +02:00
parent a29e5025ae
commit 53513fe6de
2 changed files with 8 additions and 2 deletions

View File

@ -28,7 +28,7 @@
</xsl:element>
</xsl:template>
<xsl:template match="part|chapter|sect1|sect2|sect3|preface|synthese|legistic_book|legistic_part|legistic_title|legistic_chapter|legistic_section|legistic_subsection|nosection">
<xsl:template match="part|chapter|sect1|sect2|sect3|sect4|preface|synthese|legistic_book|legistic_part|legistic_title|legistic_chapter|legistic_section|legistic_subsection|nosection">
<xsl:apply-templates select="*"/>
</xsl:template>
@ -143,6 +143,7 @@
<xsl:when test="$par = 'sect1'">Heading_20_3</xsl:when>
<xsl:when test="$par = 'sect2'">Heading_20_4</xsl:when>
<xsl:when test="$par = 'sect3'">Heading_20_5</xsl:when>
<xsl:when test="$par = 'sect4'">Heading_20_6</xsl:when>
<xsl:otherwise>
<xsl:message>Unknown location for title: <xsl:value-of select="$par"/></xsl:message>
</xsl:otherwise>
@ -154,6 +155,7 @@
<xsl:when test="$par = 'sect1'">3</xsl:when>
<xsl:when test="$par = 'sect2'">4</xsl:when>
<xsl:when test="$par = 'sect3'">5</xsl:when>
<xsl:when test="$par = 'sect4'">6</xsl:when>
</xsl:choose>
</xsl:attribute><xsl:value-of select="."/></text:h>
</xsl:otherwise>

View File

@ -60,6 +60,9 @@ TITLE_LEVELS = {
'Sec 1.1.1': 'sect3',
'Sec_20_1.1.1': 'sect3',
'Heading_20_5': 'sect3',
'Sec 1.1.1.1': 'sect4',
'Sec_20_1.1.1.1': 'sect4',
'Heading_20_6': 'sect4',
'Lchapitre': 'legistic_chapter',
'Lsection': 'legistic_section',
'LSous-Section': 'legistic_subsection',
@ -899,7 +902,8 @@ def convert_to_legi_xml(content, metadata = None):
speech = None
offstructure = None
levels = {'book':0, 'part':1, 'chapter':2, 'preface':2, 'synthese':2, 'sect1':3, 'sect2':4, 'sect3':5}
levels = {'book':0, 'part':1, 'chapter':2, 'preface':2, 'synthese':2,
'sect1':3, 'sect2':4, 'sect3':5, 'sect4':6}
legistic_levels = {'legistic_part': 0,
'legistic_book': 1,
'legistic_title': 2,