Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #9436 -- Updated docs build code to create "new in development …

…version".

Patch from Marc Fargas.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10006 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 059765fa6c273af584ad255eb1395dea6f0e2307 1 parent fedea84
Malcolm Tredinnick malcolmt authored
Showing with 33 additions and 0 deletions.
  1. +31 −0 docs/_ext/djangodocs.py
  2. +2 −0  docs/conf.py
31 docs/_ext/djangodocs.py
View
@@ -10,6 +10,8 @@
import sphinx.directives
import sphinx.environment
import sphinx.htmlwriter
+import sphinx.roles
+from docutils import nodes
def setup(app):
app.add_crossref_type(
@@ -44,11 +46,40 @@ def setup(app):
indextemplate = "pair: %s; django-admin command-line option",
parse_node = lambda env, sig, signode: sphinx.directives.parse_option_desc(signode, sig),
)
+ app.add_config_value('django_next_version', '0.0', True)
+ app.add_directive('versionadded', parse_version_directive, 1, (1, 1, 1))
+ app.add_directive('versionchanged', parse_version_directive, 1, (1, 1, 1))
app.add_transform(SuppressBlockquotes)
# Monkeypatch PickleHTMLBuilder so that it doesn't die in Sphinx 0.4.2
if sphinx.__version__ == '0.4.2':
monkeypatch_pickle_builder()
+
+def parse_version_directive(name, arguments, options, content, lineno,
+ content_offset, block_text, state, state_machine):
+ env = state.document.settings.env
+ is_nextversion = env.config.django_next_version == arguments[0]
+ ret = []
+ node = sphinx.addnodes.versionmodified()
+ ret.append(node)
+ if not is_nextversion:
+ if len(arguments) == 1:
+ linktext = 'Please, see the release notes <releases-%s>' % (arguments[0])
+ xrefs = sphinx.roles.xfileref_role('ref', linktext, linktext, lineno, state)
+ node.extend(xrefs[0])
+ node['version'] = arguments[0]
+ else:
+ node['version'] = "Development version"
+ node['type'] = name
+ if len(arguments) == 2:
+ inodes, messages = state.inline_text(arguments[1], lineno+1)
+ node.extend(inodes)
+ if content:
+ state.nested_parse(content, content_offset, node)
+ ret = ret + messages
+ env.note_versionchange(node['type'], node['version'], node, lineno)
+ return ret
+
class SuppressBlockquotes(docutils.transforms.Transform):
"""
2  docs/conf.py
View
@@ -44,6 +44,8 @@
version = '1.0'
# The full version, including alpha/beta/rc tags.
release = version
+# The next version to be released
+django_next_version = '1.1'
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
Please sign in to comment.
Something went wrong with that request. Please try again.