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


on getOneDirective (directiveName, s) { //new in 4.0.1
	<<Get one directive, usually from a page other than the one being rendered.
		<<PBS 5/15/98:
			<<Call into kernel verbs now kernelized,
				<<html.runOutlineDirectives and html.runDirectives.
			<<This improves the accuracy of this script without affecting performance,
			<<and it removes some duplicate code from the website framework.
		<<Old code
			<<local (ix = string.patternMatch (string.lower (directivename), string.lower (s)))
			<<if ix > 0
				<<s = string.delete (s, 1, ix + sizeof (directivename))
				<<s = string.delete (s, string.patternmatch (cr, s), infinity)
				<<return (evaluate (s))
				<<return ("")
	local (directivesTable);
	new (tableType, @directivesTable);
	if directiveName beginsWith "#" { //pop off leading # character
		directiveName = string.delete (directiveName, 1, 1)};
	if typeOf (s) == outlineType {
		local (outlineCopy = s);
		try {html.runOutlineDirectives (@outlineCopy, @directivesTable)}}
	else {
		try {html.runDirectives (string (s), @directivesTable)}};
	<<if defined (directivesTable.[directiveName])
		<<return (evaluate ("\"" + directivesTable.[directiveName] + "\""))
	try {return (directivesTable.[directiveName])};
	return ("")}

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.