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
52da0ebf
Commit
52da0ebf
authored
Dec 18, 2016
by
cliclac
Browse files
Copie des images
Mise en place OPF Table des matières
parent
11952eae
Changes
6
Hide whitespace changes
Inline
Side-by-side
hdoc_to_epub/hdoc_to_epub.ant
View file @
52da0ebf
...
...
@@ -7,8 +7,10 @@
<property
name=
"in"
location=
"${basedir}/input"
/>
<property
name=
"out"
location=
"${basedir}/output"
/>
<property
name=
"tmp"
location=
"${basedir}/tmp"
/>
<property
name=
"xsl"
location=
"${basedir}/xsl"
/>
<property
name=
"file"
location=
"${basedir}/file"
/>
<property
name=
"schema"
location=
"${basedir}/schema"
/>
<property
name=
"lib"
location=
"${basedir}/lib"
/>
<target
name=
"convert"
>
<delete
dir=
"${tmp}"
failonerror=
"false"
/>
...
...
@@ -38,9 +40,13 @@
<antcall
target=
"MakeOCF"
/>
<!--<antcall target="MakeOPF"/> -->
<antcall
target=
"MakeOPF"
>
<param
name=
"filename"
value=
"${filename}"
/>
</antcall>
<antcall
target=
"MakeOPS"
/>
<antcall
target=
"MakeOPS"
>
<param
name=
"filename"
value=
"${filename}"
/>
</antcall>
</sequential>
</for>
...
...
@@ -73,13 +79,18 @@
</target>
<target
name=
"MakeOPF"
>
<xslt
in=
"${tmp}/${filename}/decompressedHdoc/content.xml"
out=
"${out}/oebps/content.xml"
classpath=
"${lib}/saxon9he.jar"
style=
"${xsl}/content.xsl"
/>
</target>
<target
name=
"MakeOPS"
>
<mkdir
dir=
"${out}/oebps/images"
/>
<copy
todir=
"${out}/oebps/images"
>
<fileset
dir=
"${tmp}/${filename}/decompressedHdoc/re"
includes=
"**"
/>
</copy>
<mkdir
dir=
"${out}/oebps/styles"
/>
<mkdir
dir=
"${out}/oebps/text"
/>
<mkdir
dir=
"${out}/oebps/chapitres"
/>
<xslt
in=
"${tmp}/${filename}/decompressedHdoc/content.xml"
out=
"${out}/oebps/tableDesMatieres.ncx"
classpath=
"${lib}/saxon9he.jar"
style=
"${xsl}/tdmncx.xsl"
/>
</target>
</project>
hdoc_to_epub/xsl/content.xsl
0 → 100644
View file @
52da0ebf
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl=
"http://www.w3.org/1999/XSL/Transform"
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
xmlns:dc=
"http://www.idpf.org/2007/opf"
xpath-default-namespace=
"http://www.utc.fr/ics/hdoc/xhtml"
exclude-result-prefixes=
"xs"
version=
"2.0"
>
<xsl:import
href=
"content/metadata.xsl"
/>
<xsl:import
href=
"content/manifest.xsl"
/>
<xsl:import
href=
"content/spine.xsl"
/>
<xsl:output
method=
"xml"
indent=
"yes"
encoding=
"UTF-8"
/>
<xsl:template
match=
"html"
>
<package
unique-identifier=
"BookID"
version=
"3.0"
>
<xsl:call-template
name=
"metadata"
/>
<xsl:call-template
name=
"manifest"
/>
<xsl:call-template
name=
"spine"
/>
</package>
</xsl:template>
<xsl:template
match=
"text()"
/>
</xsl:stylesheet>
hdoc_to_epub/xsl/content/manifest.xsl
0 → 100644
View file @
52da0ebf
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl=
"http://www.w3.org/1999/XSL/Transform"
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
xmlns:dc=
"http://www.idpf.org/2007/opf"
xpath-default-namespace=
"http://www.utc.fr/ics/hdoc/xhtml"
exclude-result-prefixes=
"xs"
version=
"2.0"
>
<xsl:template
name=
"manifest"
>
<manifest>
<item
id=
"tDMncx"
href=
"tableDesMatieres.ncx"
media-type=
"application/x-dtbncx+xml"
/>
<xsl:for-each
select=
"body/section"
>
<item>
<xsl:attribute
name=
"href"
>
chapitres/chapitre
<xsl:number
level=
"multiple"
count=
"section"
format=
"1"
/>
.xhtml
</xsl:attribute>
<xsl:attribute
name=
"id"
>
ch
<xsl:number
level=
"multiple"
count=
"section"
format=
"1"
/></xsl:attribute>
<xsl:attribute
name=
"media-type"
>
application/xhtml+xml
</xsl:attribute>
</item>
</xsl:for-each>
</manifest>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
hdoc_to_epub/xsl/content/metadata.xsl
0 → 100644
View file @
52da0ebf
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl=
"http://www.w3.org/1999/XSL/Transform"
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
xmlns:dc=
"http://www.idpf.org/2007/opf"
xpath-default-namespace=
"http://www.utc.fr/ics/hdoc/xhtml"
exclude-result-prefixes=
"xs"
version=
"2.0"
>
<xsl:template
name=
"metadata"
>
<metadata>
<dc:title><xsl:value-of
select=
"head/title"
/></dc:title>
<dc:creator><xsl:value-of
select=
"head/meta[@name='author']/@content"
/></dc:creator>
<dc:language>
fr
</dc:language>
</metadata>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
hdoc_to_epub/xsl/content/spine.xsl
0 → 100644
View file @
52da0ebf
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl=
"http://www.w3.org/1999/XSL/Transform"
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
xmlns:dc=
"http://www.idpf.org/2007/opf"
xpath-default-namespace=
"http://www.utc.fr/ics/hdoc/xhtml"
exclude-result-prefixes=
"xs"
version=
"2.0"
>
<xsl:template
name=
"spine"
>
<spine
toc=
"tDMncx"
>
<xsl:for-each
select=
"body/section"
>
<itemref>
<xsl:attribute
name=
"idref"
>
ch
<xsl:number
level=
"multiple"
count=
"section"
format=
"1"
/></xsl:attribute>
</itemref>
</xsl:for-each>
</spine>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
hdoc_to_epub/xsl/tdmncx.xsl
0 → 100644
View file @
52da0ebf
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl=
"http://www.w3.org/1999/XSL/Transform"
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes=
"xs"
xpath-default-namespace=
"http://www.utc.fr/ics/hdoc/xhtml"
version=
"2.0"
>
<xsl:output
method=
"xml"
indent=
"yes"
encoding=
"UTF-8"
/>
<xsl:template
match=
"html"
>
<ncx
xmlns=
"http://www.daisy.org/z3986/2005/ncx/"
version=
"2005-1"
xml:lang=
"en-US"
>
<head>
<meta
content=
"org-example-5059463624137734586"
name=
"dtb:uid"
/>
</head>
<navMap>
<xsl:apply-templates/>
</navMap>
</ncx>
</xsl:template>
<xsl:template
match=
"//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>
<navLabel>
<text>
<xsl:value-of
select=
"header/h1"
/>
</text>
</navLabel>
<content>
<xsl:attribute
name=
"src"
>
content.html#ch_
<xsl:number
level=
"multiple"
count=
"section"
format=
"1_1"
/></xsl:attribute>
</content>
<xsl:apply-templates/>
</navPoint>
</xsl:template>
<xsl:template
match=
"text()"
/>
</xsl:stylesheet>
\ No newline at end of file
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