def _makeLineNumbers(howMany):
 width = len(str(howMany))
 labels = [('%*d' % (width, i)) for i in range(1, (howMany + 1))]
 p = dom.Element('p')
 p.setAttribute('class', 'py-linenumber')
 t = dom.Text()
 t.data = ('\n'.join(labels) + '\n')
 p.appendChild(t)
 return p

def _makeLineNumbers ( howMany ) : width = len ( str ( howMany ) ) labels = [ ( '%*d' % ( width , i ) ) for i in range ( 1 , ( howMany + 1 ) ) ] p = dom . Element ( 'p' ) p . setAttribute ( 'class' , 'py-linenumber' ) t = dom . Text ( ) t . data = ( '\n' . join ( labels ) + '\n' ) p . appendChild ( t ) return p
return an element which will render line numbers for a source listing .