Next / Previous / Contents / Shipman's homepage

23. class FirstBlock: Block for the first or only line

An instance of this class represents an ordinary block containing an input line that did not exceed the column width. It is derived from Section 22, “class OutBlock: One output block”.

# - - - - -   c l a s s   F i r s t B l o c k

class FirstBlock(OutBlock):
    '''Normal, first or only output block.
    def __init__(self, text, goodBreak, bodyLayout):
        OutBlock.__init__(self, text, goodBreak, bodyLayout)

23.1. FirstBlock.render()

Renders the text in an unindented, normal block. See Section 22.4, “OutBlock.__makeBlock(): Build the block element” and Section 22.5, “OutBlock.renderLine(): Render text”.

# - - -   F i r s t B l o c k . r e n d e r

    def render(self, parent):
        '''Render self as an XSL-FO block element.
        #-- 1
        # [ parent  +:=  a block element with OUT_BLOCK_PROPS
        #       and additional properties as specified by
        #       Args() and self.__isBreak ]
        block = OutBlock.makeBlock(self, parent)

        #-- 2
        # [ block  :=  block with self.text added, rendered as XSL-FO ]
        OutBlock.renderLine(self, block)