diff options
| -rw-r--r-- | docutils/docutils/writers/manpage.py | 6 | ||||
| -rw-r--r-- | docutils/test/test_writers/test_manpage.py | 32 |
2 files changed, 37 insertions, 1 deletions
diff --git a/docutils/docutils/writers/manpage.py b/docutils/docutils/writers/manpage.py index 3955c7051..570f5a706 100644 --- a/docutils/docutils/writers/manpage.py +++ b/docutils/docutils/writers/manpage.py @@ -210,6 +210,7 @@ class Translator(nodes.NodeVisitor): # # Fonts are put on a stack, the top one is used. # ``.ft P`` or ``\\fP`` pop from stack. + # But ``.BI`` seams to fill stack with BIBIBIBIB... # ``B`` bold, ``I`` italic, ``R`` roman should be available. # Hopefully ``C`` courier too. self.defs = { @@ -912,7 +913,10 @@ class Translator(nodes.NodeVisitor): def visit_option(self, node): # each form of the option will be presented separately if self.context[-1] > 0: - self.body.append('\\fP,\\fB ') + if self.context[-3] == '.BI': + self.body.append('\\fR,\\fB ') + else: + self.body.append('\\fP,\\fB ') if self.context[-3] == '.BI': self.body.append('\\') self.body.append(' ') diff --git a/docutils/test/test_writers/test_manpage.py b/docutils/test/test_writers/test_manpage.py index 1ad776bb9..4d6bdc58f 100644 --- a/docutils/test/test_writers/test_manpage.py +++ b/docutils/test/test_writers/test_manpage.py @@ -362,6 +362,38 @@ Description of Term 1 Description of Term 1 .'''], ] +totest['cmdlineoptions'] = [ + ["""optional arguments: + -h, --help show this help + --output FILE, -o FILE output filename + -i DEVICE, --input DEVICE input device +""", + r""".\" Man page generated from reStructuredText. +. +.TH "" "" "" +.SH NAME + \- +"""+indend_macros+ +r""".INDENT 0.0 +.TP +.B optional arguments: +.INDENT 7.0 +.TP +.B \-h\fP,\fB \-\-help +show this help +.TP +.BI \-\-output \ FILE\fR,\fB \ \-o \ FILE +output filename +.TP +.BI \-i \ DEVICE\fR,\fB \ \-\-input \ DEVICE +input device +.UNINDENT +.UNINDENT +.\" Generated by docutils manpage writer. +. +"""], + ] + if __name__ == '__main__': import unittest |
