mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #9981: std domain: Strip value part of the option directive from genindex
This commit is contained in:
parent
ce6803a186
commit
008005cc39
1
CHANGES
1
CHANGES
@ -41,6 +41,7 @@ Features added
|
|||||||
* #10055: sphinx-build: Create directories when ``-w`` option given
|
* #10055: sphinx-build: Create directories when ``-w`` option given
|
||||||
* #9993: std domain: Allow to refer an inline target (ex. ``_`target name```)
|
* #9993: std domain: Allow to refer an inline target (ex. ``_`target name```)
|
||||||
via :rst:role:`ref` role
|
via :rst:role:`ref` role
|
||||||
|
* #9981: std domain: Strip value part of the option directive from general index
|
||||||
* #9391: texinfo: improve variable in ``samp`` role
|
* #9391: texinfo: improve variable in ``samp`` role
|
||||||
* #9578: texinfo: Add :confval:`texinfo_cross_references` to disable cross
|
* #9578: texinfo: Add :confval:`texinfo_cross_references` to disable cross
|
||||||
references for readability with standalone readers
|
references for readability with standalone readers
|
||||||
|
@ -242,7 +242,7 @@ class Cmdoption(ObjectDescription[str]):
|
|||||||
descr = _('%s command line option') % currprogram
|
descr = _('%s command line option') % currprogram
|
||||||
else:
|
else:
|
||||||
descr = _('command line option')
|
descr = _('command line option')
|
||||||
for option in sig.split(', '):
|
for option in signode.get('allnames', []):
|
||||||
entry = '; '.join([descr, option])
|
entry = '; '.join([descr, option])
|
||||||
self.indexnode['entries'].append(('pair', entry, signode['ids'][0], '', None))
|
self.indexnode['entries'].append(('pair', entry, signode['ids'][0], '', None))
|
||||||
|
|
||||||
|
@ -97,6 +97,9 @@ def test_cmd_option_with_optional_value(app):
|
|||||||
[desc, ([desc_signature, ([desc_name, '-j'],
|
[desc, ([desc_signature, ([desc_name, '-j'],
|
||||||
[desc_addname, '[=N]'])],
|
[desc_addname, '[=N]'])],
|
||||||
[desc_content, ()])]))
|
[desc_content, ()])]))
|
||||||
|
assert_node(doctree[0], addnodes.index,
|
||||||
|
entries=[('pair', 'command line option; -j', 'cmdoption-j', '', None)])
|
||||||
|
|
||||||
objects = list(app.env.get_domain("std").get_objects())
|
objects = list(app.env.get_domain("std").get_objects())
|
||||||
assert ('-j', '-j', 'cmdoption', 'index', 'cmdoption-j', 1) in objects
|
assert ('-j', '-j', 'cmdoption', 'index', 'cmdoption-j', 1) in objects
|
||||||
|
|
||||||
@ -355,10 +358,8 @@ def test_multiple_cmdoptions(app):
|
|||||||
[desc_addname, " directory"])],
|
[desc_addname, " directory"])],
|
||||||
[desc_content, ()])]))
|
[desc_content, ()])]))
|
||||||
assert_node(doctree[0], addnodes.index,
|
assert_node(doctree[0], addnodes.index,
|
||||||
entries=[('pair', 'cmd command line option; -o directory',
|
entries=[('pair', 'cmd command line option; -o', 'cmdoption-cmd-o', '', None),
|
||||||
'cmdoption-cmd-o', '', None),
|
('pair', 'cmd command line option; --output', 'cmdoption-cmd-o', '', None)])
|
||||||
('pair', 'cmd command line option; --output directory',
|
|
||||||
'cmdoption-cmd-o', '', None)])
|
|
||||||
assert ('cmd', '-o') in domain.progoptions
|
assert ('cmd', '-o') in domain.progoptions
|
||||||
assert ('cmd', '--output') in domain.progoptions
|
assert ('cmd', '--output') in domain.progoptions
|
||||||
assert domain.progoptions[('cmd', '-o')] == ('index', 'cmdoption-cmd-o')
|
assert domain.progoptions[('cmd', '-o')] == ('index', 'cmdoption-cmd-o')
|
||||||
|
Loading…
Reference in New Issue
Block a user