notNumbered := 0; # possible values for html table row numbering numberedLeft := 1; # " " " " " " " numberedRight := 2; # " " " " " " " alignCentre := 0; # possible values for html table column alignment alignLeft := 1; # " " " " " " " alignRight := 2; # " " " " " " " # write an html table to a file writeHtmlTable := proc( fh, t :: table ) is local align := "align='"; case t.columnAlignment of alignLeft then align := align & "left'" of alignRight then align := align & "right'" else align := align & "center'" esac; local put := proc( text :: string ) is io.write( fh, text & "\n" ) end; local thElement := proc( content :: string ) is put( "" & content & "" ) end; local tdElement := proc( content ) is put( "" & content & "" ) end; # table element put( "" ); # table headings put( "" ); if t.rowNumbering = numberedLeft then thElement( "" ) fi; for col to size t.headings do thElement( t.headings[ col ] ) od; if t.rowNumbering = numberedRight then thElement( "" ) fi; put( "" ); # table rows for row to size t.data do put( "" ); if t.rowNumbering = numberedLeft then thElement( row & "" ) fi; for col to size t.data[ row ] do tdElement( t.data[ row, col ] ) od; if t.rowNumbering = numberedRight then thElement( row & "" ) fi; put( "" ) od; # end of table put( "" ) end ; # create an html table and print it to standard output scope local t := []; t.cellSpacing, t.colSpacing := 0, 0; t.border := 1; t.columnAlignment := alignRight; t.rowNumbering := numberedLeft; t.headings := [ "A", "B", "C" ]; t.data := [ [ 1001, 1002, 1003 ], [ 21, 22, 23 ], [ 201, 202, 203 ] ]; writeHtmlTable( io.stdout, t ) epocs