HTML Filtering (How?)

alevy - September 5, 2008 - 21:49
Project:Diff
Version:6.x-2.x-dev
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

I cannot figure out how to filter out the HTML on the diff page (supposedly should be able to replace with new lines).

I've read the threads - I've messed around - I must be missing something...

Please just give me some direction...

Thanks in advance

#1

stacysimpson - January 16, 2009 - 13:39

Ditto. I installed the latest diff module (version 2.1) and do not see how to filter out HTML tags from the displayed diff output. Is this supported natively now, or do we need to incorporate a patch of some sort.

#2

stacysimpson - June 20, 2009 - 18:56
Version:5.x-2.1» 6.x-2.x-dev
Category:support request» feature request

We hacked into the diff module to strip out HTML stuff before comparing various revisions. Our customers only care when the raw content changes...not formatting. It would be nice to have this as a configurable options.

#3

stacysimpson - June 22, 2009 - 12:55

Here are the changes to node.inc's node_diff():

  if ($type->has_body) {
    // replace <br>'s with LF's
    $old_node->body = str_replace(array("<br>", "<br />"), "\n", $old_node->body);
    $new_node->body = str_replace(array("<br>", "<br />"), "\n", $new_node->body);
 
    // replace <p>'s with LF's - then strip the closing </p> - this is so much easier than preg_replace to find contents of paragraph
    $old_node->body = str_replace("<p>", "\n", $old_node->body);
    $new_node->body = str_replace("<p>", "\n", $new_node->body);
  
    //  then strip the rest
    $old_node->body = strip_tags(html_entity_decode($old_node->body, ENT_QUOTES));
    $new_node->body = strip_tags(html_entity_decode($new_node->body, ENT_QUOTES));
  ...

 
 

Drupal is a registered trademark of Dries Buytaert.