@matheusbsbs / matheus-bagliano / commits / 204d363f5a
Fork 0

Quote ' as \(aq in manpages

The docbook/xmlto toolchain insists on quoting ' as \'. This does achieve the quoting goal, but modern 'man' implementations turn the apostrophe into a unicode "proper" apostrophe (given the right circumstances), breaking code examples in many of our manpages. Quote them as \(aq instead, which is an "apostrophe quote" as per the groff_char manpage. Unfortunately, as Anders Kaseorg kindly pointed out, this is not portable beyond groff, so we add an extra Makefile variable GNU_ROFF which you need to enable to get the new quoting. Thanks also to Miklos Vajna for documentation. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Thomas Rast committed Oct 22, 2009 at 10:19 UTC 204d363f5a05bba0bdeb13f96a08d5078dcee820
3 files changed +28
Documentation/Makefile
+8
@@ -103,6 +103,14 @@ ifdef DOCBOOK_SUPPRESS_SP
103 XMLTO_EXTRA += -m manpage-suppress-sp.xsl
104 endif
105
106 +# If your target system uses GNU groff, it may try to render
107 +# apostrophes as a "pretty" apostrophe using unicode. This breaks
108 +# cut&paste, so you should set GNU_ROFF to force them to be ASCII
109 +# apostrophes. Unfortunately does not work with non-GNU roff.
110 +ifdef GNU_ROFF
111 +XMLTO_EXTRA += -m manpage-quote-apos.xsl
112 +endif
113 +
114 SHELL_PATH ?= $(SHELL)
115 # Shell quote;
116 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
Documentation/manpage-quote-apos.xsl new
+16
@@ -0,0 +1,16 @@
1 +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2 + version="1.0">
3 +
4 +<!-- work around newer groff/man setups using a prettier apostrophe
5 + that unfortunately does not quote anything when cut&pasting
6 + examples to the shell -->
7 +<xsl:template name="escape.apostrophe">
8 + <xsl:param name="content"/>
9 + <xsl:call-template name="string.subst">
10 + <xsl:with-param name="string" select="$content"/>
11 + <xsl:with-param name="target">'</xsl:with-param>
12 + <xsl:with-param name="replacement">\(aq</xsl:with-param>
13 + </xsl:call-template>
14 +</xsl:template>
15 +
16 +</xsl:stylesheet>
Makefile
+4
@@ -142,6 +142,10 @@ all::
142 #
143 # Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72.
144 #
145 +# Define GNU_ROFF if your target system uses GNU groff. This forces
146 +# apostrophes to be ASCII so that cut&pasting examples to the shell
147 +# will work.
148 +#
149 # Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's
150 # MakeMaker (e.g. using ActiveState under Cygwin).
151 #