Commit d7955f69 authored by aperdria's avatar aperdria

You can now convert several files in the same time ; Adding of run.bat and run.sh ;

parent 316f4da1
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="default" >
<project basedir="." default="default">
<property name="in" location="${basedir}/input"/>
<property name="out" value="${basedir}/result"/>
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${basedir}/lib/ant-contrib.jar"/>
</classpath>
</taskdef>
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${basedir}/lib/ant-contrib.jar"/>
</classpath>
</taskdef>
<property name="module" value="default"/>
<!--
only for the debug
<property name="inputPath" value="test.mm"></property>
<property name="outputPath" value="content.xml"/>
<property name="converting" value="yes"/>
-->
<property name="resultFile" value="${basedir}/result"/>
<target name="default" depends="preparation">
<echo>----------------------------Begin of conversion----------------------------------</echo>
<!-- Sect Schema : only sect element -->
<echo>----------------------------Begin of
conversion----------------------------------</echo>
<antcall target="hdoc_conversion"/>
<echo>----------------------------End of conversion----------------------------------</echo>
</target>
<target name="hdoc_conversion">
<if>
<isset property="${inputPath}"/>
<then>
<antcall target="hdoc_conversion.input-path"/>
</then>
<else>
<antcall target="hdoc_conversion.no-input-path"/>
</else>
</if>
</target>
<target name="hdoc_conversion.input-path">
<echo>There is an input path in parameter : conversion of this file</echo>
<antcall target="Makehdoc">
<param name="myXSLT" value="sect.xsl"/>
<param name="hdocName" value="sect"/>
<param name="hdocName" value="${filename}"/>
<param name="InputPath" value="${inputPath}"/>
</antcall>
<!-- For debug purposes <delete dir="${basedir}/temp"/> -->
<echo>----------------------------End of conversion----------------------------------</echo>
</target>
<target name="hdoc_conversion.no-input-path">
<echo>There is no input path in parameter : conversion of all the files in ./input</echo>
<for param="inputFile">
<path>
<fileset dir="${in}" includes="**/*.mm"/>
</path>
<sequential>
<local name="filename"/>
<basename property="filename" file="@{inputFile}"/>
<antcall target="Makehdoc">
<param name="myXSLT" value="sect.xsl"/>
<param name="hdocName" value="${filename}"/>
<param name="inputPath" value="input/${filename}"/>
</antcall>
<property name="filename" value="${filename}"/>
</sequential>
</for>
</target>
<!--<target name="hdoc_conversion" depends="hdoc_conversion.input-path, hdoc_conversion.no-input-path" />
-->
<target name="preparation">
<echo>Setting up the conversion</echo>
<delete dir="${basedir}/temp"></delete>
<mkdir dir="${basedir}/temp" />
<delete dir="${resultFile}/hdoc"></delete>
<mkdir dir="${resultFile}/hdoc" />
<!--<condition>
<equals arg1="${foo}" arg2=""/>
</condition> -->
<!-- //delete temp -->
<delete dir="${basedir}/temp"/>
<mkdir dir="${basedir}/temp"/>
<delete dir="${basedir}/result"/>
<mkdir dir="${basedir}/result"/>
<echo>--- End ----</echo>
</target>
<!-- Convert a mindMap file into a hdoc, with a xsl schema specified in the parameter -->
<target name="Makehdoc" >
<target name="Makehdoc">
<echo>Begin data conversion</echo>
<mkdir dir="${basedir}/temp/${hdocName}"/>
<mkdir dir="${basedir}/temp/${hdocName}/META-INF"/>
<copy file="${basedir}/mimetype" tofile="${basedir}/temp/${hdocName}/mimetype"/>
<!-- create the container file with an XSLT transformation -->
<xslt classpath="lib/saxon9he.jar" in="${basedir}/${inputPath}" out="${basedir}/temp/${hdocName}/META-INF/container.xml" xslresource="${basedir}/xslt/makeContainer.xsl"/>
<xslt classpath="lib/saxon9he.jar" in="${basedir}/${inputPath}"
out="${basedir}/temp/${hdocName}/META-INF/container.xml"
xslresource="${basedir}/xslt/makeContainer.xsl"/>
<!-- create the file which contains the freemind data converted-->
<xslt classpath="lib/saxon9he.jar" in="${basedir}/${inputPath}" out="${basedir}/temp/${hdocName}/content.xml" xslresource="${basedir}/xslt/${myXSLT}"/>
<xslt classpath="lib/saxon9he.jar" in="${basedir}/${inputPath}"
out="${basedir}/temp/${hdocName}/content.xml" xslresource="${basedir}/xslt/${myXSLT}"/>
<!-- zipping files as the hdoc format -->
<zip destfile="${resultFile}/hdoc/${hdocName}.hdoc"
basedir="${basedir}/temp/${hdocName}"/>
<zip destfile="${resultFile}/${hdocName}.hdoc" basedir="${basedir}/temp/${hdocName}"/>
<!-- </condition> -->
<echo>end data conversion</echo>
</target>
</project>
</project>
@echo off
set lib=lib
set ant=mindmapping_to_hdoc.ant
set antparam=-Dprogram.param=%1
set scJarList=%lib%\*
java.exe -classpath "%scJarList%" -Xmx150m org.apache.tools.ant.Main -buildfile %ant% %antparam%
pause
REM start /MIN java.exe -classpath "%scJarList%" -Xmx150m org.apache.tools.ant.Main -buildfile %ant% %antparam%
#!/bin/sh
lib="lib"
ant="mindmapping_to_hdoc.ant"
antparam="-Dprogram.param=$1"
#Recherche de java et controle que se soit une version SUN
vJavaCmd="java"
xCheckJava () {
vInputVarName=\$"$1"
vInputVarVal=`eval "expr \"$vInputVarName\" "`
if [ -z "$vInputVarVal" ];then
eval "$1=false"
return
fi
vSunJavaFound=`$vInputVarVal -version 2>&1 | grep -Eo -m 1 "(HotSpot)|(OpenJDK)"`
if [ "$vSunJavaFound" != "HotSpot" ] && [ "$vSunJavaFound" != "OpenJDK" ] ; then
eval "$1=false"
return
fi
}
xCheckJava vJavaCmd
if [ "$vJavaCmd" = "false" ]; then
vJavaCmd="$JAVA_HOME/bin/java"
xCheckJava vJavaCmd
if [ "$vJavaCmd" = "false" ]; then
echo "ERREUR: JRE de SUN introuvable. Veuillez déclarer la variable d'environnement JAVA_HOME."
exit 1
fi
fi
#Lancer la commande
scJarList="$lib/*"
$vJavaCmd -classpath "$scJarList:" -Xmx150m org.apache.tools.ant.Main -buildfile $ant $antparam
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