fix docs warnings
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Lord · committed by David Lord · parent 5477175 · Browse files · 3 files·+14 added−9 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+14 added−9 removed
- other:+14 added−9 removed
Provenance
- Commit
5ffbf8e- Tree
072b686- Author
David Lord <davidism@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent
5477175
3 files changed+14 added−9 removed
modified:docs/extensions.rst+3 added-3 removed
25 unmodified lines26 --------------27 28 **Import name:** `jinja2.ext.i18n`29 30-The i18n extension can be used in combination with `gettext`_ or `babel`_. If 31-the i18n extension is enabled Jinja2 provides a `trans` statement that marks 30+The i18n extension can be used in combination with `gettext`_ or `babel`_. If31+the i18n extension is enabled Jinja2 provides a `trans` statement that marks32 the wrapped string as translatable and calls `gettext`.33 34 After enabling, dummy `_` function that forwards calls to `gettext` is added35 to the environment globals. An internationalized application then has to266 unmodified lines302 303 The current :class:`~jinja2.lexer.TokenStream`304 305 .. autoclass:: jinja2.lexer.TokenStream306- :members: push, look, eos, skip, next, next_if, skip_if, expect306+ :members: push, look, eos, skip, __next__, next_if, skip_if, expect307 308 .. attribute:: current309 310 The current :class:`~jinja2.lexer.Token`.40 unmodified linesmodified:docs/templates.rst+7 added-5 removed
195 unmodified lines196 197 gets rendered with blank lines inside the div::198 199 <div>200- 200+201 yay202- 202+203 </div>204 205 But with both `trim_blocks` and `lstrip_blocks` enabled, the template block206 lines are removed and other whitespace is preserved::207- 207+208 <div>209 yay210 </div>211 309 unmodified lines521 Working with Automatic Escaping522 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~523 524 When automatic escaping is enabled, everything is escaped by default except525-for values explicitly marked as safe. Variables and expressions 525+for values explicitly marked as safe. Variables and expressions526 can be marked as safe either in:527 528 a. the context dictionary by the application with `MarkupSafe.Markup`, or529 b. the template, with the `|safe` filter530- 530+531 The main problem with this approach is that Python itself doesn't have the532 concept of tainted values; so whether a value is safe or unsafe can get lost.533 534 If a value is not marked safe, auto-escaping will take place; which means that764 unmodified lines1299 1300 The `else` part is optional. If not provided, the else block implicitly1301 evaluates into an undefined object::1302 1303+.. sourcecode:: jinja1304+1305 {{ '[%s]' % page.title if page.title }}1306 1307 1308 .. _builtin-filters:350 unmodified linesmodified:jinja2/lexer.py+4 added-1 removed
345 unmodified lines346 """Like :meth:`next_if` but only returns `True` or `False`."""347 return self.next_if(expr) is not None348 349 def __next__(self):350- """Go one token ahead and return the old one"""350+ """Go one token ahead and return the old one.351+352+ Use the built-in :func:`next` instead of calling this directly.353+ """354 rv = self.current355 if self._pushed:356 self.current = self._pushed.popleft()357 elif self.current.type is not TOKEN_EOF:382 unmodified lines