Exemple #1
0
    def createToken(self, info, parent):
        tok = info['token']

        # Sub/super script must have word before the rest cannot
        if (tok == '^') or (tok == '@'):
            if not parent.children or not isinstance(parent.children[-1],
                                                     tokens.Word):
                return None
        elif parent.children and isinstance(parent.children[-1], tokens.Word):
            return None

        if tok == u'@':
            return tokens.Subscript(parent)
        elif tok == u'^':
            return tokens.Superscript(parent)
        elif tok == u'=':
            return tokens.Underline(parent)
        elif tok == u'*':
            return tokens.Emphasis(parent)
        elif tok == u'+':
            return tokens.Strong(parent)
        elif tok == u'~':
            return tokens.Strikethrough(parent)
        elif tok == u'`':
            return tokens.Monospace(parent,
                                    code=info['inline'],
                                    recursive=False)
Exemple #2
0
 def testSubscript(self):
     tokens.Subscript()