Commit 64a94691 authored by Jacob Kaplan-Moss's avatar Jacob Kaplan-Moss
Browse files

Fixed #8753: converted "new in ..." callouts to proper Sphinx...

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
parent c435975c
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -89,6 +89,34 @@ class DjangoHTMLTranslator(sphinx.htmlwriter.SmartyPantsHTMLTranslator):
        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...
    
+5 −1
Original line number Diff line number Diff line
@@ -107,6 +107,10 @@ dt .literal, table .literal { background:none; }
div.admonition-philosophy { padding-left:65px; background:url(docicons-philosophy.gif) .8em .8em no-repeat;}
div.admonition-behind-the-scenes { padding-left:65px; background:url(docicons-behindscenes.gif) .8em .8em no-repeat;}

/*** versoinadded/changes ***/
div.versionadded, div.versionchanged {  }
div.versionadded span.title, div.versionchanged span.title { font-weight: bold; }

/*** p-links ***/
a.headerlink { color: #c60f0f; font-size: 0.8em; padding: 0 4px 0 4px; text-decoration: none; visibility: hidden; }
h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, h4:hover > a.headerlink, h5:hover > a.headerlink, h6:hover > a.headerlink, dt:hover > a.headerlink { visibility: visible; }
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
Writing custom django-admin commands
====================================

**New in Django development version**
.. versionadded:: 1.0

Applications can register their own actions with ``manage.py``. For example,
you might want to add a ``manage.py`` action for a Django app that you're
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
Writing custom model fields
===========================

**New in Django development version**
.. versionadded:: 1.0

Introduction
============
+3 −3
Original line number Diff line number Diff line
@@ -157,7 +157,7 @@ will use the function's name as the filter name.
Filters and auto-escaping
~~~~~~~~~~~~~~~~~~~~~~~~~

**New in Django development version**
.. versionadded:: 1.0

When writing a custom filter, give some thought to how the filter will interact
with Django's auto-escaping behavior. Note that three types of strings can be
@@ -422,7 +422,7 @@ without having to be parsed multiple times.
Auto-escaping considerations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

**New in Django development version**
.. versionadded:: 1.0

The output from template tags is **not** automatically run through the
auto-escaping filters. However, there are still a couple of things you should
@@ -547,7 +547,7 @@ current context, available in the ``render`` method::
``resolve_variable`` will try to resolve ``blog_entry.date_updated`` and then
format it accordingly.

.. admonition:: New in development version:
.. versionadded:: 1.0

    Variable resolution has changed in the development version of Django.
    ``template.resolve_variable()`` is still available, but has been deprecated
Loading