hgmanpage.patch revision 2302
2302N/Arst2man does a poor job of creating man pages that can be read on Solaris.
2302N/ASome of the changes in this patch make the Solaris *roff tools do the right
2302N/Athing:
2302N/A
2302N/A - Getting rid of the rst2man header before the SYNOPSIS
2302N/A
2302N/A - Changing "\(aq" to "'", and making sure that single quotes don't start
2302N/A a line (at least in a couple of places where it's not safe)
2302N/A
2302N/A - Changing ".ft C" and ".ft P" to simply ".ft"
2302N/A
2302N/A - Removing "\%" and "\:"
2302N/A
2302N/AGroff also seems to have as much trouble with the .INDENT/.UNINDENT macros
2302N/Aas Solaris *roff, de-indenting paragraphs that shouldn't be, so we use
2302N/A.RS/.RE instead. It's not as fancy, but seems to do the job.
2302N/A
2302N/AApplying this patch has no effect in the normal userland build (it can't
2302N/Arun automatically until docutils is delivered), but it enables a "gmake
2302N/Apatches/manpage.patch" to regenerate the manpages with the updated text
2302N/A(found in rst.patch) with the patched hgmanpage.py, and updates the
2302N/Amanpage.patch file.
2302N/A
2302N/A--- mercurial-2.7/doc/hgmanpage.py Thu Aug 1 20:37:39 2013
2302N/A+++ mercurial-2.7/doc/hgmanpage.py Mon Aug 19 14:40:04 2013
2302N/A@@ -197,6 +197,7 @@
2302N/A self._in_docinfo = None
2302N/A self._active_table = None
2302N/A self._in_literal = False
2302N/A+ self._in_literal_inline = False
2302N/A self.header_written = 0
2302N/A self._line_block = 0
2302N/A self.authors = []
2302N/A@@ -212,15 +213,15 @@
2302N/A # ``B`` bold, ``I`` italic, ``R`` roman should be available.
2302N/A # Hopefully ``C`` courier too.
2302N/A self.defs = {
2302N/A- 'indent' : ('.INDENT %.1f\n', '.UNINDENT\n'),
2302N/A+ 'indent' : ('.RS %d\n', '.RE\n'),
2302N/A 'definition_list_item' : ('.TP', ''),
2302N/A 'field_name' : ('.TP\n.B ', '\n'),
2302N/A 'literal' : ('\\fB', '\\fP'),
2302N/A- 'literal_block' : ('.sp\n.nf\n.ft C\n', '\n.ft P\n.fi\n'),
2302N/A+ 'literal_block' : ('.sp\n.nf\n.ft\n', '\n.ft\n.fi\n'),
2302N/A
2302N/A 'option_list_item' : ('.TP\n', ''),
2302N/A
2302N/A- 'reference' : (r'\%', r'\:'),
2302N/A+ 'reference' : (r'', r''),
2302N/A 'emphasis': ('\\fI', '\\fP'),
2302N/A 'strong' : ('\\fB', '\\fP'),
2302N/A 'term' : ('\n.B ', '\n'),
2302N/A@@ -267,6 +268,7 @@
2302N/A self.body[i - 2][:4] == '.TP\n'):
2302N/A self.body[i] = '.\n'
2302N/A elif (self.body[i - 1] == '\n' and
2302N/A+ self.body[i - 2] and
2302N/A self.body[i - 2][0] != '.' and
2302N/A (self.body[i - 3][:7] == '.TP\n.B '
2302N/A or self.body[i - 3][:4] == '\n.B ')
2302N/A@@ -284,7 +286,6 @@
2302N/A text = text.replace('\\','\\e')
2302N/A replace_pairs = [
2302N/A (u'-', ur'\-'),
2302N/A- (u'\'', ur'\(aq'),
2302N/A (u'ยด', ur'\''),
2302N/A (u'`', ur'\(ga'),
2302N/A ]
2302N/A@@ -297,6 +298,15 @@
2302N/A if text[0] == '.':
2302N/A text = '\\&' + text
2302N/A text = text.replace('\n.', '\n\\&.')
2302N/A+ # We need to do the same thing for the inline literals, too
2302N/A+ if self._in_literal_inline and text[0] == '.':
2302N/A+ if self.body[-2].endswith('\n') and \
2302N/A+ self.body[-1] == self.defs['literal'][0]:
2302N/A+ self.body.append('\\&')
2302N/A+ # Single quotes starting a line are harmful, too.
2302N/A+ if text[0] == "'":
2302N/A+ text = '\\&' + text
2302N/A+ text = text.replace("\n'", "\n\\&'")
2302N/A self.body.append(text)
2302N/A
2302N/A def depart_Text(self, node):
2302N/A@@ -381,7 +391,6 @@
2302N/A if self.header_written:
2302N/A return
2302N/A self.body.append(self.header())
2302N/A- self.body.append(MACRO_DEF)
2302N/A self.header_written = 1
2302N/A
2302N/A def visit_address(self, node):
2302N/A@@ -795,8 +804,10 @@
2302N/A
2302N/A def visit_literal(self, node):
2302N/A self.body.append(self.defs['literal'][0])
2302N/A+ self._in_literal_inline = True
2302N/A
2302N/A def depart_literal(self, node):
2302N/A+ self._in_literal_inline = False
2302N/A self.body.append(self.defs['literal'][1])
2302N/A
2302N/A def visit_literal_block(self, node):