Skip to content

Commit

Permalink
Use emphasis-style to change emphasis output
Browse files Browse the repository at this point in the history
  • Loading branch information
tomschr committed Feb 24, 2025
1 parent e2581b9 commit a9a7c7b
Showing 1 changed file with 37 additions and 3 deletions.
40 changes: 37 additions & 3 deletions suse2022-ns/fo/inline.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -366,12 +366,46 @@
<xsl:with-param name="name" select="concat( local-name(),'-close')"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="content">
<xsl:apply-imports/>
<xsl:variable name="style">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'styles'"/>
<xsl:with-param name="name" select="concat( local-name(),'-style')"/>
</xsl:call-template>
</xsl:variable>

<xsl:copy-of select="$open"/>
<xsl:copy-of select="$content"/>
<xsl:choose>
<xsl:when test="$style='bold' or @role='bold' or @role='strong'">
<xsl:call-template name="inline.boldseq"/>
</xsl:when>
<xsl:when test="@role='underline'">
<fo:inline text-decoration="underline">
<xsl:call-template name="inline.charseq"/>
</fo:inline>
</xsl:when>
<xsl:when test="@role='strikethrough'">
<fo:inline text-decoration="line-through">
<xsl:call-template name="inline.charseq"/>
</fo:inline>
</xsl:when>
<xsl:otherwise>
<!-- How many regular emphasis ancestors does this element have -->
<xsl:variable name="depth" select="count(ancestor::d:emphasis
[not(contains(' bold strong underline strikethrough ', concat(' ', @role, ' ')))]
)"/>

<xsl:choose>
<xsl:when test="$depth mod 2 = 1">
<fo:inline font-style="normal">
<xsl:apply-templates/>
</fo:inline>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="inline.italicseq"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
<xsl:copy-of select="$close"/>
</xsl:template>

Expand Down

0 comments on commit a9a7c7b

Please sign in to comment.