util_expand_entities (public)

 util_expand_entities html

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

Replaces all occurrences of common HTML entities with their plaintext equivalents in a way that's appropriate for pretty-printing.

Currently, the following entities are converted: <, >, &apm;quot;, &, — and —.

This proc is more suitable for pretty-printing that its sister-proc, util_expand_entities_ie_style. The two differences are that this one is more strict: it requires proper entities i.e., both opening ampersand and closing semicolon, and it doesn't do numeric entities, because they're generally not safe to send to browsers. If we want to do numeric entities in general, we should also consider how they interact with character encodings.

Parameters:
html

Partial Call Graph (max 5 caller/called nodes):
%3 ad_html_to_text_put_text ad_html_to_text_put_text (private) util_expand_entities util_expand_entities ad_html_to_text_put_text->util_expand_entities

Testcases:
No testcase defined.
Source code:
        regsub -all -- {&lt;} $html {<} html
        regsub -all -- {&gt;} $html {>} html
        regsub -all -- {&quot;} $html "\"" html
        regsub -all -- {&mdash;} $html {--} html
        regsub -all -- {&#151;} $html {--} html
        # Need to do the &amp; last, because otherwise it could interfere with the other expansions,
        # e.g., if the text said &amp;lt;, that would be translated into <, instead of &lt;
        regsub -all -- {&amp;} $html {\&} html
        return $html
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: