Closed (fixed)
Project:
GeSHi Filter for syntax highlighting
Version:
7.x-1.x-dev
Component:
Filtering
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Jul 2013 at 13:37 UTC
Updated:
26 Apr 2017 at 22:55 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Johann Wagner commentedA patch to correct this bug :
Comment #2
soxofaan commentedwhat other filters are there in the text format and in what order?
Comment #4
askibinski commentedThis is an issue using CKEditor + CodeSnippet plugin, because html is turned into entities and should be decoded, BUT only for the code between code tags. I tried with something like this which works for most cases, but not when the itself contains pre and code tags.
Comment #5
yukare commentedOn my site i use this, quoted from a site, just i do not have the url now:
You must hack a GeSHi filter file. I'm talking about the code you download separately form the Drupal GeSHi module.
Under sites/[sitename or all]/modules/geshifilter/geshi, open geshi.php for editing. Add the below code at line 2046 (a blank line in GeSHi 1.0.8.6) or after // Replace all newlines to a common form:
// Replace all newlines to a common form.
I have seen that this will be a bigger issue in drupal 8 , as it will use ckeditor by default.
I will work on a fix for drupal 8 this week, have started it already, and it maybe simple as this: on filter prepare call a "decode" function only with the contents that will be passed to geshi(so do not need a regex for all possible blocks) and do the above changes on it. I am 99% sure that the same code used on drupal 8 will work on drupal 7.
Comment #6
yrocq commentedHi ! I also have this problem for one if my projects. I think replacing the entities is a good idea, but it may not be appropriate in all cases. I suggest that we add it as a setting. Here is my patch.
Comment #7
yukare commentedI like this patch, and as a setting it will not change as it works now, which is good, but this part:
Must be moved to latter in processing, maybe to geshifilter_process_sourcecode(), or somewhere before it with $format available, because now it will work on all text, not only in text that geshi will process.
Comment #9
yukare commentedThe previous commit was for Drupal 8, please use it as a base for a Drupal 7 patch.
Comment #10
yrocq commentedI changed my patch so that the decoding is made in geshifilter_process_sourcecode. I wanted to add tests, but they are currently broken for the Drupal 7 version of this module. I can submit a more complete patch when this issue will be resolved.
Comment #11
yukare commentedTests are working now, they are fixed and all tests are passing since per filter settings are fixed too. I just would like to have it enabled on d.o but it do not work here because geshi library will be missing.
Comment #12
yukare commentedThis patch add tests and move the decode to prepare functions, where we have $format available. Please review it.
Working on this make me love the new oop from Drupal 8 where we do not need to pass $filter or $format around.
Comment #13
ar-jan commentedThe patch in #12 applies and works in my testing (special characters are rendered correctly in highlighted code). If there are no objections code-wise I'd say RTBC.
Comment #14
MulleG commentedPatch #12 also works for me
Morten
Comment #15
crzdev commentedThanks yukare, path #12 working perfectly!
Comment #16
mausolos commentedAlso tested #12, works great! Was tearing my hair out! So this patch has been out there now for TWO YEARS. When can we get this rolled into the official module? Anything I can do to make that happen faster?
Thanks!
Charles
Comment #18
yukare commentedCommited, thanks everyone.