Skip to content
GitLab
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
84edcb18
Commit
84edcb18
authored
Jan 07, 2017
by
bperraud
Browse files
Flatten of last div + handling of microformats
parent
dc2f0d6a
Changes
3
Hide whitespace changes
Inline
Side-by-side
hdoc_to_pdf/xsl/find_content.xsl
View file @
84edcb18
...
...
@@ -65,7 +65,8 @@
<xslt
in=
"{$TempDirectory}/{$path}"
out=
"{$dirpath}/hdoc_nsless.xhtml"
style=
"xsl/ns_remover.xsl"
classpath=
"./lib/saxon9he.jar"
/>
<xslt
in=
"{$dirpath}/hdoc_nsless.xhtml"
out=
"{$dirpath}/flat_hdoc.xhtml"
style=
"xsl/hdoc_flattenizer.xsl"
classpath=
"./lib/saxon9he.jar"
/>
<xslt
in=
"{$dirpath}/flat_hdoc.xhtml"
out=
"{$dirpath}/pre_final.xhtml"
style=
"xsl/toc_generator.xsl"
classpath=
"./lib/saxon9he.jar"
/>
<xslt
in=
"{$dirpath}/flat_hdoc.xhtml"
out=
"{$dirpath}/post_toc.xhtml"
style=
"xsl/toc_generator.xsl"
classpath=
"./lib/saxon9he.jar"
/>
<xslt
in=
"{$dirpath}/post_toc.xhtml"
out=
"{$dirpath}/pre_final.xhtml"
style=
"xsl/microformat_transformer.xsl"
classpath=
"./lib/saxon9he.jar"
/>
<xslt
in=
"{$dirpath}/pre_final.xhtml"
out=
"{$dirpath}/final.xhtml"
style=
"xsl/last_transformer.xsl"
classpath=
"./lib/saxon9he.jar"
/>
<propertyfile
file=
"{$TempDirectory}/my.properties"
>
...
...
hdoc_to_pdf/xsl/last_transformer.xsl
View file @
84edcb18
...
...
@@ -28,6 +28,16 @@
<xsl:apply-templates
select=
"node()"
/>
</xsl:template>
<!-- Suppression des div de micro-formats -->
<xsl:template
match=
"div[@data-hdoc-type=('definition', 'example', 'remark', 'advice', 'warning', 'complement', 'emphasis')]"
>
<xsl:apply-templates
select=
"node()"
/>
</xsl:template>
<!-- Suppression des div génériques -->
<xsl:template
match=
"div"
>
<xsl:apply-templates
select=
"node()"
/>
</xsl:template>
<!-- Traitement des liens hypertextes pour autoriser le saut à la ligne-->
<xsl:template
match=
"a"
>
<a>
...
...
hdoc_to_pdf/xsl/microformat_transformer.xsl
0 → 100644
View file @
84edcb18
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl=
"http://www.w3.org/1999/XSL/Transform"
version=
"2.0"
xpath-default-namespace=
"http://www.w3.org/1999/xhtml"
xmlns=
"http://www.w3.org/1999/xhtml"
>
<xsl:output
method=
"xml"
indent=
"yes"
/>
<xsl:template
match=
"node()|@*"
>
<xsl:copy>
<xsl:apply-templates
select=
"node()|@*"
/>
</xsl:copy>
</xsl:template>
<!-- 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=
"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>
<xsl:when
test=
"$type = 'example'"
>
<xsl:text>
Exemple
</xsl:text>
</xsl:when>
<xsl:when
test=
"$type = 'remark'"
>
<xsl:text>
Remarque
</xsl:text>
</xsl:when>
<xsl:when
test=
"$type = 'advice'"
>
<xsl:text>
Conseil
</xsl:text>
</xsl:when>
<xsl:when
test=
"$type = 'warning'"
>
<xsl:text>
Attention
</xsl:text>
</xsl:when>
<xsl:when
test=
"$type = 'complement'"
>
<xsl:text>
Complément
</xsl:text>
</xsl:when>
<xsl:when
test=
"$type = 'emphasis'"
>
<xsl:text>
Fondamental
</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:copy>
<xsl:copy-of
select=
"@*"
/>
<xsl:value-of
select=
"concat($prefix, ' : ', $prename)"
/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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