From b9bba672ed9c1f6af32769dccff0603b9f35e097 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 15 Feb 2017 01:42:08 +0900 Subject: [PATCH] Fix #3366: option directive does not allow punctuations --- CHANGES | 1 + sphinx/domains/std.py | 2 +- tests/root/objects.txt | 4 +++- tests/test_build_html.py | 2 ++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 1dc59cbc5..783a76ab8 100644 --- a/CHANGES +++ b/CHANGES @@ -26,6 +26,7 @@ Bugs fixed * #3394: When ``'pointsize'`` is not ``10pt``, Japanese ``'manual'`` document gets wrong PDF page dimensions * #3399: quickstart: conf.py was not overwritten by template +* #3366: option directive does not allow punctuations Testing -------- diff --git a/sphinx/domains/std.py b/sphinx/domains/std.py index 244b12e45..d8c843152 100644 --- a/sphinx/domains/std.py +++ b/sphinx/domains/std.py @@ -28,7 +28,7 @@ from sphinx.util.compat import Directive # RE for option descriptions -option_desc_re = re.compile(r'((?:/|--|-|\+)?[-\.?@#_a-zA-Z0-9]+)(=?\s*.*)') +option_desc_re = re.compile(r'((?:/|--|-|\+)?[-+\.?@#_a-zA-Z0-9]+)(=?\s*.*)') # RE for grammar tokens token_re = re.compile('`(\w+)`', re.U) diff --git a/tests/root/objects.txt b/tests/root/objects.txt index 1fc23567a..7e9bc15a9 100644 --- a/tests/root/objects.txt +++ b/tests/root/objects.txt @@ -172,13 +172,15 @@ Others .. option:: +p +.. option:: --ObjC++ + .. option:: --plugin.option .. option:: create-auth-token .. option:: arg -Link to :option:`perl +p`, :option:`--plugin.option`, :option:`create-auth-token` and :option:`arg` +Link to :option:`perl +p`, :option:`--ObjC++`, :option:`--plugin.option`, :option:`create-auth-token` and :option:`arg` .. program:: hg diff --git a/tests/test_build_html.py b/tests/test_build_html.py index 56ce041cd..8938d901b 100644 --- a/tests/test_build_html.py +++ b/tests/test_build_html.py @@ -347,6 +347,8 @@ def test_static_output(app): 'perl'), (".//a[@class='reference internal'][@href='#cmdoption-perl-arg-p']/code/span", '\+p'), + (".//a[@class='reference internal'][@href='#cmdoption-perl-objc']/code/span", + '--ObjC\\+\\+'), (".//a[@class='reference internal'][@href='#cmdoption-perl-plugin-option']/code/span", '--plugin.option'), (".//a[@class='reference internal'][@href='#cmdoption-perl-arg-create-auth-token']"