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

36.7. CensusRowLabel.foCompound()

This method generates two block elements that will be vertically stacked: the first with the first English bird name, the second with the relationship code (“×” for a hybrid or “/” for a species pair) followed by the second English name. See Section 36.8, “CensusRowLabel._foBirdName() for lookup and XSL-FO formatting of English names, which can fail. For failure modes, see Section 36.6, “CensusRowLabel._foSimple(): Render a simple name as XSL-FO”.

cbchistlib.py
# - - -   C e n s u s R o w L a b e l . _ f o C o m p o u n d

    def _foCompound(self, s):
        '''Render a compound bird name.

          [ s is a sox.Sox instance ->
              if self.birdId is a compound form defined in
              self.birdId.txny ->
                s  +:=  (a block element containing the English name for
                    self.birdId.abbr as XSL-FO) + (a block element
                    containing self.birdId.rel and the English name for
                    self.birdId.abbr as XSL-FO)
              else -> raise ScriptError ]
        '''
        #-- 1
        # [ if self.birdId.abbr is defined in self.birdId.txny ->
        #     s  +:=  a block element containing the English name
        #         for self.birdId.abbr as XSL-FO
        #   else -> raise ScriptError ]
        block = s.start('block', FO_ALIGN_LEFT)
        self._foBirdName(s, self.birdId.abbr)
        block.end()

        #-- 2
        if self.birdId.rel == abbrMod.REL_HYBRID:
            relText = TIMES
        else:
            relText = "/"

        #-- 3
        # [ if self.birdId.abbr2 is defined in self.birdId.txny ->
        #     s  +:=  a block element containing (relText) + " " +
        #         (the English name for self.birdId.abbr as XSL-FO)
        #   else -> raise ScriptError ]
        block = s.start('block', FO_ALIGN_LEFT, relText, u' ')
        self._foBirdName(s, self.birdId.abbr2)
        block.end()