Monday, November 08, 2010 at 12:03 AM.
system.verbs.builtins.html.getOutlineHTML
on getOutlineHTML (adroutline, indentstring, outdentstring, linestartstring, lineendstring, flprettyPrint=true) {
try { //only works on Mac OS
return (html.ucmds.getOutlineHTML (adroutline, indentstring, outdentstring, linestartstring, lineendstring))}
else {
local (level = 0);
local (htmltext = "");
on add (s) {
htmltext = htmltext + s};
on addLine (s) {
if flPrettyPrint {
add (string.filledString ("\t", level) + s + "\r")}
else {
add (s)}};
on visit () {
loop {
addLine (linestartstring + op.getLineText () + lineendstring);
if op.go (right, 1) > 0 {
level++;
addLine (indentstring);
visit ();
addLine (outdentstring);
level--;
op.go (left, 1)};
if not op.go (down, 1) {
break}}};
local (oldtarget = target.get ());
target.set (adroutline);
op.firstSummit ();
op.fullExpand ();
if flPrettyPrint {
add ("\r")};
visit ();
try {target.set (oldtarget)};
return (htmltext)}}
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.