ad_dom_fix_html (private)

 ad_dom_fix_html -html html [ -marker marker ] [ -dom ]

Defined in packages/acs-tcl/tcl/text-html-procs.tcl

Similar in spirit to the famous Tidy command line utility, this proc takes a piece of possibly invalid markup and returns a 'fixed' version where unopened tags have been closed and attribute specifications have been normalized by transforming them in the form attribute-name="attribute value". All attributes with an invalid (non-alphanumeric) name will be stripped.

Be aware that every comment and also the possibly present DOCTYPE declaration will be stripped from the markup. Also, most of tag's internal whitespace will be trimmed. This behavior comes from the htmlparse library used in this implementation.

Switches:
-html (required)
Markup to process
-marker (optional, defaults to "root")
Root element use to enforce a single root of the DOM tree.
-dom (optional, boolean)
When this flag is set, instead of returning markup, the proc will return the tDOM object built during the operation. Useful when the result should be used by tDOM anyway, so we can avoid superfluous parsing.
Returns:
markup or a tDOM document object if the -dom flag is specified
Author:
Antonio Pisano

Partial Call Graph (max 5 caller/called nodes):
%3 ad_dom_sanitize_html ad_dom_sanitize_html (public) ad_dom_fix_html ad_dom_fix_html ad_dom_sanitize_html->ad_dom_fix_html dom dom ad_dom_fix_html->dom

Testcases:
No testcase defined.
[ show source ]
Show another procedure: