def _make_header_elem(self, span, sep, elem, exp): return "\\multicolumn{%s}{%sc%s}{%s}" % ( span, sep[0], sep[1], exp.sub("", utils.escape(elem, patterns=utils.TEX_ESCAPE)), )
def _body(self, row_sep="""\n""", col_sep="""\t""", escape=None): """ Buld the table body. This is a template method to let subclasses do the dirty job, while still providing a simple text output. Infact, in most cases, changing this method's parameters is enough to obtain the result. @ param row_sep: row separators, what indicates the end of a row (default: '\n') @ param col_sep: column separators, what indicated the end of a column (default: '\t') @ return: a string """ records = self._to_records() ret = ( row_sep.join( [ col_sep.join( [utils.escape(self._format_elem(idx, elem), patterns=escape) for idx, elem in enumerate(record)] ) for record in records ] ) + row_sep ) return ret
def body(self): records = self._to_records() return HTML.TBODY( *[ HTML.TR( *[ HTML.TD( utils.escape(self._format_elem(idx, elem)), align=self.ALIGNMENT_MAP.get(self._vars[self._keys[idx]]["align"], "l"), ) for idx, elem in enumerate(record) ] ) for record in records ] )
def _make_header_elem(self, span, sep, elem, exp): return HTML.TH(exp.sub("", utils.escape(elem, patterns=utils.HTML_ESCAPE)), colspan="%s" % span)