Commit 78d41803 authored by crzt's avatar crzt

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

parents 8db0234f 802a40b8
# Etherpad to Hdoc -- HDOC CONVERTER PROJECT # Converter etherpad_to_hdoc
## [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. ## License
- To do so : License GPL3.0
1. please place your html files in the `/input` folder http://www.gnu.org/licenses/gpl-3.0.txt
## Crédits
- Jean-Côme Douteau
- Gabrielle Rit
- Jean Vintache
- Fecherolle Cécile
## Presentation
This module is able to convert several [etherpad](http://etherpad.org/) files (exported as html files) to the hdoc format.
## User documentation
### Running etherpad_to_hdoc.ant
1. Create an etherpad document and export it as an html file.
1. please place your html files in the `/input` folder
2. run the `run.[bat|sh]` script of your choice depending on your OS 2. run the `run.[bat|sh]` script of your choice depending on your OS
3. and retrieve the hdoc outputs in the `/output` folder 3. and retrieve the hdoc outputs in the `/output` folder
## Unsupported
- Markdown
- Author paternity
- Etherpad timeline
- Chat
## Known bugs
## TODO
## Technical notes
### Description of etherpad_to_hdoc.ant
#### Prelude
- Importation of necessary classes (antlib, htmlcleaner, jing)
- Creation of directories architecture tree
#### Transformations
- Use of htmlcleaner to transform the input file from html to xhtml. For more info, see http://htmlcleaner.sourceforge.net/index.php.
- Apply html2xhtml.xsl : this xsl extracts the content into <body> tags
- Apply html2xhtmlv1.xsl : this xsl is used as a fix and adds br tag at the end of lists (ul and ol)
- Apply html2xhtmlv2.xsl : this xsl surround text line with p tags and transforms non-hdoc tags into hdoc tags as s, u, strong tags.
- Apply html2xhtml3.xsl : this xsl is used as a fix, it deletes p tags when its child is ul or ol
- Apply xhtml2hdoc.xsl : this xsl transforms the content into hdoc structure
#### Post-transformations actions
- Build hdoc structure
- Jing checks if the output file is validated with the right rng schema
- Zip the directory into hdoc archive
## Capitalisation
\ No newline at end of file
...@@ -5,14 +5,14 @@ ...@@ -5,14 +5,14 @@
> >
<xsl:output method="xml" indent="yes" encoding="UTF-8"/> <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:param name="filename"/> <xsl:param name="filename"/>
<!-- This template matches the root and create a ANT project, the root of any ANT buildfile. --> <!-- This template matches the root and create a ANT project, the root of any ANT buildfile. -->
<xsl:template match="h:html"> <xsl:template match="h:html">
<project name="moveRessourceFiles" basedir="." default="moveRessourceFiles"> <project name="moveRessourceFiles" basedir="." default="moveRessourceFiles">
<property file="global.properties"/> <property file="global.properties"/>
<property name="filename" location="{$filename}"/> <property name="filename2" location="{$filename}"/>
<target name="moveRessourceFiles"> <target name="moveRessourceFiles">
<xsl:apply-templates select="./*"/> <xsl:apply-templates select="./*"/>
</target> </target>
...@@ -32,16 +32,16 @@ ...@@ -32,16 +32,16 @@
<!-- Targeted markups. --> <!-- Targeted markups. -->
<xsl:template match="h:img"> <xsl:template match="h:img">
<copy tofile="${{filename}}/decompressedOpale/res/{./@src}" file="${{filename}}/decompressedHdoc/{./@src}"/> <copy tofile="${{filename2}}/decompressedOpale/res/{./@src}" file="${{filename2}}/decompressedHdoc/{./@src}"/>
</xsl:template> </xsl:template>
<xsl:template match="h:audio"> <xsl:template match="h:audio">
<copy tofile="${{filename}}/decompressedOpale/res/{./@src}" file="${{filename}}/decompressedHdoc/{./@src}"/> <copy tofile="${{filename2}}/decompressedOpale/res/{./@src}" file="${{filename2}}/decompressedHdoc/{./@src}"/>
</xsl:template> </xsl:template>
<xsl:template match="h:video"> <xsl:template match="h:video">
<copy tofile="${{filename}}/decompressedOpale/res/{./@src}" file="${{filename}}/decompressedHdoc/{./@src}"/> <copy tofile="${{filename2}}/decompressedOpale/res/{./@src}" file="${{filename2}}/decompressedHdoc/{./@src}"/>
</xsl:template> </xsl:template>
<xsl:template match="h:object"> <xsl:template match="h:object">
<copy tofile="${{filename}}/decompressedOpale/res/{./@data}" file="${{filename}}/decompressedHdoc/{./@data}"/> <copy tofile="${{filename2}}/decompressedOpale/res/{./@data}" file="${{filename2}}/decompressedHdoc/{./@data}"/>
</xsl:template> </xsl:template>
<!-- These markups are matched in order to minimize "apply-templates" side-effects (i.e. their contents are not relevant for this transformation). --> <!-- These markups are matched in order to minimize "apply-templates" side-effects (i.e. their contents are not relevant for this transformation). -->
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<property name="lib" location="${{basedir}}/lib"/> <property name="lib" location="${{basedir}}/lib"/>
<property name="log" location="${{basedir}}/log"/> <property name="log" location="${{basedir}}/log"/>
<property name="schema" location="${{basedir}}/schema"/> <property name="schema" location="${{basedir}}/schema"/>
<property name="filename" location="{$filename}"/> <property name="filename" location="${$filename}"/>
<taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask"> <taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask">
<classpath> <classpath>
<pathelement location="../${lib}/jing.jar"/> <pathelement location="../${lib}/jing.jar"/>
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
style="${{xsl}}/moveRessourceFiles.xsl" style="${{xsl}}/moveRessourceFiles.xsl"
processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison" processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison"
> >
<param name="filename" expression="${{tmp}}/${{filename}}"/> <param name="filename" expression="${{tmp}}\${{filename}}"/>
</xslt> </xslt>
<chmod file="${{tmp}}/${{filename}}/moveRessourceFiles.xml" perm="777"/> <chmod file="${{tmp}}/${{filename}}/moveRessourceFiles.xml" perm="777"/>
<xslt <xslt
......
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