Commit b33d671c authored by Gregory's avatar Gregory

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

parents 7e026ffb 087afe35
*/input/*
*/tmp/*
*/output/*
!*/input/sample.*
*.DS_Store*
\ No newline at end of file
*/node_modules*/
*.DS_Store*
[submodule "hdoc_to_mongo/node_modules/node-mongodb-native"]
path = hdoc_to_mongo/node_modules/node-mongodb-native
url = https://github.com/mongodb/node-mongodb-native.git
......@@ -3,3 +3,17 @@
## User story
Un utilisateur a créé un cours de mathématiques à l'aide de l'outil Canoprof. Il souhaite, pour une raison quelconque, convertir son projet (et donc ses activités et programmations) dans un autre format. Pour cela il utilise notre convertisseur qui permet préalablement une conversion vers un format intermédiare (hdoc). Il fait donc un clic droit sur l'élément principal de son projet sous Canoprof et clique sur "exporter l'archive". Il laisse les options (Inclure le réseau descendant complet des items sélectionnés, et Préserver les espaces de l'atelier) par défaut. Il déplace ensuite le fichier .scar obtenu dans le dossier input du convertisseur puis exécute le fichier run.bat (ou run.sh sous un système UNIX). Une fois l'exécution terminée, il récupère son hdoc dans le dossier output.
## Getting started
- Put the Canoprof .scar in the input folder. The scar should be the only one in this folder. The .programme should be into the root of your .scar and should be named Test.programme
- Use the run.bat file to launch conversion.
- You will find your converted .hdoc in the output folder.
## What the converter handle
- Sequence
- Session
- Activity created in the .programme, transclusion available.
- Information/Warning/Advice/ect...
- Method and Remind fully functional.
- Add QCU and QCM. Transclusion of them available too. Need to fix a schema validation error when putting a title to a question, without filling the question content.
-Add "Exercice redactionnel" and transclusion.
\ No newline at end of file
......@@ -7,14 +7,29 @@
<target name="convert">
<antcall target="init" />
<antcall target="unzip_scar" />
<antcall target="hdoc_structure"/>
<antcall target="process_canoscar"/>
<antcall target="not_canoscar"/>
<echo message="OK" file="${out}/testfile"/>
<antcall target="zip" />
<antcall target="clean"/>
</target>
<!-- Create the hdoc structure -->
<target name="hdoc_structure">
<mkdir dir="${hdoc}"/>
<mkdir dir="${hdoc}/META-INF" />
<touch file="${hdoc}/META-INF/container.xml" />
<touch file="${hdoc}/mimetype" />
<echo message="application/x-hdoc+zip" file="${hdoc}/mimetype" />
<echoxml file="${hdoc}/META-INF/container.xml" namespacePolicy="elementsOnly">
<container xmlns="urn:utc.fr:ics:hdoc:container" version="1.0">
<rootfiles>
<rootfile full-path="${rootfilename}" media-type="text/xml" />
</rootfiles>
</container>
</echoxml>
</target>
<!-- Initialize folders -->
<target name="init">
......@@ -30,6 +45,7 @@
<!-- delete folders -->
<delete dir="${unzipfolder}"/>
<delete dir="${tmp}"/>
<delete dir="${hdoc}"/>
<delete file="get_ressources.ant"/>
</target>
......@@ -43,8 +59,10 @@
<target name="process_canoscar" depends="check_scar" if="${canoprof.is_canoprof_scar}">
<!-- TODO traitement du fichier -->
<echo file="${out}/scar_cano_or_not_scar_cano.txt" message="C'est un scar canoprof"/>
<!-- TODO change test.xml to the temporary file created while fusioning all the xml files -->
<xslt style="xsl/programmation.xsl" in="${unzipfolder}/Test.programme" out="${hdoc}/content.xml" classpath="./lib/saxon9he.jar">
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
</xslt>
</target>
<target name="not_canoscar" depends="check_scar" unless="${canoprof.is_canoprof_scar}">
......@@ -63,6 +81,11 @@
<!-- Zip the final content into a scar file -->
<target name="zip">
<!-- TODO zip the output files -->
<fileset id="fileset_scar" dir="input" casesensitive="yes">
<include name="*.scar"/>
</fileset>
<pathconvert property="scar.path" pathsep="" refid="fileset_scar" />
<basename property="filename" file="${scar.path}" suffix=".scar"/>
<zip destfile="${out}/${filename}.hdoc" basedir="${hdoc}"/>
</target>
</project>
\ No newline at end of file
......@@ -4,6 +4,7 @@ tmp = ${basedir}/tmp
xsl = ${basedir}/xsl
lib = ${basedir}/lib
log = ${basedir}/log
hdoc = ${out}/hdoc
unzipfolder = ${basedir}/unzip
cano_in = ../canoprof_to_hdoc/input
......
This diff is collapsed.
......@@ -2,4 +2,22 @@
## User story
Un utilisateur a créé un cours de mathématiques à l'aide de l'outil Canoprof. Il souhaite, pour une raison quelconque, convertir son projet (et donc ses activités et programmations) au format Opale. Pour cela il utilise notre convertisseur qui va agir en deux étapes : une conversion dans un format intermédiaire (le format hdoc), puis conversion de ce hdoc dans le format Opale. Une fois son cours créé, il effectue un clic-droit sur l'élément racine de son projet, et choisit "exporter l'archive". Il laisse les options (Inclure le réseau descendant complet des items sélectionnés, et Préserver les espaces de l'atelier) par défaut. Il déplace ensuite le fichier .scar obtenu dans le dossier input du convertisseur puis exécute le fichier run.bat (ou run.sh sous un système UNIX). Il récupère ensuite un nouveau fichier .scar dans le dossier output, qu'il pourra importer dans Scenari.
\ No newline at end of file
Un utilisateur a créé un cours de mathématiques à l'aide de l'outil Canoprof. Il souhaite, pour une raison quelconque, convertir son projet (et donc ses activités et programmations) au format Opale. Pour cela il utilise notre convertisseur qui va agir en deux étapes : une conversion dans un format intermédiaire (le format hdoc), puis conversion de ce hdoc dans le format Opale. Une fois son cours créé, il effectue un clic-droit sur l'élément racine de son projet, et choisit "exporter l'archive". Il laisse les options (Inclure le réseau descendant complet des items sélectionnés, et Préserver les espaces de l'atelier) par défaut. Il déplace ensuite le fichier .scar obtenu dans le dossier input du convertisseur puis exécute le fichier run.bat (ou run.sh sous un système UNIX). Il récupère ensuite un nouveau fichier .scar dans le dossier output, qu'il pourra importer dans Scenari.
## Getting started
- Put the Canoprof .scar in the input folder. The scar should be the only one in this folder. The .programme should be into the root of your .scar and should be named Test.programme
An .scar example is already in the input folder.
- Check if there's no .scar file in the input folder of canoprof_to_hdoc folder. If files exist, please remove them. Otherwise, the converter can take one of the .scar in this folder instead of the one you want to convert.
- Use the run.bat file to launch conversion.
- You will find your converted .scar in the output folder.
## What the converter handle
- Sequence
- Session
- Activity created in the .programme, transclusion should be available soon.
- Information/Warning/Advice/ect...
- Method and Remind fully functional
- QCM and QCU working, even with transclusion.
- Add "Exercice redactionnel" and transclusion.
......@@ -79,7 +79,6 @@
<antcall target="to_hdoc_windows"/>
<antcall target="to_opale_unix"/>
<antcall target="to_opale_windows"/>
<antcall target="to_opale_end"/>
<echo file="${out}/testfile" message="Ok"/>
<antcall target="to_opale_end"/>
</target>
</project>
\ 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>
......@@ -16,7 +16,7 @@ http://www.gnu.org/licenses/gpl-3.0.txt
- Fecherolle Cécile
## Presentation
This module is able to convert several [etherpad](http://etherpad.org/) files (exported as html files) to the hdoc format.
This module is able to convert several [framad](https://framapad.org/) files (exported as html files) to the hdoc format.
## User documentation
......@@ -24,32 +24,12 @@ This module is able to convert several [etherpad](http://etherpad.org/) files (e
Vous êtes un utilisateur de framapad et en créez un pour un projet. Après avoir travaillé sur votre pad, vous souhaitez transformer ce document en un autre format que vous pourrez utiliser dans un nouveau contexte de travail. Pour ce faire, vous exportez le framapad au format HTML grâce au bouton « Import/Export ». Vous récupérez ensuite les fichiers nécessaires à la transformation framapad to hdoc sur le répertoire git du projet hdoc (voir http://hdoc.crzt.fr/). Il ne vous reste alors plus qu'à placer le fichier html précédemment récupéré dans le dossier « input » du dossier framapad_to_hdoc et à exécuter le /run.bat si vous êtes sur Windows ou le /run.sh si vous êtes sur Linux/Mac. Cela produira une archive .hdoc dont l'intérêt est de servir de format de passage pour une transformation d'un format à un autre, et ce pour une grande variété de format. Il vous restera ensuite à déterminer le nouveau format dans lequel vous voulez transformer votre hdoc et utiliser le convertisseur approprié s'il existe.
## Running etherpad_to_hdoc.ant
1. Create an etherpad document and export it as an html file.
## Running framapad_to_hdoc.ant
1. Create a framapad document and export it as an html file.
2. please place your html files in the `/input` folder
3. run the `run.[bat|sh]` script of your choice depending on your OS
4. and retrieve the hdoc outputs in the `/output` folder
## Unsupported
- Markdown
- Author paternity
- Etherpad timeline
- Chat
## Known bugs
- Nested lists in lists are not supported
Example :
`<ul>
<li>
<ul>
<li>
Never gonna give you up.
</li>
</ul>
</li>
<ul>`
- As a consequence, etherpad indentation is not supported because it is coded as nested lists.
## Product Backlog
Currently available on: https://framemo.org/framapad_to_opale
......@@ -57,15 +37,13 @@ Currently available on: https://framemo.org/framapad_to_opale
See also : https://bimestriel.framapad.org/p/nf29_framapad_to_opale for the full documentation of our working process.
## TODO
- Nested Lists
- Indentation
- Titles (and therefore Structure of the doc)
- Coloured text
- Code
- Markdown
## Technical notes
### Description of etherpad_to_hdoc.ant
### Description of framapad_to_hdoc.ant
#### Prelude
- Importation of necessary classes (antlib, htmlcleaner, jing)
......
......@@ -5,9 +5,28 @@
<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:apply-templates select="./ul"/>
<xsl:apply-templates select="./ol"/>
<p>
<xsl:apply-templates select="./node()[not(self::ul) and not(self::ol)]"/>
</p>
</xsl:template>
<xsl:template match="//ul[parent::ul or parent::ol]" priority="1">
<li>
<ul>
<xsl:apply-templates select="*"/>
</ul>
</li>
</xsl:template>
<xsl:template match="//ol[parent::ul or parent::ol]" priority="1">
<li>
<ol>
<xsl:apply-templates select="*"/>
</ol>
</li>
</xsl:template>
<!--Identity template,
......
......@@ -6,12 +6,12 @@
<xsl:template match="ul">
<ul>
<xsl:apply-templates select="*"/>
</ul><br/>
</ul>
</xsl:template>
<xsl:template match="ol">
<ol>
<xsl:apply-templates select="*"/>
</ol><br/>
</ol>
</xsl:template>
<xsl:template match="@*|node()">
......
......@@ -23,6 +23,11 @@
<xsl:apply-templates select="@*|node()"/>
</em>
</xsl:template>
<xsl:template match="span[@data-color]">
<em>
<xsl:apply-templates select="node()"/>
</em>
</xsl:template>
<xsl:template match="s">
<em>
<xsl:apply-templates select="@*|node()"/>
......@@ -43,8 +48,14 @@
<xsl:apply-templates select="*"/>
</ol>
</xsl:template>
<xsl:template match="h1 | h2 | h3 | h4 | h5 | h6">
Titre (non pris en compte pour l'instant) :
<xsl:apply-templates select="@*|node()"/>
</xsl:template>
<xsl:template match="code">
Code (non pris en compte pour l'instant) :
<xsl:apply-templates select="@*|node()"/>
</xsl:template>
<xsl:template match="page">
<xsl:apply-templates select="@*|node()"/>
</xsl:template>
......@@ -54,4 +65,4 @@
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
</xsl:stylesheet>
# Etherpad2Opale -- HDOC CONVERTER PROJECT
# framapad2opale -- HDOC CONVERTER PROJECT
## License
[GPL 3.0](http://www.gnu.org/licenses/gpl-3.0.txt)
## Credits
- Boucaud Fabien
- Chognard Etienne
- Rit Gabrielle
- Vintache Jean
- Douteau Jean-Come
- Fecherolle Cecile (2014)
## Presentation
How to transform an etherpad document in opale document.
How to transform a framapad document in opale document.
Filepaths in this document are relative to this readme file.
## Dependence
- Etherpad2Hdoc
- framapad2Hdoc
- Hdoc2Opale
## User Documentation
1. Download an etherpad document in html format.
1. Create or join an etherpad document then export it in html format (Import/Export Button) in the `/input` directory (if the directory does not exists, you have to create it).
1. Create a framapad document then export it in html format (Import/Export Button) and put it in the `/input` directory (if the directory does not exists, you have to create it).
2. Execute the file `/run.bat` or `/run.sh` depending on the OS. A `.scar` file is created in the directory `/output`
*If the `/input` directory contains multiple files, they will be all treated.
3. Open the document with Opale
1. Open Scenari, and choose "UTC-etu_opale" as distant depot.
2. Go in the directory `sandBox/etherpad-to-opale.`
2. Go in the sandbox.
3. Import your `.scar` file in the directory.
4. Open the file Main.xml created.
## Unsupported
- MarkDown
- Timeline and author paternity
- Chat
## Known bugs
Nested lists in lists are not supported.
Here's an example :
`<ul>
<li>
<ul>
<li>
Never gonna give you up.
</li>
</ul>
</li>
<ul>`
## TODO
- Work with markdown
- Correct nested lists
## Technical notes
### Description of etherpad_to_hdoc.ant
### Description of framapad_to_hdoc.ant
#### Prelude
- Importation of necessary classes (antlib, htmlcleaner, jing)
......@@ -75,4 +53,4 @@ Here's an example :
We have to change how we get the input file:
1 Get the first file of the input directory
2 Make the run with the name of the file as parameter
Finally, ant should be changed to manage multiple entries
\ No newline at end of file
Finally, ant should be changed to manage multiple entries
This diff is collapsed.
!input/.gitkeep
!output/.gitkeep
\ No newline at end of file
......@@ -24,11 +24,11 @@ This project can be used alone if you want to import an HDOC file into basex.
## User stories
------------------
- Among a group of courses, user can search by title, author or keywords of the course.
- By searching a certain keyword, user can obtain the sections that contain it with their hierarchy levels in the course.
- In a certain section, by searching a key word, user can obtain paragraphes that contain it.
- User can get definitions related to a keyword
- User can get examples whose titles contain a keyword
- Among a group of courses, user can search by title, author or keywords of the course.
- By searching a certain keyword, user can obtain the sections that contain it with their hierarchy levels in the course.
- In a certain section, by searching a key word, user can obtain paragraphes that contain it.
- User can get definitions related to a keyword
- User can get examples whose titles contain a keyword
Step by step :
[Step 1 : File transformation]
......@@ -38,8 +38,15 @@ Step by step :
[Step 2 : Create data base in basex]
- Download and install [BaseX](http://basex.org/products/download/all-downloads/)
- Run BasexGui
- In the Text Editor of BaseX, open the command script "createbd.bxs" in folder [/basex/command] (https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex/basex/command).
- In the Text Editor of BaseX, open the command script "createbd.bxs" in folder [`basex/command`](https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex/basex/command).
Follow the instructions in the script, and then execute it.
[Step 3 : Make XQuery request]
-
\ No newline at end of file
- In the Text Editor of BaseX, you can open and execute xquery script "main.xq" in folder [`basex/xquery`](https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex/basex/xquery).
It's in this main module that we call predefined functions and execute script
- .xqm files are library modules where we have defined functions, we can go to these files for more detailed using instructions
Available library modules :
* searchDocByAuthor.xqm
* searchDocByTitle.xqm
* searchDocByTitle.xqm
\ No newline at end of file
# This script allows for creation of a data base in baseX from the xml files in the folder output
# Before executing this script, please make sure that you have successfully finished the transformation in the step 1 in the "user story" of the README.md
# This script will a database that includes all the xml files in the folder /hdoc_to_basex/output automatically
# Before executing this script, please make sure that you have successfully finished the transformation in the step 1 in the part "user story" of the README.md
# Syntax : CREATE DB [name] ([input])
# Example :
CREATE DB myDB D:\School\UTC\GI04\NF29\Projet\hdoc\hdoc_to_basex\output
#CREATE DB myDB [..the repertory of the projet in your local disk..]/hdoc/hdoc_to_basex/output
# Example :
CREATE DB myDB D:/School/UTC/GI04/NF29/Projet/hdoc/hdoc_to_basex/output
# P.S. If you get error message : Resource "..." not found, please confirm your file repertory is correct
\ No newline at end of file
(: this script with .xq as suffix is the main module :)
(: all functions defined in .xqm files (library modules) can be called here :)
import module namespace myNs = "https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex" at "searchSectionByTitle.xqm", "searchSectionByTitle.xqm", "searchDocByAuthor.xqm";
(: myNs:searchDocByTitle('^NF29_HdocEtherpad$', //document ):)
(: myNs:searchSectionByTitle('contenu', //document) :)
(: myNs:searchDocByAuthor('montangé', //document) :)
myNs:searchSectionByTitle('xml', myNs:searchDocByAuthor('montangé', //document))
\ No newline at end of file
(: This script will return documents by searching its author :)
(: We can assign a Regular Expression to the variable $author :)
(: For example, $author := '^Baptiste Montangé$', to search for an exact name:)
(: For example, $name := '^Baptiste Montangé$', to search for an exact name:)
(: For example, $name := 'Montangé', to search for documents whose author named Coutant:)
(: Remark : Accents in the authors' names have been taken care of :)
(: Remark : case and accents in author's name have been taken care of :)
<documents>{
let $name := 'Montangé'
let $name_noAcc := translate($name, 'áàâäéèêëíìîïóòôöúùûü','aaaaeeeeiiiioooouuuu')
for $doc in //document
module namespace myNs = "https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex";
declare function myNs:searchDocByAuthor($name as xs:string, $docs as node()*) as node()*
{
let $name_noAcc := translate($name, 'áàâäéèêëíìîïóòôöúùûüABCDEFGHIJKLMNOPQRSTUVWXYZ','aaaaeeeeiiiioooouuuuabcdefghijklmnopqrstuvwxyz')
for $doc in $docs
return
for $author in $doc/authors/author
let $titre := $doc/titre
let $author_noAcc := translate($author, 'áàâäéèêëíìîïóòôöúùûü','aaaaeeeeiiiioooouuuu')
let $author_noAcc := translate($author, 'áàâäéèêëíìîïóòôöúùûüABCDEFGHIJKLMNOPQRSTUVWXYZ','aaaaeeeeiiiioooouuuuabcdefghijklmnopqrstuvwxyz')
where matches($author_noAcc, $name_noAcc)
group by $titre (: Avoid duplications of documents by their titre:)
return $doc
}</documents>
\ No newline at end of file
};
\ No newline at end of file
......@@ -3,9 +3,11 @@
(: For example, $name := '^NF29_HdocEtherpad$', to search for an exact name:)
(: For example, $name := 'NF29', to search for documents whose name contains 'NF29':)
<documents>{
let $name := '^NF29_HdocEtherpad$'
for $doc in //document
module namespace myNs = "https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex";
declare function myNs:searchDocByTitle($name as xs:string, $docs as node()*) as node()*
{
for $doc in $docs
where matches($doc/titre, $name, "i")
return $doc
}</documents>
\ No newline at end of file
};
\ No newline at end of file
(: This script will return a section by searching keyword in its title :)
(: We can assign a Regular Expression to the variable $keyword :)
(: For example, $keyword := '^Objectifs$', to search for sections whose titles are exactly "Objectifs":)
(: For example, $keyword := 'Syntax', to search for sections whose titles containing "Syntax" :)
(: Remark : case and accents in the keyword have been taken care of :)
module namespace myNs = "https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex";
declare function myNs:searchSectionByTitle($keyword as xs:string, $docs as node()*) as node()*
{
let $keyword_noAcc := translate($keyword, 'áàâäéèêëíìîïóòôöúùûüABCDEFGHIJKLMNOPQRSTUVWXYZ','aaaaeeeeiiiioooouuuuabcdefghijklmnopqrstuvwxyz')
for $doc in $docs
return
for $section in $doc/sections/section
let $title_noAcc := translate($section/titresection, 'áàâäéèêëíìîïóòôöúùûüABCDEFGHIJKLMNOPQRSTUVWXYZ','aaaaeeeeiiiioooouuuuabcdefghijklmnopqrstuvwxyz')
where matches($title_noAcc, $keyword_noAcc)
return $section
};
\ No newline at end of file
......@@ -20,6 +20,10 @@ Dependencies
---
There's no particular dependencies needed to run the converter.
Conditions particulières
---
Pour le moment, il ne faut pas utilisé les "sous-Division" de Opale. Les divisions à la racine sont autorisées.
User Story
---
### Running the script
......
......@@ -32,16 +32,16 @@
<!-- Targeted markups. -->
<xsl:template match="h:img">
<copy tofile="${{filename2}}/decompressedOpale/res/{./@src}" file="${{filename2}}/decompressedHdoc/{./@src}"/>
<copy tofile="${{filename2}}/decompressedcanoprof/res/{./@src}" file="${{filename2}}/decompressedHdoc/{./@src}"/>
</xsl:template>
<xsl:template match="h:audio">
<copy tofile="${{filename2}}/decompressedOpale/res/{./@src}" file="${{filename2}}/decompressedHdoc/{./@src}"/>
<copy tofile="${{filename2}}/decompressedcanoprof/res/{./@src}" file="${{filename2}}/decompressedHdoc/{./@src}"/>
</xsl:template>
<xsl:template match="h:video">
<copy tofile="${{filename2}}/decompressedOpale/res/{./@src}" file="${{filename2}}/decompressedHdoc/{./@src}"/>
<copy tofile="${{filename2}}/decompressedcanoprof/res/{./@src}" file="${{filename2}}/decompressedHdoc/{./@src}"/>
</xsl:template>
<xsl:template match="h:object">
<copy tofile="${{filename2}}/decompressedOpale/res/{./@data}" file="${{filename2}}/decompressedHdoc/{./@data}"/>
<copy tofile="${{filename2}}/decompressedcanoprof/res/{./@data}" file="${{filename2}}/decompressedHdoc/{./@data}"/>
</xsl:template>
<!-- These markups are matched in order to minimize "apply-templates" side-effects (i.e. their contents are not relevant for this transformation). -->
......
......@@ -113,6 +113,226 @@
</sp:abstract>
</xsl:template>
<!-- CanoProf's Activite TetM = hdoc's body/Section/Section = Opale's Grain -->
<xsl:template match="h:body/h:section/h:section">
<xsl:if test="./*">
<sp:textActivity>
<cp:textActivity>
<cp:activityM>
<sp:title>
<xsl:if test="not(./h:header/h:h1/text())"> Untitled </xsl:if>
<xsl:value-of select="./h:header/h:h1"/>
</sp:title>
<xsl:if test="(./h:header/h:div[@data-hdoc-type = 'introduction']/text())">
<xsl:apply-templates
select="./h:header/h:div[@data-hdoc-type = 'introduction']"/>
</xsl:if>
</cp:activityM>
<xsl:if test="./h:div/*">
<sp:body>
<cp:blocks>
<xsl:apply-templates select="./h:div"/>
</cp:blocks>
</sp:body>
</xsl:if>
<xsl:if test="./h:section/*">
<xsl:apply-templates select="./h:section" mode="CanoprofSection"/>
</xsl:if>
</cp:textActivity>
</sp:textActivity>
</xsl:if>
</xsl:template>
<!-- CanoProf's Activite TetM (section) = hdoc's body/Section/Section/(Section...) = Opale's Grain (partie) -->
<!-- TODO -->
<xsl:template match="h:section" mode="CanoprofSection">
</xsl:template>
<!-- Div related templates -->
<!-- Formatting content based on @data-hdoc-type -->
<xsl:template match=