Mako Cheat Sheet

Published ,  by

Learning Mako by Example

Mako is a powerful templating language built on top of Python.  Mako is written by Mike BayerThe development repository is on GitHub.

This page teaches Mako's most essential features through a series of examples.  If you have questions about anything, or if you want to learn about other cool Mako features that are not covered here, refer to the official Mako docs.

Why Mako?

I need to explain why I chose Mako, rather than Jinja2, Cheetah, Django Templates, or others.

Text and Unicode

Comments and <%text>



Flow Controls

<% ... %>

<%! ... %>


start elif for for for for-else while try try-else finally with 1.34 1.53 1.68 4/2210 21047 end inline execution = ['start', 'elif', 'for', 'for', 'for', 'for-else', 'while', 'try', 'try-else', 'finally', 'with', 'end'] module execution = ['start', 'if', 'elif', 'else', 'for', 'for-else', 'while', 'while-else', 'try', 'except', 'try-else', 'finally', 'with', 'end']

Related Blog Posts: