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

system.verbs.builtins.html.data.standardMacros.hierarchicTableDisplayer

on hierarchicTableDisplayer (adrtable) { //a recursive table display in HTML
	local (indentlevel = 0);
	local (htmltext = "");
	on add (s) {
		htmltext = htmltext + string.filledstring ("\t", indentlevel) + s + "\r"};
	on renderOneTable (adrtable) {
		local (i, adritem);
		for i = 1 to sizeof (adrtable^) {
			adritem = @adrtable^ [i];
			case typeof (adritem^) {
				tabletype {
					add (nameof (adritem^));
					indentlevel++;
					renderOneTable (adritem);
					indentlevel--};
				binarytype {
					add ("(binary, type = " + getbinarytype (adritem^) +  ", size = " + sizeof (adritem^) + ")")}}
			else {
				local (s = string (adritem^));
				s = string.replaceall (s, "<", "<");
				if sizeof (s) == 0 {
					s = " "};
				if s contains "\r" {
					s = "<pre>" + s + "</pre>";
					s = string.replaceall (s, "\r\n", "\r")};
				add (nameof (adritem^) + " = " + s)}};
		return (htmltext)};
	return ("<pre>" + string.trimwhitespace (renderOneTable (adrtable)) + "</pre>")}



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.