Skip to content
Myr

remove vim syntax file

Before adoption: this commit came in with the history the project adopted, so no landing records it.

remove unmaintained information from integration doc

authored by David Lord · committed by David Lord · parent da81281 · Browse files · 3 files+35 added−202 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+35 added−202 removed

  • other:+35 added−202 removed

3 files+35 added−202 removed

modified:docs/integration.rst+35 added-66 removed
1Integration2===========34Jinja provides some code for integration into other tools such as frameworks,5the `Babel`_ library or your favourite editor for fancy code highlighting.6This is a brief description of whats included.78Files to help integration are available9`here. <https://github.com/pallets/jinja/tree/master/ext>`_104.. _babel-integration:513Babel Integration14-----------------6Babel7-----816Jinja provides support for extracting gettext messages from templates via a17`Babel`_ extractor entry point called `jinja2.ext.babel_extract`. The Babel18support is implemented as part of the :ref:`i18n-extension` extension.9Jinja provides support for extracting gettext messages from templates10via a `Babel`_ extractor entry point called11``jinja2.ext.babel_extract``. The support is implemented as part of the12:ref:`i18n-extension` extension.1320Gettext messages extracted from both `trans` tags and code expressions.14Gettext messages are extracted from both ``trans`` tags and code15expressions.1622To extract gettext messages from templates, the project needs a Jinja section23in its Babel extraction method `mapping file`_:17To extract gettext messages from templates, the project needs a Jinja18section in its Babel extraction method `mapping file`_:1920.. sourcecode:: ini2122 [jinja2: **/templates/**.html]23 encoding = utf-82430The syntax related options of the :class:`Environment` are also available as31configuration values in the mapping file. For example to tell the extraction32that templates use ``%`` as `line_statement_prefix` you can use this code:25The syntax related options of the :class:`Environment` are also26available as configuration values in the mapping file. For example, to27tell the extractor that templates use ``%`` as28``line_statement_prefix`` you can use this code:2930.. sourcecode:: ini3132 [jinja2: **/templates/**.html]33 encoding = utf-834 line_statement_prefix = %3540:ref:`jinja-extensions` may also be defined by passing a comma separated list41of import paths as `extensions` value. The i18n extension is added42automatically.36:ref:`jinja-extensions` may also be defined by passing a comma separated37list of import paths as the ``extensions`` value. The i18n extension is38added automatically.3944.. versionchanged:: 2.740Template syntax errors are ignored by default. The assumption is that41tests will catch syntax errors in templates. If you don't want to ignore42errors, add ``silent = false`` to the settings.4346 Until 2.7 template syntax errors were always ignored. This was done47 since many people are dropping non template html files into the48 templates folder and it would randomly fail. The assumption was that49 testsuites will catch syntax errors in templates anyways. If you don't50 want that behavior you can add ``silent=false`` to the settings and51 exceptions are propagated.44.. _Babel: https://babel.readthedocs.io/45.. _mapping file: https://babel.readthedocs.io/en/latest/messages.html#extraction-method-mapping-and-configuration4653.. _mapping file: http://babel.pocoo.org/en/latest/messages.html#extraction-method-mapping-and-configuration4748Pylons49------5058With `Pylons`_ 0.9.7 onwards it's incredible easy to integrate Jinja into a59Pylons powered application.51It's easy to integrate Jinja into a `Pylons`_ application.5261The template engine is configured in `config/environment.py`. The configuration62for Jinja looks something like that::53The template engine is configured in ``config/environment.py``. The54configuration for Jinja looks something like this:5556.. code-block:: python5758 from jinja2 import Environment, PackageLoader59 config['pylons.app_globals'].jinja_env = Environment(60 loader=PackageLoader('yourapplication', 'templates')61 )6269After that you can render Jinja templates by using the `render_jinja` function70from the `pylons.templating` module.63After that you can render Jinja templates by using the ``render_jinja``64function from the ``pylons.templating`` module.6572Additionally it's a good idea to set the Pylons' `c` object into strict mode.73Per default any attribute to not existing attributes on the `c` object return74an empty string and not an undefined object. To change this just use this75snippet and add it into your `config/environment.py`::66Additionally it's a good idea to set the Pylons ``c`` object to strict67mode. By default attribute access on missing attributes on the ``c``68object returns an empty string and not an undefined object. To change69this add this to ``config/environment.py``:7071.. code-block:: python7273 config['pylons.strict_c'] = True7475.. _Pylons: https://pylonshq.com/8081TextMate82--------8384There is a `bundle for TextMate`_ that supports syntax highlighting for Jinja 185and Jinja 2 for text based templates as well as HTML. It also contains a few86often used snippets.8788.. _bundle for TextMate: https://github.com/mitsuhiko/jinja2-tmbundle8990Vim91---9293A syntax plugin for `Vim`_ is available `from the jinja repository94<https://github.com/pallets/jinja/blob/master/ext/Vim/jinja.vim>`_. The script95supports Jinja 1 and Jinja 2. Once installed, two file types are available96(``jinja`` and ``htmljinja``). The first one is for text-based templates and the97second is for HTML templates. For HTML documents, the plugin attempts to98automatically detect Jinja syntax inside of existing HTML documents.99100If you are using a plugin manager like `Pathogen`_, see the `vim-jinja101<https://github.com/mitsuhiko/vim-jinja>`_ repository for installing in the102``bundle/`` directory.103104.. _Babel: http://babel.pocoo.org/105.. _Vim: https://www.vim.org/106.. _Pathogen: https://github.com/tpope/vim-pathogen
deleted:ext/Vim/jinja.vim-135 removed
1" Vim syntax file2" Language: Jinja template3" Maintainer: Armin Ronacher <armin.ronacher@active-4.com>4" Last Change: 2008 May 95" Version: 1.16"7" Known Bugs:8" because of odd limitations dicts and the modulo operator9" appear wrong in the template.10"11" Changes:12"13" 2008 May 9: Added support for Jinja 2 changes (new keyword rules)1415" .vimrc variable to disable html highlighting16if !exists('g:jinja_syntax_html')17 let g:jinja_syntax_html=118endif1920" For version 5.x: Clear all syntax items21" For version 6.x: Quit when a syntax file was already loaded22if !exists("main_syntax")23 if v:version < 60024 syntax clear25 elseif exists("b:current_syntax")26 finish27 endif28 let main_syntax = 'jinja'29endif3031" Pull in the HTML syntax.32if g:jinja_syntax_html33 if v:version < 60034 so <sfile>:p:h/html.vim35 else36 runtime! syntax/html.vim37 unlet b:current_syntax38 endif39endif4041syntax case match4243" Jinja template built-in tags and parameters (without filter, macro, is and raw, they44" have special threatment)45syn keyword jinjaStatement containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained and if else in not or recursive as import4647syn keyword jinjaStatement containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained is filter skipwhite nextgroup=jinjaFilter48syn keyword jinjaStatement containedin=jinjaTagBlock contained macro skipwhite nextgroup=jinjaFunction49syn keyword jinjaStatement containedin=jinjaTagBlock contained block skipwhite nextgroup=jinjaBlockName5051" Variable Names52syn match jinjaVariable containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /[a-zA-Z_][a-zA-Z0-9_]*/53syn keyword jinjaSpecial containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained false true none False True None loop super caller varargs kwargs5455" Filters56syn match jinjaOperator "|" containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained skipwhite nextgroup=jinjaFilter57syn match jinjaFilter contained /[a-zA-Z_][a-zA-Z0-9_]*/58syn match jinjaFunction contained /[a-zA-Z_][a-zA-Z0-9_]*/59syn match jinjaBlockName contained /[a-zA-Z_][a-zA-Z0-9_]*/6061" Jinja template constants62syn region jinjaString containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained start=/"/ skip=/\(\\\)\@<!\(\(\\\\\)\@>\)*\\"/ end=/"/63syn region jinjaString containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained start=/'/ skip=/\(\\\)\@<!\(\(\\\\\)\@>\)*\\'/ end=/'/64syn match jinjaNumber containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /[0-9]\+\(\.[0-9]\+\)\?/6566" Operators67syn match jinjaOperator containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /[+\-*\/<>=!,:]/68syn match jinjaPunctuation containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /[()\[\]]/69syn match jinjaOperator containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /\./ nextgroup=jinjaAttribute70syn match jinjaAttribute contained /[a-zA-Z_][a-zA-Z0-9_]*/7172" Jinja template tag and variable blocks73syn region jinjaNested matchgroup=jinjaOperator start="(" end=")" transparent display containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained74syn region jinjaNested matchgroup=jinjaOperator start="\[" end="\]" transparent display containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained75syn region jinjaNested matchgroup=jinjaOperator start="{" end="}" transparent display containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained76syn region jinjaTagBlock matchgroup=jinjaTagDelim start=/{%-\?/ end=/-\?%}/ containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaRaw,jinjaString,jinjaNested,jinjaComment7778syn region jinjaVarBlock matchgroup=jinjaVarDelim start=/{{-\?/ end=/-\?}}/ containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaRaw,jinjaString,jinjaNested,jinjaComment7980" Jinja template 'raw' tag81syn region jinjaRaw matchgroup=jinjaRawDelim start="{%\s*raw\s*%}" end="{%\s*endraw\s*%}" containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaString,jinjaComment8283" Jinja comments84syn region jinjaComment matchgroup=jinjaCommentDelim start="{#" end="#}" containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaString,jinjaComment8586" Block start keywords. A bit tricker. We only highlight at the start of a87" tag block and only if the name is not followed by a comma or equals sign88" which usually means that we have to deal with an assignment.89syn match jinjaStatement containedin=jinjaTagBlock contained /\({%-\?\s*\)\@<=\<[a-zA-Z_][a-zA-Z0-9_]*\>\(\s*[,=]\)\@!/9091" and context modifiers92syn match jinjaStatement containedin=jinjaTagBlock contained /\<with\(out\)\?\s\+context\>/939495" Define the default highlighting.96" For version 5.7 and earlier: only when not done already97" For version 5.8 and later: only when an item doesn't have highlighting yet98if v:version >= 508 || !exists("did_jinja_syn_inits")99 if v:version < 508100 let did_jinja_syn_inits = 1101 command -nargs=+ HiLink hi link <args>102 else103 command -nargs=+ HiLink hi def link <args>104 endif105106 HiLink jinjaPunctuation jinjaOperator107 HiLink jinjaAttribute jinjaVariable108 HiLink jinjaFunction jinjaFilter109110 HiLink jinjaTagDelim jinjaTagBlock111 HiLink jinjaVarDelim jinjaVarBlock112 HiLink jinjaCommentDelim jinjaComment113 HiLink jinjaRawDelim jinja114115 HiLink jinjaSpecial Special116 HiLink jinjaOperator Normal117 HiLink jinjaRaw Normal118 HiLink jinjaTagBlock PreProc119 HiLink jinjaVarBlock PreProc120 HiLink jinjaStatement Statement121 HiLink jinjaFilter Function122 HiLink jinjaBlockName Function123 HiLink jinjaVariable Identifier124 HiLink jinjaString Constant125 HiLink jinjaNumber Constant126 HiLink jinjaComment Comment127128 delcommand HiLink129endif130131let b:current_syntax = "jinja"132133if main_syntax ==# 'jinja'134 unlet main_syntax135endif
modified:MANIFEST.in-1 removed
2 unmodified lines
3graft artwork4graft docs5prune docs/_build6graft examples7graft ext7graft tests8global-exclude *.pyc