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

Merge branch 'mindmapping'

parents 5e78baae b12bebd8
.ant-targets-mindMapping2Hdoc.ant
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"?>
<project basedir="." default="default">
<project basedir="." default="default" >
<property name="module" value="default"/>
<!--
only for the debug
......@@ -14,25 +14,13 @@
<echo>----------------------------Begin of conversion----------------------------------</echo>
<!-- Sect Schema : only sect element -->
<!-- Sect Schema : only sect element -->
<antcall target="Makehdoc">
<param name="myXSLT" value="sect.xsl"/>
<param name="hdocName" value="sect"/>
</antcall>
<!-- Div Schema : sect and div element -->
<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"/>
<!-- For debug purposes <delete dir="${basedir}/temp"/> -->
<echo>----------------------------End of conversion----------------------------------</echo>
</target>
......@@ -56,9 +44,9 @@
<mkdir dir="${basedir}/temp/${hdocName}/META-INF"/>
<copy file="${basedir}/mimetype" tofile="${basedir}/temp/${hdocName}/mimetype"/>
<!-- 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-->
<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 -->
<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"?>
<xsl:stylesheet
version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xpath-default-namespace="http://www.utc.fr/ics/hdoc/xhtml"
xmlns="http://www.utc.fr/ics/hdoc/xhtml"
>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.utc.fr/ics/hdoc/xhtml" xmlns:utc="http://www.utc.fr/ics/hdoc/xhtml"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This is wrong -> xpath-default-namespace="http://www.utc.fr/ics/hdoc/xhtml"-->
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="map">
<xsl:processing-instruction name="oxygen">
RNGSchema="http://scenari.utc.fr/hdoc/schemas/xhtml/hdoc1-xhtml.rng" type="xml"
</xsl:processing-instruction>
<html>
<head>
<xsl:apply-templates mode="header"></xsl:apply-templates>
<xsl:apply-templates mode="header"/>
</head>
<body>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="node[1]" mode="header">
<title><xsl:value-of select="@TEXT"/></title>
<meta charset="utf-8"/>
<meta name="author" content=""/>
<title>
<xsl:value-of select="@TEXT"/><xsl:value-of select="richcontent"></xsl:value-of>
</title>
<meta charset="utf-8"/>
<meta name="author" content=""/>
</xsl:template>
<!-- Default behavior for node -->
<xsl:template match="node">
<xsl:element name="section" >
<xsl:element name="section">
<header>
<h1>
<xsl:value-of select="@TEXT"/>
<xsl:value-of select="richcontent"/>
</h1>
</header>
<xsl:apply-templates/>
<xsl:apply-templates select="node"/>
</xsl:element>
</xsl:template>
<xsl:template match="node[not(node)]" priority="5">
<xsl:element name="section" >
<!-- Behavior when node has no children -->
<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>
<header>
<h1>
<xsl:value-of select="@TEXT"/>
<xsl:value-of select="richcontent"/>
</h1>
</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:template>
<xsl:template match="richcontent"/>
<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: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>
......@@ -18,17 +18,6 @@
<antcall target="Makehdoc">
<param name="hdocName" value="sect"/>
</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"/>
<echo>----------------------------End of conversion----------------------------------</echo>
......
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