mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #8753: converted "new in ..." callouts to proper Sphinx "versionadded/versionchanged" directives. Thanks to Marc Fargas for all the heavy lifting here.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8843 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
c435975cc7
commit
64a9469127
47 changed files with 303 additions and 232 deletions
|
@ -88,6 +88,34 @@ class DjangoHTMLTranslator(sphinx.htmlwriter.SmartyPantsHTMLTranslator):
|
|||
def depart_desc_parameterlist(self, node):
|
||||
self.body.append(')')
|
||||
pass
|
||||
|
||||
#
|
||||
# Turn the "new in version" stuff (versoinadded/versionchanged) into a
|
||||
# better callout -- the Sphinx default is just a little span,
|
||||
# which is a bit less obvious that I'd like.
|
||||
#
|
||||
# FIXME: these messages are all hardcoded in English. We need to chanage
|
||||
# that to accomodate other language docs, but I can't work out how to make
|
||||
# that work and I think it'll require Sphinx 0.5 anyway.
|
||||
#
|
||||
version_text = {
|
||||
'deprecated': 'Deprecated in Django %s',
|
||||
'versionchanged': 'Changed in Django %s',
|
||||
'versionadded': 'New in Django %s',
|
||||
}
|
||||
|
||||
def visit_versionmodified(self, node):
|
||||
self.body.append(
|
||||
self.starttag(node, 'div', CLASS=node['type'])
|
||||
)
|
||||
title = "%s%s" % (
|
||||
self.version_text[node['type']] % node['version'],
|
||||
len(node) and ":" or "."
|
||||
)
|
||||
self.body.append('<span class="title">%s</span> ' % title)
|
||||
|
||||
def depart_versionmodified(self, node):
|
||||
self.body.append("</div>\n")
|
||||
|
||||
# Give each section a unique ID -- nice for custom CSS hooks
|
||||
# This is different on docutils 0.5 vs. 0.4...
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue