#67686Clean way to extract doctype
Description
Typo3 CMS is allowing a user to set a custom doctype string in
config.doctype
instead of using one of the constants:
xhtml_trans for the XHTML 1.0 Transitional doctype. xhtml_frames for the XHTML 1.0 Frameset doctype. xhtml_strict for the XHTML 1.0 Strict doctype. xhtml_basic for the XHTML basic doctype. xhtml_11 for the XHTML 1.1 doctype. xhtml+rdfa_10 for the XHTML+RDFa 1.0 doctype. html5 for the HTML5 doctype. none for no doctype at all.
When a custom doctype string is used then the user MUST set
config.xhtmlDoctype
which is one of
xhtml_trans for XHTML 1.0 Transitional doctype. xhtml_frames for XHTML 1.0 Frameset doctype. xhtml_strict for XHTML 1.0 Strict doctype. xhtml_basic for XHTML basic doctype. xhtml_11 for XHTML 1.1 doctype.
Is there a clean way to extract the doctype suitable for a standard conform tag generation (validation)?
Allowing a custom doctype string in
config.doctype
makes it necessary to use another config variable (xhtmlDoctype) for exactly the same thing even using the same constants. And there’s more to come like
This specification defines version 5.0 of the XHTML syntax, known as "XHTML 5".
mentioned in http://www.w3.org/TR/html5/introduction.html#html-vs-xhtml
I suggest to
- use a new config variable
config.customDoctypeString
. If set, it overwrites the doctype string generated viaconfig.doctype
- deprecate and later remove
config.xhtmlDoctype
. It’s obsolete then. - not allow costom doctype strings any longer in
config.doctype
For BC, I suggest to
- look if
config.doctype
contains a custom doctype string (which is not in the list of constants). If that’s the case, then - copy the value of
config.doctype
intoconfig.customDoctypeString
. - copy the value of
config.xhtmlDoctype
intoconfig.doctype
(documentation says it MUST be set when using a custom doctype string)
BC could be removed when deprecation period is over. I guess that extensions would be more compatible with old well-defined known constants than they are now with custom doctype strings. Still, the full gain occurs already during deprecation period. Later on, existing users only have to configure themselves what the BC does before it’s removed.
A use case would be https://github.com/mblaschke/TYPO3-metaseo/issues/70
Personally, I’d also like to see PHP constants to be used for doctype constants. They could be reused in extensions and be up-to-date when e.g. a doctype changes from html_5 to html5.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.