summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorFlorian Dahlitz <f2dahlitz@freenet.de>2020-05-30 07:47:32 (GMT)
committerGitHub <noreply@github.com>2020-05-30 07:47:32 (GMT)
commit735d902b363b759df9ff00e58bbf4f7e2bde78cd (patch)
tree7423b50123db23b66c970fdd602da0a495264e76 /Doc
parent4649202ea75d48e1496e99911709824ca2d3170e (diff)
downloadcpython-735d902b363b759df9ff00e58bbf4f7e2bde78cd.zip
cpython-735d902b363b759df9ff00e58bbf4f7e2bde78cd.tar.gz
cpython-735d902b363b759df9ff00e58bbf4f7e2bde78cd.tar.bz2
bpo-40798: Generate a different message for already removed elements (GH-20483)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/tools/extensions/pyspecific.py13
-rw-r--r--Doc/tools/templates/dummy.html1
2 files changed, 12 insertions, 2 deletions
diff --git a/Doc/tools/extensions/pyspecific.py b/Doc/tools/extensions/pyspecific.py
index bc51555..46064fa 100644
--- a/Doc/tools/extensions/pyspecific.py
+++ b/Doc/tools/extensions/pyspecific.py
@@ -311,7 +311,8 @@ class DeprecatedRemoved(Directive):
final_argument_whitespace = True
option_spec = {}
- _label = 'Deprecated since version {deprecated}, will be removed in version {removed}'
+ _deprecated_label = 'Deprecated since version {deprecated}, will be removed in version {removed}'
+ _removed_label = 'Deprecated since version {deprecated}, removed in version {removed}'
def run(self):
node = addnodes.versionmodified()
@@ -319,7 +320,15 @@ class DeprecatedRemoved(Directive):
node['type'] = 'deprecated-removed'
version = (self.arguments[0], self.arguments[1])
node['version'] = version
- label = translators['sphinx'].gettext(self._label)
+ env = self.state.document.settings.env
+ current_version = tuple(int(e) for e in env.config.version.split('.'))
+ removed_version = tuple(int(e) for e in self.arguments[1].split('.'))
+ if current_version < removed_version:
+ label = self._deprecated_label
+ else:
+ label = self._removed_label
+
+ label = translators['sphinx'].gettext(label)
text = label.format(deprecated=self.arguments[0], removed=self.arguments[1])
if len(self.arguments) == 3:
inodes, messages = self.state.inline_text(self.arguments[2],
diff --git a/Doc/tools/templates/dummy.html b/Doc/tools/templates/dummy.html
index 8d94137..68ae3ad 100644
--- a/Doc/tools/templates/dummy.html
+++ b/Doc/tools/templates/dummy.html
@@ -5,3 +5,4 @@ In extensions/pyspecific.py:
{% trans %}CPython implementation detail:{% endtrans %}
{% trans %}Deprecated since version {deprecated}, will be removed in version {removed}{% endtrans %}
+{% trans %}Deprecated since version {deprecated}, removed in version {removed}{% endtrans %}