Monday, November 08, 2010 at 12:03 AM.

system.verbs.builtins.html.runOutlineDirectives

on runOutlineDirectives (adroutline, adrPageTable=@websites.["#data"]) { <<4.2
	<<The outline can contain #directives.
		<<Run all the #directives and return the outline with the directives deleted.
		<<Please send us a *COPY* of your outline. Thanks!
	if html.getPref ("useKernelCode", adrPageTable) {
		on kernelcall (adroutline, adrPageTable) {
			kernel (html.runOutlineDirectives)};
		return (kernelcall (adroutline, adrPageTable))}
	else {
		local (oldtarget = target.get ());
		target.set (adroutline);
		op.firstSummit ();
		loop {
			local (s = op.getLineText ());
			if s beginsWith "#" {
				s = string.delete (s, 1, 1); <<pop off the #
				local (lastdirective = html.runDirective (s, adrPageTable));
				local (newtype = nil); <<4.2
				case lastdirective { <<4.2
					"define" {
						newtype = outlinetype};
					"definescript" {
						newtype = scripttype}};
				if newtype != nil {
					local (theList);
					local (objectname = adrPageTable^.[lastdirective]);
					delete (@adrPageTable^.[lastdirective]);
					op.expand (1);
					if op.go (right, 1) {
						theList = op.outlineToList (adroutline)}
					else {
						scriptError ("Empty sub-outline in \"" + objectname + "\"#define directive.")};
					local (adrnewoutline = @adrPageTable^.[objectname]);
					new (newtype, adrnewoutline);
					op.listToOutline (theList, adrnewoutline);
					target.set (adrnewoutline);
					op.firstsummit ();
					op.deleteline ();
					target.set (adroutline);
					op.go (left, 1)};
				op.deleteline ()}
			else {
				if script.isComment () { <<new in 4.0b7 -- omit top-level comment lines
					op.deleteline ()}
				else {
					if not op.go (down, 1) {
						break}}}};
		try {target.set (oldtarget)}}}



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.