Skip to content

Commit

Permalink
option ref: support optional part with '[=value]' or ' value'
Browse files Browse the repository at this point in the history
This supports a commonly used format when it comes to optional argument:
-fauto-profile[=path], where `path` is optional part. Plus it supports
a format when space is used: -fauto-profile path.

Extends: sphinx-doc#10840
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
  • Loading branch information
marxin and AA-Turner committed Oct 2, 2022
1 parent 55e7f8d commit 8e83d4d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/roots/test-root/objects.txt
Expand Up @@ -214,7 +214,8 @@ Test repeated option directive.

My secret API.

Reference the first option :option:`-mapi=secret` or :option:`-mapi[=xxx]`.
Reference the first option :option:`-mapi=secret`, :option:`-mapi[=xxx]`
or :option:`-mapi with_space`.


User markup
Expand Down
1 change: 1 addition & 0 deletions tests/test_build_html.py
Expand Up @@ -1773,6 +1773,7 @@ def test_option_reference_with_value(app, status, warning):
assert 'first option <a class="reference internal" href="#cmdoption-git-commit-mapi">' in content
assert ('<a class="reference internal" href="#cmdoption-git-commit-mapi">'
'<code class="xref std std-option docutils literal notranslate"><span class="pre">-mapi[=xxx]</span></code></a>') in content
assert '<span class="pre">-mapi</span> <span class="pre">with_space</span>' in content


@pytest.mark.sphinx('html', testroot='theming')
Expand Down

0 comments on commit 8e83d4d

Please sign in to comment.