Next / Previous / Contents / TCC Help System / NM Tech homepage

44.2. StatCell.html()

cbchistlib.py
# - - -   S t a t C e l l . h t m l

    def html(self, sox, addCss=None):
        '''Render self as XHTML.
        '''

The result is a td element. The logic that determines what to display is shared with the XSL-FO rendering logic; see Section 44.3, “StatCell._display(): What text should appear?”.

The td element carries the CSS class defined in Section 13.4.13, “CLASS_STAT_CELL, plus any other CSS classes passed in via the addCss argument; see Section 59, “combineCss(): Combine CSS classes from different sources”.

cbchistlib.py
        #-- 1
        # [ if self.value is a string ->
        #     text = self.value
        #   else if self.value <= 0 ->
        #     text = '-'
        #   else ->
        #     text = self.value as a string, without excessive precision ]
        text = self._display()

        #-- 2
        # [ sox  +:=  a new td et.Element with CSS class CLASS_STAT_CELL
        #             plus any other classes specified in addCss ]
        sox.leaf("td", text, combineCss(CLASS_STAT_CELL, addCss))