Version 4 > Developer's Guide > HTML Markup

HTML Markup

The markup class (ExSite::ML) has been updated to support HTML5. Set the HTML level it should presume using

markup.html_level = 5  # 4 or 5; 5 is the default

It now AUTOLOADs implicit methods for all tags, so you can call

$ml->foo(...)   # or _foo or __foo

and it will generate markup like

<foo>...</foo>

Smart Headings

ML objects also support smart headings, which allows you to generate well-structured and context-appropriate headings, even in cases where you don't know the current heading level.

$ml->hlevel(n);  # set the heading level without generating a heading
$ml->h1($heading);  # output a heading at level 1, and set that heading level (ditto for h2 ... h6)
$ml->h($heading);  # generating a heading at the current heading level
$ml->_h($heading);  # append a heading at the current heading level
$ml->hup($heading);  # go up/back one heading level (eg. h3 to h2) and generate a heading
$ml->hdown($heading);  # go down one heading level (eg. h2 to h3) and generate a heading