[Imps] HTML5 integration in Genshi (input, output and now templates!)

Thomas Broyer t.broyer at gmail.com
Wed Mar 28 00:45:52 PDT 2007


2007/3/27, Thomas Broyer:
> 2007/3/26, Thomas Broyer:
> >
> > I'm wondering whether I'll use Kid or Genshi myself*, so I'll probably
> > contribute an HTML5Serializer to Genshi too…
>
> Done!
>
> http://genshi.edgewall.org/ticket/108
>
> along with an HTML5Parser

Now with an HTML5Template! (see the revised patch)

(Since there are no PIs in HTML5, there's currently no way to include
python script inside a template; would <script type="text/x-python">
be a good replacement for <?python> ?)

Example (the 'time' should have been passed in the context data):
<!DOCTYPE html>
<title>${title}</title>
<nav>
<menu type="toolbar" py_for="item in sitemap">
   <li><a href="${item.url}">${item.label}</a>
</menu></nav>
<h1>${title}</h1>
<article py:for="entry in entries">
   <h2>${entry.title}</h2>
   <p>Published <time datetime='${time.strftime("%Y-%m-%dT%H:%M:%SZ",
time.gmtime(entry.pubdate))}'>${time.strftime("the %x at %X",
time.localtime(entry.pubdate))}</time> by <cite
py_content="entry.author">Author placeholder</cite></p>
   ${entry.content}
</article>


-- 
Thomas Broyer


More information about the Implementors mailing list