'''
html.py - HTML functions
(c) 2005 Jan ONDREJ (SAL)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
'''
import os,re
from StringIO import StringIO
from aglib import find_service
class table:
def __init__(self,params=''):
self.TAB=StringIO()
self.TAB.write("" % params)
self.tr=''
self.cols={}
def column(self,n):
if self.cols.get(n):
return ' '+self.cols.get(n)
elif self.cols.get(0):
return ' '+self.cols.get(0)
else:
return ''
def add(self,*args):
self.TAB.write(self.tr)
n=0
for col in args:
n+=1
self.TAB.write("| %s | " % (self.column(n),col))
self.TAB.write("
\n")
def addhdr(self,*args):
self.TAB.write(self.tr)
n=0
for col in args:
n+=1
self.TAB.write("%s | " % (self.column(n),col))
self.TAB.write("\n")
def __str__(self):
self.TAB.write("
\n")
return self.TAB.getvalue()
class page:
TAILER='