Next / Previous / Contents / Shipman's homepage

10.12. Texer.convert()

xnomo3.py
# - - -   T e x e r . c o n v e r t

    def convert(self, c):
        '''Convert one character.
        '''
        #-- 1 --
        if c == '_':
            if self.italics: result = TEX_ITAL_END
            else:            result = TEX_ITAL_START
            self.italics = not self.italics
        elif c == '"':
            if self.quotes:  result = TEX_RQ
            else:            result = TEX_LQ
            self.quotes = not self.quotes
        else:
            result = c

        #-- 2 --
        return result