I've got master.kid (simplified):
<html>
<head py:match="item.tag == 'head'">
<title>My Site</title>
</head>
<body py:match="item.tag == 'body'">
<h1>My Site</h1>
<div py:replace="item[:]"></div>
<p id="footer">Copyright Blixt 2010</p>
</body>
</html>
And mypage.kid:
<html>
<head></head>
<body>
<p>Hello World!</p>
</body>
</html>
Now I want it to be possible to add more content before the </body>
tag in the resulting HTML, specific to mypage.kid.
Basically the result should be something this:
<html>
<head>
<title>My Site</title>
</head>
<body>
<h1>My Site</h1>
<p>Hello World!</p>
<p id="footer">Copyright Blixt 2010</p>
<script type="text/javascript">alert('Hello World!');</script>
</body>
</html>
The <script>
tag should be specified in mypage.kid. It's okay if I have to modify master.kid to optionally support additional content before the </body>
tag, but what the content is has to be specified in mypage.kid.
At first I figured adding an element before the </body>
tag in master.kid with py:match="item.tag == 'bodyend'"
would work. The problem is that it uses the position of the element in mypage.kid, and not the position of the element doing py:match
. So if I put the <bodyend>
tag before </body>
in mypage.kid, it is imported before <p id="footer">
, and if I put it below </body>
it will stay there.
How do I set up master.kid and mypage.kid to support adding content immediately before the </body>
tag?