id summary reporter owner description type status priority milestone component version severity resolution keywords cc branch changelog apichanges internalchanges 166 See colorized source files. tbrkic@… daniel "Hi, I wanted to be able to see colorized source files and thought of extending trac. I reached the point where I have no idea why it doesnt show up in colors. I downloaded and installed an python module called SilverCity and looked in the script source2html how they did. I imported the changes into File.py in trac. And now when I klick on a file I get valid html. But it doesnt show up as html but I see all the markups aswell. If I view the source and save it to disk as html and the view it in a browser it looks exactly as I want it. I only modified apply_template() in File.py below is the modified function. I think to see the source code with syntax highlighting would be really nice and I am quite close. So it would be nice if it could be fixe. What you need to do download and install SilverCity the default.css file in the SilverCity directory must be readable from Apache. {{{#!python def apply_template (self): rev = dict_get_with_default(self.args, 'rev', None) path = dict_get_with_default(self.args, 'path', '/') if not rev: rev = fs.youngest_rev(self.fs_ptr, self.pool) else: rev = int(rev) root = fs.revision_root(self.fs_ptr, rev, self.pool) generator = None mime_type = self.get_mime_type (root, path) if mime_type == 'text/plain': #if text see if we can pretty print it try: import SilverCity from SilverCity import LanguageInfo import urllib import os generator = LanguageInfo.guess_language_for_file(path).get_default_html_generator()() except: pass size = fs.file_length(root, path, self.pool) date = fs.revision_prop(self.fs_ptr, rev, util.SVN_PROP_REVISION_DATE, self.pool) date_seconds = util.svn_time_from_cstring(date, self.pool) / 1000000 date = strftime(""%a, %d %b %Y %H:%M:%S GMT"", gmtime(date_seconds)) if generator: css = 'file:' + urllib.pathname2url(SilverCity.get_default_stylesheet_location()) xhtml_prefix = \ r"""""" %(title)s """""" sys.stdout.write(xhtml_prefix % {'title' : os.path.basename(path), 'css' : css}) else: sys.stdout.write('Last-Modified: %s\r\n' % date) sys.stdout.write('Content-Length: %d\r\n' % size) sys.stdout.write('Content-Type: %s\r\n\r\n' % mime_type) file = fs.file_contents(root, path, self.pool) while 1: data = util.svn_stream_read(file, self.CHUNK_SIZE) if not data: break if generator: suffix = \ """""" """""" generator.generate_html(sys.stdout, data) sys.stdout.write(suffix) else: sys.stdout.write(data) }}} " enhancement closed normal version control/browser 0.5.2 normal duplicate tbrkic@…