refs #1658, #1750: add test and small tweak.

This commit is contained in:
shimizukawa
2015-03-03 08:13:14 +09:00
parent dfcd84c5dd
commit 9ba0a51555
5 changed files with 9 additions and 5 deletions

View File

@@ -25,6 +25,8 @@ Bugs fixed
* #1745: latex builder cause maximum recursion depth exceeded when a * #1745: latex builder cause maximum recursion depth exceeded when a
footnote has a footnote mark itself. footnote has a footnote mark itself.
* #1748: SyntaxError in sphinx/ext/ifconfig.py with Python 2.6. * #1748: SyntaxError in sphinx/ext/ifconfig.py with Python 2.6.
* #1658, #1750: No link created (and warning given) if option does not
begin with -, / or +. Thanks to Takayuki Hirai.
Release 1.3b3 (released Feb 24, 2015) Release 1.3b3 (released Feb 24, 2015)

View File

@@ -211,7 +211,7 @@ class Program(Directive):
class OptionXRefRole(XRefRole): class OptionXRefRole(XRefRole):
def process_link(self, env, refnode, has_explicit_title, title, target): def process_link(self, env, refnode, has_explicit_title, title, target):
# validate content # validate content
if not re.match('(.+ )?[-/+]', target): if not re.match(r'(.+ )?[-/+\w]', target):
env.warn_node('Malformed :option: %r, does not contain option ' env.warn_node('Malformed :option: %r, does not contain option '
'marker - or -- or / or +' % target, refnode) 'marker - or -- or / or +' % target, refnode)
refnode['std:program'] = env.ref_context.get('std:program') refnode['std:program'] = env.ref_context.get('std:program')
@@ -660,7 +660,7 @@ class StandardDomain(Domain):
# most obvious thing: we are a flag option without program # most obvious thing: we are a flag option without program
if target.startswith(('-', '/', '+')): if target.startswith(('-', '/', '+')):
progname = node.get('std:program') progname = node.get('std:program')
elif ' -' in target or ' /' in target: elif re.search(r'[-/+]', target):
try: try:
progname, target = re.split(r' (?=-|--|/|\+)', target, 1) progname, target = re.split(r' (?=-|--|/|\+)', target, 1)
except ValueError: except ValueError:

View File

@@ -149,7 +149,7 @@ Adding \n to test unescaping.
* :doc:`subdir/includes` * :doc:`subdir/includes`
* ``:download:`` is tested in includes.txt * ``:download:`` is tested in includes.txt
* :option:`Python -c option <python -c>` * :option:`Python -c option <python -c>`
* This used to crash: :option:`Python c option` * This used to crash: :option:`&option`
Test :abbr:`abbr (abbreviation)` and another :abbr:`abbr (abbreviation)`. Test :abbr:`abbr (abbreviation)` and another :abbr:`abbr (abbreviation)`.

View File

@@ -172,7 +172,9 @@ Others
.. option:: +p .. option:: +p
Link to :option:`perl +p`. .. option:: arg
Link to :option:`perl +p` and :option:`arg`.
User markup User markup

View File

@@ -31,7 +31,7 @@ http://www.python.org/logo.png
reading included file u'.*?wrongenc.inc' seems to be wrong, try giving an \ reading included file u'.*?wrongenc.inc' seems to be wrong, try giving an \
:encoding: option\\n? :encoding: option\\n?
%(root)s/includes.txt:4: WARNING: download file not readable: .*?nonexisting.png %(root)s/includes.txt:4: WARNING: download file not readable: .*?nonexisting.png
(%(root)s/markup.txt:\\d+: WARNING: Malformed :option: u'Python c option', does \ (%(root)s/markup.txt:\\d+: WARNING: Malformed :option: u'&option', does \
not contain option marker - or -- or / or \\+ not contain option marker - or -- or / or \\+
%(root)s/undecodable.txt:3: WARNING: undecodable source characters, replacing \ %(root)s/undecodable.txt:3: WARNING: undecodable source characters, replacing \
with "\\?": b?'here: >>>(\\\\|/)xbb<<<' with "\\?": b?'here: >>>(\\\\|/)xbb<<<'