A module can be a special case, too (perl-test-mockmodule)

This commit is contained in:
Pierre Labastie 2018-11-23 14:30:06 +00:00
parent 6e28f3c4de
commit 1646303d91
2 changed files with 55 additions and 28 deletions

View file

@ -224,6 +224,33 @@ for ver_ent in $EXCEPTIONS; do
[[ -z $id ]] && continue [[ -z $id ]] && continue
cat >>$SPECIAL_FILE << EOF cat >>$SPECIAL_FILE << EOF
<xsl:when test="@id='$id'"> <xsl:when test="@id='$id'">
<!-- if there is a sect1 ancestor, we have a module -->
<xsl:choose>
<xsl:when test="ancestor::sect1">
<xsl:text> </xsl:text>
<module><xsl:text>&#xA; </xsl:text>
<xsl:element name="name">$id</xsl:element>
<xsl:text>&#xA; </xsl:text>
<xsl:element name="version">$ver_ent</xsl:element>
<xsl:if
test="document(\$installed-packages)//package[name=current()/@id]">
<xsl:text>&#xA; </xsl:text>
<xsl:element name="inst-version">
<xsl:value-of
select="document(\$installed-packages
)//package[name=current()/@id]/version"/>
</xsl:element>
</xsl:if>
<!-- Dependencies -->
<xsl:apply-templates select=".//para[@role='required' or
@role='recommended' or
@role='optional']"
mode="dependency"/>
<!-- End dependencies -->
<xsl:text>&#xA; </xsl:text>
</module><xsl:text>&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text> </xsl:text> <xsl:text> </xsl:text>
<package><xsl:text>&#xA; </xsl:text> <package><xsl:text>&#xA; </xsl:text>
<xsl:element name="name">$id</xsl:element> <xsl:element name="name">$id</xsl:element>
@ -246,6 +273,8 @@ for ver_ent in $EXCEPTIONS; do
<!-- End dependencies --> <!-- End dependencies -->
<xsl:text>&#xA; </xsl:text> <xsl:text>&#xA; </xsl:text>
</package><xsl:text>&#xA;</xsl:text> </package><xsl:text>&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when> </xsl:when>
EOF EOF
done done

View file

@ -189,14 +189,12 @@
<xsl:value-of select="normalize-space(title)"/> <xsl:value-of select="normalize-space(title)"/>
</xsl:element> </xsl:element>
<xsl:text>&#xA;</xsl:text> <xsl:text>&#xA;</xsl:text>
<!-- Do not use .//*, which would include self. --> <!-- Do not use .//*, which would include self.
<xsl:apply-templates Even a module can be a special case, so
select="descendant::node()[contains(translate(@xreflabel, call the template of specialCases.xsl,
'123456789', which calls the "normal" template when the
'000000000'), case is normal. -->
'-0') <xsl:apply-templates select="descendant::*" mode="special">
]"
mode="normal">
<xsl:sort select="@id"/> <xsl:sort select="@id"/>
</xsl:apply-templates> </xsl:apply-templates>
<xsl:text> </xsl:text> <xsl:text> </xsl:text>