Commit c08edc5b authored by Decorde Jeffrey's avatar Decorde Jeffrey

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

parents da86dac8 355e15ff
# Converter hdoc_to_lexique
In order to use this converter, follow those steps :
1. Copy your hdoc file (.scar or .zip) into the input directory.
2. Execute the run that correspond to your OS.
3. You will find the result into the output directory.
\ No newline at end of file
libdir=${basedir}/lib
rngdir=${basedir}/rng
xsldir=${basedir}/xsl
srcdir=${basedir}/in
outdir=${basedir}/out
\ No newline at end of file
libdir=${basedir}/lib
rngdir=${basedir}/rng
xsldir=${basedir}/xsl
srcdir=${basedir}/in
outdir=${basedir}/out
InputPath=${basedir}/input
OutputPath=${basedir}/output
<?xml version="1.0" encoding="UTF-8"?>
<project name="project" default="clean" basedir=".">
<property file="build.properties"/>
<property name="InputPath" value="" />
<property name="OutputPath" value="" />
<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>
<?xml version="1.0" encoding="UTF-8"?>
<project name="project" default="clean" basedir=".">
<property file="build.properties"/>
<!-- <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">
<fileset dir="${InputPath}" id="inputsId">
<include name="*.zip"/>
<include name="*.scar"/>
</fileset>
<property name="nameInputsId" refid="inputsId"/>
<echo>Fichier en entree : ${nameInputsId}</echo>
<unzip src="${InputPath}/${nameInputsId}" dest="${srcdir}/${nameInputsId}"></unzip>
</target>
<target name="buildOutput" depends="unzipSource">
<xslt classpath="${libdir}/saxon9he.jar" style="${xsldir}/hdoc_to_lexique.xsl" basedir="${srcdir}" destdir="${outdir}" followsymlinks="false" extension=".term">
<include name="**/*.xml"/>
</xslt>
<!--<jing rngfile="${rngdir}/op_glos.rng">
<fileset dir="${outdir}">
<include name="**/*.ref"/>
</fileset>
</jing>-->
</target>
<target name="exportOutput" depends="buildOutput">
<copy file="lexique.wspmeta" tofile="${outdir}/.wspmeta"></copy>
<copydir src="${outdir}/${nameInputsId}" dest="${OutputPath}/lexique-${nameInputsId}"></copydir>
<!--<zip basedir="${outdir}" destfile="${OutputPath}/opale-${nameInputsId}" encoding="UTF-8"></zip>-->
</target>
<target name="clean" depends="exportOutput">
<delete dir="${srcdir}" />
<delete dir="${outdir}" />
</target>
</project>
@echo off
set lib=lib
set ant=hdoc_to_lexique.ant
set antparam=-Dprogram.param=%1
set scJarList=%lib%\*
java.exe -classpath "%scJarList%" -Xmx150m org.apache.tools.ant.Main -buildfile %ant% %antparam%
pause
REM start /MIN java.exe -classpath "%scJarList%" -Xmx150m org.apache.tools.ant.Main -buildfile %ant% %antparam%
#!/bin/sh
lib="lib"
ant="hdoc_to_lexique.ant"
antparam="-Dprogram.param=$1"
#Recherche de java et controle que se soit une version SUN
vJavaCmd="java"
xCheckJava () {
vInputVarName=\$"$1"
vInputVarVal=`eval "expr \"$vInputVarName\" "`
if [ -z "$vInputVarVal" ];then
eval "$1=false"
return
fi
vSunJavaFound=`$vInputVarVal -version 2>&1 | grep -Eo -m 1 "(HotSpot)|(OpenJDK)"`
if [ "$vSunJavaFound" != "HotSpot" ] && [ "$vSunJavaFound" != "OpenJDK" ] ; then
eval "$1=false"
return
fi
}
xCheckJava vJavaCmd
if [ "$vJavaCmd" = "false" ]; then
vJavaCmd="$JAVA_HOME/bin/java"
xCheckJava vJavaCmd
if [ "$vJavaCmd" = "false" ]; then
echo "ERREUR: JRE de SUN introuvable. Veuillez déclarer la variable d'environnement JAVA_HOME."
exit 1
fi
fi
#Lancer la commande
scJarList="$lib/*"
$vJavaCmd -classpath "$scJarList:" -Xmx150m org.apache.tools.ant.Main -buildfile $ant $antparam
<?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"
xmlns:hodoc="http://www.utc.fr/ics/hdoc/xhtml"
exclude-result-prefixes="xs"
version="2.0">
<xsl:output method="xml" indent="yes" />
<xsl:template match="/">
<sc:item xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
<lx:term xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive" xmlns:lx="scpf.org:lexicon">
<lx:termM>
<sp:name><xsl:value-of select="hodoc:html/hodoc:body/hodoc:h2[@span='titre_def']"></xsl:value-of></sp:name>
</lx:termM>
<sp:def>
<lx:definition>
<sp:desc>
<lx:defTxt>
<xsl:apply-templates select="hodoc:html/hodoc:body/hodoc:p[@span='def_content']"></xsl:apply-templates>
</lx:defTxt>
</sp:desc>
</lx:definition>
</sp:def>
</lx:term>
</sc:item>
</xsl:template>
<xsl:template match="hodoc:p[@span='def_content']" >
<xsl:value-of select="."/>
<!--
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>-->
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0"?>
<?oxygen RNGSchema="http://scenari.utc.fr/hdoc/schemas/container/hdoc1-container.rng" type="xml" ?>
<container version="1.0" xmlns="urn:utc.fr:ics:hdoc:container">
<rootfiles>
<rootfile full-path="content.xml" media-type="text/xml"/>
</rootfiles>
</container>
\ No newline at end of file
# Converter lexique_to_hdoc
In order to use this converter, follow those steps :
1. Copy your Lexique file (.scar or .zip) into the input directory.
2. Execute the run that correspond to your OS. (run.sh for linux, run.bat for ubuntu
3. You will find the result into the output directory.
libdir=${basedir}/lib
rngdir=${basedir}/rng
xsldir=${basedir}/xsl
srcdir=${basedir}/in
outdir=${basedir}/out
InputPath=${basedir}/input
OutputPath=${basedir}/output
libdir=${basedir}/lib
rngdir=${basedir}/rng
xsldir=${basedir}/xsl
srcdir=${basedir}/in
outdir=${basedir}/out
InputPath=${basedir}/input
OutputPath=${basedir}/output
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project name="project" default="clean" basedir=".">
<property file="build.properties"/>
<!-- <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">
<fileset dir="${InputPath}" id="inputsId">
<include name="*.zip"/>
<include name="*.scar"/>
</fileset>
<property name="nameInputsId" refid="inputsId"/>
<echo>Fichier en entree : ${nameInputsId}</echo>
<unzip src="${InputPath}/${nameInputsId}" dest="${srcdir}/${nameInputsId}"></unzip>
</target>
<target name="buildOutput" depends="unzipSource">
<<<<<<< HEAD
<xslt classpath="${libdir}/saxon9he.jar" style="${xsldir}/lexique_to_hdoc.xsl" basedir="${srcdir}" destdir="${outdir}" followsymlinks="false" extension=".xml">
=======
<xslt classpath="${libdir}/saxon9he.jar" style="${xsldir}/lexique_to_hdoc.xsl.xsl" basedir="${srcdir}" destdir="${outdir}" followsymlinks="false" extension=".xml">
>>>>>>> e6164602e4169b2cb7eaf6215434ae0ed8be47a3
<include name="**/*.term"/>
</xslt>
<!--<jing rngfile="${rngdir}/op_glos.rng">
<fileset dir="${outdir}">
<include name="**/*.ref"/>
</fileset>
</jing>-->
</target>
<!--ajout du mimetype au fichier racine
TODO rajouter le container.xml dans le fichier META-INF et qui pointe sur le fichier transformé : un mkdir avec les inputs à transformer en parametre?-->
<target name="exportOutput" depends="buildOutput">
<copy file="mimetype" tofile="${outdir}/mimetype"></copy>
<<<<<<< HEAD
<copydir src="META-INF" dest="${OutputPath}/hdoc-${nameInputsId}"></copydir>
=======
>>>>>>> e6164602e4169b2cb7eaf6215434ae0ed8be47a3
<copydir src="${outdir}/${nameInputsId}" dest="${OutputPath}/hdoc-${nameInputsId}"></copydir>
<!--<zip basedir="${outdir}" destfile="${OutputPath}/opale-${nameInputsId}" encoding="UTF-8"></zip>-->
</target>
<target name="clean" depends="exportOutput">
<delete dir="${srcdir}" />
<delete dir="${outdir}" />
</target>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project name="project" default="clean" basedir=".">
<property file="build.properties"/>
<!-- <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">
<fileset dir="${InputPath}" id="inputsId">
<include name="*.zip"/>
<include name="*.scar"/>
</fileset>
<property name="nameInputsId" refid="inputsId"/>
<echo>Fichier en entree : ${nameInputsId}</echo>
<unzip src="${InputPath}/${nameInputsId}" dest="${srcdir}/${nameInputsId}"></unzip>
</target>
<target name="buildOutput" depends="unzipSource">
<<<<<<< HEAD
<xslt classpath="${libdir}/saxon9he.jar" style="${xsldir}/lexique_to_hdoc.xsl" basedir="${srcdir}" destdir="${outdir}" followsymlinks="false" extension=".xml">
=======
<xslt classpath="${libdir}/saxon9he.jar" style="${xsldir}/lexique_to_hdoc.xsl.xsl" basedir="${srcdir}" destdir="${outdir}" followsymlinks="false" extension=".xml">
>>>>>>> e6164602e4169b2cb7eaf6215434ae0ed8be47a3
<include name="**/*.term"/>
</xslt>
<!--<jing rngfile="${rngdir}/op_glos.rng">
<fileset dir="${outdir}">
<include name="**/*.ref"/>
</fileset>
</jing>-->
</target>
<!--ajout du mimetype au fichier racine
TODO rajouter le container.xml dans le fichier META-INF et qui pointe sur le fichier transformé : un mkdir avec les inputs à transformer en parametre?-->
<target name="exportOutput" depends="buildOutput">
<copy file="mimetype" tofile="${outdir}/mimetype"></copy>
<copydir src="${outdir}/${nameInputsId}" dest="${OutputPath}/hdoc-${nameInputsId}"></copydir>
<!--<zip basedir="${outdir}" destfile="${OutputPath}/opale-${nameInputsId}" encoding="UTF-8"></zip>-->
</target>
<target name="clean" depends="exportOutput">
<delete dir="${srcdir}" />
<delete dir="${outdir}" />
</target>
</project>
application/x-hdoc+zip
application/x-hdoc+zip
<?xml version="1.0" encoding="UTF-8"?>
<sng:grammar xmlns:sng="http://relaxng.org/ns/structure/1.0"
xmlns:hsoc="http://www.utc.fr/ics/hdoc/xhtml"
xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<a:documentation>This schema describes the content file for hdoc format</a:documentation>
<a:documentation>This schema is a restriction of XHTML (it validates XHTML schema, if namespace
is changed to http://www.w3.org/1999/xhtml)</a:documentation>
<a:documentation>Last update : 2014-12-22</a:documentation>
<a:documentation>Changes since last update : Adding biblio management via a href=''
data-hdoc-type='bibtexml' </a:documentation>
<sng:start>
<sng:element name="html" xmlns:hdoc="http://www.utc.fr/ics/hdoc/xhtml">
<ref name="Head"/>
<ref name="Body"/>
</sng:element>
</sng:start>
<sng:define name="Head">
<element name="head">
<!-- mandatory : document title -->
<element name="title">
<text/>
</element>
<!-- mandatory : charset=utf-8 -->
<element name="meta">
<attribute name="charset">
<value>utf-8</value>
</attribute>
</element>
<!-- optional : hdoc source generator -->
<optional>
<element name="meta">
<attribute name="name">
<value>generator</value>
</attribute>
<attribute name="content">
<choice>
<value>SimpleOptim</value>
<value>HdocConverter/SimpleChain</value>
<value>SimpleChain</value>
<value>HdocConverter/Etherpad</value>
<value>HdocConverter/Opale3.4</value>
<value>HdocConverter/Dokiel4.0</value>
<value>HdocConverter/Optim1.2</value>
<value>HdocConverter/Topaze1.3</value>
<value>HdocConverter/wikipedia</value>
<value>HdocConverter/Wordpress</value>
<value>HdocConverter/OpenDocumentText</value>
<value>HdocConverter/LaTeX</value>
<value>HdocConverter/OPML</value>
<value>HdocConverter/DITA</value>
</choice>
</attribute>
</element>
</optional>
<!-- optional : metadata about content ; TODO : date...
-->
<zeroOrMore>
<element name="meta">
<attribute name="name">
<choice>
<value>description</value>
<value>keywords</value>
<value>author</value>
<value>rights</value>
<value>date</value>
</choice>
</attribute>
<attribute name="content">
<text/>
</attribute>
</element>
</zeroOrMore>
</element>
</sng:define>
<define name="Body">
<element name="body">
<ref name="Structure"/>
</element>
</define>
<define name="Structure">
<oneOrMore>
<ref name="Section"/>
</oneOrMore>
</define>
<!-- Recursive and hierachical organization of the document
-->
<define name="Section">
<element name="section">
<!-- optional typing -->
<ref name="SectionType"/>
<!-- mandatory : title (header > h1) -->
<element name="header">
<element name="h1">
<text/>
</element>
<optional>
<element name="div">
<attribute name="data-hdoc-type">
<value>author</value>
</attribute>
<text/>
</element>
</optional>
<optional>
<element name="div">
<attribute name="data-hdoc-type">
<value>date</value>
</attribute>
<data type="date"/>
</element>
</optional>
<optional>
<element name="div">
<attribute name="data-hdoc-type">
<value>rights</value>
</attribute>
<text/>
</element>
</optional>
<optional>
<element name="div">
<attribute name="data-hdoc-type">
<value>introduction</value>
</attribute>
<text/>
</element>
</optional>
</element>
<!-- optional content of the section-->
<optional>
<ref name="Content"/>
</optional>
<!-- optional internal sub-structrure -->
<optional>
<ref name="Structure"/>
</optional>
<!-- optional footer -->
<optional>
<element name="footer">
<optional>
<element name="div">
<attribute name="data-hdoc-type">
<value>conclusion</value>
</attribute>
<text/>
</element>
</optional>
<optional>
<element name="div">
<attribute name="data-hdoc-type">
<value>tags</value>
</attribute>
<oneOrMore>
<element name="span">
<text/>
</element>
</oneOrMore>
</element>
</optional>
<optional>
<element name="div">
<attribute name="data-hdoc-type">
<value>categories</value>
</attribute>
<oneOrMore>
<element name="span">
<text/>
</element>
</oneOrMore>
</element>
</optional>
</element>
</optional>
</element>
</define>
<!-- A content is a sequence of blocs -->
<define name="Content">
<oneOrMore>
<element name="div">
<!-- optional typing attribute -->
<ref name="DivType"/>
<!-- Optional title of a div -->
<optional>
<element name="h6">
<text/>
</element>
</optional>
<ref name="Flow"/>
</element>
</oneOrMore>
</define>
<!-- A flow is a sequence of media : text, table, image, audio, video, others
-->
<define name="Flow">
<oneOrMore>
<choice>
<ref name="Text"/>
<ref name="Table"/>
<ref name="Image"/>
<ref name="Audio"/>
<ref name="Video"/>
<ref name="Object"/>
</choice>
</oneOrMore>
</define>
<!-- Text -->
<define name="Text">
<oneOrMore>
<choice>
<ref name="P"/>
<ref name="L"/>
</choice>
</oneOrMore>
</define>
<!-- Paragraphe -->
<define name="P">
<element name="p">
<ref name="Inline"/>
</element>
</define>
<!-- Inline elements -->
<define name="Inline">
<!-- TODO : cite, code, sub, sup... -->
<zeroOrMore>
<choice>
<text/>
<element name="em">
<ref name="Inline"/>
</element>
<element name="i">
<ref name="Inline"/>
</element>
<element name="q">
<ref name="Inline"/>
</element>
<element name="sub">
<ref name="Inline"/>
</element>
<element name="sup">
<ref name="Inline"/>
</element>
<element name="a">
<attribute name="href">
<data type="anyURI"/>
</attribute>
<optional>
<!-- Biblio reference management -->
<attribute name="data-hdoc-type">
<value>bibtexml</value>
</attribute>
</optional>
<ref name="Inline"/>
</element>
<element name="span">
<ref name="SpanType"/>
<ref name="Inline"/>
</element>
</choice>
</zeroOrMore>
</define>
<!-- List -->
<define name="L">
<choice>
<element name="ul">
<ref name="I"/>
</element>
<element name="ol">
<ref name="I"/>
</element>
</choice>
</define>
<!-- List item -->
<define name="I">
<oneOrMore>
<element name="li">
<ref name="Text"/>
</element>
</oneOrMore>
</define>
<!-- Table -->
<define name="Table">
<element name="table">
<optional>
<element name="caption">
<text/>
</element>
</optional>
<oneOrMore>
<element name="tr">
<oneOrMore>
<element name="td">
<ref name="Text"/>
</element>
</oneOrMore>