Skip to content

Commit 5121a6d

Browse files
ChrisJohnsengitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0c04f52 commit 5121a6d

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

Documentation/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ man7dir=$(mandir)/man7
4242
ASCIIDOC=asciidoc
4343
ASCIIDOC_EXTRA =
4444
MANPAGE_XSL = manpage-normal.xsl
45+
XMLTO_EXTRA =
4546
INSTALL?=install
4647
RM ?= rm -f
4748
DOC_REF = origin/man
@@ -93,6 +94,9 @@ else
9394
ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
9495
endif
9596
endif
97+
ifdef MAN_BOLD_LITERAL
98+
XMLTO_EXTRA += -m manpage-bold-literal.xsl
99+
endif
96100

97101
#
98102
# Please note that there is a minor bug in asciidoc.
@@ -192,7 +196,7 @@ $(MAN_HTML): %.html : %.txt
192196

193197
%.1 %.5 %.7 : %.xml
194198
$(RM) $@
195-
xmlto -m $(MANPAGE_XSL) man $<
199+
xmlto -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
196200

197201
%.xml : %.txt
198202
$(RM) $@+ $@
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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>

0 commit comments

Comments
 (0)