Skip to main content
# Jinja2 Support for Pydgeot
Add support for [Jinja2](https://github.com/mitsuhiko/jinja2) templates to
[Pydgeot](http://www.github.com/broiledmeat/pydgeot). Any changes to extended or included templates will propagate
regeneration to the file that used those templates. Templates may set context variables that are accessible from
other templates, which will also affect the regeneration.

### Features
- Standard [Jinja2](https://github.com/mitsuhiko/jinja2) templating.
- Globally available context variables.
- Regenerate files dependent on other templates or context variables.

### Requirements
- Python 3.*
- [Pydgeot](http://www.github.com/broiledmeat/pydgeot)
- [Jinja2](https://github.com/mitsuhiko/jinja2)

### Installation
Via pip:
```bash
pip install pydgeot_jinja
```

Or via source:
```bash
git clone https://github.com/broiledmeat/pydgeot_jinja.git pydgeot_jinja
cd pydgeot_jinja
python setup.py install
```

### Configuration
Add `jinja` to your pydgeot.conf `plugins` list to enable the plugin. Then add `jinja` to the `processors` list in
pydgeot.conf, or nested .pydgeot.conf's, to use the file processor. Options are, also, placed under a `jinja` key.
- `source_ext` Extension of source files to build. _Default: .html_
- `build_ext` Extension of built files. _Default: .html_
```json
{
"plugins": ["jinja"],
"processors": ["jinja"],
"jinja" {
"source_ext": ".jinja"
}
}
```

### Usage
The Jinja2 plugin will process any `.html` (or `source_ext` extension specified in pydgeot.conf) file as a Jinja2
template.

A page may be marked as template only by setting the `template_only` variable to `True`. This will cause the file to not
be generated, but any changes will still cause dependent files to be generated.

#### Context Variables
Setting a context variable makes it available to the file it was created in, and to any other template file.
`{% setcontext name="value" }%`

Context variables can be accessed in the setting file (or extended and included files,) in the same way as if it had
been created with the standard Jinja `set`.

Context variables may be created with the same names across multiple sources, so global access is done iteratively.
`getcontexts(name, "value")` will retrieve a list of files that have set a context variable matching the name and value.
The value may be a [glob pattern](https://github.com/broiledmeat/pydgeot#glob-patterns).

For example, `{% for page in getcontexts("fullname", "test.*") %}` would find any file with context variables named
"fullname" with values starting with "test.", then grab all of that files context variables and set them as properties
of `page`.

Metadata

Release files for pydgeot_jinja 0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydgeot_jinja 0.5
File Size Uploaded Provenance Actions
pydgeot_jinja-0.5.tar.gz 4.6 kB Without provenance Details for pydgeot_jinja-0.5.tar.gz

Release files / pydgeot_jinja-0.5.tar.gz

Download URL pydgeot_jinja-0.5.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b47d7e2436d1f4aacbcffc699d487d850d90f361e923ab6d07d101502fce8e18
BLAKE2b-256 checksum
How to use checksums
1e03fbeea95c47c387c18d3bd852e45675b3cb01f79a1c3530e217c1cde1afae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pydgeot_jinja 0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page