@matheusbsbs / matheus-bagliano / commits / 5121a6d993
Fork 0

Documentation: option to render literal text as bold for manpages

This allows manpages viewed on a tty to render inline literal text in a manner that is distinct from the surrounding text. The initial implementation (pre-mailing-list) of this patch included a conditional variant of the XSLT code in manpage-base.xsl and use xmlto's --stringparam option to optionally enable the functionality. It turns out that --stringparam is broken in all versions of xmlto except for the pre-release, SVN version. Since xmlto is a shell script the patch to fix it is simple enough, but I instead opted to use xmlto's "module" functionality. Testing done with asciidoc 8.3.1 and docbook-xsl 1.74.0. Signed-off-by: Chris Johnsen <chris_johnsen@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Chris Johnsen committed Mar 27, 2009 at 01:44 UTC 5121a6d99368906292dfdf7fe0047fb89c4c1969
2 files changed +22 -1
Documentation/Makefile
+5 -1
@@ -42,6 +42,7 @@ man7dir=$(mandir)/man7
42 ASCIIDOC=asciidoc
43 ASCIIDOC_EXTRA =
44 MANPAGE_XSL = manpage-normal.xsl
45 +XMLTO_EXTRA =
46 INSTALL?=install
47 RM ?= rm -f
48 DOC_REF = origin/man
@@ -93,6 +94,9 @@ else
94 ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
95 endif
96 endif
97 +ifdef MAN_BOLD_LITERAL
98 +XMLTO_EXTRA += -m manpage-bold-literal.xsl
99 +endif
100
101 #
102 # Please note that there is a minor bug in asciidoc.
@@ -192,7 +196,7 @@ $(MAN_HTML): %.html : %.txt
196
197 %.1 %.5 %.7 : %.xml
198 $(RM) $@
195 - xmlto -m $(MANPAGE_XSL) man $<
199 + xmlto -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
200
201 %.xml : %.txt
202 $(RM) $@+ $@
Documentation/manpage-bold-literal.xsl new
+17
@@ -0,0 +1,17 @@
1 +<!-- manpage-bold-literal.xsl:
2 + special formatting for manpages rendered from asciidoc+docbook -->
3 +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 + version="1.0">
5 +
6 +<!-- render literal text as bold (instead of plain or monospace);
7 + this makes literal text easier to distinguish in manpages
8 + viewed on a tty -->
9 +<xsl:template match="literal">
10 + <xsl:value-of select="$git.docbook.backslash"/>
11 + <xsl:text>fB</xsl:text>
12 + <xsl:apply-templates/>
13 + <xsl:value-of select="$git.docbook.backslash"/>
14 + <xsl:text>fR</xsl:text>
15 +</xsl:template>
16 +
17 +</xsl:stylesheet>