Next / Previous / Contents / Shipman's homepage

10.6. Htmler.convert()

The structure of this method is laid out exactly in its. intended function. See also Section 10.7, “Htmler._italStart() and Section 10.8, “Htmler._italEnd().

xnomo3.py
# - - -   H t m l e r . c o n v e r t

    def convert(self, c, cssClass=None):
        '''Convert one character to HTML.
        '''
        #-- 1 --
        if c == '_':
            if self.italics: result = self._italEnd(cssClass)
            else:            result = self._italStart(cssClass)
            self.italics = not self.italics
        elif c == '"':
            if self.quotes:  result = RDQUO
            else:            result = LDQUO
            self.quotes = not self.quotes
        else:
            result = c

        #-- 2 --
        return result