both <!--break --> and <!--pagebreak--> are not working anymore as they are transferred into &lt;!--break--&gt;
removing this line makes it work, but I don't know if that is such a clever idea...
$text = preg_replace('!<([^a-zA-Z/])!', '&lt;\1', $text);

Comments

seanburlington’s picture

I don't think commenting it out is a good idea

This will still turn extraneous <'s into <'s

$text = preg_replace('#<([^a-zA-Z/!])#', '<\1', $text);
while keeping comments as comments

dokumori’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev
Status: Active » Needs work
StatusFileSize
new973 bytes

I had the same problem on 5.2, so I created a module that solves this problem.
It's an implementation of hook_filter that converts '<' to '<' and '>' to '>' only in the context of HTML comment.

Make sure you set the weight of HTML Corrector lighter than this module. It will not work otherwise.

The attachment has .patch extension, but it's a zip archive.

dokumori’s picture

Status: Needs work » Needs review
StatusFileSize
new973 bytes

oops. I meant to choose 'code needs review'

jcfiala’s picture

StatusFileSize
new904 bytes

Here's a different patch, that doesn't involve adding a new module but which adds a new regex call and modifies a second so that html comments aren't turned into &lt;!-- in the code. What do folks think?

davidwhthomas’s picture

jcfiala's patch works for me and fixes an annoying problem. thanks!

DT

gpk’s picture

See also http://drupal.org/node/222926 (same issue but in the context of htmlcorrector as part of core filter.module in Drupal 6.x). I'd mark one or other duplicate except that these are now separate projects since htmlcorrector has been taken into core.

quicksketch’s picture

Marked http://drupal.org/node/138098 as duplicate.

sun’s picture

StatusFileSize
new785 bytes

Hm. It should be as easy as attached patch. Works for me (and Paging module).
Please test.

This issue needs to be moved into Drupal core's queue after this has been solved, so the fix gets also applied for D6+.

#167197: Not compatible with HTML Corrector module/filter has been marked as duplicate of this issue.

sun’s picture

StatusFileSize
new1.71 KB

Aha. So after reviewing the existing core issue in #222926: HTML Corrector filter escapes HTML comments, I've come up with attached solution.

chrisschaub’s picture

Can this last patch #9 get committed? It works fine.

jcnventura’s picture

No it doesn't. The contents of the HTML comments are still processed by the filter. See #222926: HTML Corrector filter escapes HTML comments #12 for a more complete patch.

João

chrisschaub’s picture

But your patch is for the Drupal 6 filter module, this patch is for the Drupal 5 htmlcorrector 3rd party module; Drupal 5 does not have the html corrector in core. This patch works fine with the pager module in my testing. Is your problem with multi-line comments?

jcnventura’s picture

Hi,

Yes, the easier test is with multi-line comments (br gets introduced at the end of each line). However, if you insert invalid HTML in the comment, it will probably correct it for you, as the corrector is still active inside the comment. I have now seen that the patch here is way more complex than the 3-line pattern fixes in the Drupal 6 patch. Only the first pattern is changed, while the second pattern that is changed in D6 is left here alone.

João

vacilando’s picture

Same problem in Drupal 6.6. Turning off HTML corrector is a solution, but not a preferred one, of course. Subscribing.

todd nienkerk’s picture

Please see my issue and patch for the core version of this module: #343236: HTML corrector encodes (entifies) <!--break--> tag.