1.1.1.2.1.5. nikola.plugins.template package — Nikola 8.1.3 documentation

# 1.1.1.2.1.5. nikola.plugins.template package

Default template engines for Nikola.

## 1.1.1.2.1.5.1. Submodules

## 1.1.1.2.1.5.2. nikola.plugins.template.jinja module

Jinja template handler.

class nikola.plugins.template.jinja.JinjaTemplates

  Bases: :class:`nikola.plugin_categories.TemplateSystem`

  Support for Jinja2 templates.

  create_lookup()

    Create a template lookup.

  dependency_cache = {}
  get_deps(filename, context=None)

    Return paths to dependencies for the template loaded from filename.

  get_string_deps(text, context=None)

    Find dependencies for a template string.

  get_template_path(template_name)

    Get the path to a template or return None.

  inject_directory(directory)

    Add a directory to the lookup and recreate it if it’s not there yet.

  lookup = None
  name = 'jinja'
  per_file_cache = {}
  render_template(template_name, output_name, context)

    Render the template into output_name using context.

  render_template_to_string(template, context)

    Render template to a string using context.

  set_directories(directories, cache_folder)

    Create a new template lookup with set directories.

  set_site(site)

    Set the Nikola site.

  template_deps(template_name, context=None)

    Generate list of dependencies for a template.

## 1.1.1.2.1.5.3. nikola.plugins.template.mako module

Mako template handler.

class nikola.plugins.template.mako.MakoTemplates

  Bases: :class:`nikola.plugin_categories.TemplateSystem`

  Support for Mako templates.

  cache = {}
  cache_dir = None
  create_lookup()

    Create a template lookup.

  directories = []
  filters = {}
  get_deps(filename, context=None)

    Get paths to dependencies for a template.

  get_string_deps(text, context=None, *, filename=None)

    Find dependencies for a template string.

  get_template_path(template_name)

    Get the path to a template or return None.

  inject_directory(directory)

    Add a directory to the lookup and recreate it if it’s not there yet.

  lookup = None
  name = 'mako'
  render_template(template_name, output_name, context)

    Render the template into output_name using context.

  render_template_to_string(template, context)

    Render template to a string using context.

  set_directories(directories, cache_folder)

    Create a new template lookup with set directories.

  set_site(site)

    Set the Nikola site.

  template_deps(template_name, context=None)

    Generate list of dependencies for a template.

nikola.plugins.template.mako.striphtml(text)

  Strip HTML tags from text.