Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
hdoc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Stephane Crozat
hdoc
Commits
fc427b0c
Commit
fc427b0c
authored
Dec 18, 2016
by
cliclac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mise en place des chapitres et de l'epub
parent
05887f58
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
115 additions
and
18 deletions
+115
-18
hdoc_to_epub/README.md
hdoc_to_epub/README.md
+10
-2
hdoc_to_epub/file/container.xml
hdoc_to_epub/file/container.xml
+1
-1
hdoc_to_epub/hdoc_to_epub.ant
hdoc_to_epub/hdoc_to_epub.ant
+52
-14
hdoc_to_epub/xsl/chapitre.xsl
hdoc_to_epub/xsl/chapitre.xsl
+50
-0
hdoc_to_epub/xsl/tdmncx.xsl
hdoc_to_epub/xsl/tdmncx.xsl
+2
-1
No files found.
hdoc_to_epub/README.md
View file @
fc427b0c
...
...
@@ -35,15 +35,23 @@ La personne possède un hdoc et voudrait le convertir en epub. Il se dirige vers
Unsupported
-----------
Known bugs
----------
Problème dans le hdoc : contient des images mais ne sont pas référencées.
Problème avec les keywords : le hdoc contient des keywords mais nous ne savons pas où les utiliser.
Todo list
---------
Validation de l'epub actuel
Mise en place de la première page
Validation
Étude compatibilité entre EPUB2 et EPUB3
Technical Notes
---------------
hdoc_to_epub/file/container.xml
View file @
fc427b0c
<?xml version="1.0"?>
<container
xmlns=
"urn:oasis:names:tc:opendocument:xmlns:container"
version=
"1.0"
>
<rootfiles>
<rootfile
full-path=
"
OEBPS
/content.opf"
media-type=
"application/oebps-package+xml"
/>
<rootfile
full-path=
"
oebps
/content.opf"
media-type=
"application/oebps-package+xml"
/>
</rootfiles>
</container>
hdoc_to_epub/hdoc_to_epub.ant
View file @
fc427b0c
...
...
@@ -11,7 +11,8 @@
<property
name=
"file"
location=
"${basedir}/file"
/>
<property
name=
"schema"
location=
"${basedir}/schema"
/>
<property
name=
"lib"
location=
"${basedir}/lib"
/>
<property
name=
"tmpRetour"
location=
"${basedir}/tmp/retour"
/>
<target
name=
"convert"
>
<delete
dir=
"${tmp}"
failonerror=
"false"
/>
<sleep
seconds=
"1"
/>
...
...
@@ -20,6 +21,8 @@
<delete
dir=
"${out}"
failonerror=
"false"
/>
<sleep
seconds=
"1"
/>
<mkdir
dir=
"${out}"
/>
<mkdir
dir=
"${tmpRetour}"
/>
<for
param=
"inputFile"
>
<path>
...
...
@@ -29,7 +32,7 @@
<sequential>
<local
name=
"filename"
/>
<basename
property=
"filename"
file=
"@{inputFile}"
/>
<antcall
target=
"UnzipHdocFile"
>
<param
name=
"filename"
value=
"${filename}"
/>
</antcall>
...
...
@@ -38,7 +41,9 @@
<param
name=
"filename"
value=
"${filename}"
/>
</antcall>
<antcall
target=
"MakeOCF"
/>
<antcall
target=
"MakeOCF"
>
<param
name=
"filename"
value=
"${filename}"
/>
</antcall>
<antcall
target=
"MakeOPF"
>
<param
name=
"filename"
value=
"${filename}"
/>
...
...
@@ -48,6 +53,15 @@
<param
name=
"filename"
value=
"${filename}"
/>
</antcall>
<antcall
target=
"ZipEpubFile"
>
<param
name=
"filename"
value=
"${filename}"
/>
</antcall>
<antcall
target=
"ValidateOutput"
>
<param
name=
"filename"
value=
"${filename}"
/>
</antcall>
<antcall
target=
"CleanTmp"
/>
</sequential>
</for>
</target>
...
...
@@ -72,25 +86,49 @@
</target>
<target
name=
"MakeOCF"
>
<mkdir
dir=
"${
out
}/META-INF"
/>
<mkdir
dir=
"${
out
}/oebps"
/>
<copy
file=
"${file}/mimetype"
todir=
"${
out
}"
/>
<copy
file=
"${file}/container.xml"
todir=
"${
out
}/META-INF"
/>
<mkdir
dir=
"${
tmpRetour
}/META-INF"
/>
<mkdir
dir=
"${
tmpRetour
}/oebps"
/>
<copy
file=
"${file}/mimetype"
todir=
"${
tmpRetour
}"
/>
<copy
file=
"${file}/container.xml"
todir=
"${
tmpRetour
}/META-INF"
/>
</target>
<target
name=
"MakeOPF"
>
<xslt
in=
"${tmp}/${filename}/decompressedHdoc/content.xml"
out=
"${
out}/oebps/content.xml
"
classpath=
"${lib}/saxon9he.jar"
style=
"${xsl}/content.xsl"
/>
<xslt
in=
"${tmp}/${filename}/decompressedHdoc/content.xml"
out=
"${
tmpRetour}/oebps/content.opf
"
classpath=
"${lib}/saxon9he.jar"
style=
"${xsl}/content.xsl"
/>
</target>
<target
name=
"MakeOPS"
>
<mkdir
dir=
"${
out
}/oebps/images"
/>
<copy
todir=
"${
out
}/oebps/images"
>
<mkdir
dir=
"${
tmpRetour
}/oebps/images"
/>
<copy
todir=
"${
tmpRetour
}/oebps/images"
>
<fileset
dir=
"${tmp}/${filename}/decompressedHdoc/re"
includes=
"**"
/>
</copy>
<mkdir
dir=
"${out}/oebps/styles"
/>
<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"
/>
<mkdir
dir=
"${tmpRetour}/oebps/styles"
/>
<mkdir
dir=
"${tmpRetour}/oebps/chapitres"
/>
<xslt
in=
"${tmp}/${filename}/decompressedHdoc/content.xml"
out=
"${tmpRetour}/oebps/tableDesMatieres.ncx"
classpath=
"${lib}/saxon9he.jar"
style=
"${xsl}/tdmncx.xsl"
/>
<xslt
destdir=
"${tmpRetour}/oebps/chapitres"
basedir=
"${tmp}/${filename}/decompressedHdoc"
includes=
"content.xml"
classpath=
"${lib}/saxon9he.jar"
style=
"${xsl}/chapitre.xsl"
/>
<delete
file=
"${tmpRetour}/oebps/chapitres/content.html"
/>
</target>
<target
name=
"ZipEpubFile"
>
<propertyregex
property=
"properFilename"
input=
"${filename}"
regexp=
".hdoc"
replace=
""
casesensitive=
"false"
override=
"true"
/>
<zip
destfile=
"${out}/${properFilename}.epub"
update=
"true"
encoding=
"UTF-8"
>
<zipfileset
dir=
"${tmpRetour}/META-INF"
includes=
"*"
prefix=
"META-INF"
/>
<zipfileset
dir=
"${tmpRetour}/oebps"
includes=
"**"
prefix=
"oebps"
/>
</zip>
<!-- zip64Mode="never" -->
<zip
destfile=
"${out}/${properFilename}.epub"
update=
"true"
compress=
"false"
encoding=
"UTF-8"
keepcompression=
"true"
createunicodeextrafields=
"never"
>
<zipfileset
dir=
"${tmpRetour}"
includes=
"mimetype"
/>
</zip>
</target>
<target
name=
"ValidateOutput"
>
</target>
<target
name=
"CleanTmp"
>
<delete
dir=
"${tmp}"
failonerror=
"false"
/>
</target>
</project>
hdoc_to_epub/xsl/chapitre.xsl
0 → 100644
View file @
fc427b0c
<?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"
xmlns=
"http://www.w3.org/1999/xhtml"
version=
"2.0"
>
<xsl:output
method=
"xml"
indent=
"yes"
encoding=
"UTF-8"
/>
<xsl:template
match=
"/html"
priority=
"10"
>
<xsl:for-each
select=
"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"
>
<head>
<title><xsl:value-of
select=
"header/h1"
/></title>
</head>
<body>
<h1><xsl:value-of
select=
"header/h1"
/></h1>
<xsl:apply-templates
select=
"div|section"
/>
</body>
</html>
</xsl:result-document>
</xsl:for-each>
</xsl:template>
<xsl:template
match=
"section"
priority=
"3"
>
<xsl:element
name=
"h{count(ancestor::section)+1}"
>
<xsl:value-of
select=
"header/h1"
/>
<xsl:apply-templates
select=
"div|section"
/>
</xsl:element>
</xsl:template>
<!-- Identity transformation -->
<xsl:template
match=
"node()|@*"
>
<xsl:copy>
<xsl:apply-templates
select=
"node()|@*"
/>
</xsl:copy>
</xsl:template>
<!-- Namespace substitution for hdoc elements -->
<xsl:template
match=
"*"
priority=
"1"
>
<xsl:element
name=
"{local-name()}"
>
<xsl:apply-templates
select=
"node()|@*"
/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
hdoc_to_epub/xsl/tdmncx.xsl
View file @
fc427b0c
...
...
@@ -3,12 +3,13 @@
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes=
"xs"
xpath-default-namespace=
"http://www.utc.fr/ics/hdoc/xhtml"
xmlns=
"http://www.daisy.org/z3986/2005/ncx/"
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"
>
<ncx
version=
"2005-1"
xml:lang=
"en-US"
>
<head>
<meta
content=
"org-example-5059463624137734586"
name=
"dtb:uid"
/>
</head>
...
...
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