[Zope] Re: HTML post processing in Zope
Cyrille Bonnet
cyrille at 3months.com
Mon May 23 17:20:32 EDT 2005
Hi Chris,
Well, you'd better believe it :-)
It works for me so far. But if you have specific examples that I can use
to improve the filter, they would be very welcome.
Two additional things that I had to do to be HTML 4.01 compliant:
* replace <html ...> with <html> (remove the namespace information)
* remove the login portlet: Plone uses form parameters __ac_name and
__ac_password, which the W3C validator rejects as invalid.
I have been customising the templates in the past and it takes a lot of
work, on many templates, all over the place. In addition, I'd like to
keep the content stored in the ZODB as XHTML. And, last but not least, I
can upgrade Plone without having to rework all my templates now.
But if you have a better idea, your suggestions are most weclome.
Back to the insanity ;-)
Cheers.
Cyrille
Chris Withers wrote:
> Cyrille Bonnet wrote:
>
>> Hi all,
>>
>> I got the filter to work. I just added 3 lines of code in
>> "ZPublisher.HTTPResponse.HTTPResponse" (thanks for your suggestion,
>> Dieter):
>>
>> doctype_str_search = re.compile(r'<!DOCTYPE.*>')
>> body = doctype_str_search.sub('<!DOCTYPE HTML PUBLIC
>> "-//W3C//DTD HTML 4.01 Transitional//EN"
>> "http://www.w3.org/TR/html4/loose.dtd">', body)
>>
>> body = body.replace('/>', '>')
>
>
> You can't be serious, right?
>
> The above do NOT suddenly make it HTML 4.01, I'm 90% sure ;-)
>
> Really, you should be customising the templates to serve HTML in the
> format you need rather than persuing this insanity...
>
> Chris
>
More information about the Zope
mailing list