diff --git a/.gitignore b/.gitignore index 177800d9aa5bb74dab8d3ebb427a17ed7a574446..7d8e14ba4aab822e7ff4ec5adbb98a757f887b21 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,12 @@ wikipedia_to_hdoc/result/* wikipedia_to_hdoc/tmp/* wikipedia_to_hdoc/hdoc_to_opale/tmp/* -wikipedia_to_hdoc/output/* \ No newline at end of file +wikipedia_to_hdoc/output/* +mindmapping_to_opale/result/* +mindmapping_to_opale/tmp/* +mindmapping_to_lexique/result/* +mindmapping_to_lexique/tmp/* +mindmapping_to_optim/result/* +mindmapping_to_optim/tmp/* +mindmapping_to_hdoc/result/* +mindmapping_to_hdoc/tmp/* \ No newline at end of file diff --git a/mindmapping_to_hdoc/samples/MindMapping.mm b/mindmapping_to_hdoc/samples/MindMapping.mm new file mode 100644 index 0000000000000000000000000000000000000000..9b3f311f997ae9f27cfdc19f81b2f169d6f48c85 --- /dev/null +++ b/mindmapping_to_hdoc/samples/MindMapping.mm @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/mindmapping_to_hdoc/samples/the_witcher.mm b/mindmapping_to_hdoc/samples/the_witcher.mm index 322ac86e31d0a5d33334fa97540a4465f42fe00a..c4f45e70ec6f4b7c2135e509035c0bfa4586e1b7 100644 --- a/mindmapping_to_hdoc/samples/the_witcher.mm +++ b/mindmapping_to_hdoc/samples/the_witcher.mm @@ -1,6 +1,8 @@ + + @@ -36,8 +38,6 @@ - - diff --git a/mindmapping_to_hdoc/xslt/sect.xsl b/mindmapping_to_hdoc/xslt/sect.xsl index 8d23c7fa1ecbcab64fe6d975146dfe05d454c1b6..98a69fa6ba1fe121f3516848b98825e20989b576 100755 --- a/mindmapping_to_hdoc/xslt/sect.xsl +++ b/mindmapping_to_hdoc/xslt/sect.xsl @@ -5,8 +5,10 @@ + + RNGSchema="http://scenari.utc.fr/hdoc/schemas/xhtml/hdoc1-xhtml.rng" type="xml" @@ -22,7 +24,7 @@ - + <xsl:value-of select="@TEXT"/> @@ -41,7 +43,31 @@ <xsl:value-of select="richcontent"/> </h1> </header> + <!--Introduction--> + <xsl:if test="child::*[contains(@TEXT, '#intro')]"> + <xsl:element name="section"> + <header><h1>Introduction</h1> + <xsl:element name="div"> + <xsl:attribute name="data-hdoc-type">introduction</xsl:attribute> + <xsl:value-of select="utc:string-remove-order(utc:string-remove-all(child::*[contains(@TEXT, '#intro')][1]/@TEXT, '#intro '))"/> + </xsl:element> + </header> + </xsl:element> + </xsl:if> + <!-- Process children --> <xsl:apply-templates select="node"/> + <!--Conclusion--> + <xsl:if test="child::*[contains(@TEXT, '#conclu')]"> + <xsl:element name="section"> + <header><h1>Concluson</h1></header> + <footer> + <xsl:element name="div"> + <xsl:attribute name="data-hdoc-type">conclusion</xsl:attribute> + <xsl:value-of select="utc:string-remove-order(utc:string-remove-all(child::*[contains(@TEXT, '#conclu')][1]/@TEXT, '#conclu '))"/> + </xsl:element> + </footer> + </xsl:element> + </xsl:if> </xsl:element> </xsl:template> @@ -49,13 +75,13 @@ <xsl:template match="node[not(node)]|node[child::*[contains(@TEXT, '#p')]]|node[child::*[contains(@TEXT, '#a')]]" priority="1"> - <xd:doc xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"> - <xd:desc> - <xd:p/> - </xd:desc> - </xd:doc> <xsl:element name="section"> <xsl:attribute name="data-hdoc-type">unit-of-content</xsl:attribute> + <xsl:if test="child::attribute[@NAME='anchor']"> + <xsl:attribute name="id"> + <xsl:value-of select="child::attribute[@NAME='anchor'][1]/@VALUE"></xsl:value-of> + </xsl:attribute> + </xsl:if> <header> <h1> <xsl:value-of select="@TEXT"/> @@ -66,28 +92,32 @@ </xsl:element> </xsl:template> + <!-- Paragraph --> <xsl:template match="node[contains(@TEXT, '#p')]" priority="2"> <xsl:element name="p"> - <xsl:value-of select="utc:string-remove-all(@TEXT, '#p ')"/> + <xsl:value-of select="utc:string-remove-order(utc:string-remove-all(@TEXT, '#p '))"/> </xsl:element> </xsl:template> + <!-- Link : need to use anchor attribute ? --> <xsl:template match="node[contains(@TEXT, '#a')]" priority="2"> <xsl:element name="a"> <xsl:attribute name="href"> <xsl:text>#</xsl:text> - <xsl:value-of select="utc:string-remove-all(@TEXT, '#a ')"/> + <xsl:value-of select="utc:string-remove-order(utc:string-remove-all(@TEXT, '#a '))"/> </xsl:attribute> - <xsl:value-of select="utc:string-remove-all(@TEXT, '#a ')"/> + <xsl:value-of select="utc:string-remove-order(utc:string-remove-all(@TEXT, '#a '))"/> </xsl:element> </xsl:template> + <!-- Default behavior for intro and conclu nodes : do nothing --> + <xsl:template match="node[contains(@TEXT, '#intro')] | node[contains(@TEXT, '#conclu')]" priority="3"/> + <xsl:template match="richcontent"> <xsl:value-of select="html/body/p"/> </xsl:template> <!-- Utility functions --> - <xsl:function name="utc:string-remove-all" as="xs:string"> <xsl:param name="text" as="xs:string"/> <xsl:param name="replace" as="xs:string"/> @@ -97,7 +127,7 @@ <xsl:with-param name="replace" select="$replace"/> </xsl:call-template> </xsl:variable> - <xsl:value-of select="$ret"></xsl:value-of> + <xsl:value-of select="$ret"/> </xsl:function> <xsl:template name="string-remove-all"> @@ -116,4 +146,11 @@ </xsl:otherwise> </xsl:choose> </xsl:template> + + <xsl:function name="utc:string-remove-order" as="xs:string"> + <xsl:param name="text" as="xs:string?" /> + <xsl:variable name="text2" select="string($text)"/> + <xsl:value-of select="replace($text2,'#[1-9][0-9]* ','')"></xsl:value-of> + </xsl:function> + </xsl:stylesheet> diff --git a/mindmapping_to_opale/mindmapping_to_opale.ant b/mindmapping_to_opale/mindmapping_to_opale.ant index 66256066f8b7b81b33ee1c9942c752ca0a40ad4e..226ee84e5479860a0e6ef6b9faed7e62a0a6215d 100755 --- a/mindmapping_to_opale/mindmapping_to_opale.ant +++ b/mindmapping_to_opale/mindmapping_to_opale.ant @@ -81,7 +81,7 @@ <target name="opale_conversion.windows"> <echo>This is a Windows machine.</echo> - <copy file="${resultFile}/hdoc/${hdocName}.hdoc" todir="${basedir}/../hdoc_to_opale/input/${hdocName}.hdoc"/> + <copy file="${resultFile}/hdoc/${hdocName}.hdoc" todir="${basedir}/../hdoc_to_opale/input"/> <exec dir="." executable="cmd"> <arg value="${basedir}/../hdoc_to_opale/run.bat"/> </exec> @@ -90,7 +90,7 @@ <target name="opale_conversion.unix"> <echo>This is an Unix machine.</echo> - <copy file="${resultFile}/hdoc/${hdocName}.hdoc" todir="${basedir}/../hdoc_to_opale/input/${hdocName}.hdoc"/> + <copy file="${resultFile}/hdoc/${hdocName}.hdoc" todir="${basedir}/../hdoc_to_opale/input"/> <exec dir="." executable="/bin/sh"> <arg value="${basedir}/../hdoc_to_opale/run.sh"/> </exec>