<!--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 <!--break-->
removing this line makes it work, but I don't know if that is such a clever idea...
$text = preg_replace('!<([^a-zA-Z/])!', '<\1', $text);

#1
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
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.
#3
oops. I meant to choose 'code needs review'
#4
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 <!-- in the code. What do folks think?
#5
jcfiala's patch works for me and fixes an annoying problem. thanks!
DT
#6
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
Marked http://drupal.org/node/138098 as duplicate.
#8
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.
#9
Aha. So after reviewing the existing core issue in #222926: htmlcorrector filter escapes HTML comments, I've come up with attached solution.
#10
Can this last patch #9 get committed? It works fine.
#11
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
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
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
Same problem in Drupal 6.6. Turning off HTML corrector is a solution, but not a preferred one, of course. Subscribing.
#15
Please see my issue and patch for the core version of this module: #343236: HTML corrector encodes (entifies) <!--break--> tag.