Commit 6de813ae authored by Bastien FREMONDIERE's avatar Bastien FREMONDIERE
Browse files

Merge branch 'mindmapping'

parents 5e78baae b12bebd8
.ant-targets-mindMapping2Hdoc.ant .ant-targets-mindMapping2Hdoc.ant
result/** result/**
temp/**
ant -buildfile mindmapping_to_hdoc.ant -DinputPath samples/the_witcher.mm
Doc du pseudo langage:
======================
Idée générale:
- Le parser réalise une arborescence parfaite, en mettant le node racine en Module, les nodes suivants en unités et les feuilles en Grains.
- Un pseudo langage est définit pour modifier ce comportement de base.
Ordonnancement:
---------------
*base:* Récupération dans l'odre du fichier .mm
*langage:* #1 , #2, ... #n OU order(n) pour gérer l'ordonnancement entre les nodes d'un même père.
Gestion des balisages:
----------------------
*base:* application du comportement de base si pas de balisage
*langage:*
- #p OU p() : <p></p>
- #intro OU introduction : voir
- #conclu OU conclusion :
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="default"> <project basedir="." default="default" >
<property name="module" value="default"/> <property name="module" value="default"/>
<!-- <!--
only for the debug only for the debug
...@@ -20,19 +20,7 @@ ...@@ -20,19 +20,7 @@
<param name="hdocName" value="sect"/> <param name="hdocName" value="sect"/>
</antcall> </antcall>
<!-- Div Schema : sect and div element --> <!-- For debug purposes <delete dir="${basedir}/temp"/> -->
<antcall target="Makehdoc">
<param name="myXSLT" value="div.xsl"/>
<param name="hdocName" value="div"/>
</antcall>
<!-- Div Schema : sect, div and p element -->
<antcall target="Makehdoc">
<param name="myXSLT" value="threeLevel.xsl"/>
<param name="hdocName" value="three"/>
</antcall>
<delete dir="${basedir}/temp"/>
<echo>----------------------------End of conversion----------------------------------</echo> <echo>----------------------------End of conversion----------------------------------</echo>
</target> </target>
...@@ -56,9 +44,9 @@ ...@@ -56,9 +44,9 @@
<mkdir dir="${basedir}/temp/${hdocName}/META-INF"/> <mkdir dir="${basedir}/temp/${hdocName}/META-INF"/>
<copy file="${basedir}/mimetype" tofile="${basedir}/temp/${hdocName}/mimetype"/> <copy file="${basedir}/mimetype" tofile="${basedir}/temp/${hdocName}/mimetype"/>
<!-- create the container file with an XSLT transformation --> <!-- create the container file with an XSLT transformation -->
<xslt in="${basedir}/${inputPath}" out="${basedir}/temp/${hdocName}/META-INF/container.xml" xslresource="${basedir}/xslt/makeContainer.xsl"/> <xslt classpath="lib/saxon9he.jar" in="${basedir}/${inputPath}" out="${basedir}/temp/${hdocName}/META-INF/container.xml" xslresource="${basedir}/xslt/makeContainer.xsl"/>
<!-- create the file which contains the freemind data converted--> <!-- create the file which contains the freemind data converted-->
<xslt in="${basedir}/${inputPath}" out="${basedir}/temp/${hdocName}/content.xml" xslresource="${basedir}/xslt/${myXSLT}"/> <xslt classpath="lib/saxon9he.jar" in="${basedir}/${inputPath}" out="${basedir}/temp/${hdocName}/content.xml" xslresource="${basedir}/xslt/${myXSLT}"/>
<!-- zipping files as the hdoc format --> <!-- zipping files as the hdoc format -->
<zip destfile="${resultFile}/hdoc/${hdocName}.hdoc" <zip destfile="${resultFile}/hdoc/${hdocName}.hdoc"
......
<map version="1.0.1">
<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->
<node CREATED="1449485059502" ID="ID_1970904157" MODIFIED="1449733283013">
<richcontent TYPE="NODE"><html>
<head>
</head>
<body>
<p>
~ The Witcher 3 ~
</p>
</body>
</html>
</richcontent>
<node CREATED="1449485120501" ID="ID_285036978" MODIFIED="1449486395915" POSITION="right" TEXT="#1 Acte I">
<attribute NAME="order" VALUE="1"/>
<node CREATED="1449485132689" ID="ID_1708921691" MODIFIED="1449485148622" TEXT="Quetes"/>
<node CREATED="1449485269697" ID="ID_1301635939" MODIFIED="1449485272519" TEXT="Lieux">
<node CREATED="1449485274196" ID="ID_238813411" MODIFIED="1449485276580" TEXT="Novigrad"/>
</node>
</node>
<node CREATED="1449485258730" ID="ID_1761718607" MODIFIED="1449486226347" POSITION="left" TEXT="#2 Acte II">
<node CREATED="1449485281338" ID="ID_265132376" MODIFIED="1449485282862" TEXT="Lieux">
<node CREATED="1449485287639" ID="ID_1277197999" MODIFIED="1449485295018" TEXT="Skellige"/>
</node>
</node>
<node CREATED="1449485406760" ID="ID_509667816" MODIFIED="1449486233215" POSITION="right" TEXT="#3 Personnages importants">
<node CREATED="1449485412886" ID="ID_1349182688" MODIFIED="1449486653689" TEXT="Siri">
<attribute NAME="anchor" VALUE="siri"/>
<node CREATED="1449485527735" ID="ID_56403828" MODIFIED="1449485538397" TEXT="#p La fille adoptive de Geralt"/>
</node>
<node CREATED="1449485417061" ID="ID_337025738" MODIFIED="1449485592055" TEXT="Triss">
<node CREATED="1449486658368" ID="ID_454465874" MODIFIED="1449486667193" TEXT="#a siri"/>
</node>
<node CREATED="1449485429136" ID="ID_1500938933" MODIFIED="1449485431782" TEXT="Yennefer"/>
</node>
<node CREATED="1449485926526" ID="ID_289476678" MODIFIED="1449486753624" POSITION="left" TEXT="Sc&#xe9;nario">
<node CREATED="1449485946398" ID="ID_596698657" MODIFIED="1449734206316" TEXT="#p Mon personnage bien a&#xee;m&#xe9; attaque tous les monstres alentours pour de l&apos;argent"/>
<node CREATED="1449486713098" ID="ID_983701334" MODIFIED="1449486715515" TEXT="#intro"/>
<node CREATED="1449486720318" ID="ID_737906523" MODIFIED="1449486722975" TEXT="#conclu"/>
<node CREATED="1449486747017" ID="ID_1777634105" MODIFIED="1449486750554" TEXT="#mcq"/>
</node>
</node>
</map>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0" xmlns="http://www.utc.fr/ics/hdoc/xhtml" xmlns:utc="http://www.utc.fr/ics/hdoc/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema">
xpath-default-namespace="http://www.utc.fr/ics/hdoc/xhtml" <!-- This is wrong -> xpath-default-namespace="http://www.utc.fr/ics/hdoc/xhtml"-->
xmlns="http://www.utc.fr/ics/hdoc/xhtml"
>
<xsl:output method="xml" indent="yes"/> <xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="map"> <xsl:template match="map">
<xsl:processing-instruction name="oxygen"> <xsl:processing-instruction name="oxygen">
...@@ -14,7 +13,7 @@ ...@@ -14,7 +13,7 @@
</xsl:processing-instruction> </xsl:processing-instruction>
<html> <html>
<head> <head>
<xsl:apply-templates mode="header"></xsl:apply-templates> <xsl:apply-templates mode="header"/>
</head> </head>
<body> <body>
<xsl:apply-templates/> <xsl:apply-templates/>
...@@ -25,36 +24,94 @@ ...@@ -25,36 +24,94 @@
<xsl:template match="node[1]" mode="header"> <xsl:template match="node[1]" mode="header">
<title><xsl:value-of select="@TEXT"/></title> <title>
<xsl:value-of select="@TEXT"/><xsl:value-of select="richcontent"></xsl:value-of>
</title>
<meta charset="utf-8"/> <meta charset="utf-8"/>
<meta name="author" content=""/> <meta name="author" content=""/>
</xsl:template> </xsl:template>
<!-- Default behavior for node -->
<xsl:template match="node"> <xsl:template match="node">
<xsl:element name="section" > <xsl:element name="section">
<header> <header>
<h1> <h1>
<xsl:value-of select="@TEXT"/> <xsl:value-of select="@TEXT"/>
<xsl:value-of select="richcontent"/>
</h1> </h1>
</header> </header>
<xsl:apply-templates/> <xsl:apply-templates select="node"/>
</xsl:element> </xsl:element>
</xsl:template> </xsl:template>
<xsl:template match="node[not(node)]" priority="5"> <!-- Behavior when node has no children -->
<xsl:element name="section" > <xsl:template
match="node[not(node)]|node[contains(//@TEXT, '#p')]|node[contains(//@TEXT, '#a')]"
priority="1">
<xd:doc xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl">
<xd:desc>
<xd:p></xd:p>
</xd:desc>
</xd:doc>
<xsl:element name="section">
<xsl:attribute name="data-hdoc-type">unit-of-content</xsl:attribute> <xsl:attribute name="data-hdoc-type">unit-of-content</xsl:attribute>
<header> <header>
<h1> <h1>
<xsl:value-of select="@TEXT"/> <xsl:value-of select="@TEXT"/>
<xsl:value-of select="richcontent"/>
</h1> </h1>
</header> </header>
<xsl:apply-templates/> <!--<xsl:apply-templates/>-->
</xsl:element>
</xsl:template>
<xsl:template match="node[contains(@TEXT, '#p')]" priority="2">
<xsl:element name="p">
<xsl:value-of select="utc:string-remove-all(@TEXT, '#p ')"/>
</xsl:element> </xsl:element>
</xsl:template> </xsl:template>
<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:attribute>
<xsl:value-of select="utc:string-remove-all(@TEXT, '#a ')"/>
</xsl:element>
</xsl:template>
<xsl:template match="richcontent"/> <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"/>
<!--
<xsl:call-template name="string-remove-all">
<xsl:with-param name="text" select="$text" />
<xsl:with-param name="replace" select="$replace" />
</xsl:call-template>-->
<xsl:value-of select="$text"/>
</xsl:function>
<xsl:template name="string-remove-all">
<xsl:param name="text" as="xs:string"/>
<xsl:param name="replace" as="xs:string"/>
<xsl:choose>
<xsl:when test="contains($text, $replace)">
<xsl:value-of select="substring-before($text,$replace)"/>
<xsl:call-template name="string-remove-all">
<xsl:with-param name="text" select="substring-after($text,$replace)"/>
<xsl:with-param name="replace" select="$replace"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet> </xsl:stylesheet>
...@@ -19,17 +19,6 @@ ...@@ -19,17 +19,6 @@
<param name="hdocName" value="sect"/> <param name="hdocName" value="sect"/>
</antcall> </antcall>
<!-- Div Schema : sect and div element -->
<antcall target="Makehdoc">
<param name="hdocName" value="div"/>
</antcall>
<!-- Div Schema : sect, div and p element -->
<antcall target="Makehdoc">
<param name="hdocName" value="three"/>
</antcall>
<delete dir="${basedir}/temp"/> <delete dir="${basedir}/temp"/>
<echo>----------------------------End of conversion----------------------------------</echo> <echo>----------------------------End of conversion----------------------------------</echo>
</target> </target>
......
Supports Markdown
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