Commit 0576d85e authored by Hachem Rihab's avatar Hachem Rihab

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

parents 78f24ebb 42674f56
<?xml version="1.0" encoding="UTF-8"?>
<project name="project" default="clean" basedir=".">
<property file="build.properties"/>
<property name="InputPath" value="test.zip" />
<property name="OutputPath" value="result.zip" />
<taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask">
<classpath>
<pathelement location="${libdir}/jing.jar"/>
</classpath>
</taskdef>
<target name="init">
<mkdir dir="${outdir}"/>
<chmod perm="777" dir="${outdir}"></chmod>
<mkdir dir="${srcdir}"/>
<chmod perm="777" dir="${srcdir}"></chmod>
</target>
<target name="unzipSource" depends="init">
<echo>Fichier en entree : ${InputPath}</echo>
<echo>Fichier de sortie : ${OutputPath}</echo>
<unzip src="${InputPath}" dest="${srcdir}"></unzip>
</target>
<target name="buildOutput" depends="unzipSource">
<xslt classpath="${libdir}/saxon9he.jar" style="${xsldir}/termToRef.xsl" basedir="${srcdir}" destdir="${outdir}" followsymlinks="false" extension=".ref">
<include name="**/*.term"/>
</xslt>
<!--<jing rngfile="${rngdir}/op_glos.rng">
<fileset dir="${outdir}">
<include name="**/*.ref"/>
</fileset>
</jing>-->
</target>
<target name="exportOutput" depends="buildOutput">
<copy file="opale.wspmeta" tofile="${outdir}/.wspmeta"></copy>
<zip basedir="${outdir}" destfile="${OutputPath}" encoding="UTF-8"></zip>
</target>
<target name="clean" depends="exportOutput">
<delete dir="${srcdir}" />
<delete dir="${outdir}" />
</target>
</project>
# HDOC CONVERTER 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>Liens utiles :<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>Je crois qu&#x27;on doit livrer deux &quot;applications&quot;:<br>-de etherpad vers hdoc<br>-de hdoc vers etherpad Moi j&#x27;avais pas compris qu&#x27;on faisait la conversion dans ce sens, surtout que ce sera pas trivial vu qu&#x27;on enrichit le format d&#x27;Etherpad de base quand on fait etherpad-&gt;hdoc<br>-&gt;je suis pas sur enfait, c&#x27;est ce que je pensais avoir compris mais c&#x27;est possible que j&#x27;ai pas tout &#233;cout&#233; comme il faut...<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>
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="jsonToXml" default="default" basedir=".">
<description>Builds, tests, and runs the project jsonToXml.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar: JAR building
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="jsonToXml-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>
This source diff could not be displayed because it is too large. You can view the blob instead.
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
build.xml.data.CRC32=dc07aabd
build.xml.script.CRC32=85f18da9
build.xml.stylesheet.CRC32=8064a381@1.75.2.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=dc07aabd
nbproject/build-impl.xml.script.CRC32=de18053f
nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.title=jsonToXml
application.vendor=JeanV
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# Files in build.classes.dir which should be excluded from distribution jar
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/jsonToXml.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
file.reference.json-20151123.jar=lib/json-20151123.jar
includes=**
jar.compress=false
javac.classpath=\
${file.reference.json-20151123.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.processorpath=\
${javac.classpath}
javac.source=1.8
javac.target=1.8
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
main.class=jsontoxml.JsonToXml
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project.
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>jsonToXml</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>
package jsontoxml;
import java.io.File;
import java.io.FileNotFoundException;
import org.json.JSONObject;
import org.json.XML;
import java.util.Scanner;
import java.io.PrintWriter;
import java.util.logging.Level;
import java.util.logging.Logger;
public class JsonToXml {
public static void main(String[] args) {
// args[0] should hold a JSON file path.
if (args.length == 0) {
return;
}
try {
String jsonText = new Scanner(new File(args[0])).useDelimiter("\\Z").next();
JSONObject json = new JSONObject(jsonText);
String xml = XML.toString(json);
PrintWriter out = new PrintWriter("json_xml_out.xml");
out.println(xml);
out.close();
} catch (FileNotFoundException ex) {
Logger.getLogger(JsonToXml.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
......@@ -2,6 +2,18 @@
<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}"/>
......@@ -18,7 +30,8 @@
<!-- Apply Xslt -->
<target name="apply-xslt">
<xslt classpath="lib\saxon9he.jar" in="${xsl}/html2xhtml.xsl" out="${tmp}/tmpPad.xhtml" style="${xsl}/html2xhtml.xsl" />
<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>
......@@ -26,29 +39,25 @@
<target name="construct_hdoc">
<mkdir dir="${tmp}/tozip/" />
<mkdir dir="${tmp}/tozip/META-INF" />
<mkdir dir="${tmp}/META-INF" />
<!-- container -->
<touch file="${tmp}/tozip/META-INF/container.xml" />
<echoxml file="${tmp}/tozip/META-INF/container.xml">
<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">
<taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask">
<classpath>
<pathelement location="lib/jing.jar"/>
</classpath>
</taskdef>
<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>
......@@ -59,8 +68,13 @@
<zip basedir="${tmp}/tozip/" destfile="${out}/output.hdoc" />
</target>
<target name="main" depends="start,apply-xslt,construct_hdoc,jing-hdoc,zip">
<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
<?xml version="1.0" encoding="UTF-8"?>
<container version="1.0">
<rootfiles>
<rootfile full-path="./content.xml" media-type="text/xml" />
</rootfiles>
</container>
<?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"
version="2.0"
xmlns="urn:utc.fr:ics:hdoc:container">
<xsl:output method="xml" indent="yes"/>
<!-- Identity transformation -->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</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:template match="container" priority="2">
<xsl:processing-instruction name="oxygen">RNGSchema="http://scenari.utc.fr/hdoc/schemas/container/hdoc1-container.rng" type="xml"</xsl:processing-instruction>
<xsl:element name="{local-name()}">
<xsl:apply-templates select="node()|@*"/>
</xsl:element>
</xsl:template>
<!-- Suppress processing-instructions -->
<xsl:template match="processing-instruction()" priority="1"/>
</xsl:stylesheet>
\ No newline at end of file
......@@ -8,11 +8,11 @@
<xsl:strip-space elements="*"/>
<xsl:param name="text-encoding" as="xs:string" select="'utf-8'"/>
<xsl:param name="text-uri" as="xs:string" select="'../input/pad.html'"/>
<xsl:param name="text-uri" as="xs:string" select="'../tmp/pad-clean.xml'"/>
<xsl:template name="text2xml">
<xsl:variable name="text" select="unparsed-text($text-uri, $text-encoding)"/>
<xsl:analyze-string select="$text" regex=".*title.(.*).title.\n.*\n.*\n.*\n.*\n.*\n.*.body.(.*br.*)..body.">
<xsl:analyze-string select="$text" flags="s" regex=".*title.(.*?)./title>.*.style.*/style.*body.(.*)./body">
<xsl:matching-substring>
<head>
<title>
......@@ -22,10 +22,11 @@
</head>
<body>
<div>
<xsl:value-of select="replace(normalize-space(regex-group(2)), 'br', 'br/')" disable-output-escaping="yes"/>
<p>
<xsl:value-of select="replace(normalize-space(regex-group(2)), 'br /', 'br /')" disable-output-escaping="yes"/>
</p>
</div>
</body>
</xsl:matching-substring>
</xsl:analyze-string>
......
......@@ -24,7 +24,39 @@
</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>Balise inconnue</xsl:comment>
<xsl:comment>Error</xsl:comment>
</xsl:template>
</xsl:stylesheet>
emplacement_hdoc=./to_zip
rootfile=./content.xml
emplacement_hdoc=./to_zip
rootfile=./content.xml
output_xml=./to_zip/content.xml
\ No newline at end of file
<project name="EtherpadToHdoc" default="convert" basedir=".">
<property file="build.properties"/>
<!-- Builds Hdoc structure -->
<target name="construct_hdoc">
<mkdir dir="${emplacement_hdoc}" />
<mkdir dir="${emplacement_hdoc}/META-INF" />
<mkdir dir="${emplacement_hdoc}/OPS" />
<touch file="${emplacement_hdoc}/META-INF/container.xml" />
<touch file="${emplacement_hdoc}/mimetype" />
<echo message="application/x-hdoc+zip" file="${emplacement_hdoc}/mimetype" />
</target>
<!-- Fills Hdoc container -->
<target name="fill_container" depends="construct_hdoc">
<echoxml file="${emplacement_hdoc}/META-INF/container.xml">
<container version="1.0">
<rootfiles>
<rootfile full-path="${rootfile1}" media-type="text/xml" />
</rootfiles>
</container>
</echoxml>
</target>
<!-- Applies Perl Script to exported HTML file from Etherpad -->
<target name="perl_exec" depends="fill_container">
<exec executable="perl">
<arg value="src/normalization.pl"/>
<arg value="${InputPath}"/>
<!-- output dans intermediaire.xml -->
</exec>
</target>
<!-- Launches XSLT transform to Perl script output -->
<target name="xslt_exec">
<xslt style="src/etherpadTohdoc.xsl" in="tmp/intermediaire.xml" out="${output_xml}" />
</target>
<!-- Zipping Hdoc container -->
<target name="zip">
<zip basedir="${emplacement_hdoc}" destfile="${OutputPath}" />
</target>
<target name="convert" depends="fill_container, perl_exec, xslt_exec, zip"/>
</project>
<project name="EtherpadToHdoc" default="convert" basedir=".">
<property file="build.properties"/>
<!-- Builds Hdoc structure -->
<target name="construct_hdoc">
<mkdir dir="${emplacement_hdoc}" />
<mkdir dir="${emplacement_hdoc}/META-INF" />
<mkdir dir="${emplacement_hdoc}/OPS" />
<touch file="${emplacement_hdoc}/META-INF/container.xml" />
<touch file="${emplacement_hdoc}/mimetype" />
<echo message="application/x-hdoc+zip" file="${emplacement_hdoc}/mimetype" />
</target>
<!-- Fills Hdoc container -->
<target name="fill_container" depends="construct_hdoc">
<echoxml file="${emplacement_hdoc}/META-INF/container.xml">
<container version="1.0">
<rootfiles>
<rootfile full-path="${rootfile1}" media-type="text/xml" />
</rootfiles>
</container>
</echoxml>
</target>
<!-- Applies Perl Script to exported HTML file from Etherpad -->
<target name="perl_exec" depends="fill_container">
<exec executable="perl">
<arg value="src/normalization.pl"/>
<arg value="${InputPath}"/>
<!-- output dans intermediaire.xml -->
</exec>
</target>
<!-- Launches XSLT transform to Perl script output -->
<target name="xslt_exec">
<xslt style="src/etherpadTohdoc.xsl" in="tmp/intermediaire.xml" out="${output_xml}" />
</target>
<!-- Zipping Hdoc container -->
<target name="zip">
<zip basedir="${emplacement_hdoc}" destfile="${OutputPath}" />
</target>
<target name="convert" depends="fill_container, perl_exec, xslt_exec, zip"/>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html>
<head>
<xsl:apply-templates select="//meta" mode="inHead"/>
<title><xsl:value-of select="//title"/></title>
</head>
<body>
<section>
<xsl:apply-templates select="@*|node()[not(self::meta)]" />
</section>
</body>
</html>
</xsl:template>
<xsl:template match="title">
</xsl:template>
<xsl:template match="meta" mode="inHead">
<xsl:for-each select="./*">
<meta name="{local-name(.)}" content="{./text()}"/>
</xsl:for-each>
<meta charset="utf-8"/>
<meta generator="HdocConverter/Etherpad"/>
</xsl:template>
<xsl:template match="meta">
</xsl:template>
<xsl:template match="h1 | h2 | h3 | h4 | h5 | h6">
<xsl:copy>
<xsl:value-of select="."/>
</xsl:copy>
</xsl:template>
<xsl:template match="important">
<div class="emphasis"><xsl:value-of select="."/></div>
</xsl:template>
<xsl:template match="exemple">
<div class="example"><xsl:value-of select="."/></div>
</xsl:template>
<xsl:template match="definition">
<div class="definition"><xsl:value-of select="."/></div>
</xsl:template>
<xsl:template match="br">
<xsl:copy>
<xsl:value-of select="."/>
</xsl:copy>
</xsl:template>
<xsl:template match="br|b|i|ul|ol|li|u|del">
<xsl:copy>
<xsl:value-of select="."/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html>
<head>
<xsl:apply-templates select="//meta" mode="inHead"/>
<title><xsl:value-of select="//title"/></title>
</head>
<body>
<section>
<xsl:apply-templates select="@*|node()[not(self::meta)]" />
</section>
</body>
</html>
</xsl:template>
<xsl:template match="title">
</xsl:template>
<xsl:template match="meta" mode="inHead">
<xsl:for-each select="./*">
<meta name="{local-name(.)}" content="{./text()}"/>
</xsl:for-each>
<meta charset="utf-8"/>
<meta generator="HdocConverter/Etherpad"/>