[TxMt] Latex to CSS (pygments ?)

Charilaos Skiadas skiadas at hanover.edu
Sun Feb 4 18:37:46 UTC 2007


Ok, so I can generate something nice with a code like this (warning,  
not a python coder):

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


Now, I assume you want to create some TextMate command that does  
something nice with it? What exactly would you want? I think we can  
probably accomplish it.

Haris





More information about the textmate mailing list