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


on runDirectives (wpstring, adrPageTable=@websites.["#data"]) { <<4.2 -- extracted from renderObject macro
	<<wpstring contains a page of text
		<<run all the #directives and return the cleaned up text
	if html.getPref ("useKernelCode", adrPageTable) {
		on kernelcall (wpstring, adrPageTable) {
			kernel (html.runDirectives)};
		return (kernelcall (wpstring, adrPageTable))}
	else {
		wpstring = string.replaceAll (wpstring, "\n", ""); <<work around Windows problem -- 11/11/97 DW
		local (s = "");
		loop { <<process #directives
			if sizeof (wpstring) == 0 {
			local (line = string.nthField (wpstring, "\r", 1));
			if line beginsWith "#" {
				html.runDirective (string.delete (line, 1, 1), adrPageTable)}
			else {
				if html.getPref ("directivesOnlyAtBeginning", adrPageTable) {
					s = s + wpstring;
				s = s + line + "\r"};
			wpstring = string.delete (wpstring, 1, sizeof (line) + 1)};
		return (s)}}

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.