Next / Previous / Contents / Shipman's homepage

6.11. Txny.abbrHtmlSubelt()

xnomo3.py
# - - -   T x n y . a b b r H t m l S u b e l t

    def abbrHtmlSubelt(self, abbr, node, cssClass=None):
        '''Attach the English name to an XHTML Element.
        '''

First we extract the inverted name from the .__abbrEng dictionary. Standardization of the code is done by Section 11.6, “fixAbbr(): Standardize a bird code”.

xnomo3.py
        #-- 1 --
        # [ if abbr, standardized, is a key in self.__abbrEng ->
        #     rawEng  :=  the related English name
        #   else -> raise KeyError ]
        rawEng = self.abbrToRawEng(abbr)

The name is normalized by Section 11.5, “engDeComma(): Normalize an English name”. For the logic that builds the XHTML, see Section 10.2, “htmlSubelt(): Add a name to an et.Element.

xnomo3.py
        #-- 2 --
        # [ if cssClass is None ->
        #     node  :=  node with content added representing rawEng,
        #         normalized, using an 'i' element
        #   else ->
        #     node  :=  node with content added representing rawEng,
        #         normalized, using a 'span' element with
        #         class=(cssClass) ] 
        htmlSubelt(node, abbrMod.engDeComma(rawEng), cssClass)