Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double hyphen (--) rendered as en dash (–) #73

Closed
j3mdamas opened this issue Jul 6, 2017 · 7 comments
Closed

Double hyphen (--) rendered as en dash (–) #73

j3mdamas opened this issue Jul 6, 2017 · 7 comments

Comments

@j3mdamas
Copy link

j3mdamas commented Jul 6, 2017

Hi,
First of all, thanks for the great extension! It's been very useful.

Just one small bug I noticed, which can be seen in your examples page:
https://sphinx-argparse.readthedocs.io/en/stable/sample.html

For example, in the sample commands, the --tree option is rendered as it is on the command-line helper, but in the Named Arguments section, it is rendered as –tree, with an en dash instead of the double hyphen. It happens the same for all these cases.

Do you have any clue about it? Thanks!

(cc @alejandrovr)

@dpryan79
Copy link
Collaborator

dpryan79 commented Jul 6, 2017

This has bothered me recently as well, thanks for bringing it up! I haven't tested it yet, but my guess is that this is the culprit. If that's the case, we can at least document that people should change this setting.

@j3mdamas
Copy link
Author

j3mdamas commented Jul 6, 2017

Thanks for the tip! @alejandrovr, can you check it out?

@alejandrovr
Copy link

alejandrovr commented Jul 6, 2017 via email

@j3mdamas
Copy link
Author

Just tried it and I think this is fixed now

@lqc
Copy link

lqc commented Dec 22, 2017

Hi, I wouldn't consider this issues fixed. This is a global setting and a bulk my documentation want this to be set to the default value, which is True. Would you consider adding an escape sequence to the generated markup instead ?

@j3mdamas
Copy link
Author

Hi @lqc

When I said this is fixed is when I noticed our documentation now has this correct: https://software.acellera.com/docs/latest/parameterize/index.html. And we did not change the html_use_smartypants to True as @dpryan79 suggested, so I assumed it just got fixed somehow?

@madebr
Copy link

madebr commented Aug 22, 2019

Is this fixed? Because I can still reproduce this using the script below.
Or at the least, the man renders only one hyphen.

What am I missing?

#!/bin/bash

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants