diff options
author | Juan Catalano <jc@streema.com> | 2013-03-24 22:48:23 -0700 |
---|---|---|
committer | Claude Paroz <claude@2xlibre.net> | 2013-04-20 17:18:21 +0200 |
commit | 4e25198ec298732409217321be10e1e06be2fcbd (patch) | |
tree | 52280af9e8165e6c92f5d291343bc879bb5d8614 /docs/_ext/djangodocs.py | |
parent | 3be8165b6267bea021df6e6c4e758a4c877c961e (diff) | |
download | django-4e25198ec298732409217321be10e1e06be2fcbd.tar.gz |
Fixed #20104 -- Changed VersionDirective in order to avoid ambiguity.
As explained in ticket #20104, the use of versionchanged/versionadded
was confusing.
To solve this ambiguity these directives no longer accept a second
argument but now they only receive the version number (1st arg) and then
a content with the proper comment.
Diffstat (limited to 'docs/_ext/djangodocs.py')
-rw-r--r-- | docs/_ext/djangodocs.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/docs/_ext/djangodocs.py b/docs/_ext/djangodocs.py index 572bcd2e29..80967580ac 100644 --- a/docs/_ext/djangodocs.py +++ b/docs/_ext/djangodocs.py @@ -64,21 +64,25 @@ class VersionDirective(Directive): option_spec = {} def run(self): + if len(self.arguments) > 1: + msg = """Only one argument accepted for directive '{directive_name}::'. + Comments should be provided as content, + not as an extra argument.""".format(directive_name=self.name) + raise ValueError(msg) + env = self.state.document.settings.env ret = [] node = addnodes.versionmodified() ret.append(node) + if self.arguments[0] == env.config.django_next_version: node['version'] = "Development version" else: node['version'] = self.arguments[0] + node['type'] = self.name - if len(self.arguments) == 2: - inodes, messages = self.state.inline_text(self.arguments[1], self.lineno+1) - node.extend(inodes) - if self.content: - self.state.nested_parse(self.content, self.content_offset, node) - ret = ret + messages + if self.content: + self.state.nested_parse(self.content, self.content_offset, node) env.note_versionchange(node['type'], node['version'], node, self.lineno) return ret |