<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head profile="http://internetalchemy.org/2003/02/profile"> <link rel="foaf" type="application/rdf+xml" title="FOAF" href="http://www.openlinksw.com/dataspace/uda/about.rdf" /> <link rel="schema.dc" href="http://purl.org/dc/elements/1.1/" /> <meta name="dc.title" content="Function: tidy_html - Virtuoso Functions Guide" /> <meta name="dc.subject" content="Function: tidy_html - Virtuoso Functions Guide" /> <meta name="dc.creator" content="OpenLink Software Documentation Team ; " /> <meta name="dc.copyright" content="OpenLink Software, 1999 - 2009" /> <link rel="top" href="index.html" title="OpenLink Virtuoso Universal Server: Documentation" /> <link rel="search" href="/doc/adv_search.vspx" title="Search OpenLink Virtuoso Universal Server: Documentation" /> <link rel="parent" href="functions.html" title="Chapter Contents" /> <link rel="prev" href="appendixa.html" title="Appendix" /> <link rel="next" href="functions.html#.html" title="" /> <link rel="shortcut icon" href="../images/misc/favicon.ico" type="image/x-icon" /> <link rel="stylesheet" type="text/css" href="doc.css" /> <link rel="stylesheet" type="text/css" href="/doc/translation.css" /> <title>Function: tidy_html - Virtuoso Functions Guide</title> <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" /> <meta name="author" content="OpenLink Software Documentation Team ; " /> <meta name="copyright" content="OpenLink Software, 1999 - 2009" /> <meta name="keywords" content="" /> <meta name="GENERATOR" content="OpenLink XSLT Team" /> </head> <body> <div id="header"> <a name="fn_tidy_html" /> <img src="../images/misc/logo.jpg" alt="" /> <h1>22. Virtuoso Functions Guide - tidy_html</h1> </div> <div id="navbartop"> <div> <a class="link" href="functions.html">Chapter Contents</a> | <a class="link" href="fn_serialize_to_UTF8_xml.html" title="serialize_to_UTF8_xml">Prev</a> | <a class="link" href="fn_tidy_list_errors.html" title="tidy_list_errors">Next</a> </div> </div> <div id="currenttoc"> <form method="post" action="/doc/adv_search.vspx"> <div class="search">Keyword Search: <br /> <input type="text" name="q" /> <input type="submit" name="go" value="Go" /> </div> </form> <div> <a href="http://www.openlinksw.com/">www.openlinksw.com</a> </div> <div> <a href="http://docs.openlinksw.com/">docs.openlinksw.com</a> </div> <br /> <div> <a href="index.html">Book Home</a> </div> <br /> <div> <a href="contents.html">Contents</a> </div> <div> <a href="preface.html">Preface</a> </div> <br /> <div> <a class="selected" href="functions.html">Virtuoso Functions Guide</a> </div> <br /> <div> <a href="functions.html#admin">Administration</a> </div> <div> <a href="functions.html#aggr">Aggregate Functions</a> </div> <div> <a href="functions.html#array">Array Manipulation</a> </div> <div> <a href="functions.html#bpel">BPEL APIs</a> </div> <div> <a href="functions.html#backup">Backup</a> </div> <div> <a href="functions.html#compression">Compression</a> </div> <div> <a href="functions.html#cursors">Cursor</a> </div> <div> <a href="functions.html#time">Date & Time Manipulation</a> </div> <div> <a href="functions.html#debug">Debug</a> </div> <div> <a href="functions.html#dict">Dictionary Manipulation</a> </div> <div> <a href="functions.html#encoding">Encoding & Decoding</a> </div> <div> <a href="functions.html#file">File Manipulation</a> </div> <div> <a href="functions.html#ft">Free Text</a> </div> <div> <a href="functions.html#hash">Hashing / Cryptographic</a> </div> <div> <a href="functions.html#ldap">LDAP</a> </div> <div> <a href="functions.html#localization">Locale</a> </div> <div> <a href="functions.html#mail">Mail</a> </div> <div> <a href="functions.html#misc">Miscellaneous</a> </div> <div> <a href="functions.html#number">Number</a> </div> <div> <a href="functions.html#phrz">Phrases</a> </div> <div> <a href="functions.html#rdf">RDF data</a> </div> <div> <a href="functions.html#rmt">Remote SQL Data Source</a> </div> <div> <a href="functions.html#repl">Replication</a> </div> <div> <a href="functions.html#soap">SOAP</a> </div> <div> <a href="functions.html#sql">SQL</a> </div> <div> <a href="functions.html#string">String</a> </div> <div> <a href="functions.html#txn">Transaction</a> </div> <div> <a href="functions.html#type">Type Mapping</a> </div> <div> <a href="functions.html#uddi">UDDI</a> </div> <div> <a href="functions.html#udt">User Defined Types & The CLR</a> </div> <div> <a href="functions.html#vad">VAD</a> </div> <div> <a href="functions.html#jvmpl">Virtuoso Java PL API</a> </div> <div> <a href="functions.html#bif">Virtuoso Server Extension Interface (VSEI)</a> </div> <div> <a href="functions.html#ws">Web & Internet</a> </div> <div> <a class="selected" href="functions.html#xml">XML</a> </div> <div class="selected"> <div> <a href="fn_XMLAGG.html">xmlagg</a> </div> <div> <a href="fn_XMLATTRIBUTES.html">xmlattributes</a> </div> <div> <a href="fn_XMLAddAttribute.html">xmladdattribute</a> </div> <div> <a href="fn_XMLAppendChildren.html">xmlappendchildren</a> </div> <div> <a href="fn_XMLCONCAT.html">xmlconcat</a> </div> <div> <a href="fn_XMLELEMENT.html">xmlelement</a> </div> <div> <a href="fn_XMLFOREST.html">xmlforest</a> </div> <div> <a href="fn_XMLInsertAfter.html">xmlinsertafter</a> </div> <div> <a href="fn_XMLInsertBefore.html">xmlinsertbefore</a> </div> <div> <a href="fn_XMLReplace.html">xmlreplace</a> </div> <div> <a href="fn_XMLType.XMLType.html">xmltype.xmltype</a> </div> <div> <a href="fn_XMLType.createNonSchemaBasedXML.html">xmltype.createnonsch...</a> </div> <div> <a href="fn_XMLType.createSchemaBasedXML.html">xmltype.createschema...</a> </div> <div> <a href="fn_XMLType.createXML.html">xmltype.createxml</a> </div> <div> <a href="fn_XMLType.existsNode.html">xmltype.existsnode</a> </div> <div> <a href="fn_XMLType.extract.html">xmltype.extract</a> </div> <div> <a href="fn_XMLType.getClobVal.html">xmltype.getclobval</a> </div> <div> <a href="fn_XMLType.getNamespace.html">xmltype.getnamespace</a> </div> <div> <a href="fn_XMLType.getNumVal.html">xmltype.getnumval</a> </div> <div> <a href="fn_XMLType.getRootElement.html">xmltype.getrooteleme...</a> </div> <div> <a href="fn_XMLType.getSchemaURL.html">xmltype.getschemaurl</a> </div> <div> <a href="fn_XMLType.getStringVal.html">xmltype.getstringval</a> </div> <div> <a href="fn_XMLType.isFragment.html">xmltype.isfragment</a> </div> <div> <a href="fn_XMLType.isSchemaBased.html">xmltype.isschemabase...</a> </div> <div> <a href="fn_XMLType.isSchemaValid.html">xmltype.isschemavali...</a> </div> <div> <a href="fn_XMLType.isSchemaValidated.html">xmltype.isschemavali...</a> </div> <div> <a href="fn_XMLType.schemaValidate.html">xmltype.schemavalida...</a> </div> <div> <a href="fn_XMLType.setSchemaValidated.html">xmltype.setschemaval...</a> </div> <div> <a href="fn_XMLType.toObject.html">xmltype.toobject</a> </div> <div> <a href="fn_XMLType.transform.html">xmltype.transform</a> </div> <div> <a href="fn_XMLUpdate.html">xmlupdate</a> </div> <div> <a href="fn_xper_right_sibling.html">xper navigation</a> </div> <div> <a href="fn_createXML.html">createxml</a> </div> <div> <a href="fn_isentity.html">isentity</a> </div> <div> <a href="fn_serialize_to_UTF8_xml.html">serialize_to_utf8_xm...</a> </div> <div> <a class="selected" href="fn_tidy_html.html">tidy_html</a> </div> <div> <a href="fn_tidy_list_errors.html">tidy_list_errors</a> </div> <div> <a href="fn_updateXML.html">updatexml</a> </div> <div> <a href="fn_xml_add_system_path.html">xml_add_system_path</a> </div> <div> <a href="fn_xml_auto.html">xml_auto</a> </div> <div> <a href="fn_xml_auto_dtd.html">xml_auto_dtd</a> </div> <div> <a href="fn_xml_auto_schema.html">xml_auto_schema</a> </div> <div> <a href="fn_xml_create_tables_from_mapping_schema_decl.html">xml_create_tables_fr...</a> </div> <div> <a href="fn_xml_cut.html">xml_cut</a> </div> <div> <a href="fn_xml_doc_output_option.html">xml_doc_output_optio...</a> </div> <div> <a href="fn_xml_get_system_paths.html">xml_get_system_paths</a> </div> <div> <a href="fn_xml_load_mapping_schema_decl.html">xml_load_mapping_sch...</a> </div> <div> <a href="fn_xml_load_schema_decl.html">xml_load_schema_decl</a> </div> <div> <a href="fn_xml_namespace_scope.html">xml_namespace_scope</a> </div> <div> <a href="fn_xml_persistent.html">xml_persistent</a> </div> <div> <a href="fn_xml_set_ns_decl.html">xml_set_ns_decl</a> </div> <div> <a href="fn_xml_template.html">xml_template</a> </div> <div> <a href="fn_xml_tree.html">xml_tree</a> </div> <div> <a href="fn_xml_tree_doc.html">xml_tree_doc</a> </div> <div> <a href="fn_xml_tree_doc_media_type.html">xml_tree_doc_media_t...</a> </div> <div> <a href="fn_xml_uri_get.html">xml_uri_get</a> </div> <div> <a href="fn_xml_validate_dtd.html">xml_validate_dtd</a> </div> <div> <a href="fn_xml_validate_schema.html">xml_validate_schema</a> </div> <div> <a href="fn_xml_view_dtd.html">xml_view_dtd</a> </div> <div> <a href="fn_xml_view_schema.html">xml_view_schema</a> </div> <div> <a href="fn_xmlsql_update.html">xmlsql_update</a> </div> <div> <a href="fn_xpath_eval.html">xpath_eval</a> </div> <div> <a href="fn_xper_cut.html">xper_cut</a> </div> <div> <a href="fn_xper_doc.html">xper_doc</a> </div> <div> <a href="fn_xper_locate_words.html">xper_locate_words</a> </div> <div> <a href="fn_xpf_extension.html">xpf_extension</a> </div> <div> <a href="fn_xpf_extension_remove.html">xpf_extension_remove</a> </div> <div> <a href="fn_xquery_eval.html">xquery_eval</a> </div> <div> <a href="fn_xslt.html">xslt</a> </div> <div> <a href="fn_xslt_format_number.html">xslt_format_number</a> </div> <div> <a href="fn_xslt_sheet.html">xslt_sheet</a> </div> <div> <a href="fn_xslt_stale.html">xslt_stale</a> </div> <div> <a href="fn_xte_head.html">xte_head</a> </div> <div> <a href="fn_xte_node.html">xte_node</a> </div> <div> <a href="fn_xte_node_from_nodebld.html">xte_node_from_nodebl...</a> </div> <div> <a href="fn_xte_nodebld_acc.html">xte_nodebld_acc</a> </div> <div> <a href="fn_xte_nodebld_final.html">xte_nodebld_final</a> </div> <div> <a href="fn_xte_nodebld_init.html">xte_nodebld_init</a> </div> <div> <a href="fn_xtree_doc.html">xtree_doc</a> </div> </div> <div> <a href="functions.html#XPATH">XPATH & XQUERY</a> </div> <br /> <div> <a href="functionidx.html">Functions Index</a> </div> <br /> </div> <div id="text"> <h2>tidy_html</h2> <div class="refpurpose">Invoke built-in version of HTML Tidy utility to fix typical errors in HTML text</div> <div class="funcsynopsis"> <span class="funcdef"> <span class="function">tidy_html</span> </span> (<span class="paramdef">in <span class="parameter">raw_html</span> varchar</span>, <span class="paramdef">in <span class="parameter">tidy_config</span> varchar</span>); </div> <div class="refsect1"> <div class="refsect1title">Description</div> <p> This function improves the given source HTML text, by invoking a custom version of HTML Tidy utility. To learn more about Tidy see http://www.w3.org/People/Raggett/tidy/ . Some particular combinations of errors in source HTML may cause Tidy to misinterpret the source so the output may be incomplete or corrupted. This is an unavoidable problem, due to heuristic nature of the procedure. On the other hand, Tidy will process almost any HTML suitable for some "popular" browser, e.g. Internet Explorer or Netscape Navigator. </p> </div> <div class="refsect1"> <div class="refsect1title">Parameters</div> <div class="refsect2"> <span class="refsect2title">raw_html – </span> Source HTML text to process. Note that the encoding of this text must be specified in <span class="computeroutput">tidy_config</span> string, and default encoding of session will not be mentioned by Tidy. </div> <div class="refsect2"> <span class="refsect2title">tidy_config – </span> Configuration string is a list of options, delimited by newlines, with exactly the same syntax as original Tidy's configuration file. Not all options of original Tidy will work, due to obvious reasons, unsupported options will be silently ignored, so you may read your favorite Tidy's configuration file by file_to_string function and pass it to tidy_html. <div class="formalpara"> <strong>tidy-mark: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong> (the default) Tidy will add a meta element to the document head to indicate that the document has been tidied. To suppress this, set tidy-mark to <strong>no</strong>. Tidy won't add a meta element if one is already present.</p> </div> <div class="formalpara"> <strong>markup: <strong>bool</strong> </strong> <p>Determines whether Tidy generates a pretty printed version of the markup. Bool values are either <strong>yes</strong> or <strong>no</strong>. Note that Tidy won't generate a pretty printed version if it finds unknown tags, or missing trailing quotes on attribute values, or missing trailing '>' on tags. The default is <strong>yes</strong>.</p> </div> <div class="formalpara"> <strong>wrap: <strong>number</strong> </strong> <p>Sets the right margin for line wrapping. Tidy tries to wrap lines so that they do not exceed this length. The default is 66. Set wrap to zero if you want to disable line wrapping.</p> </div> <div class="formalpara"> <strong>wrap-attributes: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, attribute values may be wrapped across lines for easier editing. The default is no. This option can be set independently of wrap-scriptlets</p> </div> <div class="formalpara"> <strong>wrap-script-literals: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, this allows lines to be wrapped within string literals that appear in script attributes. The default is <strong>no</strong>. The example shows how Tidy wraps a really really long script string literal inserting a backslash character before the linebreak: <span class="computeroutput"> <a href="somewhere.html" onmouseover="document.status = '...some \ really, really, really, really, really, really, really, really, \ really, really long string..';">test</a> </span> </p> </div> <div class="formalpara"> <strong>wrap-asp: <strong>bool</strong> </strong> <p>If set to <strong>no</strong>, this prevents lines from being wrapped within ASP pseudo elements, which look like: <% ... %>. The default is <strong>yes</strong>.</p> </div> <div class="formalpara"> <strong>wrap-jste: <strong>bool</strong> </strong> <p>If set to <strong>no</strong>, this prevents lines from being wrapped within JSTE pseudo elements, which look like: <# ... #>. The default is <strong>yes</strong>.</p> </div> <div class="formalpara"> <strong>wrap-php: <strong>bool</strong> </strong> <p>If set to <strong>no</strong>, this prevents lines from being wrapped within PHP pseudo elements. The default is <strong>yes</strong>.</p> </div> <div class="formalpara"> <strong>literal-attributes: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, this ensures that whitespace characters within attribute values are passed through unchanged. The default is <strong>no</strong>.</p> </div> <div class="formalpara"> <strong>tab-size: <strong>number</strong> </strong> <p>Sets the number of columns between successive tab stops. The default is 4. It is used to map tabs to spaces when reading files. Tidy never outputs files with tabs.</p> </div> <div class="formalpara"> <strong>indent: <strong>no, yes</strong> or <strong>auto</strong> </strong> <p>If set to <strong>yes</strong>, Tidy will indent block-level tags. The default is <strong>no</strong>. If set to <strong>auto</strong> Tidy will decide whether or not to indent the content of tags such as title, h1-h6, li, td, th, or p depending on whether or not the content includes a block-level element. You are advised to avoid setting indent to yes as this can expose layout bugs in some browsers.</p> </div> <div class="formalpara"> <strong>indent-spaces: <strong>number</strong> </strong> <p>Sets the number of spaces to indent content when indentation is enabled. The default is 2 spaces.</p> </div> <div class="formalpara"> <strong>indent-attributes: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, each attribute will begin on a new line. The default is <strong>no</strong>.</p> </div> <div class="formalpara"> <strong>hide-endtags: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, optional end-tags will be omitted when generating the pretty printed markup. This option is ignored if you are outputting to XML. The default is <strong>no</strong>.</p> </div> <div class="formalpara"> <strong>input-xml: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, Tidy will use the XML parser rather than the error correcting HTML parser. The default is <strong>no</strong>.</p> </div> <div class="formalpara"> <strong>output-xml: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, Tidy will use generate the pretty printed output writing it as well-formed XML. Any entities not defined in XML 1.0 will be written as numeric entities to allow them to be parsed by an XML parser. The tags and attributes will be in the case used in the input document, regardless of other options. The default is <strong>no</strong>.</p> </div> <div class="formalpara"> <strong>add-xml-pi: <strong>bool</strong>, add-xml-decl: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, Tidy will add the XML declaration when outputting XML or XHTML. The default is <strong>no</strong>. Note that if the input document includes an <?xml?> declaration then it will appear in the output independent of the value of this option.</p> </div> <div class="formalpara"> <strong>output-xhtml: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, Tidy will generate the pretty printed output writing it as extensible HTML. The default is <strong>no</strong>. This option causes Tidy to set the doctype and default namespace as appropriate to XHTML. If a doctype or namespace is given they will checked for consistency with the content of the document. In the case of an inconsistency, the corrected values will appear in the output. For XHTML, entities can be written as named or numeric entities according to the value of the "numeric-entities" property. The tags and attributes will be output in the case used in the input document, regardless of other options.</p> </div> <div class="formalpara"> <strong>doctype: <strong>omit, auto, strict, loose</strong> or <<strong>fpi</strong>></strong> <p>This property controls the doctype declaration generated by Tidy. If set to <strong>omit</strong> the output file won't contain a doctype declaration. If set to <strong>auto</strong> (the default) Tidy will use an educated guess based upon the contents of the document. If set to <strong>strict</strong>, Tidy will set the doctype to the strict DTD. If set to <strong>loose</strong>, the doctype is set to the loose (transitional) DTD. Alternatively, you can supply a string for the formal public identifier (fpi) for example: <span class="computeroutput"> doctype: "-//ACME//DTD HTML 3.14159//EN" </span> If you specify the fpi for an XHTML document, Tidy will set the system identifier to the empty string. Tidy leaves the document type for generic XML documents unchanged.</p> </div> <div class="formalpara"> <strong>char-encoding: <strong>raw, ascii, latin1, utf8</strong> or <strong>iso2022</strong> </strong> <p>Determines how Tidy interprets character streams. For <strong>ascii</strong>, Tidy will accept Latin-1 character values, but will use entities for all characters whose value > 127. For <strong>raw</strong>, Tidy will output values above 127 without translating them into entities. For <strong>latin1</strong> characters above 255 will be written as entities. For <strong>utf8</strong>, Tidy assumes that both input and output is encoded as UTF-8. You can use <strong>iso2022</strong> for files encoded using the ISO2022 family of encodings e.g. ISO 2022-JP. The default is <strong>ascii</strong>.</p> </div> <div class="formalpara"> <strong>numeric-entities: <strong>bool</strong> </strong> <p>Causes entities other than the basic XML 1.0 named entities to be written in the numeric rather than the named entity form. The default is <strong>no</strong> </p> </div> <div class="formalpara"> <strong>quote-marks: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, this causes " characters to be written out as &quot; as is preferred by some editing environments. The apostrophe character ' is written out as &#39; since many web browsers don't yet support &apos;. The default is <strong>no</strong>.</p> </div> <div class="formalpara"> <strong>quote-nbsp: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, this causes non-breaking space characters to be written out as entities, rather than as the Unicode character value 160 (decimal). The default is <strong>yes</strong>.</p> </div> <div class="formalpara"> <strong>quote-ampersand: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, this causes unadorned & characters to be written out as &amp;. The default is <strong>yes</strong>.</p> </div> <div class="formalpara"> <strong>assume-xml-procins: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, this changes the parsing of processing instructions to require ?> as the terminator rather than >. The default is <strong>no</strong>. This option is automatically set if the input is in XML.</p> </div> <div class="formalpara"> <strong>fix-backslash: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, this causes backslash characters "\" in URLs to be replaced by forward slashes "/". The default is <strong>yes</strong>.</p> </div> <div class="formalpara"> <strong>break-before-br: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, Tidy will output a line break before each <br> element. The default is <strong>no</strong>.</p> </div> <div class="formalpara"> <strong>uppercase-tags: <strong>bool</strong> </strong> <p>Causes tag names to be output in upper case. The default is <strong>no</strong> resulting in lowercase, except for XML input where the original case is preserved.</p> </div> <div class="formalpara"> <strong>uppercase-attributes: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong> attribute names are output in upper case. The default is <strong>no</strong> resulting in lowercase, except for XML where the original case is preserved.</p> </div> <div class="formalpara"> <strong>word-2000: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, Tidy will go to great pains to strip out all the surplus stuff Microsoft Word 2000 inserts when you save Word documents as "Web pages". The default is <strong>no</strong>. Note that Tidy doesn't yet know what to do with VML markup from Word, but in future I hope to be able to map VML to SVG.</p> <p> Microsoft has developed its own optional filter for exporting to HTML, and the 2.0 version is much improved. You can download the filter free from the <a href="http://officeupdate.microsoft.com/2000/downloadDetails/Msohtmf2.htm"> Microsoft Office Update site</a>.</p> </div> <div class="formalpara"> <strong>clean: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, causes Tidy to strip out surplus presentational tags and attributes replacing them by style rules and structural markup as appropriate. It works well on the html saved from Microsoft Office'97. The default is <strong>no</strong>.</p> </div> <div class="formalpara"> <strong>logical-emphasis: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, causes Tidy to replace any occurrence of i by em and any occurrence of b by strong. In both cases, the attributes are preserved unchanged. The default is <strong>no</strong>. This option can now be set independently of the clean and drop-font-tags options.</p> </div> <div class="formalpara"> <strong>drop-empty-paras: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, empty paragraphs will be discarded. If set to no, empty paragraphs are replaced by a pair of <br> elements as HTML4 precludes empty paragraphs. The default is <strong>yes</strong>.</p> </div> <div class="formalpara"> <strong>drop-font-tags: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong> together with the clean option (see above), Tidy will discard font and center tags rather than creating the corresponding style rules. The default is <strong>no</strong>.</p> </div> <div class="formalpara"> <strong>enclose-text: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, this causes Tidy to enclose any text it finds in the body element within a p element. This is useful when you want to take an existing html file and use it with a style sheet. Any text at the body level will screw up the margins, but wrap the text within a p element and all is well! The default is <strong>no</strong>.</p> </div> <div class="formalpara"> <strong>enclose-block-text: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, this causes Tidy to insert a p element to enclose any text it finds in any element that allows mixed content for HTML transitional but not HTML strict. The default is <strong>no</strong>.</p> </div> <div class="formalpara"> <strong>fix-bad-comments: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, this causes Tidy to replace unexpected hyphens with "=" characters when it comes across adjacent hyphens. The default is <strong>yes</strong>. This option is provided for users of Cold Fusion which uses the comment syntax: <!--- ---></p> </div> <div class="formalpara"> <strong>add-xml-space: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, this causes Tidy to add xml:space="preserve" to elements such as pre, style and script when generating XML. This is needed if the whitespace in such elements is to be parsed appropriately without having access to the DTD. The default is <strong>no</strong>.</p> </div> <div class="formalpara"> <strong>alt-text: <strong>string</strong> </strong> <p>This allows you to set the default alt text for img attributes. This feature is dangerous as it suppresses further accessibility warnings. <strong>YOU ARE RESPONSIBLE FOR MAKING YOUR DOCUMENTS ACCESSIBLE TO PEOPLE WHO CAN'T SEE THE IMAGES!!!</strong> </p> </div> <div class="formalpara"> <strong>write-back: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, Tidy will write back the tidied markup to the same file it read from. The default is <strong>no</strong>. You are advised to keep copies of important files before tidying them as on rare occasions the result may not always be what you expect.</p> </div> <div class="formalpara"> <strong>keep-time: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, Tidy won't alter the last modified time for files it writes back to. The default is <strong>yes</strong>. This allows you to tidy files without effecting which ones will be uploaded to the Web server when using a tool such as 'SiteCopy'. Note that this feature may not work on some platforms.</p> </div> <div class="formalpara"> <strong>error-file: <strong>filename</strong> </strong> <p>Writes errors and warnings to the named file rather than to stderr.</p> </div> <div class="formalpara"> <strong>show-warnings: <strong>bool</strong> </strong> <p>If set to <strong>no</strong>, warnings are suppressed. This can be useful when a few errors are hidden in a flurry of warnings. The default is <strong>yes</strong>.</p> </div> <div class="formalpara"> <strong>quiet: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, Tidy won't output the welcome message or the summary of the numbers of errors and warnings. The default is <strong>no</strong>.</p> </div> <div class="formalpara"> <strong>gnu-emacs: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong>, Tidy changes the format for reporting errors and warnings to a format that is more easily parsed by GNU Emacs. The default is <strong>no</strong>.</p> </div> <div class="formalpara"> <strong>split: <strong>bool</strong> </strong> <p>If set to <strong>yes</strong> Tidy will use the input file to create a sequence of slides, splitting the markup prior to each successive <h2>. You can see an example of the results in a <a href="http://www.w3.org/Talks/1999/03/24-stockholm-xhtml/"> recent talk on XHTML</a>. The slides are written to "slide1.html", "slide2.html" etc. The default is <strong>no</strong>.</p> </div> <div class="formalpara"> <strong>new-empty-tags: <strong>tag1, tag2, tag3</strong> </strong> <p>Use this to declare new empty inline tags. The option takes a space or comma separated list of tag names. Unless you declare new tags, Tidy will refuse to generate a tidied file if the input includes previously unknown tags. Remember to also declare empty tags as either inline or blocklevel, see below.</p> </div> <div class="formalpara"> <strong>new-inline-tags: <strong>tag1, tag2, tag3</strong> </strong> <p>Use this to declare new non-empty inline tags. The option takes a space or comma separated list of tag names. Unless you declare new tags, Tidy will refuse to generate a tidied file if the input includes previously unknown tags.</p> </div> <div class="formalpara"> <strong>new-blocklevel-tags: <strong>tag1, tag2, tag3</strong> </strong> <p>Use this to declare new block-level tags. The option takes a space or comma separated list of tag names. Unless you declare new tags, Tidy will refuse to generate a tidied file if the input includes previously unknown tags. Note you can't change the content model for elements such as table, ul, ol and dl. This is explained in more detail in the original release notes.</p> </div> <div class="formalpara"> <strong>new-pre-tags: <strong>tag1, tag2, tag3</strong> </strong> <p>Use this to declare new tags that are to be processed in exactly the same way as HTML's pre element. The option takes a space or comma separated list of tag names. Unless you declare new tags, Tidy will refuse to generate a tidied file if the input includes previously unknown tags. Note you can't as yet add new CDATA elements (similar to script).</p> </div> </div> </div> <div class="refsect1"> <div class="refsect1title">Return Types</div> <p /> </div> <div class="refsect1title">Errors</div> <table class="data"> <tr> <th class="data">SQLState</th> <th class="data">Error Code</th> <th class="data">Error Text</th> <th class="data">Description</th> </tr> <tr> <td class="data"> <a name="errXTID2" /> <span class="errorcode">XTID2</span> </td> <td class="data"> <a name="err" /> <span class="errorcode" /> </td> <td class="data"> <span class="errorname">HTML Tidy failed</span> </td> <td class="data">The given HTML text contains serious errors. To get detailed list of them, call tidy_list_errors with same parameters as tidy_html.</td> </tr> </table> <br /> <p /> <div class="refsect1"> <div class="refsect1title">Examples</div> <a name="ex_tidy_html" /> <div class="example"> <div class="exampletitle" /> <p /> <div> <pre class="screen"> fine_html := tidy_html (ugly_html, ' indent: auto indent-spaces: 2 wrap: 72 markup: yes output-xml: no input-xml: no show-warnings: yes numeric-entities: yes quote-marks: yes quote-nbsp: yes quote-ampersand: no break-before-br: no uppercase-tags: no uppercase-attributes: no char-encoding: latin1 new-inline-tags: cfif, cfelse, math, mroot, mrow, mi, mn, mo, msqrt, mfrac, msubsup, munderover, munder, mover, mmultiscripts, msup, msub, mtext, mprescripts, mtable, mtr, mtd, mth new-blocklevel-tags: cfoutput, cfquery new-empty-tags: cfelse'); </pre> </div> </div> </div> <div class="refsect1"> <div class="refsect1title">See Also</div> <p> <a href="fn_tidy_list_errors.html" /> </p> </div> </div> <div id="footer"> <div>Copyright© 1999 - 2009 OpenLink Software All rights reserved.</div> <div id="validation"> <a href="http://validator.w3.org/check/referer"> <img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /> </a> <a href="http://jigsaw.w3.org/css-validator/"> <img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" height="31" width="88" /> </a> </div> </div> </body> </html>