formatting
This commit is contained in:
parent
e7daad3f95
commit
3267a980b3
2 changed files with 170 additions and 183 deletions
49
traceur.xsl
49
traceur.xsl
|
@ -18,9 +18,9 @@
|
|||
paramètres -->
|
||||
<xsl:call-template name="process-commands">
|
||||
<xsl:with-param name="commands" select="*" />
|
||||
<xsl:with-param name="x"
|
||||
select="$initial-x" />
|
||||
<xsl:with-param name="y" select="$initial-y" />
|
||||
<xsl:with-param name="x" select="$initial-x" />
|
||||
<xsl:with-param
|
||||
name="y" select="$initial-y" />
|
||||
<xsl:with-param
|
||||
name="angle" select="$initial-angle" />
|
||||
<xsl:with-param name="states" select="()" />
|
||||
|
@ -29,14 +29,14 @@
|
|||
</xsl:template>
|
||||
|
||||
<!-- Template récursif pour traiter les commandes individuelles -->
|
||||
<xsl:template
|
||||
<xsl:template
|
||||
name="process-commands">
|
||||
<xsl:param name="commands" />
|
||||
<xsl:param name="x" />
|
||||
<xsl:param name="y" />
|
||||
<xsl:param name="angle" />
|
||||
<xsl:param
|
||||
name="angle" />
|
||||
<xsl:param name="states" />
|
||||
name="states" />
|
||||
|
||||
<!-- Si il reste des commandes à traiter -->
|
||||
<xsl:if test="$commands">
|
||||
|
@ -61,16 +61,14 @@
|
|||
y="{format-number($new-y, '#.######')}" />
|
||||
<!-- Rappel récursif du template avec la mise à jour des coordonnées et des
|
||||
commandes restantes -->
|
||||
<xsl:call-template
|
||||
name="process-commands">
|
||||
<xsl:call-template name="process-commands">
|
||||
<xsl:with-param name="commands" select="$commands[position() > 1]" />
|
||||
<xsl:with-param
|
||||
name="x" select="$new-x" />
|
||||
<xsl:with-param name="y" select="$new-y" />
|
||||
<xsl:with-param
|
||||
name="angle" select="$angle" />
|
||||
<xsl:with-param name="states"
|
||||
select="$states" />
|
||||
<xsl:with-param name="states" select="$states" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<!-- Si la commande est un turn -->
|
||||
|
@ -88,8 +86,7 @@
|
|||
<xsl:with-param name="y" select="$y" />
|
||||
<xsl:with-param
|
||||
name="angle" select="$new-angle" />
|
||||
<xsl:with-param name="states"
|
||||
select="$states" />
|
||||
<xsl:with-param name="states" select="$states" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<!-- Si la commande est un MOVE -->
|
||||
|
@ -109,29 +106,23 @@
|
|||
y="{format-number($new-y, '#.######')}" />
|
||||
<!-- Rappel récursif du template avec la mise à jour des coordonnées et des
|
||||
commandes restantes -->
|
||||
<xsl:call-template
|
||||
name="process-commands">
|
||||
<xsl:call-template name="process-commands">
|
||||
<xsl:with-param name="commands" select="$commands[position() > 1]" />
|
||||
<xsl:with-param
|
||||
name="x" select="$new-x" />
|
||||
<xsl:with-param name="y" select="$new-y" />
|
||||
<xsl:with-param
|
||||
name="angle" select="$angle" />
|
||||
<xsl:with-param name="states"
|
||||
select="$states" />
|
||||
<xsl:with-param name="states" select="$states" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<!--Si
|
||||
la commande est un store -->
|
||||
<!-- Si la commande est un store -->
|
||||
<xsl:when test="local-name($current-command) = 'store'">
|
||||
<!--On
|
||||
enregistre le nouvelle état-->
|
||||
<xsl:variable
|
||||
name="new-state">
|
||||
<!-- On enregistre le nouvelle état-->
|
||||
<xsl:variable name="new-state">
|
||||
<state x="{$x}" y="{$y}" angle="{$angle}" />
|
||||
</xsl:variable>
|
||||
<!--On
|
||||
l'ajoute au précédent -->
|
||||
<!-- On l'ajoute au précédent -->
|
||||
<xsl:variable
|
||||
name="new-states" select="($states, $new-state)" />
|
||||
<xsl:call-template
|
||||
|
@ -142,15 +133,12 @@
|
|||
<xsl:with-param name="y" select="$y" />
|
||||
<xsl:with-param
|
||||
name="angle" select="$angle" />
|
||||
<xsl:with-param name="states"
|
||||
select="$new-states" />
|
||||
<xsl:with-param name="states" select="$new-states" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<!--Si
|
||||
la commande est un restore et que au moins 1 état est enregistré : -->
|
||||
<!-- Si la commande est un restore et que au moins 1 état est enregistré : -->
|
||||
<xsl:when test="local-name($current-command) = 'restore' and count($states)>=1">
|
||||
<!--On
|
||||
séléctionne notre state-->
|
||||
<!-- On séléctionne notre state-->
|
||||
<xsl:variable
|
||||
name="state" select="$states/state[1]" />
|
||||
<xsl:variable
|
||||
|
@ -170,7 +158,6 @@
|
|||
select="$remaining-states" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
|
Reference in a new issue