In the current Plone main_template we have the following code:
<metal:page define-macro="master">
<tal:doctype tal:replace="structure string:<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">"
/>
As part of creating a new theme for Plone 4, I'd like to clean this up,
and define the whole page macro on the <html> tag, as ZPT intends you to
do. The code would then look like this:
<!DOCTYPE html>
<html metal:define-macro="master">
The problem with this is that the doctype is then outside of the master
macro, so any page template that fills the slots in the template will have
to define its own doctype. People never remember to do this, and it was
indeed a problem in Plone 1.0, since the browser goes into quirks mode if
you forget.
I'd like a better solution for this, but it would probably involve fixing
up ZPT (and possibly Chameleon) to know what to do if there's a missing
doctype. There's a related problem when you are rendering XML, the
mandatory <?xml> header:
<?xml version="1.0" encoding="UTF-8"?>
In my opinion, ZPT/Chameleon should special-case this, since it's hard to
handle with the standard structures — since it doesn't behave like other
tags (and they aren't tags, technically).
A configuration option that allows you to specify the header for a given
rendered MIME type would be ideal. That way, you could specify the above
header for application/xml, and a doctype header for text/html.
We have the following options:
1) Add a DOCTYPE declaration to every page template in Plone and in add-on
products. If people forget this, the page will be rendered in quirks mode
— not a good thing, you get the wrong box model, etc. I don't think this
is a realistic option.
2) Figure out a way to make ZPT (and Chameleon?) specify a default doctype
if one is missing. This is my preferred solution, but I have no idea how
hard it would be to implement.
3) Do nothing, and live with ugly/confusing markup.
Thoughts and ideas appreciated.
--
Alexander Limi ·
http://limi.net------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at:
http://p.sf.net/sfu/Challenge_______________________________________________
Plone-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-developers