[TxMt] Latex to CSS (pygments ?)

Alain Matthes alain.matthes at mac.com
Sun Feb 4 20:50:35 UTC 2007


Le 4 févr. 07 à 21:29, Charilaos Skiadas a écrit :

> On Feb 4, 2007, at 2:47 PM, Alain Matthes wrote:
>
>>
>>> thydere
>>
>> ??? sorry but i don't understand...
>
> Not much to understand, that's the IRC name of the guy who helped  
> me fix this.
>
>> Traceback (most recent call last):
>>   File "/tmp/temp_textmate.tERir7", line 4, in ?
>>     from pygments import highlight
>> ImportError: No module named pygments
>
> Looks like you don't have pygments installed, it doesn't come built  
> in. You would need to install pygments first, or wait a bit until  
> (if) we package it with TextMate.
>

Pygments is install this code work :

import codecs
from pygments import highlight
from pygments.lexers import TexLexer
from pygments.formatters import HtmlFormatter>>> from
pygments.formatters import HtmlFormatter
from pygments.lexers import TexLexer
from pygments.formatters import HtmlFormatter
fileObj = codecs.open("/Users/ego/Desktop/sign-diagram.tex", "r" ,
"utf8")
code = fileObj.read()
filecontent = highlight(u, TexLexer(), HtmlFormatter())
unicodefilecontent = unicode(filecontent)
out = file( "/Users/ego/Desktop/sign-diagram.html", "w")
out.write(unicodefilecontent)
out.close()

when i run python !

Alain


More information about the textmate mailing list