Commit 794dc845 authored by Ivan D'halluin's avatar Ivan D'halluin
Browse files

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

parents 9c772450 f00cf78f
application/x-hdoc+zip
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project name="hdoc_to_opale" basedir="." default="convert">
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask"/>
<property name="in" location="${basedir}/input"/>
<property name="out" location="${basedir}/output"/>
<property name="tmp" location="${basedir}/tmp"/>
......@@ -11,17 +15,17 @@
<property file="global.properties"/>
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask">
<classpath>
<pathelement location="lib/jing.jar"/>
</classpath>
</taskdef>
<target name="convert">
<!-- This is the main target : it is called whether by the project (as the default target) or by the user/converter
website, if specified in the command line. Basically, this target consists in several targets/ant buildfiles calls. -->
<antcall target="CleanDirectory"/>
<delete dir="${tmp}" failonerror="false"/>
<sleep seconds="2"/>
<mkdir dir="${tmp}"/>
<delete dir="${out}" failonerror="false"/>
<sleep seconds="2"/>
<mkdir dir="${out}"/>
<delete dir="${log}" failonerror="false"/>
<sleep seconds="2"/>
<mkdir dir="${log}"/>
<antcall target="UnzipHdocFile"/>
<antcall target="ValidateInput" />
......
......@@ -6,11 +6,13 @@
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:param name="filename"/>
<!-- This template matches the root and create a ANT project, the root of any ANT buildfile. -->
<xsl:template match="h:html">
<project name="moveRessourceFiles" basedir="." default="moveRessourceFiles">
<property file="global.properties"/>
<property name="filename" location="${filename}"/>
<property name="filename" location="{$filename}"/>
<target name="moveRessourceFiles">
<xsl:apply-templates select="./*"/>
</target>
......
......@@ -37,7 +37,9 @@
out="${{tmp}}/${{filename}}/decompressedOpale/main.xml"
style="${{xsl}}/transformation2.xsl"
processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison"
/>
>
<param name="filename" expression="${{tmp}}/${{filename}}"/>
</xslt>
<chmod file="${{tmp}}/${{filename}}/decompressedOpale/main.xml" perm="777"/>
<!-- Finding references and converting them -->
......
......@@ -11,6 +11,8 @@
>
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:param name="filename"/>
<!-- This template matches the root. One hdoc file = one Opale's "Module" -->
<xsl:template match="h:html">
<sc:item xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
......@@ -109,10 +111,16 @@
<!-- Body related templates. -->
<xsl:template match="h:body">
<xsl:if test="./h:section[@data-hdoc-type = 'introduction']/h:div/*">
<xsl:if test="./h:section/h:div[@data-hdoc-type = 'introduction']/*">
<sp:intro>
<op:res>
<xsl:apply-templates select="./h:section[@data-hdoc-type = 'introduction']/h:div/*" />
<sp:txt>
<op:txt>
<sc:para>
<xsl:apply-templates select="./h:section/h:div[@data-hdoc-type = 'introduction']/*" />
</sc:para>
</op:txt>
</sp:txt>
</op:res>
</sp:intro>
</xsl:if>
......@@ -139,18 +147,29 @@
<xsl:template match="h:div[@data-hdoc-type='introduction']">
<sp:intro>
<op:res>
<xsl:apply-templates select="./h:p" />
<sp:txt>
<op:txt>
<sc:para>
<xsl:apply-templates select="./text()" /></sc:para>
</op:txt>
</sp:txt>
</op:res>
</sp:intro>
</xsl:template>
<!-- Conclusion <section> -->
<xsl:template match="h:div[@data-hdoc-type='conclusion']">
<xsl:template match="h:footer/h:div[@data-hdoc-type='conclusion']">
<sp:conclu>
<op:res>
<sp:txt>
<op:txt>
<sc:para>
<!-- Going straight to the content -->
<!-- For the conclusion, we ignore <header> and <footer> -->
<xsl:apply-templates select="./h:p" />
<xsl:apply-templates select="./text()" />
</sc:para>
</op:txt>
</sp:txt>
</op:res>
</sp:conclu>
</xsl:template>
......@@ -256,7 +275,7 @@
<xsl:apply-templates select="./h:section[not(@data-hdoc-type = 'introduction' or @data-hdoc-type = 'conclusion')]"/>
<!-- Conclusion for a division -->
<xsl:apply-templates select="./h:header/h:div[@data-hdoc-type='conclusion']" />
<xsl:apply-templates select="./h:footer/h:div[@data-hdoc-type='conclusion']" />
</op:ueDiv>
</sp:div>
......@@ -577,15 +596,13 @@
</xsl:template>
<!-- Listing Informatique-->
<xsl:param name="text-encoding" as="xs:string" select="'iso-8859-1'"/>
<xsl:param name="text-uri" as="xs:string" select="res/listing/listing1.txt"/>
<xsl:template match="h:object[@type='application/pdf']" priority="1">
<sp:listing>
<xsl:copy-of select="document(fn:concat('../tmp/decompressedHdoc/',@data))/sc:item/op:code"/>
<xsl:copy-of select="document(fn:concat($filename,'/decompressedHdoc/',@data))/sc:item/op:code"/>
</sp:listing>
</xsl:template>
<xsl:template match="h:section[h:div[@data-hdoc-type = 'question']]">
<!-- Selecting the first question -->
<sp:trainUcMcqMur>
......
Pour réaliser votre conversion vous devez ajouter un fichier .hdoc dans le dossier input. Veillez à n'en placer qu'un seul dedans. Ensuite il suffit d'appeler le script (.bat ou .sh).
\ No newline at end of file
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