Posted by rötzi on January 23, 2007 at 5:20pm
| Project: | GeSHi Filter for syntax highlighting |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | soxofaan |
| Status: | closed (fixed) |
Issue Summary
For my needs I have rewritten the geshifilter module. Although I started from the original, it is almost a complete rewrite. Changes include:
1. Support for GeSHi 1.1.x (although I wouldn't reccomend using it at the moment)
2. Rewrote regexp to support larger code blocks (http://drupal.org/node/82276)
3. Special tags per language
4. Same tag for blockcode and inline code
5. Configurable tag names and attribute names (http://drupal.org/node/80407)
At the moment the option to support css classes and change the surrounding block (pre,div,none) are not implemented (because I didn't have the need for this yet).
Tell me what you think.
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| geshifilter.tar.gz | 6.79 KB | Ignored: Check issue status. | None | None |
Comments
#1
i forgot to remove some debug stuff. here the new version.
#2
Nice stuff. Not tested it, but had a quick look through the code and it looks like a big improvement.
I'm annoyed I missed this before doing a much more basic port myself! However, I guess some of the CSS changes from my code (at http://drupal.org/node/120300) could be merged into this.
#3
I will look at it when I find the time (I'm quite busy at the moment, so it may not be that soon).
By the way, there is a new version of the module which works with the latest pearwiki_filter available here: http://drupal.tschannen.net/wiki/geshi_filter
#4
I just updated my site to 5.1 and your rewrite works wonderfully! The settings interface is much nicer than in my original version.
Good Work!
#5
The module attached to #1 seems to work. Thanks!
#6
yes, it works great. thanks!
#7
Hi, thanks for the effort!
I can't get it to work though :/
I downloaded the latest version (from comment #3).
tried with both geshi 1.0.7.1 and 1.0.7.19 (latest stable)
I use Drupal 5.1, 2007-01-29
the module is enabled, in configuration it says "1.0.x version detected", the config is pretty much left default.
I did made sure php syntax hilighting is enabled
when i try to write a blogpost and type something like this:
echo $bla;/*some test */
i see the cleartext, un-hilighted output.
Anyone has an idea what might be the cause?
thanks,
Dieter
#8
Oh, drupal ate my surrounding tags in the previous post :)
i typed this [code lang="php"]...[/code] but with < and > instead of [ and ]
#9
@Dieter_be:
Maybe a shot in the dark but you might try this: go to
Administer >> Site configuration >> Input formats
and then make sure that the Geshi filter is activated in the "PHP code" input format.
HTH,
Marco
#10
Ah, OK... you already did that, as I'm reading only now.
Sorry, will do better next time ;)
#11
Hello fellow Gentoo user,
no you were right, that was exactly what I forgot to do!
Damn, this is even mentioned in the readme, maybe it could be elaborated a bit more?
anyway it works now, thanks
Dieter
#12
Glad I could help (meanwhile I've read your post for the third time and now I do see where I've misread) ;)
Regards,
Marco
P.S.: Gentoo rocks ;)
#13
So, is there any talk of commiting the rewrite to contrib as the 'official' geshifilter module? I have some enhancements to this i've done for my own purposes, but would rather see them merged back in.
#14
How do I use Special Tags?...I try to put ... on post...I've configured on Special Tags 'delphi' and do not work.
#15
I spend some time on evaluating rötzi's rewrite for drupal 5 and I like it a lot. I worked further on his version from #3 (http://drupal.tschannen.net/wiki/geshi_filter) and ended up with the attached version.
The changes with rötzi's version are mainly:
As far as I can tell this rewritten geshifilter module is in a very good shape, rötzi did a very good job with his rewrite.
I hope this rewrite will make it in some form to the official branch.
It seems, however, that there is little/low activity in the tracker. Are the maintainers still actively maintaining the geshifilter module? Just curious.
Cheers
Soxofaan
#16
Awesome job, soxofaan! Would it be possible to create a checkbox that enables custom css styles? Also, as of right now, the geshifilter.css stylesheet overrides any theme level css, but I expect the css checkbox feature would fix this.
#17
In my test setup with the standard garland theme, the garland css files come after geshifilter.css, so garland could override geshifilter.css.
Moreover, what do you want to change to geshifilter.css? It's such a small file, you could maybe just edit that file?
Anyway, it doesn't feel right to add a checkbox to the settings page for theming purposes. I think there should be a better solution. Can you give more info about your setup?
Thanks for your feedback.
#18
I checked and my theme stylesheet gets called after geshifilter as well, so this must just be a css issue on my end then.
I tend to shy away from editing any core/module files so that it is easier to update them. Really, the functionality that I would like is to be able to override the geshifilter default styling. This has more to do with the actual *language*.php files in the geshi folder rather than the geshifilter.css file in the module folder. In fact, there is a built in way to handle this in the Geshi code (http://qbnz.com/highlighter/geshi-doc.html#using-css-classes). Since it is more or less a true/false flag, I figured the best, or at least simplest, way to handle it would be with a checkbox. Do you see any other ways of handling it?
#19
If I understand you correctly, you want to override the GeSHi styling, and not the GeSHi filter styling (technically, the GeSHi filter module is just a wrapper around the GeSHi library). This is indeed a sensible feature request.
in attachment is a new version of the rewrite with:
* option to choose between inline CSS or CSS classes+external stylesheet
* the per language settings can now be filtered with 'all' , 'enabled' or 'disabled'
* solved bug when to much spaces are entered in the tag and attribute fields
cheers
#20
#21
Perfect! That is exactly what I had in mind.
#22
Thanks.
Also note that the rewrite of this issue thread is already committed to CVS and further being worked on (as version 5.x-2.x).
Latest version (at the time of this writing): geshifilter 5.x-2.0-rc2.
So you better use that one, than the tar balls in this thread.
#23