def addPlainListings(document, dir):
 for node in domhelpers.findElementsWithAttribute(document, 'class', 'listing'):
  filename = node.getAttribute('href')
  val = ('<pre>\n%s</pre>' % cgi.escape(open(os.path.join(dir, filename)).read()))
  _replaceWithListing(node, val, filename, 'listing')

def addPlainListings ( document , dir ) : for node in domhelpers . findElementsWithAttribute ( document , 'class' , 'listing' ) : filename = node . getAttribute ( 'href' ) val = ( '<pre>\n%s</pre>' % cgi . escape ( open ( os . path . join ( dir , filename ) ) . read ( ) ) ) _replaceWithListing ( node , val , filename , 'listing' )
insert text listings into the given document from files in the given directory based on c{listing} nodes .