parameters: (self, cov_file)
docstring: Writes the HTML for a file.
  
      Args:
        cov_file: croc.CoveredFile to write.
docstring_summary: Writes the HTML for a file.
docstring_tokens: Writes the HTML for a file .
function: def WriteFile(self, cov_file):
      """Writes the HTML for a file.
  
      Args:
        cov_file: croc.CoveredFile to write.
      """
      print '  ' + cov_file.filename
      title = 'Coverage for ' + cov_file.filename
  
      f = self.CreateHtmlDoc(cov_file.filename + '.html', title)
      body = f.body
  
      # Write header section
      self.AddCaptionForFile(body, cov_file.filename)
  
      # Summary for this file
      table = body.E('table')
      self.AddSectionHeader(table, None, None, is_file=True)
      self.AddItem(table, None, cov_file.stats, cov_file.attrs)
  
      body.E('h2').Text('Line-by-line coverage:')
  
      # Print line-by-line coverage
      if cov_file.local_path:
        code_table = body.E('table').E('tr').E('td').E('pre')
  
        flines = open(cov_file.local_path, 'rt')
        lineno = 0
  
        for line in flines:
          lineno += 1
          line_cov = cov_file.lines.get(lineno, 2)
          e_class = COV_TYPE_CLASS.get(line_cov)
  
          code_table.E('span', e_class=e_class).Text('%4d  %s :  %s\n' % (
              lineno,
              COV_TYPE_STRING.get(line_cov),
              line.rstrip()
          ))
  
      else:
        body.Text('Line-by-line coverage not available.  Make sure the directory'
                  ' containing this file has been scanned via ')
        body.E('B').Text('add_files')
        body.Text(' in a configuration file, or the ')
        body.E('B').Text('--addfiles')
        body.Text(' command line option.')
  
        # TODO: if file doesn't have a local path, try to find it by
        # reverse-mapping roots and searching for the file.
  
      body.E('p', e_class='time').Text(self.time_string)
      f.Write()
function_tokens: def WriteFile ( self , cov_file ) : print '  ' + cov_file . filename title = 'Coverage for ' + cov_file . filename f = self . CreateHtmlDoc ( cov_file . filename + '.html' , title ) body = f . body # Write header section self . AddCaptionForFile ( body , cov_file . filename ) # Summary for this file table = body . E ( 'table' ) self . AddSectionHeader ( table , None , None , is_file = True ) self . AddItem ( table , None , cov_file . stats , cov_file . attrs ) body . E ( 'h2' ) . Text ( 'Line-by-line coverage:' ) # Print line-by-line coverage if cov_file . local_path : code_table = body . E ( 'table' ) . E ( 'tr' ) . E ( 'td' ) . E ( 'pre' ) flines = open ( cov_file . local_path , 'rt' ) lineno = 0 for line in flines : lineno += 1 line_cov = cov_file . lines . get ( lineno , 2 ) e_class = COV_TYPE_CLASS . get ( line_cov ) code_table . E ( 'span' , e_class = e_class ) . Text ( '%4d  %s :  %s\n' % ( lineno , COV_TYPE_STRING . get ( line_cov ) , line . rstrip ( ) ) ) else : body . Text ( 'Line-by-line coverage not available.  Make sure the directory' ' containing this file has been scanned via ' ) body . E ( 'B' ) . Text ( 'add_files' ) body . Text ( ' in a configuration file, or the ' ) body . E ( 'B' ) . Text ( '--addfiles' ) body . Text ( ' command line option.' ) # TODO: if file doesn't have a local path, try to find it by # reverse-mapping roots and searching for the file. body . E ( 'p' , e_class = 'time' ) . Text ( self . time_string ) f . Write ( )