RESEND: syntax-highlighting.py

Jason A. Donenfeld Jason at zx2c4.com
Wed Jan 8 17:28:48 CET 2014


On Wed, Jan 8, 2014 at 5:22 PM, Stefan Tatschner <stefan at sevenbyte.org> wrote:
> I have looked in pygment's sourcecode and found this [0]. I just have to
> add the filenames in the lexer definitions. I will try to create an
> upstream pull request. The only problem is that the latest release of
> pygments is almost 1 year old. It think it will take a while until the
> changes get merged...
>
> As a workaround we could create such a dict as you suggested and check
> if the filenames match.

Another workaround might be just to monkey patch _mapping.LEXERS. Any
of these possibilities is probably fine.


> At first I run guess_lexer_for_filename (line 26). It checks the content
> of the file and also looks at the filename. After that I check if there
> is a shebang because the script has already looked at the content with
> guess_lexer_for_filename. I have tested this without the shebang
> detection and especially with plaintext files it often returns crap...

Okay fair enough. Shebang guessing only.


> It will take a few days because currently I have exams... Should I work
> on the master branch or something else?

Yes the master branch.

>
> What do you want to de with the CSS definitions? Just put them into the
> default cgit CSS file or maybe include it seperately?

We already handle that on line 34 of [1], so no need to do anything
differently. Please base your work off [1] generally.


Thanks a bunch! Looking forward to seeing the results.

Jason

[1] http://git.zx2c4.com/cgit/tree/filters/syntax-highlighting.py


More information about the CGit mailing list