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
3dd7c36c
Commit
3dd7c36c
authored
Dec 20, 2016
by
cliclac
Browse files
découpage en sous-chapitre
correction css : ne coupe plus un élément au milieu
parent
f7c3b1ad
Changes
7
Show whitespace changes
Inline
Side-by-side
hdoc_to_epub/README.md
View file @
3dd7c36c
...
...
@@ -55,5 +55,7 @@ Validation
Étude compatibilité entre EPUB2 et EPUB3
Test : Mettre un élément fondamental avec une taille plus grande qu'une page.
Technical Notes
---------------
hdoc_to_epub/file/stylesheet.css
View file @
3dd7c36c
...
...
@@ -89,3 +89,7 @@ td{
padding
:
5px
;
clear
:
both
;
}
.noCut
{
page-break-inside
:
avoid
;
}
hdoc_to_epub/hdoc_to_epub.ant
View file @
3dd7c36c
...
...
@@ -102,7 +102,7 @@
<mkdir
dir=
"${tmpRetour}/oebps/styles"
/>
<copy
file=
"${file}/stylesheet.css"
todir=
"${tmpRetour}/oebps/styles"
/>
<mkdir
dir=
"${tmpRetour}/oebps/images"
/>
<copy
todir=
"${tmpRetour}/oebps/images"
>
<copy
todir=
"${tmpRetour}/oebps/images"
failonerror=
"false"
>
<fileset
dir=
"${tmp}/${filename}/decompressedHdoc/re"
includes=
"**"
/>
</copy>
<mkdir
dir=
"${tmpRetour}/oebps/chapitres"
/>
...
...
@@ -131,7 +131,7 @@
</target>
<target
name=
"CleanTmp"
>
<delete
dir=
"${tmp}"
failonerror=
"false"
/>
<!--
<delete dir="${tmp}" failonerror="false"/>
-->
</target>
</project>
hdoc_to_epub/xsl/chapitre.xsl
View file @
3dd7c36c
...
...
@@ -9,7 +9,7 @@
<xsl:output
method=
"xml"
indent=
"yes"
encoding=
"UTF-8"
/>
<xsl:template
match=
"/html"
priority=
"10"
>
<xsl:for-each
select=
"body/section"
>
<xsl:for-each
select=
"
/html/
body/section"
>
<xsl:variable
name=
"path"
>
../../../retour/oebps/chapitres/chapitre
<xsl:number
level=
"multiple"
count=
"section"
format=
"1"
/>
.xhtml
</xsl:variable>
<xsl:result-document
method=
"xml"
href=
"{$path}"
>
<html
xml:lang=
"en"
lang=
"en"
xmlns:epub=
"http://www.idpf.org/2007/ops"
>
...
...
@@ -27,6 +27,23 @@
</xsl:for-each>
</xsl:template>
<xsl:template
match=
"//section[count(ancestor::section) = 1 and position() > 1]"
priority=
"9"
>
<xsl:variable
name=
"path"
>
../../../retour/oebps/chapitres/chapitre
<xsl:number
level=
"multiple"
count=
"section"
format=
"1_1"
/>
.xhtml
</xsl:variable>
<xsl:result-document
method=
"xml"
href=
"{$path}"
>
<html
xml:lang=
"en"
lang=
"en"
xmlns:epub=
"http://www.idpf.org/2007/ops"
>
<head>
<title><xsl:value-of
select=
"header/h1"
/></title>
<meta
content=
"http://www.w3.org/1999/xhtml; charset=utf-8"
http-equiv=
"Content-Type"
/>
<link
href=
"../styles/stylesheet.css"
type=
"text/css"
rel=
"stylesheet"
/>
</head>
<body>
<h2><xsl:value-of
select=
"header/h1"
/></h2>
<xsl:apply-templates
select=
"div|section"
/>
</body>
</html>
</xsl:result-document>
</xsl:template>
<xsl:template
match=
"section"
priority=
"3"
>
<xsl:element
name=
"h{count(ancestor::section)+1}"
>
<xsl:value-of
select=
"header/h1"
/>
...
...
@@ -38,6 +55,7 @@
<xsl:template
match=
"//div[@data-hdoc-type='remark']"
priority=
"4"
>
<div
class=
"noCut"
>
<h3>
<xsl:if
test=
"h6"
>
<span
class=
"textTitle"
><xsl:value-of
select=
"h6"
/></span>
...
...
@@ -47,9 +65,11 @@
<div
class=
"border"
>
<xsl:apply-templates/>
</div>
</div>
</xsl:template>
<xsl:template
match=
"//div[@data-hdoc-type='emphasis']"
priority=
"4"
>
<div
class=
"noCut"
>
<h3>
<xsl:if
test=
"h6"
>
<span
class=
"textTitle"
><xsl:value-of
select=
"h6"
/></span>
...
...
@@ -59,9 +79,11 @@
<div
class=
"border"
>
<xsl:apply-templates/>
</div>
</div>
</xsl:template>
<xsl:template
match=
"//div[@data-hdoc-type='complement']"
priority=
"4"
>
<div
class=
"noCut"
>
<h3>
<xsl:if
test=
"h6"
>
<span
class=
"textTitle"
><xsl:value-of
select=
"h6"
/></span>
...
...
@@ -71,9 +93,11 @@
<div
class=
"border"
>
<xsl:apply-templates/>
</div>
</div>
</xsl:template>
<xsl:template
match=
"//div[@data-hdoc-type='example']"
priority=
"4"
>
<div
class=
"noCut"
>
<h3>
<xsl:if
test=
"h6"
>
<span
class=
"textTitle"
><xsl:value-of
select=
"h6"
/></span>
...
...
@@ -83,6 +107,7 @@
<div
class=
"border"
>
<xsl:apply-templates/>
</div>
</div>
</xsl:template>
<xsl:template
match=
"//div[@data-hdoc-type='warning']"
priority=
"4"
>
...
...
@@ -97,6 +122,20 @@
</div>
</xsl:template>
<xsl:template
match=
"//div[@data-hdoc-type='advice']"
priority=
"4"
>
<div
class=
"noCut"
>
<h3>
<xsl:if
test=
"h6"
>
<span
class=
"textTitle"
><xsl:value-of
select=
"h6"
/></span>
</xsl:if>
<span
class=
"title"
>
Conseil
</span>
</h3>
<div
class=
"border"
>
<xsl:apply-templates/>
</div>
</div>
</xsl:template>
<!-- Identity transformation -->
<xsl:template
match=
"node()|@*"
>
<xsl:copy>
...
...
hdoc_to_epub/xsl/content/manifest.xsl
View file @
3dd7c36c
...
...
@@ -17,6 +17,13 @@
<xsl:attribute
name=
"media-type"
>
application/xhtml+xml
</xsl:attribute>
</item>
</xsl:for-each>
<xsl:for-each
select=
"//section[count(ancestor::section) = 1 and position() > 1]"
>
<item>
<xsl:attribute
name=
"href"
>
chapitres/chapitre
<xsl:number
level=
"multiple"
count=
"section"
format=
"1_1"
/>
.xhtml
</xsl:attribute>
<xsl:attribute
name=
"id"
>
ch_
<xsl:number
level=
"multiple"
count=
"section"
format=
"1_1"
/></xsl:attribute>
<xsl:attribute
name=
"media-type"
>
application/xhtml+xml
</xsl:attribute>
</item>
</xsl:for-each>
<!-- CSS -->
<item
id=
"CSS"
href=
"styles/stylesheet.css"
media-type=
"text/css"
/>
<!-- Images -->
...
...
hdoc_to_epub/xsl/content/spine.xsl
View file @
3dd7c36c
...
...
@@ -12,6 +12,11 @@
<xsl:attribute
name=
"idref"
>
ch_
<xsl:number
level=
"multiple"
count=
"section"
format=
"1"
/></xsl:attribute>
</itemref>
</xsl:for-each>
<xsl:for-each
select=
"//section[count(ancestor::section) = 1 and position() > 1]"
>
<itemref>
<xsl:attribute
name=
"idref"
>
ch_
<xsl:number
level=
"multiple"
count=
"section"
format=
"1_1"
/></xsl:attribute>
</itemref>
</xsl:for-each>
</spine>
</xsl:template>
</xsl:stylesheet>
hdoc_to_epub/xsl/tdmncx.xsl
View file @
3dd7c36c
...
...
@@ -22,7 +22,7 @@
</ncx>
</xsl:template>
<xsl:template
match=
"
/
html/body/section"
>
<xsl:template
match=
"html/body/section"
>
<navPoint>
<xsl:attribute
name=
"class"
>
h
<xsl:value-of
select=
"count(ancestor::section)+1"
/></xsl:attribute>
<xsl:attribute
name=
"id"
>
ch_
<xsl:number
level=
"multiple"
count=
"section"
format=
"1_1"
/></xsl:attribute>
...
...
@@ -35,7 +35,22 @@
<xsl:attribute
name=
"src"
>
chapitres/chapitre
<xsl:number
level=
"multiple"
count=
"section"
format=
"1_1"
/>
.xhtml
</xsl:attribute>
</content>
<xsl:apply-templates/>
</navPoint>
</xsl:template>
<xsl:template
match=
"//section[count(ancestor::section) = 1 and position() > 1]"
>
<navPoint>
<xsl:attribute
name=
"class"
>
h
<xsl:value-of
select=
"count(ancestor::section)+1"
/></xsl:attribute>
<xsl:attribute
name=
"id"
>
ch_
<xsl:number
level=
"multiple"
count=
"section"
format=
"1_1"
/></xsl:attribute>
<navLabel>
<text>
<xsl:value-of
select=
"header/h1"
/>
</text>
</navLabel>
<content>
<xsl:attribute
name=
"src"
>
chapitres/chapitre
<xsl:number
level=
"multiple"
count=
"section"
format=
"1_1"
/>
.xhtml
</xsl:attribute>
</content>
<xsl:apply-templates/>
</navPoint>
</xsl:template>
...
...
Write
Preview
Markdown
is supported
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