Commit a9c3f851 authored by Raphaël's avatar Raphaël

Merge branch 'master' of https://gitlab.utc.fr/crozatst/hdoc

parents 1c0a8bd7 5e324d37
......@@ -13,16 +13,18 @@
<target name="convert">
<echo message="DEBUT"/>
<delete dir="${tmp}" failonerror="false"/>
<sleep seconds="1"/>
<mkdir dir="${tmp}"/>
<delete dir="${out}" failonerror="false"/>
<sleep seconds="1"/>
<mkdir dir="${out}"/>
<delete dir="${log}" failonerror="false"/>
<sleep seconds="1"/>
<mkdir dir="${log}"/>
<for param="inputFile">
<path>
<fileset dir="${in}" includes="**/*.hdoc"/>
</path>
......@@ -30,7 +32,7 @@
<sequential>
<local name="filename"/>
<basename property="filename" file="sample.hdoc"/>
<basename property="filename" file="@{inputFile}"/>
<antcall target="UnzipHdocFile">
<param name="filename" value="${filename}"/>
......@@ -39,9 +41,10 @@
<antcall target="content">
<param name="filename" value="${filename}"/>
</antcall>
</sequential>
<echo message="FIN"/>
</sequential>
</for>
</target>
<target name="UnzipHdocFile">
......@@ -50,14 +53,17 @@
<unzip src="${in}/${filename}" dest="${tmp}/${filename}/decompressedHdoc"/>
<chmod dir="${tmp}/${filename}/decompressedHdoc" perm="777"/>
<echo message="${tmp}/${filename}/decompressedHdoc"/>
<sleep seconds="1"/>
</target>
<target name="content" >
<xslt in="${tmp}/${filename}/decompressedHdoc/content.xml" out="${tmp}/${filename}/generateContentPath.xml" style="${xsl}/transformation.xsl" processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison">
<xslt in="${tmp}/${filename}/decompressedHdoc/content.xml" out="${out}/${filename}_data.xml" style="${xsl}/transformation.xsl" processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison">
<param name="filename" expression="${filename}"/>
<param name="lib" expression="${lib}"/>
</xslt>
<echo message="${filename}" />
<delete dir="${tmp}" failonerror="false"/>
</target>
......
......@@ -13,7 +13,7 @@
<titre><xsl:value-of select="./h:title"/></titre>
</xsl:template>
<xsl:template match="h:body" mode="title">
</xsl:template>
<xsl:template match="h:body" mode="title">
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
......@@ -18,20 +18,25 @@ Credits
Presentation
------------
"Hdoc to Epub" is an hdoc converter to epub files. It's a set of ANT scripts and XSL files
Dependencies
------------
There's no particular dependencies needed to run the converter.
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 README.md 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
-----------
Known bugs
----------
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- test.ant -->
<project>
<property name="p">Default</property>
<echo message="${p}"/>
<project name="hdoc_to_epub" basedir="." default="convert">
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<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">
<path>
<fileset dir="${in}" includes="**/*.hdoc"/>
</path>
<sequential>
<local name="filename"/>
<basename property="filename" file="@{inputFile}"/>
<antcall target="UnzipHdocFile">
<param name="filename" value="${filename}"/>
</antcall>
<antcall target="ValidateInput">
<param name="filename" value="${filename}"/>
</antcall>
</sequential>
</for>
</target>
<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"/>
</target>
<!-- Validating the XML container file -->
<target name="ValidateInput">
<trycatch property="foo" reference="bar">
<try>
<jing file="${tmp}/${filename}/decompressedHdoc/META-INF/container.xml" rngfile="${schema}/hdoc1-container.rng"></jing>
</try>
<catch>
<echo>Validation failed</echo>
</catch>
</trycatch>
</target>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<grammar
xmlns="http://relaxng.org/ns/structure/1.0"
xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
ns="urn:utc.fr:ics:hdoc:container"
>
<a:documentation>This schema describes the META-INF/container.xml file for hdoc format</a:documentation>
<a:documentation>This schema is a derivation of http://www.idpf.org/epub/30/schema/ocf-container-30.rnc
from EPUB Open Container Format (http://www.idpf.org/epub/30/spec/epub30-ocf.html)
</a:documentation>
<start>
<element name="container">
<attribute name="version">
<value>1.0</value>
</attribute>
<element name="rootfiles">
<element name="rootfile">
<attribute name="full-path">
<data type="anyURI"/>
</attribute>
<attribute name="media-type">
<value>text/xml</value>
</attribute>
</element>
</element>
</element>
</start>
</grammar>
......@@ -51,10 +51,6 @@ Generic Todo
Technical notes
---------------
* The product backlog of the current project can be found through the following url: <https://framacalc.org/NF29_Opale_to_Pdf_PB>
* Time-sheets can be found through the following urls:
- <https://framacalc.org/NF29_Opale_to_Pdf_fichetemps_PERRAUD>
- <https://framacalc.org/NF29_Opale_to_Pdf_fichetemps_DEBRAY>
User Story
----------
......
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