Skip to content
This repository has been archived by the owner on Oct 30, 2019. It is now read-only.

[WIP] This project tests compatibility of Jinja2 template language with Nunjucks and Twig.

Notifications You must be signed in to change notification settings

jbmoelker/jinja-compat-tests

Repository files navigation

[WIP] Jinja Compat Tests

This project tests compatibility of Jinja2 template language with Nunjucks and Twig.

Build Status

Jinja2 (Python) introduced an expressive template language. It has since been adapted by other template engines (languages): Nunjucks (JavaScript), Twig (PHP) and others. While the template syntax between these implementations is very similar, they do have their differences. This project uses a single set of tests, generates the output with all template engines separately, and then compares the output.

Test results

You can browse the test results online. In addition all raw data is available as JSON:

Test setup

This project aims to cover all features of the templating language(s). The test setup consists of:

All scripts render the tests to output/ in a directory per template engine. The output file has the same name as the test file, but with the rendered result. If a render error occurs an error log file is written to the tests output destination instead.

Test engines

Jinja2

Install

The Jinja2 setup requires Python (>= 3.3) and pip3 (comes with Python3) to be installed. Then install dependencies:

pip3 install -r requirements.txt

Run tests

Render all tests to output/jinja2/:

python3 test-jinja2.py

Nunjucks

Install

The Nunjucks setup requires NodeJS (>= 6.0) and npm (comes with Node) to be installed. Then install dependencies:

npm install

Run tests

Render all tests to output/nunjucks/:

node test-nunjucks.js

Twig

Install

The Twig setup requires PHP (>= 5.5.9) and Composer to be installed. Then install dependencies:

composer install

Run tests

Render all tests to output/twig/:

php test-twig.php

Swig

Install

The Swig setup requires NodeJS (>= 6.0) and npm (comes with Node) to be installed. Then install dependencies:

npm install

Run tests

Render all tests to output/swig/:

node test-swig.js

Django

Install

The Django setup requires Python (>= 3.3) and pip3 (comes with Python3) to be installed. Then install dependencies:

pip3 install -r requirements.txt

Run tests

Render all tests to output/django/:

python3 test-django.py

Roadmap

  • Tests for all templating features and all their use cases
  • UI to compare output of templating engines
  • Add more templating engines (Jinjava (Java), Pongo (Go Lang), ...)

About

[WIP] This project tests compatibility of Jinja2 template language with Nunjucks and Twig.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages