Commit 2a1bbfc7 authored by lhommeni's avatar lhommeni
Browse files

Separation de wikipedia_to_hdoc (faisant wikipedia_to_opale) en...

Separation de wikipedia_to_hdoc (faisant wikipedia_to_opale) en wikipedia_to_hdoc et wikipedia_to_opale
parent 704bcd3c
......@@ -5,12 +5,14 @@
>
<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">
......@@ -577,15 +579,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>
......
......@@ -4,7 +4,7 @@
<!-- input path -->
<property name="in" value="${basedir}/input"/>
<!-- inputFile is the only required parameter to run the script -->
<property name="inputFile" value="${inputFile}/source.xml"/>
<property name="inputFile" value="${in}/source.xml"/>
<basename property="filename" file="${inputFile}" suffix=".xml"/>
......@@ -20,11 +20,11 @@
<!-- Main target -->
<target name="main">
<antcall target="clean"/>
<antcall target="prepare"/>
<antcall target="prepareHdocStructure"/>
<antcall target="transformWikiToHdoc"/>
<antcall target="zip"/>
<antcall target="clean"/>
</target>
<target name="prepare">
......@@ -33,7 +33,7 @@
<mkdir dir="${hdocResultPath}"/>
<!-- Making tmp xml wikipedia file without some elements which are not useful -->
<xslt classpath="lib/saxon9he.jar" in="input/${inputFile}" out="${tmpFolderPath}/${filename}_prepared.xml" style="${xsltFolderPath}/prepare_wiki_to_hdoc.xsl">
<xslt classpath="lib/saxon9he.jar" in="${inputFile}" out="${tmpFolderPath}/${filename}_prepared.xml" style="${xsltFolderPath}/prepare_wiki_to_hdoc.xsl">
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
</xslt>
......
<?xml version="1.0" encoding="UTF-8"?>
<project name="wikiToHdoc" default="main" basedir=".">
<project name="wikiToHdoc" default="main" basedir="..">
<!-- wikipediaUrl and destination are the only required parameters -->
<property name="wikipediaUrl" value=""/>
......@@ -14,15 +14,15 @@
<property name="xsltFolderPath" value="${basedir}/xslt"/>
<property name="hdocResultPath" value="${resultFolderPath}/${filename}"/>
<!--<property name="inputFile" value="${hdocResultPath}/${filename}.xml"/>-->
<property name="inputFile" value="${in}/${filename}.xml"/>
<property name="inputFile" value="${filename}.xml"/>
<!-- Main target -->
<target name="main">
<antcall target="clean"/>
<antcall target="prepare"/>
<antcall target="prepareHdocStructure"/>
<antcall target="transformWikiToHdoc"/>
<antcall target="zip"/>
<antcall target="clean"/>
</target>
<target name="prepare">
......@@ -38,10 +38,10 @@
<loadresource encoding="UTF-8" property="myURL">
<url url="${wikipediaUrl}"/>
</loadresource>
<echo file="${inputFile}" encoding="UTF-8">${myURL}</echo>
<echo file="${in}/${inputFile}" encoding="UTF-8">${myURL}</echo>
<!-- Making tmp xml wikipedia file without some elements which are not useful -->
<xslt classpath="lib/saxon9he.jar" in="${inputFile}" out="${tmpFolderPath}/${filename}_prepared.xml" style="${xsltFolderPath}/prepare_wiki_to_hdoc.xsl">
<xslt classpath="lib/saxon9he.jar" in="${in}/${inputFile}" out="${tmpFolderPath}/${filename}_prepared.xml" style="${xsltFolderPath}/prepare_wiki_to_hdoc.xsl">
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
</xslt>
......
<?xml version="1.0" encoding="UTF-8"?>
<project name="wikiToOpale" default="main" basedir="..">
<!-- inputFile is the only required parameter to run the script -->
<property name="inputFile" value="source.xml"/>
<!-- Name of the output file -->
<basename property="filename" file="${inputFile}" suffix=".xml"/>
<!-- Folder paths -->
<!-- tmp paths (removed at the end of the process) -->
<property name="tmpFolderPath" value="${basedir}/tmp"/>
<property name="tmpHdocResultFolderPath" value="${tmpFolderPath}/hdoc"/>
<!-- ant and xslt paths -->
<property name="resultFolderPath" value="${basedir}/result"/>
<property name="antFolderPath" value="${basedir}/ant"/>
<property name="xsltFolderPath" value="${basedir}/xslt"/>
<!-- result path -->
<property name="hdocResultPath" value="${resultFolderPath}/${filename}"/>
<target name="main">
<!-- First: wiki to Hdoc -->
<ant antfile="${antFolderPath}/wiki_to_hdoc.ant"/>
<!-- Then hdoc to opale (important to set the new basedir in order to make it work) -->
<ant antfile="${basedir}/hdoc_to_opale/myantce.ant" dir="${basedir}/hdoc_to_opale">
<property name="in" value="${hdocResultPath}"/>
<property name="out" value="${hdocResultPath}"/>
</ant>
</target>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project name="wikiToOpale" default="main" basedir="..">
<!-- wikipediaUrl and destination are the only required parameters -->
<property name="wikipediaUrl" value=""/>
<property name="filename" value=""/>
<!-- Folder paths -->
<!-- tmp paths (removed at the end of the process) -->
<property name="tmpFolderPath" value="${basedir}/tmp"/>
<property name="tmpHdocResultFolderPath" value="${tmpFolderPath}/hdoc"/>
<!-- ant and xslt paths -->
<property name="resultFolderPath" value="${basedir}/result"/>
<property name="antFolderPath" value="${basedir}/ant"/>
<property name="xsltFolderPath" value="${basedir}/xslt"/>
<!-- result path -->
<property name="hdocResultPath" value="${resultFolderPath}/${filename}"/>
<target name="main">
<!-- First: wiki to Hdoc -->
<ant antfile="${antFolderPath}/wiki_to_hdoc_fetcher.ant"/>
<!-- Then hdoc to opale (important to set the new basedir in order to make it work) -->
<ant antfile="${basedir}/hdoc_to_opale/myantce.ant" dir="${basedir}/hdoc_to_opale">
<property name="in" value="${hdocResultPath}"/>
<property name="out" value="${hdocResultPath}"/>
</ant>
</target>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
ns="http://www.utc.fr/ics/hdoc/xhtml">
<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>
<start>
<element name="html">
<ref name="Head"/>
<ref name="Body"/>
</element>
</start>
<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>
</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="ListingInformatique"/>
<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"></ref>
</element>
</oneOrMore>
</element>
</oneOrMore>
</element>
</define>
<!-- Image -->
<define name="Image">
<element name="img">
<attribute name="src">
<data type="anyURI"/>
</attribute>
<attribute name="alt">
<text/>
</attribute>
</element>
</define>
<!-- Audio -->
<define name="Audio">
<element name="audio">
<attribute name="src">
<data type="anyURI"/>
</attribute>
</element>
</define>
<!-- Vidéo -->
<define name="Video">
<element name="video">
<attribute name="src">
<data type="anyURI"/>
</attribute>
<ref name="VideoType"/>
</element>
</define>
<!-- Other external resources -->
<define name="Object">
<element name="object">
<ref name="ObjectType"/>
<attribute name="data">
<data type="anyURI"/>
</attribute>
<empty/>
</element>
</define>
<!-- Microdata and other Types -->
<include href="type.rng"/>
</grammar>
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
ns="http://www.utc.fr/ics/hdoc/xhtml">
<a:documentation>Last update : 2014-12-04</a:documentation>
<a:documentation>Changes since last update :
In order to manage quiz :
- Adding multiple-choice-question and fill-in-the-blank to section
- Adding question, choice-correct, choice-uncorrect and explanation to div
- Adding blank to span
- Externalizing ObjectType and VideoType from main schema
</a:documentation>
<!-- Type Microdata -->
<define name="SectionType">
<optional>
<attribute name="data-hdoc-type">
<choice>
<value>introduction</value>
<value>conclusion</value>
<value>unit-of-content</value>
<value>multiple-choice-question</value>
<value>fill-in-the-blank</value>
</choice>
</attribute>
</optional>
</define>
<define name="DivType">
<optional>
<attribute name="data-hdoc-type">
<choice>
<!-- block management -->
<value>emphasis</value>
<value>complement</value>
<value>definition</value>
<value>example</value>
<value>remark</value>
<value>warning</value>
<value>advice</value>
<!-- quiz management -->
<value>question</value>
<value>choice-correct</value>
<value>choice-incorrect</value>
<value>explanation</value>
</choice>
</attribute>
</optional>
</define>
<define name="SpanType">
<optional>
<attribute name="data-hdoc-type">
<choice>
<value>syntax</value>
<value>latex</value>
<!-- quiz management -->
<value>blank</value>
</choice>