Project

General

Profile

Actions

Feature #67686

closed

Clean way to extract doctype

Added by Thomas Mayer almost 9 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Should have
Category:
Frontend
Start date:
2015-06-22
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

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 via
    config.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
    into
    config.customDoctypeString
    .
  • copy the value of
    config.xhtmlDoctype
    into
    config.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.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #40503: XHTML 5Closed2012-09-01

Actions
Actions

Also available in: Atom PDF