Description
This is a plugin for Textpattern 4.5.4.
Download
Manual
This plugin defines a number of tags to handle the differences between HTML and XHTML. With this Tags you can generate XML declarations, DOC types, namespaces, language attributes and content type meta tags. The difference to handwritten markup is the fallback to SGML based HTML instead of XHTML in case of user agents don’t accept XHTML.
XML Declaration
<txp:shs_xml_declaration/>
generates a XML-Declaration when XHTML is accepted. Using this Tag the Mime-Type in the HTTP-Response is automaticly set to “appllication/xhtml+xml”.
Document Type Definition
The second tag <txp:shs_doctype /> generates a DTD-Declaration. You can select between different HTML and XHTML DTDs. With the attribute xhtmltype you can select the XHTML-DTD to generate if XHTML is acceped by the user agend. As a fallback you can spezifie an old HTML-DTD with the attribute htmltype.
The Following Values are accepted for both attributes:
Attribute Value | DTD Declaration |
html_4_transitional | <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”> |
html_4_strict | <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”> |
xhtml_1_0_transitional | <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> |
xhtml_1_0_strict | <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”> |
xhtml_1_1 | <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN” “http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”> |
xhtml_mathml_svg | <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN” “http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd”> |
html5 | <!DOCTYPE html> |
Example
<txp:shs_doctype html="html_4_strict" xhtml="xhtml_1_0_strict" />
Namespaces
With <txp:shs_namespace />
namespace declarations are generated if XHTML is accepted by the user agent. Otherwise, nothing is added to your page.
By default the XHTML namespace “http://www.w3.org/1999/xhtml” is printet out. In additional you can add SVG, MathML, XLink ore other namespace declarations by using the
attributes svg, mathml, xlink and other.
The Attributes svg, mathml and xlink can use as an boolean attributes. A Value of 0 hide the namspace declaration,
a value of 1 generates a declaration with a prefix of svg, m or xlink. Alterative you can set your own prefix as the attributes value: mathml="math"
.
With the Attribute other you can add additional namespaces to your page.
Use this Tag inside your <HTML> tag.
Example
<html <txp:shs_namespace svg="1" mathml="math" other='exp="http://example.org/namespace"' /> >
Language Attributes
<txp:shs_language />
generates the Attributes “xml:lang” and “lang” in XHTML mode and only “lang” in HTML mode.
The attributes value is set by the lang attribute of <txp:shs_language />.
You can use this Tag in your <HTML> tag.
Example
<html <txp:shs_language lang="de"> >
Meta Tag: Content Type
Most Pages contains an <META> tag declaring the mime typ. With <txp:shs_content_type /> such a tag is generated.
In XHMTL mode it is application/xhtml+xml: <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
.
For Browsers acceptin HTML only it looks like <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
If you using HTMl5 you can also generate the simplified version <meta charset="UTF-8" />
by using the Attribute html5 with a value of “1”.
Use this tag in your <HEAD> tag.
Examples
<head>
<txp:shs_content_type />
</head>
<head>
<txp:shs_content_type html5="1" />
</head>
Conditional Tag
The content of the conditional tag <txp:shs_if_xhtml_accepted> is parsed if the user agend accept XHTML.
Example
<txp:shs_xml_declaration />
<txp:shs_doctype htmltype="html_4_strict" xhtmltype="xhtml_1_0_strict" />
<html <txp:shs_namespace svg="1" mathml="math" other='exp="http://example.org/namespace"' /> <txp:shs_language lang="de-DE" />>
<head> <txp:shs_content_type /> ... <head> <body> ...
<txp:shs_if_xhtml_accepted> ... <txp:else /> ... <txp:shs_if_xhtml_accepted>
... </body> </html>
Licence
This software is licensed under the following GPL license:
* Copyright 2011 Sebastian Spautz * * Textpattern Webmention Plugin is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * see http://www.gnu.org/licenses/.
ChangeLog
- 0.9.0: Register the custom tags to avoid a warning in debug mode of Textpattern
- 0.8.3: First public release