<!--break --> is transformed into html code with lt and gt

ednique - November 12, 2006 - 18:10
Project:HTML corrector
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

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

#1

seanburlington - May 11, 2007 - 12:33

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

#2

dokumori - October 9, 2007 - 16:54
Version:4.7.x-1.x-dev» 5.x-1.x-dev
Status:active» needs work

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.

AttachmentSize
drupalbreak_enabler.zip_.patch 973 bytes

#3

dokumori - October 9, 2007 - 16:57
Status:needs work» needs review

oops. I meant to choose 'code needs review'

AttachmentSize
drupalbreak_enabler.zip__0.patch 973 bytes

#4

jcfiala - January 18, 2008 - 20:40

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?

AttachmentSize
htmlcorrector.module.comment_fix.patch 904 bytes

#5

davidwhthomas - March 4, 2008 - 03:44

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

DT

#6

gpk - March 8, 2008 - 14:37

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.

#7

quicksketch - April 15, 2008 - 22:20

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

#8

sun - June 3, 2008 - 22:21

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.

AttachmentSize
htmlcorrector-DRUPAL-5.comments.patch 785 bytes

#9

sun - June 3, 2008 - 22:40

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

AttachmentSize
htmlcorrector-DRUPAL-5.comments.patch 1.71 KB

#10

lutegrass - August 21, 2008 - 15:40

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

#11

jcnventura - September 5, 2008 - 13:07

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

João

#12

lutegrass - September 6, 2008 - 00:48

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?

#13

jcnventura - September 6, 2008 - 21:33

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

#14

vacilando - November 8, 2008 - 13:01

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

#15

Todd Nienkerk - December 15, 2008 - 17:23

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

 
 

Drupal is a registered trademark of Dries Buytaert.