[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 global ``_()`` function causes interference. Explicitly importing
``ugettext()`` as ``_()`` avoids this problem. ``ugettext()`` as ``_()`` avoids this problem.
.. highlightlang:: python
In this example, the text ``"Welcome to my site."`` is marked as a translation In this example, the text ``"Welcome to my site."`` is marked as a translation
string:: 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`` will render a conditional expression. This will evaluate to either a ``true``
(should pluralize) or ``false`` (should **not** pluralize) value. (should pluralize) or ``false`` (should **not** pluralize) value.
.. highlightlang:: python
Note on performance 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`` language prefix to the URL patterns that were added by the ``i18n_patterns``
function. Example:: function. Example::
from django.core.urlresolvers import reverse >>> from django.core.urlresolvers import reverse
from django.utils.translation import activate >>> from django.utils.translation import activate
>>> activate('en') >>> activate('en')
>>> reverse('sitemap-xml') >>> 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 :func:`~django.core.urlresolvers.reverse` function will return the URL in the
active language. Example:: active language. Example::
from django.core.urlresolvers import reverse >>> from django.core.urlresolvers import reverse
from django.utils.translation import activate >>> from django.utils.translation import activate
>>> activate('en') >>> activate('en')
>>> reverse('news:category', kwargs={'slug': 'recent'}) >>> reverse('news:category', kwargs={'slug': 'recent'})
@ -1624,8 +1624,6 @@ translation utilities with a ``gettext`` package if the command ``xgettext
Customizing the ``makemessages`` command Customizing the ``makemessages`` command
---------------------------------------- ----------------------------------------
.. highlightlang:: python
If you want to pass additional parameters to ``xgettext``, you need to create a If you want to pass additional parameters to ``xgettext``, you need to create a
custom :djadmin:`makemessages` command and override its ``xgettext_options`` custom :djadmin:`makemessages` command and override its ``xgettext_options``
attribute:: attribute::
@ -1664,8 +1662,6 @@ Miscellaneous
The ``set_language`` redirect view The ``set_language`` redirect view
---------------------------------- ----------------------------------
.. highlightlang:: python
.. currentmodule:: django.views.i18n .. currentmodule:: django.views.i18n
.. function:: set_language(request) .. function:: set_language(request)
@ -1728,8 +1724,6 @@ redirected in the ``redirect_to`` context variable.
Explicitly setting the active language Explicitly setting the active language
-------------------------------------- --------------------------------------
.. highlightlang:: python
You may want to set the active language for the current session explicitly. Perhaps 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. a user's language preference is retrieved from another system, for example.
You've already been introduced to :func:`django.utils.translation.activate()`. That 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 malicious input, it is not entirely foolproof. For example, it will not
protect the following: protect the following:
.. code-block:: html+django .. code-block:: text
.. highlighting as html+django fails due to intentionally missing quotes.
<style class={{ var }}>...</style> <style class={{ var }}>...</style>