39,59d38 < < class PrettyPrintPlugin(Component): < """Convert Wiki pages to pretty printable HTML (using custom CSS).""" < implements(IContentConverter) < < # IContentConverter methods < def get_supported_conversions(self): < yield ('html', 'Print version', 'html', 'text/x-trac-wiki', 'text/html', 7) < < def convert_content(self, req, input_type, source, output_type): < hfile, hfilename = mkstemp('tracprint') < codepage = self.env.config.get('trac', 'default_charset', 0) < page = wiki_to_html(source, self.env, req).encode(codepage) < page = re.sub('' + css_string + '' + page + '') < os.close(hfile) < out = open(hfilename, 'rb').read() < os.unlink(hfilename) < return (out, 'text/html')