render to XHTML

5 views
Skip to first unread message

Shannon -jj Behrens

unread,
Oct 2, 2006, 8:19:13 PM10/2/06
to gen...@googlegroups.com
Hi,

Please forgive me if I've just totally messed up. I'm using Genshi
with Pylons. I know that Genshi can render to XHTML. If I use Buffet
to plug in Genshi, I don't see a way to tell Buffet that the default
renderer should be XHTML instead of HTML. This seems like a useful
option.

Somewhat off topic, am I being a dork by sticking with XHTML? This
seems to be a hot topic. "DHTML Utopia: Modern Web Design Using
JavaScript & DOM" suggests 4.01 strict, whereas "Build Your Own Ajax
Web Applications" suggests XHTML (and I work with that guy). On the
other hand, Yahoo still uses 4.01 strict, and Genshi defaults to HTML.
I'm sorry if this is a silly, off-topic question.

Thanks,
-jj

--
The one who gets the last laugh isn't the one who did the laughing,
but rather the one who did the writing.

Christopher Lenz

unread,
Oct 4, 2006, 4:22:23 AM10/4/06
to gen...@googlegroups.com
Hi Shannon,

Am 03.10.2006 um 02:19 schrieb Shannon -jj Behrens:
> Please forgive me if I've just totally messed up. I'm using Genshi
> with Pylons. I know that Genshi can render to XHTML. If I use Buffet
> to plug in Genshi, I don't see a way to tell Buffet that the default
> renderer should be XHTML instead of HTML. This seems like a useful
> option.

Absolutely. But looking at the Buffet code, I don't think it supports
passing the "format" argument to the render() method of a template
engine. That's something you should probably nag the Buffet author
about ;-)

Global options are apparently pulled from "genshi_settings" from the
CherryPy config if I correctly read the code. So that would be
another way to let Genshi know which format to produce... except that
the Genshi plugin currently doesn't support any options :-P

I wanted to add configuration options to the plugin for some time
now, such as:

genshi.default_doctype:
the default doctype to generate (html_strict,
xhtml_transitional, etc)
genshi.default_encoding:
the default output encoding
genshi.default_format:
the default output format (xml, xhtml, html or text)
genshi.max_cache_size:
maximum number of templates to keep in the cache
genshi.search_path:
colon-separated(?) list of directories to search for templates

Any others?

> Somewhat off topic, am I being a dork by sticking with XHTML? This
> seems to be a hot topic. "DHTML Utopia: Modern Web Design Using
> JavaScript & DOM" suggests 4.01 strict, whereas "Build Your Own Ajax
> Web Applications" suggests XHTML (and I work with that guy). On the
> other hand, Yahoo still uses 4.01 strict, and Genshi defaults to HTML.
> I'm sorry if this is a silly, off-topic question.

Have you seen <http://webkit.org/blog/?p=68>? Definitely recommended
reading.

Choosing XHTML over HTML is often more of a political decision than a
technical one. Many people use "modern XHTML design" as a selling
point, even though it's technically no better than without the "X".
Pretty much the only technical reason to use XHTML is that you can
use inline MathML or SVG (in some browsers, anyway). Personally, I
use HTML 4.01 Strict for most of my work.

Luckily, with either Genshi or Kid, you don't need to make the
decision early on. It's easy to change the output format later
without touching any of the templates (one possible exception being
script/style elements, but if you follow the advice given in <http://
genshi.edgewall.org/ticket/24#comment:3> you're safe).

Cheers,
Chris
--
Christopher Lenz
cmlenz at gmx.de
http://www.cmlenz.net/

Matt Good

unread,
Oct 4, 2006, 11:57:44 AM10/4/06
to Genshi
Christopher Lenz wrote:
> Hi Shannon,
>
> Am 03.10.2006 um 02:19 schrieb Shannon -jj Behrens:
> > Please forgive me if I've just totally messed up. I'm using Genshi
> > with Pylons. I know that Genshi can render to XHTML. If I use Buffet
> > to plug in Genshi, I don't see a way to tell Buffet that the default
> > renderer should be XHTML instead of HTML. This seems like a useful
> > option.
>
> Absolutely. But looking at the Buffet code, I don't think it supports
> passing the "format" argument to the render() method of a template
> engine. That's something you should probably nag the Buffet author
> about ;-)

Actually Pylons uses its own implementation of the Buffet/TurboGears
template plugin API, but it has the same problem. The "Buffet" class
in Pylons accepts additional kwargs, but the "render" and
"render_response" methods that are typically used don't make it
possible to pass args like "format" to the template. So, it's the
Pylons authors that will need nagged here.

-- Matt Good

Reply all
Reply to author
Forward
0 new messages