[docutils:bugs] #380 manpage writer does not add space after .B
"Günter Milde" via Docutils-develop <[email protected]>
| Newsgroups | gmane.text.docutils.devel |
|---|---|
| Message-ID | </p/docutils/bugs/380/9b75d22b1bbb8ab03f41532f29ae4aeb361e5ee8.bugs@docutils.p.sourceforge.net> |
- **labels**: manpage-writer --> manpage writer
---
** [bugs:#380] manpage writer does not add space after .B**
**Status:** closed-accepted
**Labels:** manpage writer
**Created:** Fri Oct 18, 2019 03:18 PM UTC by Maarten
**Last Updated:** Tue Mar 03, 2020 09:41 PM UTC
**Owner:** engelbert gruber
I'm using sphinx-argparse to generate a man page from an argparse object.
The generated man page has no spaces after .B inserted.
This causes `--option` to show up as `-option` or `-o` as `o` in the manual.
I think the cause of this problem is in docutils because adding a space after `'.B'` at
https://github.com/docutils-mirror/docutils/blob/e88c5fb08d5cdfa8b4ac1020dd6f7177778d5990/docutils/writers/manpage.py#L887
fixed the problem for me.
(`'.B' -> '.B '`)
I've created a reproducer using sphinx-argparse.
This requires (at least) sphinx-argparse, sphinx and docutils.
```
cd /tmp
rm -rf WORKDIR
mkdir WORKDIR
cd WORKDIR
sphinx-quickstart $PWD --extensions sphinxarg.ext --sep -p option_bug -a author -r 0.1 -l en --no-batchfile --makefile
cat >>source/conf.py <<EOF
man_pages = [
('cmd_main', 'tmpmain', 'tmpmain Documentation',
['name of author'], 1)
]
import sys
import os
sys.path.insert(0, os.path.dirname(os.getcwd()))
EOF
mkdir pymodule
touch pymodule/__init__.py
cat >pymodule/tmpmain.py <<EOF
#!/usr/bin/env python3
import argparse
def my_func_that_returns_a_parser():
parser = argparse.ArgumentParser()
parser.add_argument('foo', default=False, help='foo help')
parser.add_argument('bar', default=False)
parser.add_argument('--general', '-G', default=False, help='General option')
subparsers = parser.add_subparsers()
subparser = subparsers.add_parser('install', help='install help')
subparser.add_argument('ref', type=str, help='foo1 help')
subparser.add_argument('--upgrade', action='store_true', default=False, help='foo2 help')
subparser.add_argument('-U', action='store_true', default=False, help='foo3 help')
return parser
if __name__ == '__main__':
p = my_func_that_returns_a_parser()
p.parse_args()
EOF
chmod a+x pymodule/tmpmain.py
cat >source/index.rst <<EOF
Welcome to pymodule's documentation!
====================================
.. toctree::
:maxdepth: 2
:caption: Contents:
cmd_main
EOF
cat >source/cmd_main.rst <<EOF
.. argparse::
:module: pymodule.tmpmain
:func: my_func_that_returns_a_parser
:prog: fancytool
EOF
make man
man build/man/tmpmain.1
```
---
Sent from sourceforge.net because [email protected] is subscribed to https://sourceforge.net/p/docutils/bugs/
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.