I really like the Mako templating system that's used in Pylons and a couple other Python frameworks, and my only complaint is how much WS leaks through even a simple inheritance scheme.
Is there anyway to accomplish below, without creating such huge WS gaps... or packing my code in like I started to do with base.mako?
Otherwise to get a grip on what I'm trying to accomplish with below.
Base is kind of like interface class for all views for the entire application, layout is just a prototype idea for 3-4 different layout files ( tables, pure CSS, etc ), and controller/action is a test to make sure my idea's are sane.
Short summary of question: How to cut out the WS created in my Mako scheme?
Update: Is not a solution because it involves seeding all of my mako files with \'s http://www.makotemplates.org/docs/syntax.html#syntax_newline
/base.mako
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head><%def name="headtags()"></%def>${self.headtags()}</head>
<body>
<%def name="header()"></%def>${self.header()}${next.body()}<%def name="footer()"></%def>${self.footer()}
</body>
</html>
/layout.mako
<%inherit file="/base.mako"/>
<%def name="headtags()">
${parent.headtags()}
<script src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js"></script>
</%def>
<%def name="header()">
<h1>My Blogination</h1>
</%def>
<div id="content">${next.body()}</div>
/controller/action.mako
<%inherit file="/layout.mako" />
<%def name="headtags()">
<title> Hello world, templating system is 1 percent done</title>
${parent.headtags()}
</%def>
Hello ${c.name}!
rendered output:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title> Hello world, templating system is 1 percent done</title>
<script src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js"></script>
</head>
<body>
<h1>My Blogination</h1>
<div id="content">
Hello Anonymous!
</div>
</body>
</html>