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,28 +224,57 @@ for ver_ent in $EXCEPTIONS; do
[[ -z $id ]] && continue
cat >>$SPECIAL_FILE << EOF
<xsl:when test="@id='$id'">
<xsl:text> </xsl:text>
<package><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>
<!-- 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"/>
<xsl:apply-templates select=".//para[@role='required' or
@role='recommended' or
@role='optional']"
mode="dependency"/>
<!-- End dependencies -->
<xsl:text>&#xA; </xsl:text>
</package><xsl:text>&#xA;</xsl:text>
<xsl:text>&#xA; </xsl:text>
</module><xsl:text>&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text> </xsl:text>
<package><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>
</package><xsl:text>&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
EOF
done

View file

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