Commit ae24c451 authored by bperraud's avatar bperraud

fix conflict

parents a2f4263a 38b47280
# Convertisseur Canoprof vers HDOC
##Credits
### Autumn 2016
* NEVEUX Anaïs
* BELLIER Pierre-Ulysse
## 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.
......@@ -15,4 +23,16 @@ Un utilisateur a cr
- 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.
\ No newline at end of file
- 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.
## Known bugs
- You can have an exercice with no question but a solution. We should add a if statement to handle this.
- Something create a "keywrds" node inside the opale output, that make the schema invalid. Editing the title inside myScenari and just pressing enter is sufficient to fix that. But it will be better to fix that inside one of the xsl files.
## TODO List
- Allow user to convert scar files which contain a .programme file with a name different than "Test.programme".
- Handle multiple files conversion
- Add all other type of exercices
- Handle other kind of paragraph
- Handle resources (images for example)
\ No newline at end of file
This diff is collapsed.
# Canoprof2Opale
##Credits
### Autumn 2016
* NEVEUX Anaïs
* BELLIER Pierre-Ulysse
## 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.
## 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.
A .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.
......@@ -14,10 +22,19 @@ An .scar example is already in the input folder.
## What the converter handle
- Sequence
- Session
- Activity created in the .programme, transclusion should be available soon.
- Activity created in the .programme, transclusion available.
- Information/Warning/Advice/ect...
- Method and Remind fully functional
- QCM and QCU working, even with transclusion.
- Add "Exercice redactionnel" and transclusion.
## Known bugs
- You can have an exercice with no question but a solution. We should add a if statement to handle this.
- Something create a "keywrds" node inside the opale output, that make the schema invalid. Editing the title inside myScenari and just pressing enter is sufficient to fix that. But it will be better to fix that inside one of the xsl files.
## TODO List
- Allow user to convert scar files which contain a .programme file with a name different than "Test.programme".
- Handle multiple files conversion
- Add all other type of exercices
- Handle other kind of paragraph
- Handle resources (images for example)
......@@ -30,26 +30,6 @@ Vous êtes un utilisateur de framapad et en créez un pour un projet. Après avo
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)
......
......@@ -10,7 +10,7 @@
- Fecherolle Cecile (2014)
## Presentation
How to transform an framapad document in opale document.
How to transform a framapad document in opale document.
Filepaths in this document are relative to this readme file.
......@@ -19,8 +19,7 @@ Filepaths in this document are relative to this readme file.
- Hdoc2Opale
## User Documentation
1. Download a framapad document in html format.
1. Create or join a framapad 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
......@@ -29,29 +28,6 @@ Filepaths in this document are relative to this readme file.
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 framapad_to_hdoc.ant
......
......@@ -42,7 +42,11 @@ Step by step :
Follow the instructions in the script, and then execute it.
[Step 3 : Make XQuery request]
- In the Text Editor of BaseX, you can open and execute xquery scripts in folder [`basex/xquery`](https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex/basex/xquery).
- Available scripts :
* searchDocByAuthor.hq
* searchDocByTitle.hq
\ 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 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 :)
declare function local:searchDocByAuthor($name as xs:string, $docs as node()*) as node()*
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, 'áàâäéèêëíìîïóòôöúùûü','aaaaeeeeiiiioooouuuu')
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
};
(: Example :)
local:searchDocByAuthor('Montangé', //document)
\ No newline at end of file
};
\ No newline at end of file
......@@ -3,12 +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':)
declare function local:searchDocByTitle($name as xs:string, $docs as node()*) as node()*
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
};
(: Example :)
local:searchDocByTitle('^NF29_HdocEtherpad$', //document)
\ 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
<project name="hdoc_to_elasticsearch" default="clean">
<!-- Use contribant -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="lib/ant-contrib-0.3.jar"/>
</classpath>
</taskdef>
<property file="build.properties"/>
<target name="unzipSource">
<target name="jsonFiles">
<echo message="Conversion begin" />
<path id="hdocDirPath">
<fileset dir="${inputPath}" id="hdocFile">
<include name="*.hdoc"/>
</fileset>
</path>
<property name="hdocFile" refId="hdocDirPath"/>
<basename property="hdocFileName" file="${hdocFile}" suffix=".hdoc"/>
<echo>Entry file : ${hdocFileName}</echo>
<echo>Entry file : ${fileToParse}</echo>
<!-- create subdirectory for each file -->
<mkdir dir="${tmpHdoc}/${hdocFileName}"/>
<!--unzips the hdoc to be converted into the previously created directory-->
<unzip dest="${tmpHdoc}/${hdocFileName}">
<fileset dir="${inputPath}" id="hdocFile">
<include name="${hdocFileName}.hdoc"/>
<mkdir dir="${tmpHdoc}" />
<basename property="fileToParseName" file="${inputPath}/${fileToParse}" suffix=".hdoc" />
<mkdir dir="${tmpHdoc}/${fileToParseName}"/>
<!--unzips the hdoc to be converted into the previously created directory -->
<unzip dest="${tmpHdoc}/${fileToParseName}">
<fileset dir="${inputPath}">
<include name="${fileToParseName}.hdoc"/>
</fileset>
</unzip>
</target>
<target name="jsonFiles" depends="unzipSource">
<echo message="JSON File creation" />
<xslt in="${tmpHdoc}/${hdocFileName}/content.xml" out="${outputPath}/${hdocFileName}.json" style="xsl/content_extractor.xsl"/>
<xslt in="${tmpHdoc}/${fileToParseName}/content.xml" out="${outputPath}/${fileToParseName}.json" style="xsl/content_extractor.xsl"/>
</target>
<!-- Parcours la liste des fichiers pour les transformer -->
<target name="targetAllFiles">
<delete>
<fileset dir="${outputPath}">
<include name="*.json"/>
</fileset>
</delete>
<foreach target="jsonFiles" param="fileToParse">
<fileset dir="${inputPath}">
<include name="*.hdoc"/>
</fileset>
</foreach>
</target>
<!-- Clear tmp files -->
<target name="clean" depends="jsonFiles">
<target name="clean" depends="targetAllFiles">
<echo message="Clean files" />
<!-- -->
<delete includeemptydirs="true" verbose="true">
......
......@@ -39,11 +39,19 @@ Image : JPEG; JPG, PNG, SVG (non testé pour SVG)
Gestion du multifichiers en input
Hypertexte
Unsupported
-----------
ODG : non supporté en EPUB => "Élément non supporté en EPUB : <xsl:value-of select="@data"/>"
Problème sur la liseuse vis à vis du CSS (à détailler)
Exercices
Méthode et Rappels (data-hdoc-type)
Known bugs
----------
......@@ -57,8 +65,13 @@ Problème avec les keywords : le hdoc contient des keywords mais nous ne savons
Todo list
---------
Étude compatibilité entre EPUB2 et EPUB3
Trouver une solution pour le dimentionnement des images
Repérer le problème avec le css
Faire l'affichage des exercices
Faire l'affichage des nouveaux types : Méthode et Rappels
Technical Notes
---------------
This diff is collapsed.
body{
margin: 0px;
padding: 0px;
height: 100%;
font: 12px Tahoma, Arial, Sans-serif;
}
h1, h2, h3, h4, h5, h6{
font-weight: bold;
}
h1{
font-size: 1.8em;
color: #4463A1;
text-align: center;
}
h2{
font-size:1.8em;
color:#4463A1;
}
h3{
font-size: 1.4em;
color: #4463A1;
}
h4, h5, h6{
font-size: 1.3em;
color: #4463A1;
}
p{
text-align: justify;
font-size: 1.2em;
margin: 0.2em 1em 0.7em 1em;
}
table, td, th {
border: 1px solid #4463A1;
text-align: center;
font-size: 1.2em;
}
td p, th p{
text-align: center;
font-size: 15px;
}
tr:first-child {
font-weight: bold;
color : white;
background-color : #4463A1;
}
table {
border-collapse: collapse;
width: 100%;
}
th {
padding: 10px;
}
td{
padding: 5px;
}
.textTitle{
float : left;
}
.title{
float : right;
}
.border{
background: #f5fcff;
border: 2px solid #4463A1;
box-shadow: 0px 5px 5px #888888;
padding: 5px;
clear: both;
}
.warning{
color:#cc0000;
}
.borderWarning{
background: #ffcccc;
border: 2px solid #cc0000;
box-shadow: 0px 5px 5px #888888;
padding: 5px;
clear: both;
}
.noCut{
page-break-inside: avoid;
}
.titlePage{
margin: 30vh 0 0 0;
text-align: center;
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
font-size: 30px;
}
.subTitlePage{
text-align: center;
font-size: 15px;
}
.bold{
font-weight: bold;
}
.imgContainer1{
text-indent:0;
text-align:center;
margin-right:auto;
margin-left:auto;
width:99%;
page-break-before:auto;
page-break-inside:avoid;
page-break-after:auto;
}
.imgContainer2{
margin-left:0;
margin-right:0;
text-align:center;
text-indent:0;
height:100%;
width:100%;
}
p .imgContainer3{
display:inline-block;
text-indent:0;
width:100%;
}
img{
max-width:99%;
max-height:75%;
}
body{
margin: 0px;
padding: 0px;
height: 100%;
font: 12px Tahoma, Arial, Sans-serif;
}
h1, h2, h3, h4, h5, h6{
font-weight: bold;
}
h1{
font-size: 1.8em;
color: #4463A1;
text-align: center;
}
h2{
font-size:1.8em;
color:#4463A1;
}
h3{
font-size: 1.4em;
color: #4463A1;
}
h4, h5, h6{
font-size: 1.3em;
color: #4463A1;
}
p{
text-align: justify;
font-size: 1.2em;
margin: 0.2em 1em 0.7em 1em;
}
table, td, th {
border: 1px solid #4463A1;
text-align: center;
font-size: 1.2em;
}
td p, th p{
text-align: center;
font-size: 15px;
}
tr:first-child {
font-weight: bold;
color : white;
background-color : #4463A1;
}
table {
border-collapse: collapse;
width: 100%;
}
th {
padding: 10px;
}
td{
padding: 5px;
}
.textTitle{
float : left;
}
.title{
float : right;
}
.border{
background: #f5fcff;
border: 2px solid #4463A1;
box-shadow: 0px 5px 5px #888888;
padding: 5px;
clear: both;
}
.warning{
color:#cc0000;
}
.borderWarning{
background: #ffcccc;
border: 2px solid #cc0000;
box-shadow: 0px 5px 5px #888888;
padding: 5px;
clear: both;
}
.noCut{
page-break-inside: avoid;
}
.titlePage{
margin: 30vh 0 0 0;
text-align: center;
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
font-size: 30px;
}
.subTitlePage{
text-align: center;
font-size: 15px;
}
.bold{
font-weight: bold;
}
.imgContainer1{
text-indent:0;
text-align:center;
margin-right:auto;
margin-left:auto;
width:99%;
page-break-before:auto;
page-break-inside:avoid;
page-break-after:auto;
}
.imgContainer2{
margin-left:0;
margin-right:0;
text-align:center;
text-indent:0;
height:100%;
width:100%;
}
p .imgContainer3{
display:inline-block;
text-indent:0;
width:100%;
}
img{
max-width:99%;
max-height:75%;
}
......@@ -629,6 +629,75 @@
<xsl:copy-of select="document(fn:concat($filename,'/decompressedHdoc/',@data))/sc:item/op:code"/>
</sp:listing>
</xsl:template>
<!-- Open Question -->
<xsl:template match="h:section[@data-hdoc-type = 'exercise']">
<sp:practUc>
<op:practUc>
<op:exeM>
<sp:title>
<xsl:value-of select="h:header/h:h1"/>
</sp:title>
</op:exeM>
<!-- TODO handle desc -->
<!-- Question/Response -->
<xsl:apply-templates select=".//h:section"/>
</op:practUc>
</sp:practUc>
</xsl:template>
<xsl:template match="h:section[h:div[@data-hdoc-type='openQuestion']]">
<sp:quest>
<op:practUcQ>
<sp:desc>
<xsl:apply-templates select="./h:div[@data-hdoc-type = 'openQuestion']"/>
</sp:desc>
<sp:hint>
<xsl:apply-templates select="./h:div[@data-hdoc-type = 'hint']"/>
</sp:hint>
<xsl:if test="h:div[@data-hdoc-type = 'solution']">
<sp:sol>
<op:pb>
<xsl:apply-templates select="./h:div[@data-hdoc-type = 'solution']"/>
</op:pb>
</sp:sol>
</xsl:if>
</op:practUcQ>
</sp:quest>
</xsl:template>
<xsl:template match="h:div[@data-hdoc-type = 'openQuestion']">
<op:res>
<xsl:apply-templates select="./*"/>
</op:res>
</xsl:template>
<xsl:template match="h:div[@data-hdoc-type = 'hint']">
<op:res>
<xsl:apply-templates select="./*"/>
</op:res>
</xsl:template>