Commit f11dc640 authored by bperraud's avatar bperraud

Remove microformat prefix when the title shares the same name

parent ea4fafbe
......@@ -16,37 +16,40 @@
<!-- Traitement des micro-formats -->
<xsl:template match="node()[local-name()=('h2', 'h3', 'h4', 'h5', 'h6') and parent::div[@data-hdoc-type=('definition', 'example', 'remark', 'advice', 'warning', 'complement', 'emphasis')]]">
<xsl:variable name="prename" select="concat(lower-case(substring(./text(), 1, 1)), substring(./text(), 2))"/>
<xsl:variable name="prename" select="./text()"/>
<xsl:variable name="type" select="parent::div/@data-hdoc-type"/>
<xsl:variable name="prefix">
<xsl:choose>
<xsl:when test="$type = 'definition'">
<xsl:text>Définition</xsl:text>
<xsl:when test="$type = 'definition' and not(lower-case(./text()) = ('definition', 'définition'))">
<xsl:text>Définition</xsl:text>
</xsl:when>
<xsl:when test="$type = 'example'">
<xsl:text>Exemple</xsl:text>
<xsl:when test="$type = 'example' and not(lower-case(./text()) = ('exemple'))">
<xsl:text>Exemple</xsl:text>
</xsl:when>
<xsl:when test="$type = 'remark'">
<xsl:text>Remarque</xsl:text>
<xsl:when test="$type = 'remark' and not(lower-case(./text()) = ('remarque'))">
<xsl:text>Remarque</xsl:text>
</xsl:when>
<xsl:when test="$type = 'advice'">
<xsl:text>Conseil</xsl:text>
<xsl:when test="$type = 'advice' and not(lower-case(./text()) = ('conseil'))">
<xsl:text>Conseil</xsl:text>
</xsl:when>
<xsl:when test="$type = 'warning'">
<xsl:text>Attention</xsl:text>
<xsl:when test="$type = 'warning' and not(lower-case(./text()) = ('attention'))">
<xsl:text>Attention</xsl:text>
</xsl:when>
<xsl:when test="$type = 'complement'">
<xsl:text>Complément</xsl:text>
<xsl:when test="$type = 'complement' and not(lower-case(./text()) = ('complement', 'complément'))">
<xsl:text>Complément</xsl:text>
</xsl:when>
<xsl:when test="$type = 'emphasis'">
<xsl:text>Fondamental</xsl:text>
<xsl:when test="$type = 'emphasis' and not(lower-case(./text()) = ('fondamental'))">
<xsl:text>Fondamental</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:value-of select="concat($prefix, ' : ', $prename)"/>
<xsl:value-of select="concat($prefix, $prename)"/>
</xsl:copy>
</xsl:template>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment