summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrubert <grubert@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2019-11-24 12:50:44 +0000
committergrubert <grubert@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2019-11-24 12:50:44 +0000
commit50a9e5a1f96396388e3418597d5b3eec9d7df1cc (patch)
treedaa0511d4b9fa238b5d09bab7b016a2b0ef1ebb6
parent4331a5315f7527fb33a657525396c4fc7a3a8e94 (diff)
downloaddocutils-50a9e5a1f96396388e3418597d5b3eec9d7df1cc.tar.gz
FIX for BUG #287 comma after option is bold
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8420 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rw-r--r--docutils/docutils/writers/manpage.py6
-rw-r--r--docutils/test/test_writers/test_manpage.py32
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