Skip to content
/ mako Public

THIS IS NOT THE OFFICIAL REPO - PLEASE SUBMIT PRs ETC AT: http://github.com/sqlalchemy/mako

License

Notifications You must be signed in to change notification settings

zzzeek/mako

Folders and files

NameName
Last commit message
Last commit date

Latest commit

3fb893e · Apr 10, 2025
Sep 18, 2023
Apr 10, 2025
May 9, 2022
Apr 10, 2025
Apr 10, 2025
Oct 23, 2021
Oct 10, 2021
Sep 18, 2023
Jul 12, 2017
Jan 10, 2014
Jan 2, 2025
Mar 10, 2022
Mar 20, 2019
Sep 2, 2024
May 13, 2024
Oct 23, 2021
Sep 18, 2023

Repository files navigation

Mako Templates for Python

Mako is a template library written in Python. It provides a familiar, non-XML syntax which compiles into Python modules for maximum performance. Mako's syntax and API borrows from the best ideas of many others, including Django templates, Cheetah, Myghty, and Genshi. Conceptually, Mako is an embedded Python (i.e. Python Server Page) language, which refines the familiar ideas of componentized layout and inheritance to produce one of the most straightforward and flexible models available, while also maintaining close ties to Python calling and scoping semantics.

Nutshell

<%inherit file="base.html"/>
<%
    rows = [[v for v in range(0,10)] for row in range(0,10)]
%>
<table>
    % for row in rows:
        ${makerow(row)}
    % endfor
</table>

<%def name="makerow(row)">
    <tr>
    % for name in row:
        <td>${name}</td>\
    % endfor
    </tr>
</%def>

Philosophy

Python is a great scripting language. Don't reinvent the wheel...your templates can handle it !

Documentation

See documentation for Mako at https://docs.makotemplates.org/en/latest/

License

Mako is licensed under an MIT-style license (see LICENSE). Other incorporated projects may be licensed under different licenses. All licenses allow for non-commercial and commercial use.