mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
From version 1.5 to 1.6. Warnings wrapped with locale.
This commit is contained in:
parent
b52118290f
commit
882bebf90a
3
CHANGES
3
CHANGES
@ -42,6 +42,7 @@ Features added
|
|||||||
imported members.
|
imported members.
|
||||||
* C++, add ``:tparam-line-spec:`` option to templated declarations.
|
* C++, add ``:tparam-line-spec:`` option to templated declarations.
|
||||||
When specified, each template parameter will be rendered on a separate line.
|
When specified, each template parameter will be rendered on a separate line.
|
||||||
|
* #3303: Add ``:pyversion:`` option to the doctest directive.
|
||||||
|
|
||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
@ -73,8 +74,6 @@ Deprecated
|
|||||||
Features added
|
Features added
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
* #3303: Added ``:pyversion:`` option to the doctest directive
|
|
||||||
|
|
||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ a comma-separated list of group names.
|
|||||||
comparison is performed by `distutils.version.LooseVersion
|
comparison is performed by `distutils.version.LooseVersion
|
||||||
<https://www.python.org/dev/peps/pep-0386/#distutils>`__.
|
<https://www.python.org/dev/peps/pep-0386/#distutils>`__.
|
||||||
|
|
||||||
.. versionadded:: 1.5
|
.. versionadded:: 1.6
|
||||||
|
|
||||||
Note that like with standard doctests, you have to use ``<BLANKLINE>`` to
|
Note that like with standard doctests, you have to use ``<BLANKLINE>`` to
|
||||||
signal a blank line in the expected output. The ``<BLANKLINE>`` is removed
|
signal a blank line in the expected output. The ``<BLANKLINE>`` is removed
|
||||||
|
@ -31,6 +31,7 @@ from sphinx.util import force_decode, logging
|
|||||||
from sphinx.util.nodes import set_source_info
|
from sphinx.util.nodes import set_source_info
|
||||||
from sphinx.util.console import bold # type: ignore
|
from sphinx.util.console import bold # type: ignore
|
||||||
from sphinx.util.osutil import fs_encoding
|
from sphinx.util.osutil import fs_encoding
|
||||||
|
from sphinx.locale import _
|
||||||
|
|
||||||
if False:
|
if False:
|
||||||
# For type annotation
|
# For type annotation
|
||||||
@ -126,15 +127,15 @@ class TestDirective(Directive):
|
|||||||
# parse doctest-like output comparison flags
|
# parse doctest-like output comparison flags
|
||||||
option_strings = self.options['options'].replace(',', ' ').split()
|
option_strings = self.options['options'].replace(',', ' ').split()
|
||||||
for option in option_strings:
|
for option in option_strings:
|
||||||
on_or_off, option_name = option[0], option[1:]
|
prefix, option_name = option[0], option[1:]
|
||||||
if on_or_off not in '+-': # type: ignore
|
if prefix not in '+-': # type: ignore
|
||||||
self.state.document.reporter.warning(
|
self.state.document.reporter.warning(
|
||||||
"missing '+' or '-' in '%s' option." % option,
|
_("missing '+' or '-' in '%s' option.") % option,
|
||||||
line=self.lineno)
|
line=self.lineno)
|
||||||
continue
|
continue
|
||||||
if option_name not in doctest.OPTIONFLAGS_BY_NAME: # type: ignore
|
if option_name not in doctest.OPTIONFLAGS_BY_NAME: # type: ignore
|
||||||
self.state.document.reporter.warning(
|
self.state.document.reporter.warning(
|
||||||
"'%s' is not a valid option." % option_name,
|
_("'%s' is not a valid option.") % option_name,
|
||||||
line=self.lineno)
|
line=self.lineno)
|
||||||
continue
|
continue
|
||||||
flag = doctest.OPTIONFLAGS_BY_NAME[option[1:]] # type: ignore
|
flag = doctest.OPTIONFLAGS_BY_NAME[option[1:]] # type: ignore
|
||||||
@ -150,7 +151,7 @@ class TestDirective(Directive):
|
|||||||
node['options'][flag] = True # Skip the test
|
node['options'][flag] = True # Skip the test
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.state.document.reporter.warning(
|
self.state.document.reporter.warning(
|
||||||
"'%s' is not a valid pyversion option" % option,
|
_("'%s' is not a valid pyversion option") % option,
|
||||||
line=self.lineno)
|
line=self.lineno)
|
||||||
return [node]
|
return [node]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user