Commit 06e10413 authored by Fremondiere Bastien's avatar Fremondiere Bastien

Avancement (ajout p/a)

parent 9e533369
......@@ -2,7 +2,7 @@ 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 plus bas en Grains.
- 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:
......@@ -18,4 +18,4 @@ Gestion des balisages:
*langage:*
- #p OU p() : <p></p>
- #intro OU introduction : voir
- #conclu OU conclusion :
\ No newline at end of file
- #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
......@@ -44,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>
......@@ -4,6 +4,8 @@
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"
xmlns:utc="http://www.utc.fr/ics/hdoc/xhtml"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<xsl:output method="xml" indent="yes"/>
......@@ -30,31 +32,78 @@
<meta name="author" content=""/>
</xsl:template>
<!-- Default behavior for node -->
<xsl:template match="node">
<xsl:element name="section" >
<header>
<h1>
<xsl:value-of select="@TEXT"/>
<xsl:value-of select="@TEXT"/><xsl:value-of select="richcontent"></xsl:value-of>
</h1>
</header>
<xsl:apply-templates/>
<xsl:apply-templates select="node"/>
</xsl:element>
</xsl:template>
<xsl:template match="node[not(node)]" priority="5">
<!-- Behavior when node has no children -->
<xsl:template match="node[not(node)]|node[contains(//@TEXT, '#p')]|node[contains(//@TEXT, '#a')]" priority="1">
<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="@TEXT"/><xsl:value-of select="richcontent"></xsl:value-of>
</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:value-of>
</xsl:element>
</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:value-of>
</xsl:attribute>
<xsl:value-of select="utc:string-remove-all(@TEXT, '#a ')"></xsl:value-of>
</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:value-of>
</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>
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