Пример #1
0
def _colorizeSource(source):
    s = []
    tokens = DTLexer.doTag(source, 'foo')
    for tok in tokens:
        if type(tok) == types.StringType:
            s.append(scanners.common.plainEscape(tok))
        else:
            s.append(_colorizeTag(source, tok))
    return string.join(s, '')
Пример #2
0
def _colorizeSource(source):
    s = []
    tokens = DTLexer.doTag(source, "foo")
    for tok in tokens:
        if type(tok) == types.StringType:
            s.append(scanners.common.plainEscape(tok))
        else:
            s.append(_colorizeTag(source, tok))
    return string.join(s, "")
Пример #3
0
def _parseSTMLDocument( filename, contents ):
    #tagRegistry is global
    try:
        tagList = DTLexer.doTag( contents, filename )
    except:
        return
    newtaglist = []
    #filter out unknown tags
    for i in tagList:
        if type(i) != type('') and tagRegistry.has_key(i.tagname):
            newtaglist.append(i)
        elif type(i) == type(''):
            newtaglist.append(i)
            
    return DTParser.parseit( contents, newtaglist, tagRegistry, filename )