From mboxrd@z Thu Jan 1 00:00:00 1970 From: stefan at sevenbyte.org (Stefan Tatschner) Date: Wed, 08 Jan 2014 17:22:08 +0100 Subject: Fwd: Re: RESEND: syntax-highlighting.py In-Reply-To: <52CD7ADF.2080903@sevenbyte.org> References: <52CD7ADF.2080903@sevenbyte.org> Message-ID: <52CD7B30.3010208@sevenbyte.org> Am 08.01.2014 16:19, schrieb Jason A. Donenfeld: > Okay reading this closer, it seems what the one in-tree could benefit from is: > > - Expanded list of filename mappings, made more generic than what you > have in your script, but basically the same idea. -- { "pkgbuild": > "bashlexer", "cmakelists.txt", "cmakelexer" }. Is there a way to do > this that ties directly into pygment's guess_lexer_for_filename? If > not, could you submit a patch upstream? 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. > - We should make use of guess_lexer as you do, but perhaps not only if > the shebang is present 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... > Would love for a patch against the in-tree version that gets it up to > date like this. :-) It will take a few days because currently I have exams... Should I work on the master branch or something else? What do you want to de with the CSS definitions? Just put them into the default cgit CSS file or maybe include it seperately? Stefan Links: [0]: https://bitbucket.org/birkenfeld/pygments-main/src/9246d7a47a42e7920c0ecee4d4946b982e9e2430/pygments/lexers/_mapping.py?at=default -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 490 bytes Desc: OpenPGP digital signature URL: