It seems that Kid is unable to handle nested layout templates.  Here's
what I'm trying to do:

1) i want master.kid to define site-wide metadata and provide the
'login' and 'logout' elements

2) for each section of my site, i want to define a template which
provides a section-specific header and footer.

3) for for each sub-section, i want to define a set of templates which
provide different types of content - charts or graphs, or image
galleries, or whatever.

Here's what i've got (simplified a bit):

master.kid:
-------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<?python import sitetemplate ?>
<html xmlns="http://www.w3.org/1999/xhtml";
xmlns:py="http://purl.org/kid/ns#"; py:extends="sitetemplate">

<head py:match="item.tag == '{http://www.w3.org/1999/xhtml}head'">
    <meta content="text/html; charset=UTF-8" http-equiv="content-type"
py:replace="''"/>
    <title>the title</title>
    <div py:replace="[item.text]+item[:]"/>
</head>
<body py:match="item.tag == '{http://www.w3.org/1999/xhtml}body'">
    <a href="/login">Login</a>
    <div py:replace="[item.text]+item[:]"/>
</body>
</html>
---------------------------

section.kid:
--------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";
xmlns:py="http://purl.org/kid/ns#"; py:layout="'master.kid'">
<head>
        <link href="/static/css/project.css" rel="stylesheet" type="text/css"
/>
</head>

<body>
    <span>Section Title Here</span>
    <content>Default Content Here</content>
</body>

</html>
---------------------------

subsection.kid:
---------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";
xmlns:py="http://purl.org/kid/ns#"; py:layout="'sectiont.kid'">

<div py:match="item.tag == 'content'">
        Project Dashboard Content Here
</div>

</html>
---------------------------

If i view the section template everything works fine - the <head> info
shows up, the login shows up, and the section header shows up.  The
problem is that when i view the subsection template, it only brings in
the content from the section template - it doesn't bring in the <head>
content defined in master.kid.

I've tried different combinations of py:extends and py:layout, and it
seems like when kid extends a template or uses a template as a layout
template, it doesn't serialize the referenced layout before using it.
In other words, Kid only seems to handle one level of inheritance.

Has anyone else been able to chain 3-4 layout templates together and
have them work?  what am i doing wrong?  or is this just one of kid's
limitations?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to