method
html
html(attributes = {})
public
Generate a top-level HTML element as a string.
The attributes of the element are specified as a hash. The pseudo-attribute “PRETTY” can be used to specify that the generated HTML string should be indented. “PRETTY” can also be specified as a string as the sole argument to this method. The pseudo-attribute “DOCTYPE”, if given, is used as the leading DOCTYPE SGML tag; it should include the entire text of this tag, including angle brackets.
The body of the html element is supplied as a block.
html{ "string" } # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><HTML>string</HTML> html("LANG" => "ja") { "string" } # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><HTML LANG="ja">string</HTML> html("DOCTYPE" => false) { "string" } # <HTML>string</HTML> html("DOCTYPE" => '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">') { "string" } # <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><HTML>string</HTML> html("PRETTY" => " ") { "<BODY></BODY>" } # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> # <HTML> # <BODY> # </BODY> # </HTML> html("PRETTY" => "\t") { "<BODY></BODY>" } # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> # <HTML> # <BODY> # </BODY> # </HTML> html("PRETTY") { "<BODY></BODY>" } # = html("PRETTY" => " ") { "<BODY></BODY>" } html(if $VERBOSE then "PRETTY" end) { "HTML string" }