10 Variable x has content: ${x}
12 Escaped for HTML: ${x | h}
15 ### Control structures
27 ### Including Python code
31 greeting = "Hello world!"
32 # arbitrary python code
36 # arbitrary python code run at toplevel
37 # cannot access variables!
39 def sign_string(number):
53 This is a raw block where ${nothing is evaluated}
57 and <html is escaped> too with "h" filter
60 <%def name="myfunc(x)">
61 this is a reusable macro, with arguments: ${x}
78 <title><%block name="title" /></title>
81 <header><h1><%block name="title" /></h1></header>
82 <main>${self.body()}</main>
90 <%inherit file="shared.html" />
91 <%block name="title">Welcome to my site</%block>
99 <%inherit file="shared.html" />
100 <%block name="title">${post.title}</%block>
110 from mako.template import Template
112 mytemplate = Template("hello, ${name}!")
113 print(mytemplate.render(name="jack"))