Commit a90eaaba authored by Ivan D'halluin's avatar Ivan D'halluin

optim to hdoc: add readme and fix naming

parent db20d76f
input/
tmp/
output/
\ No newline at end of file
Usage
-----
Put `.scar` files in the input folder, run `run.bat` or `run.sh` and get results in output folder (one folder and zip per .scar).
Suppported
----------
- sections, blocks, paragraphs
- inline tags (quote, emphasis, url, definition, inlineImg)
- ordered/unordered lists
- images
- audio
- tables
- OpenDocument .ods, .odg files
- event list
- concept tree
Unsupported
-----------
The Hdoc format create some limitations with the conversion and some points cannot be converted for the moment:
- references of sections or fragments inside a paragraphe
Known bugs
----------
Because of the small amount of tested file this list of know bugs could increase in a near futur:
- references of sections or fragments inside a paragraphe ;
- images and ressources sometimes need to be reselected after the conversion to opale (images are shown in the editor but fail to be loaded when publishing) ;
- links to ressources sometimes doesn't appears after the conversion to opale (links are still in the text view but not in the editor) ;
- Références à des fragments et des sections à l'intérieur de paragraphes non converti ;
- Les images doivent parfois être sélectionnés à nouveau ;
- Les liens n'apparaissent pas parfois mais sont bien présent en mode édition de texte ;
Todo list
---------
There is some points that still need to be tested. Actually I don't have enough Optim files to be sure that everything works fine (does every optim item is converted properly). In the same way I've only tested the conversion with a few publication items (webpage, paper) and I need to test it with the other forms of publication items allowed in Optim.
Another point is that for the moment the level of unit of content for the Opal conversion if basically set to sections witch doesn't contains any section but some could need it to be set to another level. Create a selection of this level could be a next step for this project.
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project default="conversion" basedir="." name="">
<target name="conversion">
<antcall target="hdoc_conversion"/>
<antcall target="opale_conversion"/>
<antcall target="delete_hdoc_file"/>
</target>
<target name="hdoc_conversion">
<ant antfile="${basedir}/optim_to_hdoc/optim_to_hdoc.ant" dir="${basedir}/optim_to_hdoc">
<property name="InputPath" value="${InputPathConvert}"/>
<property name="OutputPath" value="${OutputPathConvert}.hdoc"/>
</ant>
</target>
<target name="opale_conversion" if="${opale.exists}" depends="opale_test">
<ant antfile="${basedir}/hdoctoopale/hdoc_to_opale.ant" dir="${basedir}/hdoctoopale">
<property name="InputPath" value="${OutputPathConvert}.hdoc"/>
<property name="OutputPath" value="${OutputPathConvert}.opale"/>
</ant>
</target>
<target name="delete_hdoc_file" if="${hdoc.delete}" depends="hdoc_test">
<delete file="${OutputPathConvert}.hdoc"></delete>
</target>
<target name="hdoc_test">
<condition property="hdoc.delete" else="false">
<equals arg1="${hdoc}" arg2="false"/>
</condition>
<echo message="delete hdoc after conversion ? ${hdoc.delete}"/>
</target>
<target name="opale_test">
<condition property="opale.exists" else="false">
<equals arg1="${opale}" arg2="true"/>
</condition>
<echo message="Run opale conversion ? ${opale.exists}"/>
</target>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." name="myantce">
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<property name="in" location="${basedir}/input"/>
<property name="out" location="${basedir}/output"/>
<property name="tmp" location="${basedir}/tmp"/>
<property name="xsl" location="${basedir}/xsl"/>
<property name="lib" location="${basedir}/lib"/>
<property name="log" location="${basedir}/log"/>
<delete dir="${tmp}" failonerror="false"/>
<mkdir dir="${tmp}"/>
<delete dir="${out}" failonerror="false"/>
<mkdir dir="${out}"/>
<delete dir="${log}" failonerror="false"/>
<mkdir dir="${log}"/>
<mkdir dir="${tmp}/extract"/>
<mkdir dir="${tmp}/internationalisation"/>
<echo message="Extract files..."/>
<for param="archive">
<path>
<fileset dir="${in}" includes="*"/>
</path>
<sequential>
<local name="archive_name"/>
<basename property="archive_name" file="@{archive}"/>
<unzip src="@{archive}" dest="${tmp}/extract/${archive_name}"></unzip>
</sequential>
</for>
<echo message="Internationalize files..."/>
<xslt useImplicitFileset="false" destdir="${tmp}/internationalisation" style="${xsl}/internalisation.xsl">
<param name="currentDir" expression="."/>
<fileset dir="${tmp}/extract">
<!-- only converting the root files -->
<include name="*/*.paper"/>
<include name="*/*.section"/>
<include name="*/*.website"/>
<include name="*/*.slideshow"/>
<include name="*/*.webpage"/>
</fileset>
</xslt>
<echo message="Convert to hdoc..."/>
<xslt basedir="${tmp}/internationalisation" destdir="${out}" style="${xsl}/optim_to_hdoc.xsl"/>
<echo message="Copy ressources files..."/>
<copy todir="${out}">
<fileset dir="${tmp}/extract">
<!-- only copying resources files -->
<exclude name="*/*.paper"/>
<exclude name="*/*.section"/>
<exclude name="*/*.website"/>
<exclude name="*/*.slideshow"/>
<exclude name="*/*.webpage"/>
</fileset>
</copy>
<echo message="Zip result..."/>
<for param="folder">
<path>
<dirset dir="${out}" includes="*"/>
</path>
<sequential>
<local name="folder_name"/>
<basename property="folder_name" file="@{folder}"/>
<zip destfile="${out}/${folder_name}.zip" basedir="@{folder}" ></zip>
</sequential>
</for>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." name="myantce">
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<property name="in" location="${basedir}/input"/>
<property name="out" location="${basedir}/output"/>
<property name="tmp" location="${basedir}/tmp"/>
<property name="xsl" location="${basedir}/xsl"/>
<project default="convert_to_hdoc">
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${basedir}/lib/ant-contrib-0.6.jar"/>
</classpath>
</taskdef>
<target name="convert_to_hdoc" depends="preparation">
<property name="lib" location="${basedir}/lib"/>
<property name="log" location="${basedir}/log"/>
<delete dir="${tmp}" failonerror="false"/>
<mkdir dir="${tmp}"/>
<delete dir="${out}" failonerror="false"/>
<mkdir dir="${out}"/>
<delete dir="${log}" failonerror="false"/>
<mkdir dir="${log}"/>
<mkdir dir="${tmp}/extract"/>
<mkdir dir="${tmp}/internationalisation"/>
<echo message="Extract files..."/>
<for param="archive">
<path>
<fileset dir="${in}" includes="*"/>
</path>
<sequential>
<local name="archive_name"/>
<basename property="archive_name" file="@{archive}"/>
<unzip src="@{archive}" dest="${tmp}/extract/${archive_name}"></unzip>
</sequential>
</for>
<echo message="Internationalize files..."/>
<unzip src="${InputPath}" dest="${InputPath}_FILES"/>
<fileset id="rootFiles" dir="${InputPath}_FILES" includes="*.paper | *.section | *.website | *.slideshow | *.webpage"/>
<property name="prop.rootFiles" refid="rootFiles"/>
<property name="currentdir" value="${InputPath}_FILES"/>
<echo message=" "/>
<echo message=" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"/>
<echo message=" ! CHECKING FOR ITEM FILE IN ROOT DIRECTORY !"/>
<echo message=" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"/>
<echo message=" "/>
<antcall target="direct_conversion"/>
<antcall target="finde_file"/>
</target>
<target name="preparation">
<echo message=" "/>
<echo message=" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"/>
<echo message=" !!!!!!! DEBUT PREPARATION !!!!!!!"/>
<echo message=" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"/>
<echo message=" "/>
<delete dir="${InputPath}_HDOC"></delete>
<delete dir="${InputPath}_FILES"></delete>
<echo message=" "/>
<echo message=" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"/>
<echo message=" !!!!!!!! FIN PREPARATION !!!!!!!!"/>
<echo message=" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"/>
<echo message=" "/>
</target>
<target name="file_null">
<condition property="file.null" else="false">
<equals arg1="${prop.rootFiles}" arg2=""/>
</condition>
<echo message="Root file missing ? ${file.null}"/>
</target>
<target name="finde_file" if="${file.null}" depends="file_null">
<echo message=" "/>
<echo message=" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"/>
<echo message=" ! NO ITEM FILE FOUND IN ROOT DIRECTORY !"/>
<echo message=" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"/>
<echo message=" "/>
<echo message=" "/>
<echo message=" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"/>
<echo message=" ! CHECKING FOR ITEM FILE IN SUB DIRECTORIES !"/>
<echo message=" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"/>
<echo message=" "/>
<foreach target="finde_file_subdir" param="worksheet" inheritall="true">
<path>
<dirset dir="${InputPath}_FILES">
<include name="*"/>
</dirset>
</path>
</foreach>
</target>
<target name="finde_file_subdir">
<echo message="finde_file_subdir called with dir : ${worksheet}"/>
<fileset id="file" dir="${worksheet}" includes="*.paper | *.section | *.website | *.slideshow | *.webpage"/>
<property name="testfile" refid="file"/>
<basename property="dir.name" file="${worksheet}"/>
<if>
<equals arg1="${testfile}" arg2="" />
<then>
<xslt useImplicitFileset="false" destdir="${tmp}/internationalisation" style="${xsl}/internalisation.xsl">
<param name="currentDir" expression="."/>
<fileset dir="${tmp}/extract">
<!-- only converting the root files -->
<include name="*/*.paper"/>
<include name="*/*.section"/>
<include name="*/*.website"/>
<include name="*/*.slideshow"/>
<include name="*/*.webpage"/>
</fileset>
</xslt>
</then>
<else>
<antcall target="conversion">
<param name="rootfile" value="${worksheet}/${testfile}"/>
<param name="currentDir" value="${dir.name}"/>
</antcall>
</else>
</if>
<echo message="Convert to hdoc..."/>
<xslt basedir="${tmp}/internationalisation" destdir="${out}" style="${xsl}/optim_to_hdoc.xsl"/>
</target>
<target name="direct_conversion" unless="${file.null}" depends="file_null">
<antcall target="conversion">
<param name="rootfile" value="${InputPath}_FILES/${prop.rootFiles}"/>
<param name="currentDir" value=""/>
</antcall>
</target>
<target name="conversion">
<echo message="conversion called with rootfile : ${rootfile} and currentDir : ${currentDir}"/>
<copy todir="${InputPath}_HDOC">
<fileset dir="hdoc"/>
</copy>
<echo message=" "/>
<echo message=" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"/>
<echo message=" !!!!! DEBUT INTERNALISATION !!!!!"/>
<echo message=" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"/>
<echo message=" "/>
<xslt in="${rootfile}" out="${InputPath}_FILES/content1.xml" style="xsl/internalisation.xsl">
<param name="currentDir" expression="${currentDir}"/>
</xslt>
<echo message=" "/>
<echo message=" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"/>
<echo message=" !!!!!! FIN INTERNALISATION !!!!!!"/>
<echo message=" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"/>
<echo message=" "/>
<echo message=" "/>
<echo message=" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"/>
<echo message=" !!!!!!!! DEBUT CONVERSION !!!!!!!"/>
<echo message=" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"/>
<echo message=" "/>
<xslt in="${InputPath}_FILES/content1.xml" out="${InputPath}_HDOC/content.xml" style="xsl/optim_to_hdoc.xsl"/>
<echo message=" "/>
<echo message=" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"/>
<echo message=" !!!!!!!!! FIN CONVERSION !!!!!!!!"/>
<echo message=" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"/>
<echo message=" "/>
<copy todir="${InputPath}_HDOC/optim">
<fileset dir="${InputPath}_FILES"/>
</copy>
<zip basedir="${InputPath}_HDOC" destfile="${OutputPath}"></zip>
<delete dir="${InputPath}_HDOC"></delete>
<delete dir="${InputPath}_FILES"></delete>
</target>
<echo message="Copy ressources files..."/>
<copy todir="${out}">
<fileset dir="${tmp}/extract">
<!-- only copying resources files -->
<exclude name="*/*.paper"/>
<exclude name="*/*.section"/>
<exclude name="*/*.website"/>
<exclude name="*/*.slideshow"/>
<exclude name="*/*.webpage"/>
</fileset>
</copy>
<echo message="Zip result..."/>
<for param="folder">
<path>
<dirset dir="${out}" includes="*"/>
</path>
<sequential>
<local name="folder_name"/>
<basename property="folder_name" file="@{folder}"/>
<zip destfile="${out}/${folder_name}.zip" basedir="@{folder}" ></zip>
</sequential>
</for>
</project>
\ No newline at end of file
@echo off
set lib=lib
set ant=myantce.ant
set ant=optim_to_hdoc.ant
set antparam=-Dprogram.param=%1
set scJarList=%lib%\*
......
#!/bin/sh
lib="lib"
ant="myantce.ant"
ant="optim_to_hdoc.ant"
antparam="-Dprogram.param=$1"
#Recherche de java et controle que se soit une version SUN
......
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