View/Edit #52:html2token html2token_suspended

Switch to edit mode.

Name(s): html2token html2token_suspended
1:  "Converts HTML text into a stream of tokens."
2:  ":html2token({'<OL><LI>Come <B>here</B>!', '</OL>'})"
3:  " => {'<OL>', '<LI>', 'Come ', '<B>', 'here', '</B>', '! ', '</OL>'}"
4:  {html} = args
5:  susp = !!index(verb, "suspended")
6:  "Form a single long line of html"
7:  if (typeof(html) == $LIST)
8:    html = $string_utils:from_list(html, " ")
9:  endif
10: html = this:decomment(html)
11: "Break the html up into tokens"
12: tokens = {}
13: while (x = index(html, "<"))
14:   x > 1 && (tokens = {@tokens, html[1..x - 1]})
15:   if (!(y = index(html = html[x..$], ">")))
16:     "This tag doesn't end!"
17:     break
18:   endif
19:   tokens = {@tokens, html[1..y]}
20:   html = html[y + 1..$]
21:   susp && $cmd_utils:suspend_if_needed()
22: endwhile
23: return {@tokens, html}
24: "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: Dax (#789)

You are not logged in.

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