1 |
commit: ee1ca6dd07a2561d26029f4f0c1a5ef65160337e |
2 |
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Jan 18 19:33:51 2022 +0000 |
4 |
Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jan 19 11:26:03 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=ee1ca6dd |
7 |
|
8 |
devbook.xsl: Support alignment of table cells |
9 |
|
10 |
The "align" attribute is documented in the DevBook XML Guide, |
11 |
but was not implemented in the XSL stylesheet. |
12 |
|
13 |
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org> |
14 |
|
15 |
devbook.xsl | 26 +++++++++++++++++--------- |
16 |
1 file changed, 17 insertions(+), 9 deletions(-) |
17 |
|
18 |
diff --git a/devbook.xsl b/devbook.xsl |
19 |
index 1ebbb3b..bf68e9a 100644 |
20 |
--- a/devbook.xsl |
21 |
+++ b/devbook.xsl |
22 |
@@ -82,9 +82,12 @@ |
23 |
<xsl:if test="@rowspan"> |
24 |
<xsl:attribute name="rowspan"><xsl:value-of select="@rowspan"/></xsl:attribute> |
25 |
</xsl:if> |
26 |
- <xsl:if test="@nowrap"> |
27 |
- <!-- Disable word wrapping for this table item. Usage: <ti nowrap="nowrap"> --> |
28 |
- <xsl:attribute name="style">white-space:<xsl:value-of select="@nowrap"/></xsl:attribute> |
29 |
+ <xsl:if test="@nowrap or @align"> |
30 |
+ <xsl:attribute name="style"> |
31 |
+ <!-- Disable word wrapping for this table item. Usage: <ti nowrap="nowrap"> --> |
32 |
+ <xsl:if test="@nowrap">white-space:<xsl:value-of select="@nowrap"/>;</xsl:if> |
33 |
+ <xsl:if test="@align">text-align:<xsl:value-of select="@align"/>;</xsl:if> |
34 |
+ </xsl:attribute> |
35 |
</xsl:if> |
36 |
<xsl:apply-templates/> |
37 |
</td> |
38 |
@@ -95,16 +98,21 @@ |
39 |
<th> |
40 |
<xsl:if test="@colspan"> |
41 |
<xsl:attribute name="colspan"><xsl:value-of select="@colspan"/></xsl:attribute> |
42 |
- <!-- Center only when item spans several columns as |
43 |
- centering all <th> might disrupt some pages. |
44 |
- We might want to use a plain html <th> tag later. |
45 |
- Tip: to center a single-cell title, use <th colspan="1"> |
46 |
- --> |
47 |
- <xsl:attribute name="style">text-align:center</xsl:attribute> |
48 |
</xsl:if> |
49 |
<xsl:if test="@rowspan"> |
50 |
<xsl:attribute name="rowspan"><xsl:value-of select="@rowspan"/></xsl:attribute> |
51 |
</xsl:if> |
52 |
+ <xsl:choose> |
53 |
+ <xsl:when test="@align"> |
54 |
+ <xsl:attribute name="style">text-align:<xsl:value-of select="@align"/>;</xsl:attribute> |
55 |
+ </xsl:when> |
56 |
+ <xsl:when test="@colspan"> |
57 |
+ <!-- Center only when item spans several columns as |
58 |
+ centering all <th> might disrupt some pages. |
59 |
+ --> |
60 |
+ <xsl:attribute name="style">text-align:center;</xsl:attribute> |
61 |
+ </xsl:when> |
62 |
+ </xsl:choose> |
63 |
<xsl:apply-templates/> |
64 |
</th> |
65 |
</xsl:template> |