I'm using both PEAR Wiki Filter and Geshi in the same input format configuration and can't get the Wiki filter to leave my code blocks untouched. When using the Geshi filter on its own, the code is formatted perfectly; but once I start using the Wiki filter (sequenced to run before the Geshi filter), I get an unformatted, escaped code block such as the following:

Here is our wiki text, which is perfect, followed by our code block

Customer joe = new Customer();
joe.Code = "JOE005";

Any advice?

CommentFileSizeAuthor
#11 pearwiki_ignoretoken.patch4.75 KBnterbogt

Comments

nterbogt’s picture

The reason this occurs is because the GeSHi actually does some smarts under the scenes to help with the "HTML filtered" input format.

What happens is this... you add 'code' to the list of tags that gets ignored by the wiki syntax, but on the preprocess of GeSHi actually converts the <code> tag to [geshifilter-code] token. Preprocess is completed and then the process functions of the filters are run. Because pearwiki only cares about the process function when it gets to this point, and doesn't have an ignore on [geshifilter-code] so it does it's standard replace, thus changing the & to &amp; to display correctly as HTML. This breaks geshi.

The only way around it at the moment is to write a regular expression to ignore [geshifilter-code type="blah"]...[/geshifilter-code] but this is only useful if you don't have any other tokens you want to ignore as well (like in my case [graphviz], [gmap], etc).

I'm working on a patch to pearwiki to allow me to ignore tokens as well as tags. ie. <code> is ignored if you add 'code' to the ignored tags field... well [geshifilter-code] will be ignored if you add it to the ignored tokens field. I have a working copy in my development environment, but it's not as clean as I would like. If you'd like me to send through the patches and instructions just drop me a line, but I'll wait to add a patch here until it works the way I like.

Oh, it does mean the comment under the 'Ignore tags' field is now incorrect though, because GeSHi changed the way their filter worked.

CompShack’s picture

Having the same problem - any updates on this? Thanks for this great module, i'm currently have it on my test box and love it.

NOTE: i'm using version 5 though.

nterbogt’s picture

Sorry, forgot about this.
I'll try to get something out over the next few days.

CompShack’s picture

by the way, the Code filter module works fine though. you you need to give it a value less than the pear input format for it to work though. The geshi module will still have problem even if you followed the above suggestion.

Thanks!

nterbogt’s picture

Version: 6.x-1.0-beta1 » 5.x-1.x-dev

Sorry guys,

Just doing the last bit of testing. So far my code works for [graphviz], [flickr], [geshifilter-code], [video] and [gmap]... I only need to write some field documentation (on the input filter configure page) and I'll be done.

Fingers crossed, tonight.

Thanks,
Nathan

sibidiba’s picture

Version: 5.x-1.x-dev » 6.x-1.0-beta1

Is some help needed for this issue?

Is this already in the CVS version? When will be this in the stable release?

sibidiba’s picture

Please, could you push your patch into CVS? Or maybe even into a new stable release?

nterbogt’s picture

Final bugs have been ironed out. I'll write some doco soon and post the patch.

infojunkie’s picture

subscribe

sibidiba’s picture

plzplzplz :)

nterbogt’s picture

Category: support » feature
Status: Active » Needs review
StatusFileSize
new4.75 KB

Ok, here it is everyone.
Sorry for the delay... I've been out in the wilderness camping :)

nterbogt’s picture

Assigned: Unassigned » nterbogt

Assigning to me.

sibidiba’s picture

Thanks, great, it works.

sibidiba’s picture

See this comment how to improve table of contents with the help of this patch: http://drupal.org/node/150067#comment-937519 .

wrunt’s picture

Status: Needs review » Reviewed & tested by the community

Works for me too. I added 'code' to the ignored tags, and 'geshifilter-code' to the ignored tokens, and rearranged the pear wiki filter to come before the geshi filter, and now they both work together.

nterbogt’s picture

Can we get this pushed into the module?

bsherwood’s picture

+1

I am having the same problem as well. Can we roll out another release?

boldfish’s picture

My workaround is here:
http://www.workalone.co.uk/node/129

basically sequence and adding div to the ignored tags in Pear Wiki

nschloe’s picture

hi applied the above patch and everything now kind of works when i put "code blockcode" as ignore tags, "geshifilter-code geshifilter-blockcode" as ignore tokens, and set pearfilter's priority of geshi's.

only issue remaining for me is the added blank line at each line break in a code or blockcode environment...