Cookbook /
HTML5Extensions
Summary: resources to use new HTML5 elements
Version:
Prerequisites: PmWiki 2.2.58 or newer
Status: new
Maintainer:
Discussion: HTML5Extensions-Talk
Questions answered by this recipe
How can I use new HTML5 elements?
Description
Various HTML5 extension recipes.
List of Recipes
- Cookbook /
- Audio5 HTML5 Audio Support for PmWiki (Stable)
- FormsPlus Form extensions adding new HTML5 input types (new updated)
- HTML5Audio
- HTML5Video
- Video5 HTML5 Video Support for PmWiki (Stable)
HTML5 Markup extensions
Note: Semantic HTML5 tags (article, section, nav, header, footer, aside, address) are included in PmWiki distribution from version 2.2.75 (2015-04-26).
For a start some code snippets to add new markup rules to older version.
Add to config.php:
Some new semantic block-level elements
(:article:), (:section:), (:header:), (:footer:), (:nav:), (:aside:), (:canvas:), (:address:) All closing with (:<tagname>end:)
(:article:) and (:section:) can be nested using numerals prepended, same as used in div markup
Attributes are passed on. First name without a key= is used as id=<name>.
Markup_e('html5', '>table',
'/^\\(:((article\\d*|section\\d*|header|footer|nav|aside|canvas|address)(?:end)?)(\\s.*?)?:\\)/i',
"HTML5Block(\$m[1], \$m[3])");
function HTML5Block($name,$attr) {
global $MarkupFrame;
$attr = preg_replace("/^\\s*([\\w]+)\\s?/","id='$1'",$attr);
$attr = PQA($attr);
$name = strtolower($name);
$key = preg_replace('/end$/', '', $name);
$out = '<:block>'.MarkupClose($key);
if (substr($name, -3) == 'end') return $out;
$cf = & $MarkupFrame[0]['closeall'];
$el = preg_replace("/\\d+/",'',$key);
$out .= "\n<$el $attr>";
$cf[$key] = '
</'.$el.'><!-- '.$key.' end -->';
return $out;
}
Usage
Notes
Change log / Release notes
See also
Contributors
Comments
See discussion at HTML5Extensions-Talk