Skip to content

Commit 1a602e1

Browse files
refactor: mover lógica de âncora e título para abstracts sem título (#1209)
- Remover chamada a 'create-anchor-and-title-for-abstracts-without-title' do template 'text-abstracts', pois a lógica agora é aplicada individualmente por cada abstract/trans-abstract - Esvaziar template 'create-anchor-and-title-for-abstracts-without-title' que era aplicado ao nível do elemento pai - Mover lógica de geração de âncora e título para o template 'anchor-and-title' de abstract[not(title)] e trans-abstract[not(title)] - Substituir chamada a 'text-labels' por 'translate' com parâmetro 'term' para tradução do termo 'Abstract' - Determinar idioma dinamicamente via @xml:lang do próprio elemento, do avô ou do bisavô, com fallback para 'en' - Remover lógica condicional de singular/plural (Abstract vs Abstracts) em favor de tradução fixa do termo 'Abstract'
1 parent 14e681e commit 1a602e1

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

packtools/catalogs/htmlgenerator/v3.0/article-meta-abstract.xsl

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@
3838
</xsl:template>
3939

4040
<xsl:template match="*[abstract]" mode="text-abstracts">
41-
<xsl:apply-templates select="." mode="create-anchor-and-title-for-abstracts-without-title"/>
42-
4341
<xsl:apply-templates select="abstract[not(@abstract-type)]" mode="layout"/>
4442
<xsl:apply-templates select="abstract[@abstract-type='key-points']" mode="layout"/>
4543
<xsl:apply-templates select="abstract[@abstract-type='graphical']" mode="layout"/>
@@ -54,13 +52,20 @@
5452
</xsl:template>
5553

5654
<xsl:template match="*[abstract]" mode="create-anchor-and-title-for-abstracts-without-title">
55+
56+
</xsl:template>
57+
58+
<xsl:template match="abstract[not(title)] | trans-abstract[not(title)]" mode="anchor-and-title">
5759
<xsl:if test="not($has_abstract_title)">
5860
<xsl:variable name="title">
59-
<xsl:apply-templates select="." mode="text-labels">
60-
<xsl:with-param name="text">
61+
<xsl:apply-templates select="." mode="translate">
62+
<xsl:with-param name="term">Abstract</xsl:with-param>
63+
<xsl:with-param name="lang">
6164
<xsl:choose>
62-
<xsl:when test="$total_abstracts=1">Abstract</xsl:when>
63-
<xsl:otherwise>Abstracts</xsl:otherwise>
65+
<xsl:when test="@xml:lang"><xsl:value-of select="@xml:lang"/></xsl:when>
66+
<xsl:when test="../../@xml:lang"><xsl:value-of select="../../@xml:lang"/></xsl:when>
67+
<xsl:when test="../../../@xml:lang"><xsl:value-of select="../../../@xml:lang"/></xsl:when>
68+
<xsl:otherwise>en</xsl:otherwise>
6469
</xsl:choose>
6570
</xsl:with-param>
6671
</xsl:apply-templates>
@@ -71,9 +76,6 @@
7176
</xsl:if>
7277
</xsl:template>
7378

74-
<xsl:template match="abstract[not(title)] | trans-abstract[not(title)]" mode="anchor-and-title">
75-
</xsl:template>
76-
7779
<xsl:template match="abstract[title] | trans-abstract[title]" mode="anchor-and-title">
7880
<!-- Apresenta a âncora e o título, ou seja, Abstract, Resumo, ou Resumen -->
7981

0 commit comments

Comments
 (0)