Patch #1651

Hack to make redmine use pygmentize instead of CodeRay

Added by Youssef Abou-Kewik 88 days ago.

Status:New Start:2008-07-15
Priority:Normal Due date:
Assigned to:- % Done:

0%

Category:-
Target version:-

Description

We're going to be using Redmine internally with lots of Python code involved. Thought I'd share this patch with you guys.
I never wrote in ruby before, and I used some of the code mentioned here: http://matt.tarbit.org/2008/02/05/extending-bluecloth-with-pygments

You need to test that pygmentize works on your system first, and if it does, this should work just fine. Unfortunately, syntax highlighting is not a plugin.

patch - use pygmentize instead of coderay patch (4.7 KB) Youssef Abou-Kewik, 2008-07-15 20:54

scm_patch_pygmentize.diff - patch #2 (4.2 KB) Youssef Abou-Kewik, 2008-07-25 22:17

scm_patch_pygmentize2.diff (4.3 KB) Anatolii Kucheruck, 2008-09-19 16:52

History

2008-07-25 05:19 - Calvin Cheng

Youssef Abou-Kewik wrote:

We're going to be using Redmine internally with lots of Python code involved. Thought I'd share this patch with you guys. I never wrote in ruby before, and I used some of the code mentioned here: http://matt.tarbit.org/2008/02/05/extending-bluecloth-with-pygments

You need to test that pygmentize works on your system first, and if it does, this should work just fine. Unfortunately, syntax highlighting is not a plugin.

Looks good. It's what I have been looking for!

Coderay has simply been just too limited. Pygments rock in comparison.

Will give this patch a shot. But it looks like I have to maintain this file thereafter since I track the trunk directly.

2008-07-25 22:17 - Youssef Abou-Kewik

I'm attaching another update. This one should count fully on pygmentize instead of CodeRay (the previous patch relied on CodeRay to determine file type). However, this one relies on writing a temp file to /tmp where pygmentize can read it and determine its file type on its own. Also, files with UTF8 encoding should work now.

2008-09-19 16:52 - Anatolii Kucheruck

Youssef Abou-Kewik wrote:

I'm attaching another update. This one should count fully on pygmentize instead of CodeRay (the previous patch relied on CodeRay to determine file type). However, this one relies on writing a temp file to /tmp where pygmentize can read it and determine its file type on its own. Also, files with UTF8 encoding should work now.

There are one "bug" in this patch: if pygmentize can't recognize file type (e.g. file has no extension or pygmentize has no such type in lexer's list), the error was occurred and empty string was returned, and we have no content.
I'm attaching athother one path with fix this (file type compulsorily set to "text" in described case).

Also available in: Atom PDF