summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-01-25 11:57:14 -0500
committerTim Graham <timograham@gmail.com>2016-01-25 12:04:55 -0500
commit20b217b0b0b94de374bf5b21285fed20c3880dfb (patch)
treec667dd9332d8c1c18756f3ae3dd667263de98a02
parent4aec49d015a24ddd893567d2cd2682e1dc1dc107 (diff)
[1.9.x] Fixed Sphinx highlight warnings in docs.
Backport of 9c43d8252a926f72be5a279186b42848501819b8 from master
-rw-r--r--docs/topics/i18n/translation.txt27
-rw-r--r--docs/topics/security.txt3
2 files changed, 12 insertions, 18 deletions
diff --git a/docs/topics/i18n/translation.txt b/docs/topics/i18n/translation.txt
index 681f0aa73a..700319baf8 100644
--- a/docs/topics/i18n/translation.txt
+++ b/docs/topics/i18n/translation.txt
@@ -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::
@@ -1213,6 +1211,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.
+.. highlight:: python
+
The ``json_catalog`` view
-------------------------
@@ -1247,7 +1247,8 @@ The view is hooked up to your application and configured in the same fashion as
The response format is as follows:
-.. code-block:: json
+.. code-block:: text
+.. JSON doesn't allow comments so highlighting as JSON won't work here.
{
"catalog": {
@@ -1270,9 +1271,7 @@ Server-side caching will reduce CPU load. It's easily implemented with the
:func:`~django.views.decorators.cache.cache_page` decorator. To trigger cache
invalidation when your translations change, provide a version-dependent key
prefix, as shown in the example below, or map the view at a version-dependent
-URL.
-
-.. code-block:: python
+URL::
from django.views.decorators.cache import cache_page
from django.views.i18n import javascript_catalog
@@ -1286,9 +1285,7 @@ Client-side caching will save bandwidth and make your site load faster. If
you're using ETags (:setting:`USE_ETAGS = True <USE_ETAGS>`), you're already
covered. Otherwise, you can apply :ref:`conditional decorators
<conditional-decorators>`. In the following example, the cache is invalidated
-whenever you restart your application server.
-
-.. code-block:: python
+whenever you restart your application server::
from django.utils import timezone
from django.views.decorators.http import last_modified
@@ -1370,8 +1367,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')
@@ -1428,8 +1425,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'})
@@ -1727,8 +1724,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::
@@ -1767,8 +1762,6 @@ Miscellaneous
The ``set_language`` redirect view
----------------------------------
-.. highlightlang:: python
-
.. currentmodule:: django.views.i18n
.. function:: set_language(request)
diff --git a/docs/topics/security.txt b/docs/topics/security.txt
index 221036e328..917817ba6f 100644
--- a/docs/topics/security.txt
+++ b/docs/topics/security.txt
@@ -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>