Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Changing doctypes via the Buffet interface
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Christoph Zwerschke  
View profile  
 More options Sep 23 2008, 6:32 am
From: Christoph Zwerschke <c...@online.de>
Date: Tue, 23 Sep 2008 12:32:49 +0200
Local: Tues, Sep 23 2008 6:32 am
Subject: Changing doctypes via the Buffet interface
In TurboGears, we're on the verge of releasing version 1.1 where Kid has
been replaced with Genshi as the default templating engine.

TurboGears 1.x is using the Buffet API, and we're facing one serious
problem here when making the switch to Genshi, namely that it's
impossible to produce different doctype on different pages, e.g. when
you have part of your application that uses HTML, and a different part
that uses XHTML, or some pages using framesets or quirks mode.

The problem is that the doctype can only be passed to the buffet plugin
as an option at startup time, but at render time you can't overwrite
options any more, you can only overwrite the "format" (which corresponds
to Genshi's "method" parameter). If you set up the plugin with "html" as
the default method, and a html doctype, though you can later render
templates with an "xhtml" method, they still get the wrong html doctype.

We did not have this problem with Kid, since you can pass a doctype by
specifying e.g. "html-frameset", or "xhtml-strict" as the Buffet format
parameter; the format name in Kid always indirectly determines the
doctype as well. In Genshi however, you can only pass "html" or "xhtml"
here, and the doctype is chosen separately beforehand.

Also, in Kid you can pass serializer instances in the Buffet format
parameter, which have a suiting doctype already set, but in Genshi, you
can pass only serializer *classes* which are later initialized with the
default doctype that the plugin has been initialized with.

Here are some ideas how this problem could be solved in Genshi:

1) Let all serializer classes have their own default doctypes which will
be used when initialized with no doctype or an incompatible doctype.

2) Allow not only the names 'html', 'xhtml', 'xml', 'text' as rendering
methods, but also all names of doctypes such as 'html-transitional',
'html-frameset' etc. to specify method plus doctype in one parameter.

3) Add a parameter "options" to the Buffet API render method allowing to
overwrite any default parameters (particularly, the doctype parameter)
at rendering time.

Let me know how you think about this or if there are any better ideas.

-- Christoph


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeroen Ruigrok van der Werven  
View profile  
 More options Sep 24 2008, 4:30 am
From: Jeroen Ruigrok van der Werven <asmo...@in-nomine.org>
Date: Wed, 24 Sep 2008 10:30:26 +0200
Local: Wed, Sep 24 2008 4:30 am
Subject: Re: Changing doctypes via the Buffet interface
-On [20080923 12:33], Christoph Zwerschke (c...@online.de) wrote:

>2) Allow not only the names 'html', 'xhtml', 'xml', 'text' as rendering
>methods, but also all names of doctypes such as 'html-transitional',
>'html-frameset' etc. to specify method plus doctype in one parameter.

Perhaps I am missing or misunderstanding something, but I am using this:

self.stream.render('xhtml', doctype=DocType.XHTML_STRICT)

with Geshi which allows me to precisely specify which doctype of XHTML I
want.

--
Jeroen Ruigrok van der Werven <asmodai(-at-)in-nomine.org> / asmodai
イェルーン ラウフロック ヴァン デル ウェルヴェン
http://www.in-nomine.org/ | http://www.rangaku.org/ | GPG: 2EAC625B
He who knows, does not speak. He who speaks, does not know...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christoph Zwerschke  
View profile  
 More options Sep 24 2008, 5:08 am
From: Christoph Zwerschke <c...@online.de>
Date: Wed, 24 Sep 2008 11:08:25 +0200
Local: Wed, Sep 24 2008 5:08 am
Subject: Re: Changing doctypes via the Buffet interface
Jeroen Ruigrok van der Werven schrieb:

> Perhaps I am missing or misunderstanding something, but I am using this:

> self.stream.render('xhtml', doctype=DocType.XHTML_STRICT)

> with Geshi which allows me to precisely specify which doctype of XHTML I
> want.

That's right, this is no problem if you're using Genshi directly. But
I'm talking about using Genshi via the Genshi Buffet interface (as used
by e.g. TurboGears 1.x). There is currently no way of passing in the
doctype parameter via Buffet at render time.

-- Christoph


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matt Good  
View profile  
 More options Oct 4 2008, 8:40 pm
From: Matt Good <matt+g...@matt-good.net>
Date: Sat, 4 Oct 2008 17:40:37 -0700 (PDT)
Local: Sat, Oct 4 2008 8:40 pm
Subject: Re: Changing doctypes via the Buffet interface
On Sep 23, 3:32 am, Christoph Zwerschke <c...@online.de> wrote:

Provide a patch to MarkupTemplateEnginePlugin._get_render_options to
map extended format names like those to the expected doctype and I'll
make sure it gets in.

http://genshi.edgewall.org/browser/trunk/genshi/template/plugin.py#L142

-- Matt


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »