Пример #1
0
 def test_highlighting(self):
     # You can pass any lexer to the pygmentize function and it will
     # never fail loudly.
     from libpaste.highlight import pygmentize
     pygmentize('code', lexer_name='python')
     pygmentize('code', lexer_name='doesnotexist')
Пример #2
0
def highlight(snippet):
    h = pygmentize(snippet.content, snippet.lexer)
    h = h.replace("  ", "  ")
    h = h.replace("\t", "    ")
    return h.splitlines()