Not quite, lets see if this clears things up.  Here is the default head
section of master.kid:

{{{
<head py:match="item.tag=='{http://www.w3.org/1999/xhtml}head'" py:attrs="
item.items()">
    <meta content="text/html; charset=UTF-8" http-equiv="content-type"
py:replace="''"/>
    <title py:replace="''">Your title goes here</title>
    <meta py:replace="item[:]"/>
    <style type="text/css">
        #pageLogin
        {
            font-size: 10px;
            font-family: verdana;
            text-align: right;
        }
    </style>
    <style type="text/css" media="screen">
@import "${tg.url('/static/css/style.css')}";
</style>
</head>
}}}

The first line:
<head py:match="item.tag=='{http://www.w3.org/1999/xhtml}head'" py:attrs="
item.items()">

matches the <head> element in the regular template (say welcome.kid) and
assigns it to the name "item"

further down we see:
<meta py:replace="item[:]"/>

what this is saying is that "this meta tag will be replaced by all of the
descendent tags of 'item' (which is <head> from welcome.kid)"

so it does not just apply to the meta tags in welcome.kid, but the entire
contents of <head> in welcome.kid

so if you take it out, the match template (in master.kid) will replace
<head> in welcome.kid, but will not have any of the original contents of
<head> from welcome.kid...which is why your script tags were disappearing.

Does this make things clearer?

Kevin Horn

On Jan 16, 2008 4:11 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
wrote:

>
> Diez
>
> Thanks.  Yes I read the docs and understand that item refers to
> components of an element (meta?) and py:replace just replaces the meta
> element with the contents of the py:replace argument.   If I'm not
> mistaken, doesn't this mean that
> <meta py:replace="item[:]"/> will simply replace the meta element with
> its contents?  That seems weird so I wonder if I'm understanding
> something wrong in docs.
>
> Chris
>
> On Jan 16, 9:57 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> > [EMAIL PROTECTED] schrieb:
> >
> > > Please explain purpose of '<meta py:replace="item[:]"/>' (in Kid
> > > templates).
> >
> > > What is the item object that seems to pop up in a lot of places?
> >
> > > I ran into some problems trying to remove it so I know it is
> > > important.
> > > (Removing it doesn't let me put script elements in head elements.)
> >
> > This is well documented in the KID docs:
> >
> > http://www.kid-templating.org/language.html#match-templates
> >
> > Diez
> >
>

--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to