def fontifyPythonNode(node):
 oldio = cStringIO.StringIO()
 latex.getLatexText(node, oldio.write, entities={'lt': '<', 'gt': '>', 'amp': '&'})
 oldio = cStringIO.StringIO((oldio.getvalue().strip() + '\n'))
 howManyLines = len(oldio.getvalue().splitlines())
 newio = cStringIO.StringIO()
 htmlizer.filter(oldio, newio, writer=htmlizer.SmallerHTMLWriter)
 lineLabels = _makeLineNumbers(howManyLines)
 newel = dom.parseString(newio.getvalue()).documentElement
 newel.setAttribute('class', 'python')
 node.parentNode.replaceChild(newel, node)
 newel.insertBefore(lineLabels, newel.firstChild)

def fontifyPythonNode ( node ) : oldio = cStringIO . StringIO ( ) latex . getLatexText ( node , oldio . write , entities = { 'lt' : '<' , 'gt' : '>' , 'amp' : '&' } ) oldio = cStringIO . StringIO ( ( oldio . getvalue ( ) . strip ( ) + '\n' ) ) howManyLines = len ( oldio . getvalue ( ) . splitlines ( ) ) newio = cStringIO . StringIO ( ) htmlizer . filter ( oldio , newio , writer = htmlizer . SmallerHTMLWriter ) lineLabels = _makeLineNumbers ( howManyLines ) newel = dom . parseString ( newio . getvalue ( ) ) . documentElement newel . setAttribute ( 'class' , 'python' ) node . parentNode . replaceChild ( newel , node ) newel . insertBefore ( lineLabels , newel . firstChild )
syntax color the given node containing python source code .