Commit a418015a authored by qkeunebr's avatar qkeunebr

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

parents 54fa1bd8 b0d00aac
......@@ -16,7 +16,7 @@
<!--<xsl:template match="*"></xsl:template>-->
<xsl:template match="cp:program">
<xsl:processing-instruction name="oxygen">
RNGSchema="http://hdoc.crzt.fr/schemas/xhtml/hdoc1-xhtml.rng" type="xml"</xsl:processing-instruction>
RNGSchema="../../schemas/xhtml/hdoc1-xhtml.rng" type="xml"</xsl:processing-instruction>
<html>
<head>
<title><xsl:value-of select="cp:programM/sp:title"/></title>
......@@ -74,9 +74,7 @@
<!-- gérer les sessionM -->
</header>
<!-- <xsl:apply-templates select="cp:session/sp:profInstruction"/> -->
<!-- TODO Faire un apply-template plus générique -->
<xsl:apply-templates select="cp:session/sp:textActivity"/>
<xsl:apply-templates select="cp:session/*[name() != 'cp:sessionM']"/>
</section>
</xsl:template>
......@@ -221,13 +219,13 @@
<!-- ******** ACTIVITE TETM ********** -->
<xsl:template match="sp:textActivity/cp:textActivity | sc:item/cp:textActivity">
<xsl:template match="sp:textActivity/cp:textActivity | sc:item/cp:textActivity | sp:section/cp:textActivity">
<section>
<header>
<h1><xsl:value-of select="cp:activityM/sp:title"/></h1>
</header>
<!-- TODO généraliser -->
<xsl:apply-templates select="sp:body/cp:blocks/sp:info | sp:body/cp:blocks/sp:warning | sp:body/cp:blocks/sp:extra | sp:body/cp:blocks/sp:advice | sp:body/cp:blocks/sp:definition | sp:body/cp:blocks/sp:example | sp:body/cp:blocks/sp:hypothesis"/>
<xsl:apply-templates select="sp:body/cp:blocks/* | sp:section/cp:textActivity"/>
</section>
</xsl:template>
......@@ -239,7 +237,6 @@
<!-- Gestion information -->
<xsl:template match="sp:info">
<div>
<!-- TODO factoriser -->
<h6><xsl:value-of select="cp:block/cp:blockM/sp:title"/></h6>
<!-- TODO gerer plusieurs types de paragraphe -->
<xsl:apply-templates select="cp:block/sp:body/cp:flow/sp:txt/cp:txt//sc:para"/>
......@@ -249,7 +246,6 @@
<!-- Gestion warning -->
<xsl:template match="sp:warning">
<div data-hdoc-type='warning'>
<!-- TODO factoriser -->
<h6><xsl:value-of select="cp:block/cp:blockM/sp:title"/></h6>
<!-- TODO gerer plusieurs types de paragraphe -->
<xsl:apply-templates select="cp:block/sp:body/cp:flow/sp:txt/cp:txt//sc:para"/>
......@@ -259,7 +255,6 @@
<!-- Gestion complement -->
<xsl:template match="sp:extra">
<div data-hdoc-type='complement'>
<!-- TODO factoriser -->
<h6><xsl:value-of select="cp:block/cp:blockM/sp:title"/></h6>
<!-- TODO gerer plusieurs types de paragraphe -->
<xsl:apply-templates select="cp:block/sp:body/cp:flow/sp:txt/cp:txt//sc:para"/>
......@@ -269,7 +264,6 @@
<!-- Gestion conseil -->
<xsl:template match="sp:advice">
<div data-hdoc-type='advice'>
<!-- TODO factoriser -->
<h6><xsl:value-of select="cp:block/cp:blockM/sp:title"/></h6>
<!-- TODO gerer plusieurs types de paragraphe -->
<xsl:apply-templates select="cp:block/sp:body/cp:flow/sp:txt/cp:txt//sc:para"/>
......@@ -279,7 +273,6 @@
<!-- Gestion definition -->
<xsl:template match="sp:definition">
<div data-hdoc-type='definition'>
<!-- TODO factoriser -->
<h6><xsl:value-of select="cp:block/cp:blockM/sp:title"/></h6>
<!-- TODO gerer plusieurs types de paragraphe -->
<xsl:apply-templates select="cp:block/sp:body/cp:flow/sp:txt/cp:txt//sc:para"/>
......@@ -289,7 +282,6 @@
<!-- Gestion exemple -->
<xsl:template match="sp:example">
<div data-hdoc-type='example'>
<!-- TODO factoriser -->
<h6><xsl:value-of select="cp:block/cp:blockM/sp:title"/></h6>
<!-- TODO gerer plusieurs types de paragraphe -->
<xsl:apply-templates select="cp:block/sp:body/cp:flow/sp:txt/cp:txt//sc:para"/>
......@@ -299,13 +291,27 @@
<!-- Gestion hypothese -->
<xsl:template match="sp:hypothesis">
<div data-hdoc-type='remark'>
<!-- TODO factoriser -->
<h6><xsl:value-of select="cp:block/cp:blockM/sp:title"/></h6>
<!-- TODO gerer plusieurs types de paragraphe -->
<xsl:apply-templates select="cp:block/sp:body/cp:flow/sp:txt/cp:txt//sc:para"/>
</div>
</xsl:template>
<!-- Gestion methode -->
<xsl:template match="sp:method">
<div data-hdoc-type='method'>
<h6><xsl:value-of select="cp:block/cp:blockM/sp:title"/></h6>
<xsl:apply-templates select="cp:block/sp:body/cp:flow/sp:txt/cp:txt//sc:para"/>
</div>
</xsl:template>
<!-- Gestion rappel -->
<xsl:template match="sp:reminder">
<div data-hdoc-type='remind'>
<h6><xsl:value-of select="cp:block/cp:blockM/sp:title"/></h6>
<xsl:apply-templates select="cp:block/sp:body/cp:flow/sp:txt/cp:txt//sc:para"/>
</div>
</xsl:template>
<!-- ******** FIN ACTIVITE TETM ********** -->
......
......@@ -110,3 +110,34 @@ td{
.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%;
}
......@@ -97,7 +97,7 @@
<target name="MakeOPF">
<!-- Récupération du nom des images dans my.images séparé par des ','-->
<path id="pathImage">
<fileset dir="${tmp}/${filename}/decompressedHdoc/re">
<fileset dir="${tmp}/${filename}/decompressedHdoc/re" erroronmissingdir="false">
<include name="**/*.jpeg"/>
<include name="**/*.jpg"/>
<include name="**/*.svg"/>
......@@ -151,7 +151,7 @@
<target name="ValidateOutput">
<java jar="./epubcheck-4.0.2/epubcheck.jar" fork="true">
<arg value="${out}/${properFilename}.epub"/>
</java>
</java>
</target>
<target name="CleanTmp">
......
......@@ -184,10 +184,23 @@
</xsl:template>
<xsl:template match="//img" priority="4">
<xsl:element name="img">
<xsl:attribute name="src">../images/<xsl:value-of select="./@alt"/></xsl:attribute>
<xsl:attribute name="alt"><xsl:value-of select="./@alt"/></xsl:attribute>
</xsl:element>
<!--<div class="imageWrapperHi">
<xsl:element name="img">
<xsl:attribute name="src">../images/<xsl:value-of select="./@alt"/></xsl:attribute>
<xsl:attribute name="alt"><xsl:value-of select="./@alt"/></xsl:attribute>
</xsl:element>
</div>-->
<div class="imgContainer1">
<div class="imgContainer2">
<xsl:element name="img">
<xsl:attribute name="src">../images/<xsl:value-of select="./@alt"/></xsl:attribute>
<xsl:attribute name="alt"><xsl:value-of select="./@alt"/></xsl:attribute>
</xsl:element>
</div>
</div>
</xsl:template>
<xsl:template match="//a[not(starts-with(@href,'http'))]" priority="4">
......
......@@ -12,13 +12,16 @@ Kapilraj Thangeswaran
This module is able to extract data from a file in Hdoc format and insert them into MongoDB.
## Dependencies
In order to work properly this module needs
- In order to make this module work you have to download and install Node.js from the [Node.js download page](https://nodejs.org/en/).
- If needed, download and install MongoDB from the [MongoDB download page](https://www.mongodb.com/download-center#community).
## Instructions
1. Install dependencies
2. Edit "config.json" file from "mongo" folder (for more details, please check "Mongo configuration")
3. Execute run.bat or run.sh
2. Add all your hdoc documents in an "input" folder
3. Add or edit "config.xml" file in "input" folder (for more details, please check "Input configuration")
4. Edit "config.json" file from "mongo" folder (for more details, please check "Mongo configuration")
5. Execute run.bat or run.sh
## Web
This module provides a Web application to access MongoDB and execute simples requests.
......@@ -26,9 +29,22 @@ This module provides a Web application to access MongoDB and execute simples req
2. Edit "config.json" file from "web" folder (for more details, please check "MongoDB configuration")
3. Open "index.html" in "web" folder
## Input configuration
You can add or edit "config.xml" in "input" folder in order to provide more information about your documents.
Supported information
- link
```
<?xml version="1.0" encoding="UTF-8"?>
<config>
<file name='sample.scar'>
<link>https://stph.scenari-community.org/nf17/co/nf17.html</link>
</file>
</config>
```
## MongoDB configuration
### In "mongo" folder
Use "config.json" in the "mongo" folder to specify :
Use "config.json" in the "mongo" folder to specify
- url : mongodb's url
- database : the database you are using
- collection : the collection you are using
......@@ -43,7 +59,7 @@ Use "config.json" in the "mongo" folder to specify :
```
### In "web" folder
Use "config.json" in the "web" folder to specify :
Use "config.json" in the "web" folder to specify
- url : mongodb's url including the database
- collection : the collection you are using
```
......@@ -61,4 +77,4 @@ Use "config.json" in the "web" folder to specify :
## User stories
- En tant qu’utilisateur rédigeant des documents sous opale, je veux récupérer les exercices corrigés d’un sujet donné dans le but de les réutiliser.
- En tant qu’utilisateur rédigeant des documents sous opale, je veux récupérer les cours d’un auteur précis dans le but d’utiliser ses cours comme références.
- En tant qu’utilisateur universitaire, je souhaite mettre à disposition mes exercices sur internet de manière structuré dans le but de permettre à d’autre utilisateurs universitaires de les trouver, par thème, auteur ou contenu et de les réutiliser.
- En tant qu’utilisateur universitaire, je souhaite mettre à disposition mes exercices sur internet de manière structuré dans le but de permettre à d’autre utilisateurs universitaires de les trouver, par thème, auteur ou contenu et de les réutiliser.
\ No newline at end of file
......@@ -48,7 +48,10 @@
<target name="convertHdoc">
<echo>Convert ${inputPath}/${file}</echo>
<basename property="basename" file="${inputPath}/${file}" suffix=".hdoc"/>
<xslt in="${tmpdir}/content.xml" out="${outputPath}/${basename}.json" style="xsl/main.xsl"/>
<xslt in="${tmpdir}/content.xml" out="${outputPath}/${basename}.json" style="xsl/main.xsl">
<param name="fileName" expression="${basename}"/>
<param name="inputPath" expression="${inputPath}"/>
</xslt>
</target>
<target name="clean">
......
<?xml version="1.0" encoding="UTF-8"?>
<config>
<file name='alg1_2016-12-12.scar'>
<link>https://stph.scenari-community.org/nf17/co/nf17.html</link>
</file>
</config>
\ No newline at end of file
......@@ -10,11 +10,19 @@
<xsl:import href="subroutines/right.xsl"/>
<xsl:import href="subroutines/introduction.xsl"/>
<xsl:import href="subroutines/exercise.xsl"/>
<xsl:import href="subroutines/config.xsl"/>
<xsl:output method="text" encoding="UTF-8" omit-xml-declaration="yes"/>
<xsl:param name="fileName" required="yes" as="xs:string"/>
<xsl:param name="inputPath" required="yes" as="xs:string"/>
<xsl:template match="/">
{
<xsl:call-template name="config-main">
<xsl:with-param name="fileName"><xsl:value-of select="$fileName"/></xsl:with-param>
<xsl:with-param name="inputPath"><xsl:value-of select="$inputPath"/></xsl:with-param>
</xsl:call-template>
"title" : <xsl:call-template name="title-main"/>,
"authors" : <xsl:call-template name="author-main"/>,
"keywords" : <xsl:call-template name="keyword-main"/>,
......
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:h2m="http://www.utc.fr/hdoc/hdoc_to_mongo">
<xsl:import href="../xsl-import/string.xsl"/>
<xsl:template name="config-main">
<xsl:param name="fileName"/>
<xsl:param name="inputPath"/>
"link" : <xsl:value-of select="h2m:escape-string(document('C:\Users\Kapil\Documents\Projets\github\hdoc\hdoc_to_mongo/input/config.xml')/config/file[@name = $fileName]/link)" />,
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
......@@ -382,6 +382,34 @@
</op:res>
</sp:adv>
</xsl:when>
<xsl:when test="./@data-hdoc-type = 'method'">
<sp:meth>
<op:pbTi>
<xsl:if test="string-length(./h:h6/text()) > 0">
<sp:title>
<xsl:value-of select="./h:h6"/>
</sp:title>
</xsl:if>
</op:pbTi>
<op:res>
<xsl:apply-templates select="./*"/>
</op:res>
</sp:meth>
</xsl:when>
<xsl:when test="./@data-hdoc-type = 'remind'">
<sp:remind>
<op:pbTi>
<xsl:if test="string-length(./h:h6/text()) > 0">
<sp:title>
<xsl:value-of select="./h:h6"/>
</sp:title>
</xsl:if>
</op:pbTi>
<op:res>
<xsl:apply-templates select="./*"/>
</op:res>
</sp:remind>
</xsl:when>
<xsl:otherwise>
<sp:info>
<op:pbTi>
......
......@@ -13,6 +13,54 @@ This module is able to extract data from a file in Opale format and insert them
## Dependencies
In order to work properly this module needs
- In order to make this module work you have to download and install Node.js from the [Node.js download page](https://nodejs.org/en/).
- If needed, download and install MongoDB from the [MongoDB download page](https://www.mongodb.com/download-center#community).
- [`opale_to_hdoc`](https://gitlab.utc.fr/crozatst/hdoc/tree/master/opale_to_hdoc) (Opale to Hdoc conversion)
- [`hdoc_to_mongo`](https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_mongo) (Hdoc to Mongo conversion)
1. [`opale_to_hdoc`](https://gitlab.utc.fr/crozatst/hdoc/tree/master/opale_to_hdoc) (Opale to Hdoc conversion)
2. [`hdoc_to_mongo`](https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_mongo) (Hdoc to Mongo conversion)
\ No newline at end of file
## Instructions
1. Install dependencies
2. Add all your hdoc documents in an "input" folder
3. Add or edit "config.xml" file in "input" folder (for more details, please check "Input configuration")
4. Edit "config.json" file from "mongo" folder in "hdoc_to_mongo" module (for more details, please check "Mongo configuration")
5. Execute run.bat or run.sh
## Input configuration
You can add or edit "config.xml" in "input" folder to provide more information about your documents.
Supported information
- link
```
<?xml version="1.0" encoding="UTF-8"?>
<config>
<file name='sample.scar'>
<link>https://stph.scenari-community.org/nf17/co/nf17.html</link>
</file>
</config>
```
## MongoDB configuration
### In "mongo" folder from "hdoc_to_mongo" module
Use "config.json" in the "mongo" folder to specify
- url : mongodb's url
- database : the database you are using
- collection : the collection you are using
- request : the request you want to perform (for allowed requests, please check "Supported requests")
```
{
"url" : "mongodb://localhost:27017/",
"database" : "database",
"collection" : "collection",
"request" : "insert"
}
```
## Supported requests
- insert
- update (using the title as filter)
- remove (using the title as filter)
## User stories
- En tant qu’utilisateur rédigeant des documents sous opale, je veux récupérer les exercices corrigés d’un sujet donné dans le but de les réutiliser.
- En tant qu’utilisateur rédigeant des documents sous opale, je veux récupérer les cours d’un auteur précis dans le but d’utiliser ses cours comme références.
- En tant qu’utilisateur universitaire, je souhaite mettre à disposition mes exercices sur internet de manière structuré dans le but de permettre à d’autre utilisateurs universitaires de les trouver, par thème, auteur ou contenu et de les réutiliser.
\ No newline at end of file
......@@ -23,6 +23,7 @@
<copy todir="${inputHdocToMongo}">
<fileset dir="${outputOpaleToHdoc}"/>
</copy>
<copy file="${inputPath}/config.xml" todir="${inputHdocToMongo}"/>
<copy todir="${nodeModulesHdocToMongo}">
<fileset dir="${nodeModules}"/>
</copy>
......
<?xml version="1.0" encoding="UTF-8"?>
<config>
<file name='alg1_2016-12-12.scar'>
<link>https://stph.scenari-community.org/nf17/co/nf17.html</link>
</file>
</config>
\ No newline at end of file
......@@ -46,6 +46,8 @@
<value>remark</value>
<value>warning</value>
<value>advice</value>
<value>remind</value>
<value>method</value>
<!-- quiz management -->
<value>question</value>
<value>singlechoicequestion</value>
......
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