Skip to content

Instantly share code, notes, and snippets.

View elgertam's full-sized avatar
💭
Me : ☕️ ⟼ Code

Andrew Elgert elgertam

💭
Me : ☕️ ⟼ Code
View GitHub Profile
#!/usr/bin/env bash
# https://github.com/mitsuhiko/pipsi
BOOTSTRAP_DIR=~/.local/venvs/__bootstrap
BOOTSTRAP_PKGS=$(cat <<EOF
virtualenv
EOF
)
@elgertam
elgertam / test_template.md
Created February 22, 2017 17:40
Generating & Testing Jinja2 templates in Python

Who Wants to Have Some Fun with Templates!

Jinja2

Jinja2 is a templating language and parsing module built by Armin Ronacher of Flask, Click and Werkzeug fame (among many other accomplishments). Jinja2 is used in a variety of projects, including Flask itself, Ansible and Pelican (a Python static website generator). I've grown quite accustomed to the Jinja2 syntax, and I really love the project.

Jinja2 itself has some interesting syntax for handling whitespace. According to its documentation, a template can control whitespace around template control flow blocks by the placement of a - adjacent to block delimiters. For example,