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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rötzi’s picture

FileSize
6.76 KB

i forgot to remove some debug stuff. here the new version.

mhutch’s picture

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.

rötzi’s picture

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

vfilby’s picture

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!

Jax’s picture

The module attached to #1 seems to work. Thanks!

BronzeAge’s picture

yes, it works great. thanks!

Dieter_be’s picture

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

Dieter_be’s picture

Oh, drupal ate my surrounding tags in the previous post :)

i typed this [code lang="php"]...[/code] but with < and > instead of [ and ]

drumlin’s picture

@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

drumlin’s picture

Ah, OK... you already did that, as I'm reading only now.
Sorry, will do better next time ;)

Dieter_be’s picture

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

drumlin’s picture

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 ;)

anisotropic’s picture

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.

Prodigyx’s picture

Title: rewrite for drupal 5 » Special tags

How do I use Special Tags?...I try to put ... on post...I've configured on Special Tags 'delphi' and do not work.

soxofaan’s picture

Title: Special tags » rewrite for drupal 5
FileSize
6.5 KB

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:

  • I worked on the language tags stuff. Instead of a bunch of collapsible fieldsets (one for each languages, which adds a lot of bloat) I implemented it as a more compact table. I also moved it to a dedicated settings page admin/settings/geshifilter/languages to unclutter the general settings page.
  • I moved the path to the geshi library to the global settings (instead making it possible to define a different GeSHi library for each input format, which doesn't make sense I think)
  • removed autoconfiguration because this messes with other modules databases (by default!), which is not a good thing to do. It also took a lot of code for a small feature. I replaced it with a separate page which reports detected known conflicts with pointers on how to solve them.
  • solved some minor bugs (e.g. when "lang" and "language" are both enabled as highlight tags, "language" would not work)
  • Documentation, UI string tweaks and other tweaks in a lot of places.

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

ktonini’s picture

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.

soxofaan’s picture

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.

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.

ktonini’s picture

In my test setup with the standard garland theme, the garland css files come after geshifilter.css, so garland could override geshifilter.css.

I checked and my theme stylesheet gets called after geshifilter as well, so this must just be a css issue on my end then.

Moreover, what do you want to change to geshifilter.css? It's such a small file, you could maybe just edit that file?

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?

soxofaan’s picture

Really, the functionality that I would like is to be able to override the geshifilter default styling.

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

soxofaan’s picture

Assigned: Unassigned » soxofaan
ktonini’s picture

Perfect! That is exactly what I had in mind.

soxofaan’s picture

Status: Needs review » Fixed

Perfect! That is exactly what I had in mind.

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.

Anonymous’s picture

Status: Fixed » Closed (fixed)