This commit is contained in:
Kovid Goyal 2017-05-04 17:34:51 +05:30
parent e6eff0f6cf
commit 3e70294279
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -196,7 +196,7 @@ def render_options(cmd, groups, options_header=True, add_program=True, header_le
if desc:
lines.extend([desc, ''])
for opt in sorted(options, key=lambda x: x.get_opt_string()):
help = opt.help if opt.help else ''
help = opt.help or ''
help = help.replace('\n', ' ').replace('*', '\\*').replace('%default', str(opt.default))
help = help.replace('"', r'\ ``"``\ ')
help = help.replace("'", r"\ ``'``\ ")
@ -214,7 +214,7 @@ def mark_options(raw):
opt = m.group()
a, b = opt.partition('=')[::2]
if a in ('--option1', '--option2'):
return m.group()
return '``' + m.group() + '``'
a = ':option:`' + a + '`'
b = (' = ``' + b + '``') if b else ''
return a + b