Skip to content

Commit

Permalink
fix: roundabout (#1043)
Browse files Browse the repository at this point in the history
* fix roundabout

* fix test

* bump version to 2.9.9
  • Loading branch information
BulotF authored and nsenave committed Jun 24, 2024
1 parent a00ff8e commit f5efddf
Show file tree
Hide file tree
Showing 7 changed files with 292 additions and 89 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>fr.insee.eno</groupId>
<artifactId>eno-core</artifactId>
<version>2.9.8</version>
<version>2.9.9</version>
<packaging>jar</packaging>

<name>Eno – Questionnaire generator</name>
Expand Down
36 changes: 33 additions & 3 deletions src/main/resources/xslt/inputs/pogues-xml/functions.fods
Original file line number Diff line number Diff line change
Expand Up @@ -1424,11 +1424,41 @@
</table:table-row>
<table:table-row table:style-name="ro1">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>enopogues:get-loop-excluded-occurrence-label</text:p>
<text:p>enopogues:get-occurrence-label-variables</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="2"/>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>Returns the label to display in a roundabout for a filtered occurrence of a loop</text:p>
<text:p>Returns the variables of the label of the occurrence for a roundabout</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro1">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>enopogues:get-occurrence-description</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="2"/>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>Returns the label to comment the status of an occurrence of a loop</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro1">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>enopogues:get-occurrence-description-variables</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="2"/>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>Returns the variables of the label to comment the status of an occurrence of a loop</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro1">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>enopogues:is-roundabout-locked</text:p>
</table:table-cell>
<table:table-cell/>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>xs:boolean</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>Returns if a roundabout is locked</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro1">
Expand All @@ -1440,7 +1470,7 @@
<text:p>Return all Roundabouts elements of the survey.</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro1" table:number-rows-repeated="10">
<table:table-row table:style-name="ro1" table:number-rows-repeated="9">
<table:table-cell table:number-columns-repeated="4"/>
</table:table-row>
<table:table-row table:style-name="ro1">
Expand Down
5 changes: 2 additions & 3 deletions src/main/resources/xslt/inputs/pogues-xml/source-fixed.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,12 @@
<xsl:sequence select="//pogues:Variable[@id = $idVariable]"/>
</xsl:template>

<xsl:template match="pogues:Expression | pogues:Formula | pogues:Text | pogues:Control/pogues:FailMessage | pogues:Label | pogues:Loop/pogues:Maximum | pogues:Loop/pogues:Minimum | pogues:Loop/pogues:Filter | pogues:OccurrenceLabel | pogues:ExcludedOccurrenceLabel" mode="enopogues:get-related-variable">
<xsl:template match="pogues:Expression | pogues:Formula | pogues:Text | pogues:Control/pogues:FailMessage | pogues:Label | pogues:Loop/pogues:Maximum | pogues:Loop/pogues:Minimum | pogues:Loop/pogues:Filter | pogues:OccurrenceLabel | pogues:OccurrenceDescription" mode="enopogues:get-related-variable">
<xsl:variable name="expressionVariable" select="tokenize(., '\$')"/>
<xsl:variable name="variables" select="//pogues:Variables"/>

<!-- 2 ways to describe a variable : $Variable$ or $Variable with a space after -->
<!-- TODO : Use regexp matches instead to handle several ' ' and linebreak cases. -->

<xsl:sequence select="$variables/pogues:Variable[some $x in $expressionVariable satisfies (if (contains($x, ' '))
then (substring-before($x, ' '))
else ($x))
Expand Down Expand Up @@ -303,7 +302,7 @@
select="concat($context/parent::pogues:Child/@id, '-secondDimension-fakeCL-1')"/>
</xsl:function>

<xsl:template match="pogues:Declaration/pogues:Text | pogues:Control/pogues:FailMessage | pogues:Label | pogues:OccurrenceLabel | pogues:ExcludedOccurrenceLabel" mode="id-variable">
<xsl:template match="pogues:Declaration/pogues:Text | pogues:Control/pogues:FailMessage | pogues:Label | pogues:OccurrenceLabel | pogues:OccurrenceDescription" mode="id-variable">
<xsl:variable name="variables" select="enopogues:get-related-variable(.)"/>
<xsl:choose>
<xsl:when test="$variables">
Expand Down
59 changes: 54 additions & 5 deletions src/main/resources/xslt/inputs/pogues-xml/templates.fods
Original file line number Diff line number Diff line change
Expand Up @@ -2476,19 +2476,68 @@
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>pogues:Loop</text:p>
<text:p>pogues:Child[@xsi:type=&apos;RoundaboutType&apos;]</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string">
<text:p>enopogues:get-loop-excluded-occurrence-label</text:p>
<text:p>enopogues:get-occurrence-label-variables</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>pogues:ExcludedOccurrenceLabel</text:p>
<text:p>enopogues:get-related-variable(pogues:OccurrenceLabel)</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>with-tag</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string">
<text:p>Returns the variables of the label of the occurrence for a roundabout</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>pogues:Child[@xsi:type=&apos;RoundaboutType&apos;]</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string">
<text:p>enopogues:get-occurrence-description</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>pogues:OccurrenceDescription</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>id-variable</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string">
<text:p>Returns the label to comment the status of an occurrence of a loop</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>pogues:Child[@xsi:type=&apos;RoundaboutType&apos;]</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string">
<text:p>enopogues:get-occurrence-description-variables</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>enopogues:get-related-variable(pogues:OccurrenceDescription)</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>Returns the label to display in a roundabout for a filtered occurrence of a loop</text:p>
<text:p>with-tag</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string">
<text:p>Returns the variables of the label to comment the status of an occurrence of a loop</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>pogues:Child[@xsi:type=&apos;RoundaboutType&apos;]</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string">
<text:p>enopogues:is-roundabout-locked</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>pogues:Locked != &apos;false&apos;</text:p>
</table:table-cell>
<table:table-cell/>
<table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string">
<text:p>Returns is a roundabout is locked</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro2">
Expand All @@ -2508,7 +2557,7 @@
<text:p>Return all Roundabouts elements of the survey. <text:s/>The with-tag of the Match_Mode column means that this template is hard-coded in the src\main\resources\xslt\inputs\pogues-xml\source-fixed.xml. This is to keep the tags as well as their content by making a sequence instead of a value-of</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro2" table:number-rows-repeated="31">
<table:table-row table:style-name="ro2" table:number-rows-repeated="30">
<table:table-cell table:number-columns-repeated="5"/>
</table:table-row>
<table:table-row table:style-name="ro2">
Expand Down
Loading

0 comments on commit f5efddf

Please sign in to comment.