]> git.ipfire.org Git - thirdparty/jinja.git/commitdiff
fix docs warnings
authorDavid Lord <davidism@gmail.com>
Thu, 6 Jul 2017 17:43:21 +0000 (10:43 -0700)
committerDavid Lord <davidism@gmail.com>
Thu, 6 Jul 2017 17:43:30 +0000 (10:43 -0700)
docs/extensions.rst
docs/templates.rst
jinja2/lexer.py

index 00adee9fb0c36cc610f33461a38e6f324e986d9d..3663060be03cc954cb6d710a482953b6667b561b 100644 (file)
@@ -27,8 +27,8 @@ i18n Extension
 
 **Import name:** `jinja2.ext.i18n`
 
-The i18n extension can be used in combination with `gettext`_ or `babel`_.  If 
-the i18n extension is enabled Jinja2 provides a `trans` statement that marks 
+The i18n extension can be used in combination with `gettext`_ or `babel`_.  If
+the i18n extension is enabled Jinja2 provides a `trans` statement that marks
 the wrapped string as translatable and calls `gettext`.
 
 After enabling, dummy `_` function that forwards calls to `gettext` is added
@@ -303,7 +303,7 @@ extensions:
         The current :class:`~jinja2.lexer.TokenStream`
 
 .. autoclass:: jinja2.lexer.TokenStream
-   :members: push, look, eos, skip, next, next_if, skip_if, expect
+   :members: push, look, eos, skip, __next__, next_if, skip_if, expect
 
    .. attribute:: current
 
index 62852c4b8c972d2fb825412b08be434c44667ba6..fd3408a76d342cfedefd436b6736d4da66149e2b 100644 (file)
@@ -197,14 +197,14 @@ without the `trim_blocks` and `lstrip_blocks` options, this template::
 gets rendered with blank lines inside the div::
 
     <div>
-    
+
             yay
-    
+
     </div>
 
 But with both `trim_blocks` and `lstrip_blocks` enabled, the template block
 lines are removed and other whitespace is preserved::
-    
+
     <div>
             yay
     </div>
@@ -522,12 +522,12 @@ Working with Automatic Escaping
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 When automatic escaping is enabled, everything is escaped by default except
-for values explicitly marked as safe.  Variables and expressions 
+for values explicitly marked as safe.  Variables and expressions
 can be marked as safe either in:
 
 a. the context dictionary by the application with `MarkupSafe.Markup`, or
 b. the template, with the `|safe` filter
-   
+
 The main problem with this approach is that Python itself doesn't have the
 concept of tainted values; so whether a value is safe or unsafe can get lost.
 
@@ -1300,6 +1300,8 @@ something else>``.
 The `else` part is optional.  If not provided, the else block implicitly
 evaluates into an undefined object::
 
+.. sourcecode:: jinja
+
     {{ '[%s]' % page.title if page.title }}
 
 
index 679e3f258c9096172661ded4843be1bfd28df2bd..6fd135dd5b0a3a31896794ab2f25cd68582752ce 100644 (file)
@@ -347,7 +347,10 @@ class TokenStream(object):
         return self.next_if(expr) is not None
 
     def __next__(self):
-        """Go one token ahead and return the old one"""
+        """Go one token ahead and return the old one.
+
+        Use the built-in :func:`next` instead of calling this directly.
+        """
         rv = self.current
         if self._pushed:
             self.current = self._pushed.popleft()