Commit dd0ea0ae authored by Decorde Jeffrey's avatar Decorde Jeffrey

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

parents 7d8f8ffb 4d976df1
......@@ -2,9 +2,7 @@
## What is Hdoc ?
Please refer to the [Hdoc converter project website](http://hdoc.crzt.fr/co/hdocConverter.html)
*Extract*
Please refer to the [Hdoc converter project website](http://hdoc.crzt.fr/www/co/hdocConverter.html)
>The aim of the project is to propose:
>- a generic XML schema based on XHTML5 for documentary purpose (Hdoc format);
>- a set of converters to transform document formats from and to Hdoc;
......
# build files
antce/input
antce/log
antce/output
antce/tmp
*/input/*
*/tmp/*
*/output/*
!*/input/sample.*
antce/lib/jsonToXml
antce/lib/jsonToXml/*
\ No newline at end of file
*.DS_Store*
\ No newline at end of file
# HDOC CONVERTER PROJECT
\ No newline at end of file
# Etherpad to Hdoc -- HDOC CONVERTER PROJECT
## [TL;DR](http://i.imgur.com/18B7f07.jpg)
- This module is able to convert several [etherpad](http://etherpad.org/) files (exported as html files) to the hdoc format.
- To do so :
1. please place your html files in the `/input` folder
2. run the `run.[bat|sh]` script of your choice depending on your OS
3. and retrieve the hdoc outputs in the `/output` folder
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." name="myantce" default="main">
<property file="build.properties"/>
<taskdef name="htmlcleaner" classname="org.htmlcleaner.HtmlCleanerForAnt">
<classpath>
<pathelement location="lib/htmlcleaner-2.16.jar"/>
</classpath>
</taskdef>
<taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask">
<classpath>
<pathelement location="lib/jing.jar"/>
</classpath>
</taskdef>
<target name="start">
<delete dir="${tmp}" failonerror="false"/>
<mkdir dir="${tmp}"/>
<delete dir="${out}" failonerror="false"/>
<mkdir dir="${out}"/>
<delete dir="${log}" failonerror="false"/>
<mkdir dir="${log}"/>
</target>
<target name="clean-tmp">
<delete dir="${tmp}" failonerror="false"/>
<mkdir dir="${tmp}"/>
</target>
<!-- Apply Xslt -->
<target name="apply-xslt">
<htmlcleaner src="${in}/pad.html" dest="${tmp}/pad-clean.xml"/>
<xslt in="${xsl}/html2xhtml.xsl" out="${tmp}/tmpPad.xhtml" style="${xsl}/html2xhtml.xsl" />
<xslt in="${tmp}/tmpPad.xhtml" out="${tmp}/tozip/content.xml" style="${xsl}/xhtml2hdoc.xsl" />
</target>
<!-- Builds Hdoc structure -->
<target name="construct_hdoc">
<mkdir dir="${tmp}/tozip/" />
<mkdir dir="${tmp}/tozip/META-INF" />
<mkdir dir="${tmp}/META-INF" />
<!-- container -->
<touch file="${tmp}/META-INF/container.xml" />
<echoxml file="${tmp}/META-INF/container.xml">
<container version="1.0">
<rootfiles>
<rootfile full-path="${rootfilename}" media-type="text/xml" />
</rootfiles>
</container>
</echoxml>
<xslt in="${tmp}/META-INF/container.xml" out="${tmp}/tozip/META-INF/container.xml" style="${xsl}/addNamespaceToContainer.xsl"/>
<!-- mimetype -->
<touch file="${tmp}/mimetype" />
<echo message="application/x-hdoc+zip" file="${tmp}/tozip/mimetype" />
</target>
<target name="jing-hdoc">
<jing file="${tmp}/tozip/content.xml" rngfile="schema/xhtml/hdoc1-xhtml.rng"></jing>
<echo>content.xml respecte le schema hdoc1-xhtml.rng</echo>
</target>
<!-- Zip Hdoc container -->
<target name="zip">
<zip basedir="${tmp}/tozip/" destfile="${out}/output.hdoc" />
</target>
<target name="main">
<antcall target="start"></antcall>
<antcall target="apply-xslt"></antcall>
<antcall target="construct_hdoc"></antcall>
<antcall target="jing-hdoc"></antcall>
<antcall target="zip"></antcall>
<antcall target="clean-tmp"></antcall>
</target>
</project>
\ No newline at end of file
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.utc.fr/ics/hdoc/xhtml" exclude-result-prefixes="xs">
<xsl:output method="xml" indent="yes"></xsl:output>
<xsl:strip-space elements="*"/>
<xsl:param name="text-encoding" as="xs:string" select="'utf-8'"/>
<xsl:param name="text-uri" as="xs:string" select="'file:///G:/Documents/Dropbox/NF29/etherpad/antce/input/NF29_HdocEtherpad.etherpad'"/>
<xsl:template name="text2xml">
<xsl:variable name="text" select="unparsed-text($text-uri, $text-encoding)"/>
<xsl:analyze-string select="$text" regex='\{{"atext":\{{"text":"(.*?)",'>
<xsl:matching-substring>
<div>
<p>
<xsl:value-of select="normalize-space(regex-group(1))"/>
</p>
</div>
</xsl:matching-substring>
</xsl:analyze-string>
</xsl:template>
<xsl:template match="/">
<html>
<head>
<title>Etherpad</title>
<meta charset="utf-8"/>
</head>
<body>
<section>
<header>
<h1>Contenu</h1>
</header>
<xsl:choose>
<xsl:when test="unparsed-text-available($text-uri, $text-encoding)">
<xsl:call-template name="text2xml"/>
</xsl:when>
</xsl:choose>
</section>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
xmlns="http://www.utc.fr/ics/hdoc/xhtml"
version="2.0">
<xsl:output method="xml" indent="yes"></xsl:output>
<xsl:template match="html">
<html>
<head>
<title><xsl:value-of select="/html/head/title"/></title>
<meta charset="utf-8"/>
</head>
<body>
<section>
<header>
<h1>Contenu</h1>
</header>
<div>
<p><xsl:value-of select="/html/body/div"></xsl:value-of></p>
</div>
</section>
</body>
</html>
</xsl:template>
<xsl:template match="div/a">
<p><a href="{.}"><xsl:value-of select="text()"/></a></p>
</xsl:template>
<xsl:template match="div/ol">
<ol>
<xsl:apply-templates select="*"></xsl:apply-templates>
</ol>
</xsl:template>
<xsl:template match="li">
<li>
<xsl:choose>
<xsl:when test="count(*) = 0"> <!-- Si la liste n'a pas de mise en forme (n'a pas de balises filles) et ne contient que du texte, on récupère le texte -->
<p><xsl:value-of select="."/></p>
</xsl:when>
<xsl:otherwise> <!-- Si mise en forme, on relance les règles-->
<xsl:apply-templates select="*"/>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:template>
<xsl:template match="div/ul">
<ul>
<xsl:apply-templates select="*"></xsl:apply-templates>
</ul>
</xsl:template>
<xsl:template match="em|strong|s">
<p><em><xsl:value-of select="."/></em></p>
</xsl:template>
<xsl:template match="li/br">
<p/>
</xsl:template>
<xsl:template match="*">
<xsl:comment>Error</xsl:comment>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." name="myantce" default="main">
<property file="etherpad_to_hdoc.properties"/>
<!-- import classes -->
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<taskdef name="htmlcleaner" classname="org.htmlcleaner.HtmlCleanerForAnt"/>
<taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask"/>
<target name="start">
<delete dir="${tmp}" failonerror="false"/>
<mkdir dir="${tmp}"/>
<delete dir="${out}" failonerror="false"/>
<mkdir dir="${out}"/>
<delete dir="${log}" failonerror="false"/>
<mkdir dir="${log}"/>
</target>
<!-- Apply Xslt -->
<target name="apply-xslt">
<!-- clean html file (html -> xhtml) -->
<htmlcleaner src="${in}/${fileName}" dest="${tmp}/pad-clean.xml"/>
<!-- calls for pad-clean.xml internally -->
<xslt in="${xsl}/html2xhtml.xsl" out="${tmp}/${properName}/tmpPad.xhtml"
style="${xsl}/html2xhtml.xsl"/>
<delete file="${tmp}/pad-clean.xml"></delete>
<xslt in="${tmp}/${properName}/tmpPad.xhtml" out="${tmp}/${properName}/tmpPad2.xhtml"
style="${xsl}/html2xhtmlv1.xsl"/>
<xslt in="${tmp}/${properName}/tmpPad2.xhtml" out="${tmp}/${properName}/tmpPad3.xhtml"
style="${xsl}/html2xhtmlv2.xsl"/>
<xslt in="${tmp}/${properName}/tmpPad3.xhtml" out="${tmp}/${properName}/tmpPad4.xhtml"
style="${xsl}/html2xhtml3.xsl"/>
<xslt in="${tmp}/${properName}/tmpPad4.xhtml" out="${tmp}/${properName}/tozip/content.xml"
style="${xsl}/xhtml2hdoc.xsl"/>
</target>
<!-- Builds Hdoc structure -->
<target name="construct_hdoc">
<mkdir dir="${tmp}/${properName}/tozip/"/>
<mkdir dir="${tmp}/${properName}/META-INF/"/>
<mkdir dir="${tmp}/${properName}/tozip/META-INF"/>
<!-- container -->
<touch file="${tmp}/${properName}/META-INF/container.xml"/>
<echoxml file="${tmp}/${properName}/META-INF/container.xml">
<container version="1.0">
<rootfiles>
<rootfile full-path="${rootfilename}" media-type="text/xml"/>
</rootfiles>
</container>
</echoxml>
<xslt in="${tmp}/${properName}/META-INF/container.xml"
out="${tmp}/${properName}/tozip/META-INF/container.xml"
style="${xsl}/addNamespaceToContainer.xsl"/>
<!-- mimetype -->
<touch file="${tmp}/${properName}/mimetype"/>
<echo message="application/x-hdoc+zip" file="${tmp}/${properName}/tozip/mimetype"/>
</target>
<target name="jing-hdoc">
<jing file="${tmp}/${properName}/tozip/content.xml"
rngfile="${schema}/xhtml/hdoc1-xhtml.rng"/>
</target>
<!-- Zip Hdoc container -->
<target name="zip">
<zip basedir="${tmp}/${properName}/tozip/" destfile="${out}/${properName}.hdoc"/>
</target>
<target name="main">
<antcall target="start"/>
<for param="inputPad">
<path>
<fileset dir="${in}" includes="*.html"/>
</path>
<sequential>
<local name="padFileName"/>
<basename property="padFileName" file="@{inputPad}"/>
<local name="properFileName"/>
<basename property="properFileName" file="@{inputPad}" suffix=".html"/>
<echo>============ Processing pad : ${properFileName} ============</echo>
<antcall target="apply-xslt">
<param name="fileName" value="${padFileName}"/>
<param name="properName" value="${properFileName}"/>
</antcall>
<antcall target="construct_hdoc">
<param name="properName" value="${properFileName}"/>
</antcall>
<trycatch>
<try>
<!-- schema verification -->
<antcall target="jing-hdoc">
<param name="properName" value="${properFileName}"/>
</antcall>
<!-- zip hdoc if the schema is verified -->
<antcall target="zip">
<param name="properName" value="${properFileName}"/>
</antcall>
<!-- delete tmp files if everything went fine -->
<delete dir="${tmp}/${properFileName}" failonerror="false"/>
</try>
<catch>
<echo>WARNING</echo>
<echo>${properFileName} : the outptut doesn't match the hdoc schema</echo>
<echo>see the Jing log above and the tmp files</echo>
</catch>
</trycatch>
</sequential>
</for>
</target>
</project>
......@@ -4,5 +4,6 @@ tmp = ${basedir}/tmp
xsl = ${basedir}/xsl
lib = ${basedir}/lib
log = ${basedir}/log
schema = ${basedir}/schema
rootfilename = content.xml
\ No newline at end of file
<!doctype html>
<html lang="en">
<head>
<title>NF29_HdocEtherpad</title>
<meta charset="utf-8">
<style> * { font-family: arial, sans-serif;
font-size: 13px;
line-height: 17px; }ul.indent { list-style-type: none; }ol { list-style-type: none; padding-left:0;}body > ol { counter-reset: first second third fourth fifth sixth seventh eigth ninth tenth eleventh twelth thirteenth fourteenth fifteenth sixteenth; }ol > li:before {content: counter(first) ". " ;counter-increment: first;}ol > ol > li:before {content: counter(first) "." counter(second) ". " ;counter-increment: second;}ol > ol > ol > li:before {content: counter(first) "." counter(second) "." counter(third) ". ";counter-increment: third;}ol > ol > ol > ol > li:before {content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) ". ";counter-increment: fourth;}ol > ol > ol > ol > ol > li:before {content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) "." counter(fifth) ". ";counter-increment: fifth;}ol > ol > ol > ol > ol > ol > li:before {content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) "." counter(fifth) "." counter(sixth) ". ";counter-increment: sixth;}ol > ol > ol > ol > ol > ol > ol > li:before {content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) "." counter(fifth) "." counter(sixth) "." counter(seventh) ". ";counter-increment: seventh;}ol > ol > ol > ol > ol > ol > ol > ol > li:before {content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) "." counter(fifth) "." counter(sixth) "." counter(seventh) "." counter(eigth) ". ";counter-increment: eigth;}ol > ol > ol > ol > ol > ol > ol > ol > ol > li:before {content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) "." counter(fifth) "." counter(sixth) "." counter(seventh) "." counter(eigth) "." counter(ninth) ". ";counter-increment: ninth;}ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > li:before {content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) "." counter(fifth) "." counter(sixth) "." counter(seventh) "." counter(eigth) "." counter(ninth) "." counter(tenth) ". ";counter-increment: tenth;}ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > li:before {content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) "." counter(fifth) "." counter(sixth) "." counter(seventh) "." counter(eigth) "." counter(ninth) "." counter(tenth) "." counter(eleventh) ". ";counter-increment: eleventh;}ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > li:before {content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) "." counter(fifth) "." counter(sixth) "." counter(seventh) "." counter(eigth) "." counter(ninth) "." counter(tenth) "." counter(eleventh) "." counter(twelth) ". ";counter-increment: twelth;}ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > li:before {content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) "." counter(fifth) "." counter(sixth) "." counter(seventh) "." counter(eigth) "." counter(ninth) "." counter(tenth) "." counter(eleventh) "." counter(twelth) "." counter(thirteenth) ". ";counter-increment: thirteenth;}ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > li:before {content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) "." counter(fifth) "." counter(sixth) "." counter(seventh) "." counter(eigth) "." counter(ninth) "." counter(tenth) "." counter(eleventh) "." counter(twelth) "." counter(thirteenth) "." counter(fourteenth) ". ";counter-increment: fourteenth;}ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > li:before {content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) "." counter(fifth) "." counter(sixth) "." counter(seventh) "." counter(eigth) "." counter(ninth) "." counter(tenth) "." counter(eleventh) "." counter(twelth) "." counter(thirteenth) "." counter(fourteenth) "." counter(fifteenth) ". ";counter-increment: fifteenth;}ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > li:before {content: counter(first) "." counter(second) "." counter(third) "." counter(fourth) "." counter(fifth) "." counter(sixth) "." counter(seventh) "." counter(eigth) "." counter(ninth) "." counter(tenth) "." counter(eleventh) "." counter(twelth) "." counter(thirteenth) "." counter(fourteenth) "." counter(fifteenth) "." counter(sixthteenth) ". ";counter-increment: sixthteenth;}ol{ text-indent: 0px; }ol > ol{ text-indent: 10px; }ol > ol > ol{ text-indent: 20px; }ol > ol > ol > ol{ text-indent: 30px; }ol > ol > ol > ol > ol{ text-indent: 40px; }ol > ol > ol > ol > ol > ol{ text-indent: 50px; }ol > ol > ol > ol > ol > ol > ol{ text-indent: 60px; }ol > ol > ol > ol > ol > ol > ol > ol{ text-indent: 70px; }ol > ol > ol > ol > ol > ol > ol > ol > ol{ text-indent: 80px; }ol > ol > ol > ol > ol > ol > ol > ol > ol > ol{ text-indent: 90px; }ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol{ text-indent: 100px; }ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol{ text-indent: 110px; }ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol { text-indent: 120px; }ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol{ text-indent: 130px; }ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol{ text-indent: 140px; }ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol > ol{ text-indent: 150px; }</style>
</head>
<body><em><s><u>Liens utiles :</u></s></em><br>gitlab : <a href="https&#x3a;&#x2F;&#x2F;gitlab&#x2e;utc&#x2e;fr&#x2F;crozatst&#x2F;hdoc">https:&#x2F;&#x2F;gitlab.utc.fr&#x2F;crozatst&#x2F;hdoc</a><br>hdoc : <a href="http&#x3a;&#x2F;&#x2F;hdoc&#x2e;crzt&#x2e;fr&#x2F;2014&#x2F;co&#x2F;hdocConverter&#x2e;html">http:&#x2F;&#x2F;hdoc.crzt.fr&#x2F;2014&#x2F;co&#x2F;hdocConverter.html</a><br>hdoc etherpad converter : <a href="http&#x3a;&#x2F;&#x2F;hdoc&#x2e;crzt&#x2e;fr&#x2F;2014&#x2F;co&#x2F;etherpad&#x2e;html">http:&#x2F;&#x2F;hdoc.crzt.fr&#x2F;2014&#x2F;co&#x2F;etherpad.html</a><br>informations sur le format hdoc : <a href="http&#x3a;&#x2F;&#x2F;hdoc&#x2e;crzt&#x2e;fr&#x2F;2014&#x2F;co&#x2F;hdoc&#x2e;html">http:&#x2F;&#x2F;hdoc.crzt.fr&#x2F;2014&#x2F;co&#x2F;hdoc.html</a><br>Changeset : <a href="http&#x3a;&#x2F;&#x2F;policypad&#x2e;readthedocs&#x2e;org&#x2F;en&#x2F;latest&#x2F;changesets&#x2e;html">http:&#x2F;&#x2F;policypad.readthedocs.org&#x2F;en&#x2F;latest&#x2F;changesets.html</a><br><br><ol class="number"><li><strong>Product Backlog</strong></li><li><strong>Lister les t&#226;ches &#224; r&#233;aliser pour am&#233;liorer le module actuel, et &#233;valuer leur dur&#233;e de r&#233;alisation.</strong></li><li><strong>D&#233;passer le volume horaire disponible, soit 18 h&#x2F;pers * 3 pers = 54h</strong></li></ol><br><ul class="bullet"><li>*markdown*</li><li>Prise en main du projet (1h)</li></ul>Configurer Git (1h)<br><br><ul class="indent"><li>Restructuration antce (1h)</li><li>Etude du sch&#233;ma Hdoc (3h)</li></ul>Etude du sch&#233;ma etherpad (3h)<br><em>Etudier les possibilit&#233;s d&#x27;xsl avec en entr&#233;e un fichier texte (3h)</em><br><em>Etudier les possibilit&#233;s d&#x27;xsl en terme d&#x27;expressions r&#233;guli&#232;res (2h)</em><br><em>Analyse de ce qu&#x27;ils faut enlever des fichiers .etherpad (2h)</em><br>R&#233;&#233;crire les fonctionalit&#233;s du script perl dans le XSL. (5h)<br>Identifier pourquoi le projet actuel ne correspond pas au format HDoc (2h)<br>Corriger le projet pour que la sortie corresponde au sch&#233;ma HDoc (10h)<br>Etudier la solution MarkDown et comment l&#x27;impl&#233;menter (3h)<br>Impl&#233;menter l&#x27;utilisation des balises Markdown dans etherpad. (3h)<br>Analyser comment fonctionne la notion d&#x27;auteur dans etherpad et comment l&#x27;impl&#233;menter en Hdoc (3h)<br>Impl&#233;menter une mise en forme en Hdoc pour distinguer ce que les diff&#233;rents auteurs ont &#233;crits ( {&amp; author text &amp;} (3h)<br>Corriger le projet pour avoir un format Hdoc destination compatible avec les modules Opale et Optim (3h)<br>Creer les applications de etherpad vers Optim&#x2F;Opale en utilisant les modules existants (3h)<br>Rendre compte des t&#226;ches r&#233;alis&#233;es et de la TODO restante &#224; la fin de la p&#233;riode (1h)<br>Comprendre en quoi l&#x27;ancien site web d&#x27;exemple est consid&#233;r&#233; obsol&#232;te (1h)<br>Mettre &#224; niveau le site web d&#x27;exemple (1h)<br>Mise &#224; jour de la rubrique correspondant au projet sur le site Hdoc (1h)<br>R&#233;aliser un rapport de projet (2h)<br><br><br>XSL1 du html a xHTML<br>-&gt; fermer les br.<br>-&gt; enlever la balise meta<br><s>-&gt;rajouter attribut type=&#x27;css&#x27; dans la balilse style.</s><br>-&gt;Rajouter une balise &lt;div&gt; &#224; la fin et au d&#233;but du texte<br><ul class="indent"><li><br></li></ul>XSL2 du xHTML &#224; HDOC<br><br><br>A la fin, on doit livrer quoi ? Application ? Antce ?<br><br>-de etherpad vers hdoc<br><br>Et en plus potentiellement de etherpad vers d&#x27;autres modules (Optim ou Opale par exemple) qui utilisent ces deux premi&#232;res applications directement.<br>Oui non &#224; priori y&#x27;a pas de hdoc vers etherpad<br>La chaine vis&#233;e c&#x27;est Etherpad - Hdoc - Optim&#x2F;Opale<br></body>
</html>
@echo off
set lib=lib
set ant=etherpad_to_hdoc.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="etherpad_to_hdoc.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
......@@ -23,7 +23,7 @@
<body>
<div>
<p>
<xsl:value-of select="replace(normalize-space(regex-group(2)), 'br /', 'br /')" disable-output-escaping="yes"/>
<xsl:value-of select="replace(normalize-space(regex-group(2)), '&lt;br&gt;', '&lt;br/&gt;')" disable-output-escaping="yes"/>
</p>
</div>
</body>
......
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs"
xmlns="http://www.utc.fr/ics/hdoc/xhtml" version="2.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="p[child::ul or child::ol]" priority="1">
<xsl:apply-templates select="./*"></xsl:apply-templates>
</xsl:template>
<!--Identity template,
provides default behavior that copies all content into the output -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:key name="bits" match="p/node()[not(self::br)]" use="generate-id((..|preceding-sibling::br[1])[last()])"/>
<xsl:template match="ul">
<ul>
<xsl:apply-templates select="*"/>
</ul><br/>
</xsl:template>
<xsl:template match="ol">
<ol>
<xsl:apply-templates select="*"/>
</ol><br/>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:key name="bits" match="p/node()[not(self::br)]" use="generate-id((..|preceding-sibling::br[1])[last()])"/>
<xsl:template match="p">
<p>
<xsl:apply-templates select="key('bits', generate-id())"/>
</p>
<xsl:apply-templates select="br"/>
</xsl:template>
<xsl:template match="p/br">
<p>
<xsl:apply-templates select="key('bits', generate-id())"/>
</p>
</xsl:template>
<xsl:template match="li/br">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="strong">
<em>
<xsl:apply-templates select="@*|node()"/>
</em>
</xsl:template>
<xsl:template match="s">
<em>
<xsl:apply-templates select="@*|node()"/>
</em>
</xsl:template>
<xsl:template match="u">
<em>
<xsl:apply-templates select="@*|node()"/>
</em>
</xsl:template>
<xsl:template match="ul">
<ul>
<xsl:apply-templates select="*"/>
</ul>
</xsl:template>
<xsl:template match="ol">
<ol>
<xsl:apply-templates select="*"/>
</ol>
</xsl:template>
<xsl:template match="page">
<xsl:apply-templates select="@*|node()"/>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs"
xmlns="http://www.utc.fr/ics/hdoc/xhtml" version="2.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="html" priority="3">
<html>
<head>
<title>
<xsl:value-of select="/html/head/title"/>
</title>
<meta charset="utf-8"/>
</head>
<body>
<section>
<header>
<h1>Contenu</h1>
</header>
<xsl:apply-templates select="/html/body/div"/>
</section>
</body>
</html>
</xsl:template>
<xsl:template match="li" priority = "2">
<li><p><xsl:apply-templates select="@* | node()"/></p></li>
</xsl:template>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<!--
<xsl:template match="/">
<xsl:apply-templates select="*"></xsl:apply-templates>
</xsl:template>
-->
<!-- Namespace substitution for hdoc elements -->
<xsl:template match="*" priority="1">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="node()|@*"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
# Etherpad To Lexique -- HDOC CONVERTER PROJECT
Comment récupérer un document de type Etherpad et le transformer en document lexique.