Skip to main content

The foostache template engine.

Project description

PyPI version PyPI - Python Version PyPI - License

foostache

foostache is a language and environment independent template engine.

Unlike alternatives such as Jinja2 and mustache, foostache can theoretically be implemented in any programming language for any runtime environment. The complete language specification can be found here.

This package provides a command-line utility and modules for Python 2 and 3.

Example

A template is marked-up unicode that might look like this:

{{:iterate my_array 1::2}}{{. %5.2f}}{{:before}}[{{:between}}, {{:after}}]{{:end}}

The template can be rendered given a context. The context is usually specified with a JSON value, such as:

{ "my_array": [2.6, 4, 18, 3.51, 42, 96.8] }

When the above context is applied to the above template, the following output is generated:

[ 4.00,  3.51, 96.80]

Command-Line

foostache template-file context-json-file
python -m foostache template-file context-json-file

Module

import foostache

template = foostache.Template("{{:iterate .}}{{.}}{{:end}}")
assert template.render(["a", "b", "c"]) == "abc"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

foostache-1.3.0-py3-none-any.whl (49.3 kB view details)

Uploaded Python 3

File details

Details for the file foostache-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: foostache-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 49.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for foostache-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 226bb08120f0301550384782ab0b9155d48c099303dffb0c29952b96e003c214
MD5 f481264f72c7d746f2182cbc59078de5
BLAKE2b-256 eedc78824f86ce2ed7792fc2cccd7b33ae25d6df90df1f8b8f25424f92017d16

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page