port the sample templates over to Mako

This commit is contained in:
Mark McClain
2011-01-05 10:37:36 -05:00
parent 289c04c044
commit 8a5030aa88
3 changed files with 36 additions and 25 deletions

View File

@@ -1,8 +1,11 @@
<html py:extends="layout.html">
<head>
<title py:block="title">Welcome to Pecan!</title>
</head>
<body py:block="body">
<%inherit file="layout.html" />
## provide definitions for blocks we want to redefine
<%def name="title()">
Welcome to Pecan!
</%def>
## now define the body of the template
<header>
<h1>Welcome to Pecan</h1>
</header>
@@ -10,7 +13,7 @@
<ul>
<li>The ability to serve static files.</li>
<li>Templating using the <a href="http://kajiki.pythonisito.com/">Kajiki template engine</a>.</li>
<li>Templating using the <a href="http://www.makotemplates.org">Mako template engine</a>.</li>
<li>Built-in error management using <a href="http://pypi.python.org/pypi/WebError">WebError</a>.</li>
</ul>
@@ -40,5 +43,5 @@
<input type="submit" />
</form>
</body>
</html>

View File

@@ -1,13 +1,20 @@
<html>
<head>
<title py:block="title">Default Title</title>
<py:block name="style">
<link rel="stylesheet" type="text/css" media="screen" href="/css/style.css" />
</py:block>
<py:block name="javascript" py:strip="True">
<script language="text/javascript" src="/javascript/shared.js" />
</py:block>
<title>${self.title()}</title>
${self.style()}
${self.javascript()}
</head>
<body py:block="body">
</body>
</html>
${self.body()}
</html>
<%def name="title()">
Default Title
</%def>
<%def name="style()">
<link rel="stylesheet" type="text/css" media="screen" href="/css/style.css" />
</%def>
<%def name="javascript()">
<script language="text/javascript" src="/javascript/shared.js"></script>
</%def>

View File

@@ -1,11 +1,12 @@
<html py:extends="layout.html">
<head>
<title py:block="title">Success!</title>
</head>
<body py:block="body">
<%inherit file="layout.html"/>
## override the title
<%def name="title()">
Success!
</%def>
## now define the body
<header>
<h1>Success!</h1>
</header>
<p>Your form submission was successful! Thanks, ${name}!</p>
</body>
</html>