def html_getrows(table): """return the table rows""" lines = [] for row in range(0, 8): lines += tag('tr', tab(html_getrow(table, row))) return lines
def writehtml(table, opts, fname): """write the schedule to an html file using CSS opts""" default = ({ 'write-html': 'False', 'title': 'Schedule', 'page-bg-color': '#FFFFFF', 'font-family': 'Verdana', 'empty-cell-bg-color': '#808080', 'border-color': '#000000', 'event-cell-font-color': '#000000', 'event-cell-bg-color': '#FFFFFF', 'header-font-color': '#000000', 'border-collapse': 'True', 'table-only': 'False' }) opts = util.fillargs(opts, default) if opts['table-only'].lower() == 'true': lines = tag('table', tab(html_gettable(table))) else: lines = tag('html', tab(html_gethtml(table, opts))) qf.writelinesn(lines, fname)
def html_gettable(table): """return the content of the <table></table> tags""" lines = tag('tr', tab(html_gettableheader())) lines += html_getrows(table) return lines
def html_getbody(table, opts): """return the content of the <body></body> tags""" return tag('table', tab(html_gettable(table)))
def html_gethead(table, opts): """return the content of the <head></head> tags""" lines = [tags('title', opts['title'])] lines += tag('style', tab(html_getstyle(table, opts))) return lines
def html_gethtml(table, opts): """return the content of the <html></html> tags""" lines = tag('head', tab(html_gethead(table, opts))) lines += tag('body', tab(html_getbody(table, opts))) return lines