Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Stephane Crozat
hdoc
Commits
f11dc640
Commit
f11dc640
authored
Jan 07, 2017
by
bperraud
Browse files
Remove microformat prefix when the title shares the same name
parent
ea4fafbe
Changes
1
Show whitespace changes
Inline
Side-by-side
hdoc_to_pdf/xsl/microformat_transformer.xsl
View file @
f11dc640
...
...
@@ -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>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment