|
Cookbook /
HTML5ExtensionsSummary: resources to use new HTML5 elements
Version:
Prerequisites:
Status: new
Maintainer:
Discussion: HTML5Extensions-Talk
Questions answered by this recipeHow can I use new HTML5 elements? DescriptionVarious HTML5 extension recipes. List of Recipes
HTML5 Markup extensionsFor a start some code snippets to add new markup rules. Some new semantic block-level elements(:article:), (:section:), (:header:), (:footer:), (:nav:), (:aside:), (:canvas:), (:address:) All closing with (:<tagname>end:)
Markup('html5', '>table',
'/^\\(:((article\\d*|section\\d*|header|footer|nav|aside|canvas|address)(?:end)?)(\\s.*?)?:\\)/ie',
"HTML5Block('$1',PSS('$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;
}
UsageNotesChange log / Release notes
See alsoContributorsCommentsSee discussion at HTML5Extensions-Talk |