Class it_html:

/**
 * Return doctype and entire HTML page.
 * Example application code to render page:
 *     echo html(head(...), body(...));
 *
 * @param any number of text args or array of key => value pairs
 * Defaults for key => value parameters are inherited from the it_html constructor and should be set there.
 * The parameters are $p['lang'], $p['htmltype'], $p['doctype'], $p['class'] and $p['manifest']
 */
function html($args)
{
    list($data, $p) = it_parse_args($args);
    $p += $this->p;

    foreach (array('class', 'manifest') as $attr)
        $attrs .= $p[$attr] ? " $attr=" . '"' . Q($p[$attr]) . '"' : "";

    $html = ($p['doctype'] ? $p['doctype'] : $this->doctypes[$p['htmltype']]) . "\n" .
        '<html ' . ($p['htmltype'] == "xhtml" ? 'xmlns="http://www.w3.org/1999/xhtml" ' : '') . ($p['htmltype'] == "xhtml-mobile" ? 'xml:lang' : 'lang') . "=\"{$p['lang']}\"$attrs>\n" . $data . ($p['omit_endhtml'] ? '' : "</html>\n");

    return EDC('upd') ? it::replace(array('<!DOCTYPE.*<head>' => ''), $html, array('singleline' => true)) : $html;
}