Commit 21a81fe8 authored by Baptiste Perraud's avatar Baptiste Perraud

Merge branch 'master' of

parents 4b4769d4 a9c3f851
...@@ -13,16 +13,18 @@ ...@@ -13,16 +13,18 @@
<target name="convert"> <target name="convert">
<echo message="DEBUT"/> <echo message="DEBUT"/>
<delete dir="${tmp}" failonerror="false"/>
<sleep seconds="1"/>
<mkdir dir="${tmp}"/> <mkdir dir="${tmp}"/>
<delete dir="${out}" failonerror="false"/> <delete dir="${out}" failonerror="false"/>
<sleep seconds="1"/>
<mkdir dir="${out}"/> <mkdir dir="${out}"/>
<delete dir="${log}" failonerror="false"/> <delete dir="${log}" failonerror="false"/>
<sleep seconds="1"/>
<mkdir dir="${log}"/> <mkdir dir="${log}"/>
<for param="inputFile">
<path> <path>
<fileset dir="${in}" includes="**/*.hdoc"/> <fileset dir="${in}" includes="**/*.hdoc"/>
</path> </path>
...@@ -30,7 +32,7 @@ ...@@ -30,7 +32,7 @@
<sequential> <sequential>
<local name="filename"/> <local name="filename"/>
<basename property="filename" file="sample.hdoc"/> <basename property="filename" file="@{inputFile}"/>
<antcall target="UnzipHdocFile"> <antcall target="UnzipHdocFile">
<param name="filename" value="${filename}"/> <param name="filename" value="${filename}"/>
...@@ -39,9 +41,10 @@ ...@@ -39,9 +41,10 @@
<antcall target="content"> <antcall target="content">
<param name="filename" value="${filename}"/> <param name="filename" value="${filename}"/>
</antcall> </antcall>
<echo message="FIN"/> <echo message="FIN"/>
</target> </target>
<target name="UnzipHdocFile"> <target name="UnzipHdocFile">
...@@ -50,14 +53,17 @@ ...@@ -50,14 +53,17 @@
<unzip src="${in}/${filename}" dest="${tmp}/${filename}/decompressedHdoc"/> <unzip src="${in}/${filename}" dest="${tmp}/${filename}/decompressedHdoc"/>
<chmod dir="${tmp}/${filename}/decompressedHdoc" perm="777"/> <chmod dir="${tmp}/${filename}/decompressedHdoc" perm="777"/>
<echo message="${tmp}/${filename}/decompressedHdoc"/> <echo message="${tmp}/${filename}/decompressedHdoc"/>
<sleep seconds="1"/>
</target> </target>
<target name="content" > <target name="content" >
<xslt in="${tmp}/${filename}/decompressedHdoc/content.xml" out="${tmp}/${filename}/generateContentPath.xml" style="${xsl}/transformation.xsl" processor=""> <xslt in="${tmp}/${filename}/decompressedHdoc/content.xml" out="${out}/${filename}_data.xml" style="${xsl}/transformation.xsl" processor="">
<param name="filename" expression="${filename}"/> <param name="filename" expression="${filename}"/>
<param name="lib" expression="${lib}"/> <param name="lib" expression="${lib}"/>
</xslt> </xslt>
<echo message="${filename}" />
<delete dir="${tmp}" failonerror="false"/>
</target> </target>
...@@ -18,20 +18,25 @@ Credits ...@@ -18,20 +18,25 @@ Credits
Presentation Presentation
------------ ------------
"Hdoc to Epub" is an hdoc converter to epub files. It's a set of ANT scripts and XSL files
Dependencies Dependencies
------------ ------------
There's no particular dependencies needed to run the converter.
User Documentation User Documentation
------------------ ------------------
### Scenario
La personne possède un hdoc et voudrait le convertir en epub. Il se dirige vers le site hdoc et télécharge le zip. Il extrait le zip et se rend vers le dossier hdoc_to_epub. Il lit le et suit les directives pour obtenir son format epub. Pour cela, il doit coller son hdoc dans le dossier input et lancer l'exécutable "run". Enfin, il aura son epub dans le dossier output.
Unsupported Unsupported
----------- -----------
Known bugs Known bugs
---------- ----------
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- test.ant --> <project name="hdoc_to_epub" basedir="." default="convert">
<property name="p">Default</property> <taskdef resource="net/sf/antcontrib/antlib.xml"/>
<echo message="${p}"/> <taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask"/>
<property name="in" location="${basedir}/input"/>
<property name="out" location="${basedir}/output"/>
<property name="tmp" location="${basedir}/tmp"/>
<property name="schema" location="${basedir}/schema"/>
<target name="convert">
<delete dir="${tmp}" failonerror="false"/>
<sleep seconds="1"/>
<mkdir dir="${tmp}"/>
<delete dir="${out}" failonerror="false"/>
<sleep seconds="1"/>
<mkdir dir="${out}"/>
<for param="inputFile">
<fileset dir="${in}" includes="**/*.hdoc"/>
<local name="filename"/>
<basename property="filename" file="@{inputFile}"/>
<antcall target="UnzipHdocFile">
<param name="filename" value="${filename}"/>
<antcall target="ValidateInput">
<param name="filename" value="${filename}"/>
<target name="UnzipHdocFile">
<!-- Unzip the input hdoc file. Decompressed folder is named "decompressedHdoc" : this name is the only one which
refers to the hdoc file furthermore in this project. -->
<unzip src="${in}/${filename}" dest="${tmp}/${filename}/decompressedHdoc"/>
<chmod dir="${tmp}/${filename}/decompressedHdoc" perm="777"/>
<!-- Validating the XML container file -->
<target name="ValidateInput">
<trycatch property="foo" reference="bar">
<jing file="${tmp}/${filename}/decompressedHdoc/META-INF/container.xml" rngfile="${schema}/hdoc1-container.rng"></jing>
<echo>Validation failed</echo>
</project> </project>
<?xml version="1.0" encoding="UTF-8"?>
<a:documentation>This schema describes the META-INF/container.xml file for hdoc format</a:documentation>
<a:documentation>This schema is a derivation of
from EPUB Open Container Format (
<element name="container">
<attribute name="version">
<element name="rootfiles">
<element name="rootfile">
<attribute name="full-path">
<data type="anyURI"/>
<attribute name="media-type">
...@@ -2,10 +2,12 @@ ...@@ -2,10 +2,12 @@
<xsl:stylesheet <xsl:stylesheet
xmlns:xsl="" version="2.0" xmlns:xsl="" version="2.0"
xmlns:xs=""> xmlns:xs=""
<xsl:output method="xml" indent="yes"/> xpath-default-namespace="">
<xsl:output method="text" indent="yes"/>
<xsl:template match="html"> <xsl:template match="html">
<Helloworld/> Hello world !
</xsl:template> </xsl:template>
</xsl:stylesheet> </xsl:stylesheet>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment