Commit 738a5ace authored by Kapilraj Thangeswaran's avatar Kapilraj Thangeswaran

Correction subroutine keyword et implémentation de opale to mongo

parent 1a183443
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
"url" : "mongodb://localhost:27017/", "url" : "mongodb://localhost:27017/",
"database" : "test", "database" : "test",
"collection" : "nf29", "collection" : "nf29",
"request" : "update" "request" : "insert"
} }
\ No newline at end of file
...@@ -6,28 +6,28 @@ ...@@ -6,28 +6,28 @@
<xsl:import href="../xsl-import/array.xsl"/> <xsl:import href="../xsl-import/array.xsl"/>
<xsl:template name="keyword-main"> <xsl:template name="keyword-main">
{ {
_: <xsl:value-of select="h2m:array(/html/head/meta[@name='keywords']/@content)"/>, "_" : <xsl:value-of select="h2m:array(/html/head/meta[@name='keywords']/@content)"/>,
content: <xsl:call-template name="keyword-content"/>, "content" : <xsl:call-template name="keyword-content"/>,
topic: <xsl:call-template name="keyword-topic"/> "topic" : <xsl:call-template name="keyword-topic"/>
} }
</xsl:template> </xsl:template>
<xsl:template name="keyword-content"> <xsl:template name="keyword-content">
[ [
<xsl:if test="/html/head/meta[@name='generator']/@content = 'HdocConverter/wikipedia'"> <xsl:if test="/html/head/meta[@name='generator']/@content = 'HdocConverter/wikipedia'">
wiki, "wiki",
</xsl:if> </xsl:if>
<xsl:if test="//@data-hdoc-type = 'exercice'"> <xsl:if test="//@data-hdoc-type = 'exercice'">
exercice, "exercice",
</xsl:if> </xsl:if>
text <!-- TODO: faire un switch pour tester si on index pas une image par exemple --> "text" <!-- TODO: faire un switch pour tester si on index pas une image par exemple -->
] ]
</xsl:template> </xsl:template>
<xsl:template name="keyword-topic"> <xsl:template name="keyword-topic">
[ [
<xsl:if test="/html/head/meta[@name='keywords']/@content[contains('XML', .)]"> <xsl:if test="/html/head/meta[@name='keywords']/@content[contains('XML', .)]">
XML "XML"
</xsl:if> </xsl:if>
<!-- TODO: faire une taxonomie des sujets, récupérer les keywords présents dedans --> <!-- TODO: faire une taxonomie des sujets, récupérer les keywords présents dedans -->
] ]
</xsl:template> </xsl:template>
</xsl:stylesheet> </xsl:stylesheet>
\ No newline at end of file
libdir=${basedir}/lib
inputPath=${basedir}/input
outputPath=${basedir}/output
nodeModules=${basedir}/node_modules
inputOpaleToHdoc=../opale_to_hdoc/input
outputOpaleToHdoc=../opale_to_hdoc/output
antOpaleToHdoc=../opale_to_hdoc/opale_to_hdoc.ant
inputHdocToMongo=../hdoc_to_mongo/input
outputHdocToMongo=../hdoc_to_mongo/output
nodeModulesHdocToMongo=../hdoc_to_mongo/node_modules
antHdocToMongo=../hdoc_to_mongo/hdoc_to_mongo.ant
\ No newline at end of file
<project name="opale_to_mongo" default="opaleToMongo">
<property file="build.properties"/>
<target name="preparation">
<delete dir="${inputOpaleToHdoc}"/>
<delete dir="${outputOpaleToHdoc}"/>
<delete dir="${inputHdocToMongo}"/>
<delete dir="${outputHdocToMongo}"/>
<delete dir="${outputPath}" />
<mkdir dir="${outputPath}"/>
<chmod perm="777" dir="${outputPath}"></chmod>
</target>
<target name="opaleToHdoc" depends="preparation">
<copy todir="${inputOpaleToHdoc}">
<fileset dir="${inputPath}"/>
</copy>
<ant antfile="${antOpaleToHdoc}" inheritAll="false"/>
</target>
<target name="hdocToMongo" depends="opaleToHdoc">
<copy todir="${inputHdocToMongo}">
<fileset dir="${outputOpaleToHdoc}"/>
</copy>
<copy todir="${nodeModulesHdocToMongo}">
<fileset dir="${nodeModules}"/>
</copy>
<ant antfile="${antHdocToMongo}" inheritAll="false"/>
<delete dir="${nodeModulesHdocToMongo}"/>
</target>
<target name="opaleToMongo" depends="hdocToMongo">
<copy todir="${outputPath}">
<fileset dir="${outputHdocToMongo}"/>
</copy>
</target>
</project>
\ No newline at end of file
@echo off
set lib=lib
set ant=opale_to_mongo.ant
set antparam=-Dprogram.param=%1
set scJarList=%lib%\*
npm link mongodb & java.exe -classpath "%scJarList%" -Xmx150m org.apache.tools.ant.Main -buildfile %ant% %antparam% & rmdir /Q /S node_modules & pause
REM start /MIN java.exe -classpath "%scJarList%" -Xmx150m org.apache.tools.ant.Main -buildfile %ant% %antparam%
#!/bin/sh
lib="lib"
ant="opale_to_mongo.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/*"
npm link mongodb
$vJavaCmd -classpath "$scJarList:" -Xmx150m org.apache.tools.ant.Main -buildfile $ant $antparam
rm -rf node_modules
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