Commit 89b2ccc4 authored by Ivan D'halluin's avatar Ivan D'halluin

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

parents 3362ee87 b66d5294
Usage
-----
Put the `.hdoc` files in the input folder, run `run.bat` or `run.sh` according to your operating system and get the .scar in the output folder.
Now, the script is able to manage several files.
Todo list
---------
- Refactor the ant script
- Resolve bugs
- (Optional) Port to XSLT 2.0
Bugs
----
- Table cell size
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project name="hdoc_to_opale" basedir="." default="convert">
<property file="global.properties"/>
<taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask">
<classpath>
<pathelement location="lib/jing.jar"/>
</classpath>
</taskdef>
<target name="convert">
<!-- This is the main target : it is called whether by the project (as the default target) or by the user/converter
website, if specified in the command line. Basically, this target consists in several targets/ant buildfiles calls. -->
<antcall target="CleanDirectory"/>
<mkdir dir="${tmpdir}"/>
<antcall target="UnzipHdocFile"/>
<antcall target="ValidateInput" />
<antcall target="FindContentFiles"/>
<ant antfile="${tmpdir}/generateContentPath.xml"/>
<antcall target="ValidateOutput"/>
<antcall target="DivideOutput"/>
<antcall target="ZipOutput"/>
<antcall target="ZipDividedOutput"/>
<antcall target="CleanDirectory"/>
</target>
<target name="CleanDirectory">
<delete dir="${tmpdir}"/>
</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="${InputPath}" dest="${tmpdir}/decompressedHdoc"/>
<chmod dir="${tmpdir}/decompressedHdoc" perm="777"/>
</target>
<target name="FindContentFiles">
<!-- Finds the absolute path of container.xml and applies transformation0.xsl on it.-->
<first id="first">
<fileset
dir="${tmpdir}/decompressedHdoc/META-INF"
includes="**/container.xml"
/>
</first>
<xslt
in="${toString:first}"
out="${tmpdir}/generateContentPath.xml"
style="transformation0.xsl"
processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison"
/>
<chmod file="${tmpdir}/generateContentPath.xml" perm="777"/>
</target>
<target name="ZipOutput">
<copy file=".wspmeta" todir="${tmpdir}/decompressedOpale"/>
<mkdir dir="${tmpdir}/decompressedOpale/res"/>
<ant antfile="${tmpdir}/moveRessourceFiles.xml"/>
<zip basedir="${tmpdir}/decompressedOpale" destfile="${OutputPath}" encoding="UTF-8"/>
</target>
<target name="ZipDividedOutput">
<copy file=".wspmeta" todir="${tmpdir}/decompressedOpaleDivided"/>
<copy todir="${tmpdir}/decompressedOpaleDivided/res" >
<fileset dir="${tmpdir}/decompressedOpale/res" includes="**"/>
</copy>
<copy todir="${tmpdir}/decompressedOpaleDivided/references" >
<fileset dir="${tmpdir}/decompressedOpale/references" includes="**"/>
</copy>
<zip basedir="${tmpdir}/decompressedOpaleDivided" destfile="${OutputPathDivided}" encoding="UTF-8"/>
</target>
<!-- Validating the XML container file -->
<target name="ValidateInput">
<jing file="${tmpdir}/decompressedHdoc/META-INF/container.xml" rngfile="schema/hdoc1-container.rng"></jing>
</target>
<!-- Validating the XML output -->
<target name="ValidateOutput">
<jing file="${tmpdir}/decompressedOpale/main.xml" rngfile="schema/op_ue.rng"></jing>
</target>
<target name="DivideOutput">
<mkdir dir="${tmpdir}/decompressedOpaleDivided"/>
<!-- Adding IDS to the general output file -->
<xslt
in="${tmpdir}/decompressedOpale/main.xml"
out="${tmpdir}/outputWithCourseUcIds.xml"
style="addCourseUcIds.xsl"
processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison"
/>
<!-- Generating the root file (with refs to other files) -->
<xslt
in="${tmpdir}/outputWithCourseUcIds.xml"
out="${tmpdir}/decompressedOpaleDivided/main.xml"
style="addCourseUcReferences.xsl"
processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison"
/>
<!-- Generating the ANT file that will copy the files -->
<xslt
in="${tmpdir}/outputWithCourseUcIds.xml"
out="${tmpdir}/exportUnits.ant"
style="prepareCourseUcCopies.xsl"
processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison"
/>
<!-- Executing that ANT file -->
<ant antfile="${tmpdir}/exportUnits.ant"/>
</target>
</project>
......@@ -82,7 +82,7 @@
<target name="opale_conversion.windows">
<echo>This is a Windows machine.</echo>
<copy file="${resultFile}/hdoc/${hdocName}.hdoc" todir="${basedir}/../hdoc_to_opale/input"/>
<exec dir="." executable="cmd">
<exec dir="${basedir}/../hdoc_to_opale" executable="cmd">
<arg value="${basedir}/../hdoc_to_opale/run.bat"/>
</exec>
<!-- <copy file="${basedir}/../hdoc_to_opale/output/output.scar" todir="${resultFile}/scar/${hdocName}.scar"/>-->
......@@ -91,7 +91,7 @@
<target name="opale_conversion.unix">
<echo>This is an Unix machine.</echo>
<copy file="${resultFile}/hdoc/${hdocName}.hdoc" todir="${basedir}/../hdoc_to_opale/input"/>
<exec dir="." executable="/bin/sh">
<exec dir="${basedir}/../hdoc_to_opale" executable="/bin/sh">
<arg value="${basedir}/../hdoc_to_opale/run.sh"/>
</exec>
<!-- <copy file="${basedir}/../hdoc_to_opale/output/output.scar" todir="${resultFile}/scar/${hdocName}.scar"/>-->
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?><map version="0.8.1"><node CREATED="1450312359766" ID="2nngtspni6hi1484pfec44c8lk" MODIFIED="1450312359766" TEXT="MindMapping"><node CREATED="1450312359766" ID="00lp6bpfm6jibhcjrpdonrhoqb" MODIFIED="1450312359766" POSITION="right" TEXT="#1 MindMapping to Hdoc"><node CREATED="1450312359766" ID="3qm1jgu7dfgs328jthlek5fd4e" MODIFIED="1450312359766" TEXT="Prendre en main le projet existant"/><node CREATED="1450312359766" ID="0u38ectmhqqp4p08p5guvgij71" MODIFIED="1450312359766" TEXT="Corriger les bugs existants"/><node CREATED="1450312359766" ID="3b1t9o2te6enh59j4iv48f4mdi" MODIFIED="1450312359766" TEXT="Restructurer le ant"/></node><node CREATED="1450312359766" ID="6lohsep5crh5g3ngj8ld8loei6" MODIFIED="1450312359766" POSITION="right" TEXT="#2 MindMapping to Opale"><node CREATED="1450312359766" ID="5pl3210hq6if3nv7r2chtjstmo" MODIFIED="1450312359766" TEXT="Faire la connexion avec le transformateur Hdoc to Opale"/><node CREATED="1450312359766" ID="3haa2fgohe9j4n04ilddco84uh" MODIFIED="1450312359766" TEXT="Permettre la personnalisation de l'organisation du module"/><node CREATED="1450312359766" ID="11k2hbkcu415e1mgk5c5ucr48k" MODIFIED="1450312359766" TEXT="Permettre la personnalisation dy type de noeud (Intro, conclusion etc.)"/><node CREATED="1450312359766" ID="4npf8jpvak3lffn9c1rsogi0sq" MODIFIED="1450312359766" TEXT="Permettre la personnalisation grâce aux couleurs/icônes"/></node><node CREATED="1450312359766" ID="3n8v43p8qb005puq3qiv7aiubc" MODIFIED="1450312359766" POSITION="right" TEXT="#3 MindMapping to Optim"><node CREATED="1450312359766" ID="2bn1la3apnjf1fi8qqfqde226t" MODIFIED="1450312359766" TEXT="Faire la connexion avec le transformateur Hdoc to Optim"/></node><node CREATED="1450312359766" ID="3s00si3hquol4pldg7lo9opjd6" MODIFIED="1450312359766" POSITION="right" TEXT="#4 MindMapping to Lexique"><node CREATED="1450312359766" ID="37jlfl25iuaoe6f2cpiv30qksd" MODIFIED="1450312359766" TEXT="Faire la connexion avec le transformateur Hdoc to Lexique"/></node><node CREATED="1450312359767" ID="27gnl6pgottjfiukpa3ulfdjrj" MODIFIED="1450312359767" POSITION="left" TEXT="#5 Prendre d'autres outils de carte mentales en entrée"/><node CREATED="1450312359767" ID="24d41nnnnvvu7fv5m8m4vegu0g" MODIFIED="1450312359767" POSITION="left" TEXT="#intro This converter aims at convert a given MindMapping file into a Hdoc file which then will be imported in Opale (advanced only)."/><node CREATED="1450312359767" ID="6a7pr2b5vvmq6na5964dhf9e13" MODIFIED="1450312359767" POSITION="left" TEXT="#conclu Ma conclusion"/></node></map>
\ 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