Summary: resources to use new HTML5 elements
Prerequisites: PmWiki 2.2.58 or newer
Status: new
Categories: Markup HTML5 PHP55
Users: (view? / edit)

Questions answered by this recipe

How can I use new HTML5 elements?


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  Play HTML5 Audio (obsolete - use APE - Automagical PmWiki Embed instead)
HTML5Video  Show HTML5 Video (obsolete - use APE - Automagical PmWiki Embed instead)
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',
  "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;



Change log / Release notes

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

See also



See discussion at HTML5Extensions-Talk