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

44.4. StatCell.fo()

As with the XHTML rendering, the logic that determines what to display is Section 44.3, “StatCell._display(): What text should appear?”. The output is a table-cell element decorated with Section 13.11.16, “FO_STAT_CELL_ATTRS, plus any additional styling that comes in as the kw dictionary.

cbchistlib.py
# - - -   S t a t C e l l . f o

    def fo(self, s, **kw):
        '''Render self as XSL-FO.
        '''
        #-- 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
        # [ s  +:=  an open table-cell element styled with
        #           FO_STAT_CELL_ATTRS
        #   cell  :=  that element ]
        cell = s.start('table-cell', FO_STAT_CELL_ATTRS, kw)

        #-- 3
        # [ s  +:=  a block element containing text, right-aligned ]
        s.leaf('block', FO_ALIGN_RIGHT, text)

        #-- 4
        cell.end()