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

system.verbs.builtins.html.table.methods.html

on html (adrTable) {
	<<Render a Frontier table as an HTML table.
	local (htmlText = "", indentLevel = 0);
	on add (s) {
		htmlText = htmlText + string.filledString ("\t", indentLevel) + s + "\r"};
	with adrTable^ {
		add ("<table border=\"" + border + "\" cellspacing=\"" + cellspacing + "\" cellpadding=\"" + cellpadding + "\">"); indentLevel++;
		
		local (adrCol, colNum);
		add ("<tr>"); indentLevel++;
		for colNum = 1 to sizeOf (adrTable^.columns) {
			adrCol = @adrTable^.columns [colNum];
			local (s = adrCol^.title);
			if adrCol^.fllink and (sizeOf (adrCol^.link) > 0) {
				s = "<a href=\"" + adrCol^.link + "\">" + s + "</a>"};
			add ("<td align=\"" + adrCol^.align + "\"><b>" + s + "</b></td>")};
		add ("</tr>"); indentLevel--;
		
		local (rowNum, adrRow, item, s);
		for rowNum = 1 to sizeOf (adrTable^.rows) {
			adrRow = @adrTable^.rows [rowNum];
			add ("<tr>"); indentLevel++;
			colNum = 1;
			for item in adrRow^.cells { //a list
				case adrTable^.columns [colNum].type {
					"string" {
						s = item};
					"time" {
						s = string.nthField (item, ";", 2) - " "};
					"date" {
						s = string.nthField (item, ";", 1)};
					"glossaryLink" {
						s = html.refGlossary (item)}};
				bundle { //add font size
					local (size = adrTable^.columns [colNum].size);
					if sizeOf (size) > 0 {
						s = "<font size=\"" + size + "\">" + s + "</font>"}};
				add ("<td align=\"" + adrTable^.columns [colNum].align + "\">" + s + "</td>");
				colNum++};
			add ("</tr>"); indentLevel--};
		
		add ("</table>"); indentLevel--};
	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.