Commit 1f7ea5e7 authored by Bastien FREMONDIERE's avatar Bastien FREMONDIERE

Merge branch 'master' into mindmapping

parents 737d86ee 34894f9e
*/input/
*/tmp/
*/output/
\ No newline at end of file
*/output/
wikipedia_to_hdoc/result/*
wikipedia_to_hdoc/tmp/*
wikipedia_to_hdoc/hdoc_to_opale/tmp/*
wikipedia_to_hdoc/output/*
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:h="http://www.utc.fr/ics/hdoc/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xmlns:sc="http://www.utc.fr/ics/scenari/v3/core"
xmlns:op="utc.fr:ics/opale3"
xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
>
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
......@@ -573,6 +575,16 @@
<op:instructionM/>
</sp:int>
</xsl:template>
<!-- Listing Informatique-->
<xsl:param name="text-encoding" as="xs:string" select="'iso-8859-1'"/>
<xsl:param name="text-uri" as="xs:string" select="res/listing/listing1.txt"/>
<xsl:template match="h:object[@type='application/pdf']" priority="1">
<sp:listing>
<xsl:copy-of select="document(fn:concat('../tmp/decompressedHdoc/',@data))/sc:item/op:code"/>
</sp:listing>
</xsl:template>
<xsl:template match="h:section[h:div[@data-hdoc-type = 'question']]">
<!-- Selecting the first question -->
......
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." name="myantce" default="main">
<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"/>
<property name="optim_to_hdoc" location="${basedir}/../optim_to_hdoc"/>
<property name="hdoc_to_opale" location="${basedir}/../hdoc_to_opale"/>
<property name="optim_to_hdoc_in" location="${basedir}/../optim_to_hdoc/input"/>
<property name="hdoc_to_opale_in" location="${basedir}/../hdoc_to_opale/input"/>
<property name="optim_to_hdoc_out" location="${basedir}/../optim_to_hdoc/output"/>
<property name="hdoc_to_opale_out" location="${basedir}/../hdoc_to_opale/output"/>
<!-- Mandatory ressource to use if conditions -->
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<fileset dir="${lib}"/>
</classpath>
</taskdef>
<!-- Main target -->
<target name="main">
<antcall target="clean"/>
<if>
<length length="0" when="greater">
<fileset dir="${in}" followsymlinks="false"/>
</length>
<then>
<!-- input Dir Not Empty -->
<antcall target="add_log">
<param name="msg" value="input directory is not empty"/>
</antcall>
<antcall target="prepare_optim_to_hdoc"/>
<antcall target="run_optim_to_hdoc"/>
<antcall target="prepare_hdoc_to_opale"/>
<antcall target="run_hdoc_to_opale"/>
</then>
<else>
<!-- input Dir Empty -->
<antcall target="add_log">
<param name="msg" value="input directory is empty"/>
</antcall>
</else>
</if>
</target>
<!-- Moves files in optim_to_hdoc hierarchy -->
<target name="prepare_optim_to_hdoc">
<antcall target="add_log">
<param name="msg" value="Copying input files into optim_to_hdoc input directory"/>
</antcall>
<copy todir="${optim_to_hdoc_in}">
<fileset dir="${in}"/>
</copy>
</target>
<!-- Simply run optim_to_hdoc script -->
<target name="run_optim_to_hdoc">
</target>
<!-- Moves files in hdoc_to_opale hierarchy -->
<target name="prepare_hdoc_to_opale">
<antcall target="add_log">
<param name="msg" value="Copying optim_to_hdoc output files into hdoc_to_opale input directory"/>
</antcall>
<copy todir="${hdoc_to_opale_in}">
<fileset dir="${optim_to_hdoc_out}"/>
</copy>
</target>
<!-- Simply run hdoc_to_opale script -->
<target name="run_hdoc_to_opale"></target>
<!-- Move files to the outut directory -->
<target name="output_files">
<antcall target="add_log">
<param name="msg" value="Copying hdoc_to_opale output files into optim_to_opale output directory"/>
</antcall>
<copy todir="${out}">
<fileset dir="${hdoc_to_opale_out}"/>
</copy>
</target>
<target name="add_log">
<tstamp>
<format property="now" pattern="HH:mm:ss:sss" locale="fr,FR"/>
</tstamp>
<echo message="[${now}] ${msg}&#xa;" file="${log}/execution.log" append="true"/>
<echo message="${msg}"/>
</target>
<target name="clean">
<delete dir="${log}" failonerror="false"/>
<mkdir dir="${log}"/>
<antcall target="add_log">
<param name="msg" value="Cleaning directories"/>
</antcall>
<delete dir="${tmp}" failonerror="false"/>
<mkdir dir="${tmp}"/>
<delete dir="${out}" failonerror="false"/>
<mkdir dir="${out}"/>
</target>
</project>
\ No newline at end of file
@echo off
set lib=lib
set ant=myantce.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="myantce.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
......@@ -36,6 +36,19 @@
<xslt classpath="lib/saxon9he.jar" in="input/${inputFile}" out="${tmpFolderPath}/${filename}_prepared.xml" style="${xsltFolderPath}/prepare_wiki_to_hdoc.xsl">
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
</xslt>
<!-- Prepare the ant script that will get our ressources(images )-->
<xslt classpath="lib/saxon9he.jar"
in="${tmpFolderPath}/${filename}_prepared.xml"
out="${tmpFolderPath}/${filename}_ressources.xml" style="${xsltFolderPath}/get_ressources_urls.xsl">
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
</xslt>
<ant antfile="${tmpFolderPath}/${filename}_ressources.xml"/>
</target>
<!-- Create the hdoc structure of the new file -->
......@@ -61,11 +74,21 @@
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
</xslt>
<!-- Copy listing files -->
<copy todir="${tmpHdocResultFolderPath}/listing" >
<fileset dir="${hdocResultPath}/listing" includes="**"/>
<!-- Copy listing files -->
<copy todir="${tmpHdocResultFolderPath}/listing" failonerror="false">
<fileset dir="${hdocResultPath}/listing" includes="**"/>
</copy>
<!-- Copy Tables files -->
<copy todir="${tmpHdocResultFolderPath}/tables" failonerror="false">
<fileset dir="${hdocResultPath}/tables" includes="**"/>
</copy>
<!-- Copy Images files -->
<copy todir="${tmpHdocResultFolderPath}/ressources" failonerror="false">
<fileset dir="${hdocResultPath}/ressources" includes="**"/>
</copy>
<!-- Copy of the html file, hdoc needs "container.xml" file, not a html. The html file can be useful to the user -->
<copy file="${hdocResultPath}/${filename}.html" tofile="${tmpHdocResultFolderPath}/content.xml"/>
</target>
......
......@@ -9,15 +9,13 @@
<!-- tmp paths (removed at the end of the process) -->
<property name="tmpFolderPath" value="${basedir}/tmp"/>
<property name="tmpHdocResultFolderPath" value="${tmpFolderPath}/hdoc"/>
<property name="in" location="${basedir}/input"/>
<property name="in" value="${basedir}/input"/>
<property name="resultFolderPath" value="${basedir}/result"/>
<property name="xsltFolderPath" value="${basedir}/xslt"/>
<property name="hdocResultPath" value="${resultFolderPath}/${filename}"/>
<property name="inputFile" value="${hdocResultPath}/${filename}.xml"/>
<!--<property name="inputFile" value="${hdocResultPath}/${filename}.xml"/>-->
<property name="inputFile" value="${in}/${filename}.xml"/>
<!-- Main target -->
<target name="main">
<antcall target="prepare"/>
......@@ -32,16 +30,33 @@
<mkdir dir="${tmpHdocResultFolderPath}"/>
<mkdir dir="${hdocResultPath}"/>
<!-- Fetching html from wikipedia -->
<!-- Fetching html from wikipedia
<java fork="true" failonerror="true" jar="${basedir}/javaSources/FetchWikipediaXml.jar">
<arg value="${wikipediaUrl}"/>
<arg value="${filename}"/>
</java>
</java>-->
<loadresource encoding="UTF-8" property="myURL">
<url url="${wikipediaUrl}"/>
</loadresource>
<echo file="${inputFile}" encoding="UTF-8">${myURL}</echo>
<!-- Making tmp xml wikipedia file without some elements which are not useful -->
<xslt classpath="lib/saxon9he.jar" in="${inputFile}" out="${tmpFolderPath}/${filename}_prepared.xml" style="${xsltFolderPath}/prepare_wiki_to_hdoc.xsl">
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
</xslt>
<!-- Prepare the ant script that will get our ressources(images )-->
<xslt classpath="lib/saxon9he.jar"
in="${tmpFolderPath}/${filename}_prepared.xml"
out="${tmpFolderPath}/${filename}_ressources.xml" style="${xsltFolderPath}/get_ressources_urls.xsl">
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
</xslt>
<ant antfile="${tmpFolderPath}/${filename}_ressources.xml"/>
</target>
<!-- Create the hdoc structure of the new file -->
......@@ -65,13 +80,22 @@
<!-- Applying wikipedia -> hdoc -->
<xslt classpath="lib/saxon9he.jar" in="${tmpFolderPath}/${filename}_prepared.xml" out="${hdocResultPath}/${filename}.html" style="${xsltFolderPath}/wiki_to_hdoc.xsl">
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
</xslt>
</xslt>
<!-- Copy listing files -->
<copy todir="${tmpHdocResultFolderPath}/listing" failonerror="false">
<fileset dir="${hdocResultPath}/listing" includes="**"/>
</copy>
<!-- Copy listing files -->
<copy todir="${tmpHdocResultFolderPath}/listing" >
<fileset dir="${hdocResultPath}/listing" includes="**"/>
<!-- Copy Tables files -->
<copy todir="${tmpHdocResultFolderPath}/tables" failonerror="false">
<fileset dir="${hdocResultPath}/tables" includes="**"/>
</copy>
<!-- Copy Images files -->
<copy todir="${tmpHdocResultFolderPath}/ressources" failonerror="false">
<fileset dir="${hdocResultPath}/ressources" includes="**"/>
</copy>
<!-- Copy of the html file, hdoc needs "container.xml" file, not a html. The html file can be useful to the user -->
<copy file="${hdocResultPath}/${filename}.html" tofile="${tmpHdocResultFolderPath}/content.xml"/>
</target>
......@@ -83,6 +107,6 @@
<!-- Delete tmp directory -->
<target name="clean">
<delete dir="${tmpFolderPath}"/>
<delete dir="${tmpFolderPath}"/>
</target>
</project>
......@@ -51,7 +51,7 @@
<xslt
in="${toString:first}"
out="${tmpdir}/generateContentPath.xml"
style="xsl/transformation0.xsl"
style="transformation0.xsl"
processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison"
/>
<chmod file="${tmpdir}/generateContentPath.xml" perm="777"/>
......
......@@ -21,7 +21,6 @@
<!-- 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="${tmp}"/>
<antcall target="UnzipHdocFile"/>
<antcall target="ValidateInput" />
......@@ -39,7 +38,11 @@
</target>
<target name="CleanDirectory">
<delete dir="${tmp}"/>
<delete>
<fileset dir="${tmp}">
<include name="**/*"/>
</fileset>
</delete>
</target>
<target name="UnzipHdocFile">
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:h="http://www.utc.fr/ics/hdoc/xhtml"
xmlns:sc="http://www.utc.fr/ics/scenari/v3/core"
xmlns:op="utc.fr:ics/opale3"
xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive"
name="copy-references"
default="main">
<property file="global.properties"/>
<target name="main">
<mkdir dir="${tmpdir}/decompressedOpale/references"/>
</target>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<?oxygen RNGSchema="http://scenari.utc.fr/hdoc/schemas/container/hdoc1-container.rng" type="xml"?>
<container xmlns="urn:utc.fr:ics:hdoc:container" version="1.0">
<rootfiles>
<rootfile full-path="content.xml" media-type="text/xml"/>
</rootfiles>
</container>
<sc:item xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
<op:code xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive" xmlns:op="utc.fr:ics/opale3">
<sc:code mimeType="text/plain">MaClasse obj;
...
obj = new MaClasse(5, "bonjour");</sc:code>
</op:code>
</sc:item>
\ No newline at end of file
<sc:item xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
<op:code xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive" xmlns:op="utc.fr:ics/opale3">
<sc:code mimeType="text/plain">String[] arguments = new String[10];
// ou bien :
int[][] uneMatrice = new int[4][5];
// ou encore :
int[][] quatreLignes = new int[4][];</sc:code>
</op:code>
</sc:item>
\ No newline at end of file
class Object
<sc:item xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
<op:code xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive" xmlns:op="utc.fr:ics/opale3">
<sc:code mimeType="text/plain">class Object
{
public :
Object (); // Constructeur par défaut
Object (int n) : nombre(n){}; // Constructeur paramétrique
Object (const Object&); // Constructeur par recopie
Object (const Object&amp;); // Constructeur par recopie
~Object (); // Destructeur
int nombre;
};
......@@ -15,4 +17,7 @@ int main ()
p_obj=new Object(27); // Appel du constructeur paramétrique pour créer un objet pour p_obj
Object obj2(obj); // Appel du constructeur par recopie pour obj2
delete p_obj; // Appel du destructeur pour détruire l'objet contenu dans p_obj
} // Appel du destructeur pour obj et obj2
} // Appel du destructeur pour obj et obj2</sc:code>
</op:code>
</sc:item>
\ No newline at end of file
public class MaClasse
<sc:item xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
<op:code xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive" xmlns:op="utc.fr:ics/opale3">
<sc:code mimeType="text/plain">public class MaClasse
{
private int a;
private string b;
......@@ -15,4 +17,7 @@ public class MaClasse
this.a = a;
this.b = b;
}
}
}</sc:code>
</op:code>
</sc:item>
\ No newline at end of file
<sc:item xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
<op:code xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive" xmlns:op="utc.fr:ics/opale3">
<sc:code mimeType="text/plain">// Instanciation d'un objet à l'aide du constructeur
MaClasse c = new MyClass(42, "string");</sc:code>
</op:code>
</sc:item>
\ No newline at end of file
public class MaClasse
<sc:item xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
<op:code xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive" xmlns:op="utc.fr:ics/opale3">
<sc:code mimeType="text/plain">public class MaClasse
{
private static int _A;
......@@ -14,4 +16,7 @@ public class MaClasse
{
}
}
}</sc:code>
</op:code>
</sc:item>
\ No newline at end of file
<sc:item xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
<op:code xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive" xmlns:op="utc.fr:ics/opale3">
<sc:code mimeType="text/plain">// Instanciation d'un objet à l'aide du constructeur
// juste avant l'instanciation
// Le constructeur statique est exécuté, _A prend la valeur 32
MaClasse c = new MaClasse();</sc:code>
</op:code>
</sc:item>
\ No newline at end of file
application/x-hdoc+zip
\ No newline at end of file