Commit af78d304 authored by Hachem Rihab's avatar Hachem Rihab

[hdoc_to_optim] put sections in a new directory + command line execution possibility

parent e75f910e
Pour réaliser votre conversion vous devez ajouter un fichier .hdoc dans le dossier input. Veillez à n'en placer qu'un seul dedans. Ensuite il suffit d'appeler le script (.bat ou .sh).
\ No newline at end of file
Il y a deux façons de réaliser votre conversion:
- Lancer le script run. Dans ce cas vous devez ajouter un fichier .hdoc dans le dossier input. Veillez à n'en placer qu'un seul dedans.
- En ligne de commande en spécifiant le fichier input, avec la commande suivante:
ant -buildfile hdoc_to_optim.ant -DInputFile <votrefichier>
Exemple:
ant -buildfile hdoc_to_optim.ant -DInputFile sample.hdoc
\ No newline at end of file
<project name="hdoc_to_optim" default="convert">
<!-- Arguments properties -->
<property name="InputFile" value="none" />
<property name="InputPath" value="input" />
<property name="OutputPath" value="output" />
<property name="OutputScarPath" value="${OutputPath}/result.scar" />
<target name="convert">
<target name="convert" depends="-condition, -noinput, -input"></target>
<!--Check wether there is an input using command line or not-->
<target name="-condition">
<condition property="do.noinput">
<equals arg1="${InputFile}" arg2="none" />
</condition>
<condition property="do.input">
<not>
<equals arg1="${InputFile}" arg2="none" />
</not>
</condition>
</target>
<!--There is no input, check the input folder-->
<target name="-noinput" if="do.noinput">
<echo message="The value of property InputFile is none... Checking the input folder" />
<!-- get input hdoc file path -->
<fileset id="fileset_hdoc" dir="${InputPath}" casesensitive="yes">
<include name="*.hdoc"/>
</fileset>
<pathconvert property="HdocPath" pathsep="" refid="fileset_hdoc" />
<pathconvert property="HdocFile" pathsep="" refid="fileset_hdoc" />
<echo message="Executing conversion..." />
<!--unzips the hdoc to be converted-->
<unzip dest="hdoc" src ="${HdocPath}"/>
<unzip dest="hdoc" src ="${HdocFile}"/>
<!--gives all rights to avoid bugs-->
<chmod dir="hdoc" perm="777"/>
......@@ -29,10 +47,38 @@
<zip basedir="result" destfile="${OutputScarPath}" encoding="UTF-8"/>
<!--temporary files and folders are deleted-->
<delete dir="hdoc"/>
<delete dir="result"/>
<!--<delete dir="hdoc"/>
<delete dir="result"/>-->
<delete file="get_content.ant"/>
<delete file="get_ressources.ant"/>
</target>
<!--There is an input-->
<target name="-input" if="do.input">
<echo message="The value of property InputFile is ${InputFile}" />
<echo message="Executing conversion..." />
<!--unzips the hdoc to be converted-->
<unzip dest="hdoc" src ="${InputFile}"/>
<!--gives all rights to avoid bugs-->
<chmod dir="hdoc" perm="777"/>
<!--launches the XSLT find_content to retrieve the content path-->
<xslt in="hdoc/META-INF/container.xml" out="get_content.ant" style="xsl/find_content.xsl"/>
<chmod file="get_content.ant" perm="777"/>
<!--launches the ANT get_content resulting from the previous XSLT in order to launch the conversion-->
<ant antfile="get_content.ant"/>
<!--once the conversion is complete, the result is zipped-->
<zip basedir="result" destfile="${OutputScarPath}" encoding="UTF-8"/>
<!--temporary files and folders are deleted-->
<!--<delete dir="hdoc"/>
<delete dir="result"/>-->
<delete file="get_content.ant"/>
<delete file="get_ressources.ant"/>
</target>
</project>
\ No newline at end of file
......@@ -101,7 +101,7 @@
</xsl:variable>
<xsl:message><xsl:value-of select="$chap"/></xsl:message>
<xsl:message>test</xsl:message>
<sp:chap sc:refUri="{$chap}.section">
<sp:chap sc:refUri="chapitres/{$chap}.section">
<xsl:call-template name="sec-body1">
<xsl:with-param name="chap" select = "$chap" />
</xsl:call-template>
......@@ -117,7 +117,7 @@
<xsl:template name="sec-body1">
<xsl:param name = "chap" />
<xsl:message><xsl:value-of select="$chap"/></xsl:message>
<xsl:result-document encoding="UTF-8" href="{$chap}.section" >
<xsl:result-document encoding="UTF-8" href="chapitres/{$chap}.section" >
<sc:item xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
<of:section>
<xsl:if test="@data-hdoc-type='introduction'">
......@@ -322,25 +322,25 @@
<!--Object-->
<xsl:template match="h:object">
<xsl:variable name="data" select="@data"/>
<sc:extBlock role="img" sc:refUri="{$data}"/>
<sc:extBlock role="img" sc:refUri="../{$data}"/>
</xsl:template>
<!--Image-->
<xsl:template match="h:img">
<xsl:variable name="src" select="@src"/>
<sc:extBlock role="img" sc:refUri="{$src}"/>
<sc:extBlock role="img" sc:refUri="../{$src}"/>
</xsl:template>
<!--Audio-->
<xsl:template match="h:audio">
<xsl:variable name="src" select="@src"/>
<sc:extBlock role="anim" sc:refUri="{$src}"/>
<sc:extBlock role="anim" sc:refUri="../{$src}"/>
</xsl:template>
<!--Video-->
<xsl:template match="h:video">
<xsl:variable name="src" select="@src"/>
<sc:extBlock role="anim" sc:refUri="{$src}"/>
<sc:extBlock role="anim" sc:refUri="../{$src}"/>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
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