Skip to content

Commit

Permalink
Do not put option part after = to Index.
Browse files Browse the repository at this point in the history
  • Loading branch information
marxin committed Dec 29, 2021
1 parent eed0730 commit e99a688
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions sphinx/domains/std.py
Expand Up @@ -244,6 +244,8 @@ def add_target_and_index(self, firstname: str, sig: str, signode: desc_signature
else:
descr = _('command line option')
for option in sig.split(', '):
# remove trailing part followed by equal symbol
option = option.split('=')[0]
entry = '; '.join([descr, option])
self.indexnode['entries'].append(('pair', entry, signode['ids'][0], '', None))

Expand Down
2 changes: 1 addition & 1 deletion tests/test_domain_std.py
Expand Up @@ -328,7 +328,7 @@ def test_cmdoption_for_None(app):
text = (".. program:: ls\n"
".. program:: None\n"
"\n"
".. option:: -l\n")
".. option:: -l=foo|bar\n")
domain = app.env.get_domain('std')
doctree = restructuredtext.parse(app, text)
assert_node(doctree, (addnodes.index,
Expand Down

0 comments on commit e99a688

Please sign in to comment.