diff options
author | Ulrich Müller <ulm@gentoo.org> | 2022-01-18 20:33:51 +0100 |
---|---|---|
committer | Ulrich Müller <ulm@gentoo.org> | 2022-01-19 12:26:03 +0100 |
commit | ee1ca6dd07a2561d26029f4f0c1a5ef65160337e (patch) | |
tree | b8606d5d0623b85db05e8822fe3da02abefa1bb5 /devbook.xsl | |
parent | function-reference/install-functions: be more specific about dobin location (diff) | |
download | devmanual-ee1ca6dd07a2561d26029f4f0c1a5ef65160337e.tar.gz devmanual-ee1ca6dd07a2561d26029f4f0c1a5ef65160337e.tar.bz2 devmanual-ee1ca6dd07a2561d26029f4f0c1a5ef65160337e.zip |
devbook.xsl: Support alignment of table cells
The "align" attribute is documented in the DevBook XML Guide,
but was not implemented in the XSL stylesheet.
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
Diffstat (limited to 'devbook.xsl')
-rw-r--r-- | devbook.xsl | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/devbook.xsl b/devbook.xsl index 1ebbb3b..bf68e9a 100644 --- a/devbook.xsl +++ b/devbook.xsl @@ -82,9 +82,12 @@ <xsl:if test="@rowspan"> <xsl:attribute name="rowspan"><xsl:value-of select="@rowspan"/></xsl:attribute> </xsl:if> - <xsl:if test="@nowrap"> - <!-- Disable word wrapping for this table item. Usage: <ti nowrap="nowrap"> --> - <xsl:attribute name="style">white-space:<xsl:value-of select="@nowrap"/></xsl:attribute> + <xsl:if test="@nowrap or @align"> + <xsl:attribute name="style"> + <!-- Disable word wrapping for this table item. Usage: <ti nowrap="nowrap"> --> + <xsl:if test="@nowrap">white-space:<xsl:value-of select="@nowrap"/>;</xsl:if> + <xsl:if test="@align">text-align:<xsl:value-of select="@align"/>;</xsl:if> + </xsl:attribute> </xsl:if> <xsl:apply-templates/> </td> @@ -95,16 +98,21 @@ <th> <xsl:if test="@colspan"> <xsl:attribute name="colspan"><xsl:value-of select="@colspan"/></xsl:attribute> - <!-- Center only when item spans several columns as - centering all <th> might disrupt some pages. - We might want to use a plain html <th> tag later. - Tip: to center a single-cell title, use <th colspan="1"> - --> - <xsl:attribute name="style">text-align:center</xsl:attribute> </xsl:if> <xsl:if test="@rowspan"> <xsl:attribute name="rowspan"><xsl:value-of select="@rowspan"/></xsl:attribute> </xsl:if> + <xsl:choose> + <xsl:when test="@align"> + <xsl:attribute name="style">text-align:<xsl:value-of select="@align"/>;</xsl:attribute> + </xsl:when> + <xsl:when test="@colspan"> + <!-- Center only when item spans several columns as + centering all <th> might disrupt some pages. + --> + <xsl:attribute name="style">text-align:center;</xsl:attribute> + </xsl:when> + </xsl:choose> <xsl:apply-templates/> </th> </xsl:template> |