Hi, Andrew,
I guess we were solving different problems. I understood the task
to be
Take a fragment of HTML and convert it so that it appears
literally in the visitor's browser.
That means that I explicitly didn't want entities protected, but
rather wanted their ampersands converted to & so that the
visitor's browser would display the "raw" entity code, and not
the entity replacement value.
-jn-
[EMAIL PROTECTED] wrote:
>
> You also need to account for Named Entities as well:
>
> Named_Entities: [
> "quot" "amp" "lt" "gt" "nbsp" "iexcl" "cent" "pound" "curren"
> "yen" "brvbar" "sect" "uml" "copy" "ordf" "laquo" "not" "shy"
> "reg" "macr" "deg" "plusmn" "sup2" "sup3" "acute" "micro"
> "para" "middot" "cedil" "sup1" "ordm" "raquo" "frac14"
> "frac12" "frac34" "iquest" "times" "Oslash"
> ]
> Replace_Named_Entities: func [Script [string!]] [
> Map Named_Entities func [Entity] [
> replace/all Script join "&" Entity join "&"
> [Amp_Entity_Replacement Entity]
> ]
> Script
> ]
> ; A temporary replacement for "amp;" to avoid infinite recursion.
> ; Don't simplify! Why? The constant will be replaced when this program
> is converted to HTML!
> Amp_Entity_Replacement: join "a" "R2HTMLmR2HTMLpR2HTML;" ; "amp;"
> with "R2HTML" between each letter.
> Replace_Entities: func [Script [string!]] [
> replace/all Script "&#" join "&" [Amp_Entity_Replacement "#"]
> Script: Replace_Named_Entities Script
> replace/all Script "<" "<"
> replace/all Script ">" ">"
> replace/all Script Amp_Entity_Replacement "amp;"
> Script
> ]
>
--
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the
subject, without the quotes.