View/Edit #52:literal_text2

Switch to edit mode.

Name(s): literal_text2
1:  "Copied from HTML utilities (#52):literal_text by Hacker (#60)Nov  8 08:20:19 2001"
2:  "Escape out all < and > characters so that the text won't be interpreted"
3:  "Leave & unescaped for use by &accents;, but do escape &s in &lt;, &gt;, and &amp; constructions"
4:  {text} = args
5:  if (typeof(text) == $LIST)
6:    for x in [1..length(text)]
7:      text[x] = strsub(strsub(strsub(text[x], "&amp;", "&amp;amp;"), "&lt;", "&amp;lt;"), "&gt;", "&amp;gt;")
8:      text[x] = strsub(strsub(text[x], "<", "&lt;"), ">", "&gt;")
9:      $cmd_utils:suspend_if_needed()
10:   endfor
11:   return text
12: elseif (typeof(text) == $STR)
13:   text = strsub(strsub(strsub(text, "&amp;", "&amp;amp;"), "&lt;", "&amp;lt;"), "&gt;", "&amp;gt;")
14:   return strsub(strsub(text, "<", "&lt;"), ">", "&gt;")
15: else
16:   return tostr(text)
17: endif
18: "Last modified by Dax (#789) on Tue May  3 13:45:02 2005 MDT."

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: Hacker (#60)

You are not logged in.

[home | help | who | search | setup | code]