[1.8.x] Fixed Sphinx highlight warnings in docs.

Backport of 9c43d8252a926f72be5a279186b42848501819b8 from master
This commit is contained in:
Tim Graham 2016-01-25 11:57:14 -05:00
parent 7b6ab2885e
commit d162438c65
2 changed files with 8 additions and 13 deletions

View File

@ -70,8 +70,6 @@ as a shorter alias, ``_``, to save typing.
global ``_()`` function causes interference. Explicitly importing
``ugettext()`` as ``_()`` avoids this problem.
.. highlightlang:: python
In this example, the text ``"Welcome to my site."`` is marked as a translation
string::
@ -1158,6 +1156,8 @@ Additionally, if there are complex rules around pluralization, the catalog view
will render a conditional expression. This will evaluate to either a ``true``
(should pluralize) or ``false`` (should **not** pluralize) value.
.. highlightlang:: python
Note on performance
-------------------
@ -1269,8 +1269,8 @@ After defining these URL patterns, Django will automatically add the
language prefix to the URL patterns that were added by the ``i18n_patterns``
function. Example::
from django.core.urlresolvers import reverse
from django.utils.translation import activate
>>> from django.core.urlresolvers import reverse
>>> from django.utils.translation import activate
>>> activate('en')
>>> reverse('sitemap-xml')
@ -1327,8 +1327,8 @@ After you've created the translations, the
:func:`~django.core.urlresolvers.reverse` function will return the URL in the
active language. Example::
from django.core.urlresolvers import reverse
from django.utils.translation import activate
>>> from django.core.urlresolvers import reverse
>>> from django.utils.translation import activate
>>> activate('en')
>>> reverse('news:category', kwargs={'slug': 'recent'})
@ -1624,8 +1624,6 @@ translation utilities with a ``gettext`` package if the command ``xgettext
Customizing the ``makemessages`` command
----------------------------------------
.. highlightlang:: python
If you want to pass additional parameters to ``xgettext``, you need to create a
custom :djadmin:`makemessages` command and override its ``xgettext_options``
attribute::
@ -1664,8 +1662,6 @@ Miscellaneous
The ``set_language`` redirect view
----------------------------------
.. highlightlang:: python
.. currentmodule:: django.views.i18n
.. function:: set_language(request)
@ -1728,8 +1724,6 @@ redirected in the ``redirect_to`` context variable.
Explicitly setting the active language
--------------------------------------
.. highlightlang:: python
You may want to set the active language for the current session explicitly. Perhaps
a user's language preference is retrieved from another system, for example.
You've already been introduced to :func:`django.utils.translation.activate()`. That

View File

@ -29,7 +29,8 @@ which are particularly dangerous to HTML. While this protects users from most
malicious input, it is not entirely foolproof. For example, it will not
protect the following:
.. code-block:: html+django
.. code-block:: text
.. highlighting as html+django fails due to intentionally missing quotes.
<style class={{ var }}>...</style>