Commit 794dc845 authored by Ivan D'halluin's avatar Ivan D'halluin
Browse files

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

parents 9c772450 f00cf78f
<?xml version="1.0" encoding="UTF-8"?>
<?oxygen RNGSchema="http://hdoc.crzt.fr/schemas/xhtml/hdoc1-xhtml.rng" type="xml"
?>
<html xmlns="http://www.utc.fr/ics/hdoc/xhtml"
xmlns:utc="http://www.utc.fr/ics/hdoc/xhtml"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<head>
<title>Compte rendu reunion</title>
<meta charset="utf-8"/>
<meta name="author" content=""/>
</head>
<body>
<section>
<header>
<h1>Compte rendu reunion</h1>
</header>
<section>
<header>
<h1>Avancé du travail</h1>
</header>
<section data-hdoc-type="unit-of-content">
<header>
<h1>Amélioration du rendement</h1>
</header>
</section>
<section data-hdoc-type="unit-of-content">
<header>
<h1>Création d'un nouveau systeme de paiement</h1>
</header>
</section>
<footer/>
</section>
<section>
<header>
<h1>Résultat courrant</h1>
</header>
<section data-hdoc-type="unit-of-content">
<header>
<h1>70% du travail fait</h1>
</header>
</section>
<footer/>
</section>
<section>
<header>
<h1>Rappel du travail à realiser</h1>
</header>
<section>
<header>
<h1>Changement du process de relation client</h1>
</header>
<section data-hdoc-type="unit-of-content">
<header>
<h1>Formation</h1>
</header>
</section>
<section data-hdoc-type="unit-of-content">
<header>
<h1>Sondage clientèle</h1>
</header>
</section>
<footer/>
</section>
<section data-hdoc-type="unit-of-content">
<header>
<h1>Trouver de nouveaux client d'ici la fin de l'année</h1>
</header>
</section>
<footer/>
</section>
<footer/>
</section>
</body>
</html>
# how to use the converter
#1 : you want to convert your freemindFile in Hdoc
- put your freemind file in the mindMapping_to_Hdoc
- enter the command line :
- linux : ant -buildfile mindmapping_to_hdoc.ant -DinputPath <yourFilename>
- windows : C:\ant\bin\ant -buildfile mindmapping_to_hdoc.ant -DinputPath <yourFilename>
you will find the result in the folder result/hdoc
@echo off
set lib=lib
set ant=mindmapping_to_hdoc.ant
set antparam=-Dprogram.param=%1
set inputPath=%2
set scJarList=%lib%\*
if defined %inputPath% java.exe -classpath "%scJarList%" -Xmx150m org.apache.tools.ant.Main -buildfile %ant% %antparam% -DinputPath %inputPath%
pause
if not defined %inputPath% 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"
inputPath="$2"
#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/*"
if [ "$inputPath" == '' ] ; then
echo "Appel sans paramètre"
$vJavaCmd -classpath "$scJarList:" -Xmx150m org.apache.tools.ant.Main -buildfile $ant $antparam
else
echo "Appel avec paramètre"
$vJavaCmd -classpath "$scJarList:" -Xmx150m org.apache.tools.ant.Main -buildfile $ant $antparam -DinputPath $inputPath
fi
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns="urn:utc.fr:ics:hdoc:container"
>
<xsl:template match="*">
<xsl:processing-instruction name="oxygen">
RNGSchema="http://scenari.utc.fr/hdoc/schemas/container/hdoc1-container.rng" type="xml"
</xsl:processing-instruction>
<xsl:element name="container" >
<xsl:attribute name="version">1.0</xsl:attribute>
<rootfiles>
<rootfile full-path="content.xml" media-type="text/xml"/>
</rootfiles>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
......@@ -11,7 +11,7 @@
<!-- Entry point -->
<xsl:template match="map">
<xsl:processing-instruction name="oxygen">
RNGSchema="http://scenari.utc.fr/hdoc/schemas/xhtml/hdoc1-xhtml.rng" type="xml"
RNGSchema="http://hdoc.crzt.fr/schemas/xhtml/hdoc1-xhtml.rng" type="xml"
</xsl:processing-instruction>
<html>
<head>
......@@ -42,32 +42,30 @@
<xsl:value-of select="utc:remove-language(@TEXT)"/>
<xsl:value-of select="richcontent"/>
</h1>
<!--Introduction-->
<xsl:if test="child::*[contains(@TEXT, '#intro')]">
<xsl:element name="div">
<xsl:attribute name="data-hdoc-type">introduction</xsl:attribute>
<xsl:value-of
select="utc:remove-language(child::*[contains(@TEXT, '#intro')][1]/@TEXT)"
/>
</xsl:element>
</xsl:if>
</header>
<!--Introduction-->
<xsl:if test="child::*[contains(@TEXT, '#intro')]">
<xsl:element name="section">
<header><h1>Introduction</h1>
<xsl:element name="div">
<xsl:attribute name="data-hdoc-type">introduction</xsl:attribute>
<xsl:value-of select="utc:remove-language(child::*[contains(@TEXT, '#intro')][1]/@TEXT)"/>
</xsl:element>
</header>
</xsl:element>
</xsl:if>
<!-- Process children -->
<xsl:apply-templates select="node"/>
<!--Conclusion-->
<xsl:if test="child::*[contains(@TEXT, '#conclu')]">
<xsl:element name="section">
<header><h1>Conclusion</h1></header>
<footer>
<xsl:element name="div">
<xsl:attribute name="data-hdoc-type">conclusion</xsl:attribute>
<xsl:value-of select="utc:remove-language(child::*[contains(@TEXT, '#conclu')][1]/@TEXT)"/>
</xsl:element>
</footer>
</xsl:element>
</xsl:if>
<footer>
<!--Conclusion-->
<xsl:if test="child::*[contains(@TEXT, '#conclu')]">
<xsl:element name="div">
<xsl:attribute name="data-hdoc-type">conclusion</xsl:attribute>
<xsl:value-of
select="utc:remove-language(child::*[contains(@TEXT, '#conclu')][1]/@TEXT)"
/>
</xsl:element>
</xsl:if>
</footer>
</xsl:element>
</xsl:template>
......@@ -79,7 +77,7 @@
<xsl:attribute name="data-hdoc-type">unit-of-content</xsl:attribute>
<xsl:if test="child::attribute[@NAME='anchor']">
<xsl:attribute name="id">
<xsl:value-of select="child::attribute[@NAME='anchor'][1]/@VALUE"></xsl:value-of>
<xsl:value-of select="child::attribute[@NAME='anchor'][1]/@VALUE"/>
</xsl:attribute>
</xsl:if>
<header>
......@@ -111,7 +109,8 @@
</xsl:template>
<!-- Default behavior for intro and conclu nodes : do nothing -->
<xsl:template match="node[contains(@TEXT, '#intro')] | node[contains(@TEXT, '#conclu')]" priority="3"/>
<xsl:template match="node[contains(@TEXT, '#intro')] | node[contains(@TEXT, '#conclu')]"
priority="3"/>
<xsl:template match="richcontent">
<xsl:value-of select="utc:remove-language(html/body/p)"/>
......@@ -119,9 +118,9 @@
<!-- Utility functions -->
<xsl:function name="utc:remove-language" as="xs:string">
<xsl:param name="text" as="xs:string?" />
<xsl:param name="text" as="xs:string?"/>
<xsl:variable name="text2" select="string($text)"/>
<xsl:value-of select="replace($text2,'(#[0-9a-z]* )+','')"></xsl:value-of>
<xsl:value-of select="replace($text2,'(#[0-9a-z]* )+','')"/>
</xsl:function>
</xsl:stylesheet>
.ant-targets-mindMapping2Hdoc.ant
result/**
temp/**
Mindmapping to HDOC
===================
Conversion of Freemind file(s) (.mm) to Opale
# How to use the converter
Use a terminal and go to the root of the folder (mindmapping_to_opale).
#1 : You want to convert SEVERAL Freemind files in Opale
- Put your files in a folder mindmapping_to_opale/input
- Enter the command line corresponding to your OS :
- On Linux : sh run.sh
- On Windows : run.bat
#2 : You want to convert ONE specific freemindFile in Opale
- Put your file in a folder mindmapping_to_opale/input
- Enter the command line corresponding to your OS :
- On Linux : sh run.sh -DinputPath input/<yourFilename>
- On Windows : run.bat -DinputPath input/<yourFilename>
You will find the result in the folder mindmapping_to_opale/result
IMPORTANT
=========
You can use special rules in Freemind to personnalize your Scenari Module :
- By default, a "Division" is created with the name of the main node of your MindMap
- Then :
A node without children is transformed in grain content
A node with children is transformed in division
- You can add introduction and conclusion using the hashtag #intro and #conclu on all the node that has no child
- You can arrange the order of the node usine the hashtag #1, #2, #3 etc.
<?xml version="1.0" encoding="UTF-8" standalone="no"?><map version="0.8.1"><node CREATED="1450312359766" ID="2nngtspni6hi1484pfec44c8lk" MODIFIED="1450312359766" TEXT="MindMapping"></node></map>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="default">
<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="in" location="${basedir}/input"/>
<property name="out" value="${basedir}/result"/>
<property name="resultFile" 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>
<target name="default" depends="preparation">
<echo>----------------------------Begin of conversion----------------------------------</echo>
<!-- Sect Schema : only sect element -->
<antcall target="Makehdoc">
<param name="hdocName" value="sect"/>
</antcall>
<delete dir="${basedir}/temp"/>
<echo>----------------------------Begin of
conversion----------------------------------</echo>
<antcall target="conversion"/>
<echo>----------------------------End of conversion----------------------------------</echo>
</target>
<target depends="ifOSWindows, ifOSUnix" name="conversion"/>
<condition property="isOSUnix">
<os family="unix" />
</condition>
<condition property="isOSWindows">
<os family="windows" />
</condition>
<!-- if the OS is windows call the target run.script.windows -->
<target name="ifOSWindows" if="isOSWindows">
<echo>is Windows........</echo>
<echo>InputPath : ${inputPath}</echo>
<if>
<isset property="inputPath"/>
<then>
<antcall target="conversion.windows.input-path"/>
</then>
<else>
<antcall target="conversion.windows.no-input-path"/>
</else>
</if>
</target>
<!-- if the OS is not windows call the target run.script.unix-->
<target name="ifOSUnix" if="isOSUnix">
<echo>is Unix........</echo>
<echo>InputPath : ${inputPath}</echo>
<if>
<isset property="inputPath"/>
<then>
<antcall target="conversion.linux.input-path"/>
</then>
<else>
<antcall target="conversion.linux.no-input-path"/>
</else>
</if>
</target>
<target name="conversion.windows.input-path">
<basename property="filename" file="${inputPath}" suffix=".mm"/>
<echo>There is an input path in parameter : conversion of this file</echo>
<!-- Conversion from mm to hdoc -->
<exec dir="${basedir}/../mindmapping_to_hdoc" executable="cmd">
<arg value="${basedir}/../mindmapping_to_hdoc/run.bat"/>
<arg line="-DinputPath ./../mindmapping_to_opale/input/${filename}.mm"/>
</exec>
<copy file="${basedir}/../mindmapping_to_hdoc/result/${filename}.hdoc" todir="${resultFile}/hdoc"/>
<!-- Conversion from hdoc to scar -->
<!-- Files have to be copied in hdoc_to_opale in order to be treated -->
<copy file="${basedir}/../mindmapping_to_hdoc/result/${filename}.hdoc" todir="${basedir}/../hdoc_to_opale/input"/>
<exec dir="${basedir}/../hdoc_to_opale" executable="cmd">
<arg value="${basedir}/../hdoc_to_opale/run.bat"/>
</exec>
<copy todir="${resultFile}/scar/${filename}">
<fileset dir="${basedir}/../hdoc_to_opale/output/${filename}"/>
</copy>
</target>
<target name="conversion.windows.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}" suffix=".mm"/>
<!-- Conversion from mm to hdoc -->
<!-- Conversion script is call with the file in parameter (no copy of files in minmapping_to_hdoc) -->
<exec dir="${basedir}/../mindmapping_to_hdoc" executable="cmd">
<arg value="${basedir}/../mindmapping_to_hdoc/run.bat"/>
<arg line="-DinputPath ./../mindmapping_to_opale/input/${filename}.mm"/>
</exec>
<property name="filename" value="${filename}"/>
<copy file="${basedir}/../mindmapping_to_hdoc/result/${filename}.hdoc" todir="${resultFile}/hdoc"/>
<!-- Conversion from hdoc to scar -->
<!-- Files have to be copied in hdoc_to_opale in order to be treated -->
<copy file="${basedir}/../mindmapping_to_hdoc/result/${filename}.hdoc" todir="${basedir}/../hdoc_to_opale/input"/>
<exec dir="${basedir}/../hdoc_to_opale" executable="cmd">
<arg value="${basedir}/../hdoc_to_opale/run.bat"/>
</exec>
<copy todir="${resultFile}/scar/${filename}">
<fileset dir="${basedir}/../hdoc_to_opale/output/${filename}"/>
</copy>
</sequential>
</for>
</target>
<target name="conversion.linux.input-path">
<basename property="filename" file="${inputPath}" suffix=".mm"/>
<echo>There is an input path in parameter : conversion of the file ${inputPath}</echo>
<!-- Conversion from mm to hdoc -->
<exec dir="${basedir}/../mindmapping_to_hdoc" executable="/bin/sh">
<arg value="${basedir}/../mindmapping_to_hdoc/run.sh"/>
<arg line="-DinputPath ./../mindmapping_to_opale/input/${filename}.mm"/>
</exec>
<copy file="${basedir}/../mindmapping_to_hdoc/result/${filename}.hdoc" todir="${resultFile}/hdoc"/>
<!-- Conversion from hdoc to scar -->
<!-- Files have to be copied in hdoc_to_opale in order to be treated -->
<copy file="${basedir}/../mindmapping_to_hdoc/result/${filename}.hdoc" todir="${basedir}/../hdoc_to_opale/input"/>
<exec dir="${basedir}/../hdoc_to_opale" executable="/bin/sh">
<arg value="${basedir}/../hdoc_to_opale/run.sh"/>
</exec>
<copy todir="${resultFile}/scar/${filename}">
<fileset dir="${basedir}/../hdoc_to_opale/output/${filename}"/>
</copy>
</target>
<target name="conversion.linux.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}" suffix=".mm"/>
<!-- Conversion from mm to hdoc -->
<!-- Conversion script is call with the file in parameter (no copy of files in minmapping_to_hdoc) -->
<exec dir="${basedir}/../mindmapping_to_hdoc" executable="/bin/sh">
<arg value="${basedir}/../mindmapping_to_hdoc/run.sh"/>
<arg line="-DinputPath ./../mindmapping_to_opale/input/${filename}.mm"/>
</exec>
<property name="filename" value="${filename}"/>
<copy file="${basedir}/../mindmapping_to_hdoc/result/${filename}.hdoc" todir="${resultFile}/hdoc"/>
<!-- Conversion from hdoc to scar -->
<!-- Files have to be copied in hdoc_to_opale in order to be treated -->
<copy file="${basedir}/../mindmapping_to_hdoc/result/${filename}.hdoc" todir="${basedir}/../hdoc_to_opale/input"/>
<exec dir="${basedir}/../hdoc_to_opale" executable="/bin/sh">
<arg value="${basedir}/../hdoc_to_opale/run.sh"/>
</exec>
<copy todir="${resultFile}/scar/${filename}">
<fileset dir="${basedir}/../hdoc_to_opale/output/${filename}"/>
</copy>
</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="${basedir}/temp"/>
<mkdir dir="${basedir}/temp"/>
<delete dir="${basedir}/result"/>
<mkdir dir="${basedir}/result"/>
<delete dir="${resultFile}/hdoc"></delete>
<mkdir dir="${resultFile}/hdoc" />
<delete dir="${resultFile}/scar"></delete>
<mkdir dir="${resultFile}/scar" />
<!--<condition>
<equals arg1="${foo}" arg2=""/>
</condition> -->
<!-- //delete temp -->
<echo>--- End ----</echo>
</target>
<!-- Convert a mindMap file into a hdoc, with a xsl schema specified in the parameter -->
<target name="Makehdoc" >
<echo>Begin data conversion</echo>
<!-- to generate scar files -->
<antcall target="hdoc_conversion"/>
<antcall target="opale_conversion"/>
<!-- </condition> -->
<!--<delete dir="${resultFile}/hdoc"></delete>-->
<echo>end data conversion</echo>
</target>
<target name="hdoc_conversion">
<!-- <condition property="converting.set" else="false"> -->
<ant antfile="${basedir}/../mindmapping_to_hdoc/mindmapping_to_hdoc.ant" dir="${basedir}/../mindmapping_to_hdoc">
<property name="InputPath" value="${inputPath}"/>
</ant>
</target>
<target depends="ifOSWindows, ifOSUnix" name="opale_conversion"/>
<condition property="isOSUnix">
<os family="unix" />
</condition>
<condition property="isOSWindows">
<os family="windows" />
</condition>
<!-- if the OS is windows call the target run.script.windows -->
<target name="ifOSWindows" if="isOSWindows">
<echo>is Windows........</echo>
<antcall target="opale_conversion.windows"/>
</target>
<!-- if the OS is not windows call the target run.script.unix-->
<target name="ifOSUnix" if="isOSUnix">
<echo>is Unix........</echo>
<antcall target="opale_conversion.unix"/>
</target>
<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="${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"/>-->
</target>
<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="${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"/>-->
</target>
</project>
<!-- Convert a mindMap file into a hdoc, with a xsl schema specified in the parameter -->
<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"/>
<!-- 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}"/>
<!-- zipping files as the hdoc format -->
<zip destfile="${resultFile}/${hdocName}.hdoc" basedir="${basedir}/temp/${hdocName}"/>
<!-- </condition> -->
<echo>end data conversion</echo>
</target>