1 rst2man does a poor job of creating man pages that can be read on Solaris.
2 Some of the changes in this patch make the Solaris *roff tools do the right
5 - Getting rid of the rst2man header before the SYNOPSIS
7 - Changing "\(aq" to "'", and making sure that single quotes don't start
8 a line (at least in a couple of places where it's not safe)
10 - Changing ".ft C" and ".ft P" to simply ".ft"
12 - Removing "\%" and "\:"
14 Groff also seems to have as much trouble with the .INDENT/.UNINDENT macros
15 as Solaris *roff, de-indenting paragraphs that shouldn't be, so we use
16 .RS/.RE instead. It's not as fancy, but seems to do the job.
18 Applying this patch has no effect in the normal userland build (it can't
19 run automatically until docutils is delivered), but it enables a "gmake
20 patches/manpage.patch" to regenerate the manpages with the updated text
21 (found in rst.patch) with the patched hgmanpage.py, and updates the
24 --- mercurial.hg/doc/hgmanpage.py 2016-10-09 20:00:17.207404849 -0700
25 +++ mercurial.hg/doc/hgmanpage.py 2016-10-10 10:04:03.695820057 -0700
27 self._in_docinfo = None
28 self._active_table = None
29 self._in_literal = False
30 + self._in_literal_inline = False
31 self.header_written = 0
35 # ``B`` bold, ``I`` italic, ``R`` roman should be available.
36 # Hopefully ``C`` courier too.
38 - 'indent' : ('.INDENT %.1f\n', '.UNINDENT\n'),
39 + 'indent' : ('.RS %d\n', '.RE\n'),
40 'definition_list_item' : ('.TP', ''),
41 'field_name' : ('.TP\n.B ', '\n'),
42 'literal' : ('\\fB', '\\fP'),
43 - 'literal_block' : ('.sp\n.nf\n.ft C\n', '\n.ft P\n.fi\n'),
44 + 'literal_block' : ('.sp\n.nf\n.ft\n', '\n.ft\n.fi\n'),
46 'option_list_item' : ('.TP\n', ''),
48 - 'reference' : (r'\%', r'\:'),
49 + 'reference' : (r'', r''),
50 'emphasis': ('\\fI', '\\fP'),
51 'strong' : ('\\fB', '\\fP'),
52 'term' : ('\n.B ', '\n'),
54 self.body[i - 2][:4] == '.TP\n'):
56 elif (self.body[i - 1] == '\n' and
57 + self.body[i - 2] and
58 self.body[i - 2][0] != '.' and
59 (self.body[i - 3][:7] == '.TP\n.B '
60 or self.body[i - 3][:4] == '\n.B ')
62 text = text.replace('\\','\\e')
72 text = text.replace('\n.', '\n\\&.')
73 + # We need to do the same thing for the inline literals, too
74 + if self._in_literal_inline and text[0] == '.':
75 + if self.body[-2].endswith('\n') and \
76 + self.body[-1] == self.defs['literal'][0]:
77 + self.body.append('\\&')
78 + # Single quotes starting a line are harmful, too.
81 + text = text.replace("\n'", "\n\\&'")
82 self.body.append(text)
84 def depart_Text(self, node):
86 if self.header_written:
88 self.body.append(self.header())
89 - self.body.append(MACRO_DEF)
90 self.header_written = 1
92 def visit_address(self, node):
95 def visit_literal(self, node):
96 self.body.append(self.defs['literal'][0])
97 + self._in_literal_inline = True
99 def depart_literal(self, node):
100 + self._in_literal_inline = False
101 self.body.append(self.defs['literal'][1])
103 def visit_literal_block(self, node):