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

Comments

stacysimpson’s picture

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.

stacysimpson’s picture

Version: 5.x-2.1 » 6.x-2.x-dev
Category: support » feature

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.

stacysimpson’s picture

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));
  ...
mitchell’s picture

Status: Active » Closed (duplicate)