3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-23 04:19:27 +01:00

Improve handling of spaces in cc diff

This commit is contained in:
Pragmatic Software 2013-08-23 18:26:43 +00:00
parent 36e48cb703
commit e6ae49fd4f
2 changed files with 5 additions and 3 deletions

View File

@ -13,8 +13,8 @@ use warnings;
# These are set automatically by the build/commit script # These are set automatically by the build/commit script
use constant { use constant {
BUILD_NAME => "PBot", BUILD_NAME => "PBot",
BUILD_REVISION => 422, BUILD_REVISION => 423,
BUILD_DATE => "2013-08-22", BUILD_DATE => "2013-08-23",
}; };
1; 1;

View File

@ -186,7 +186,9 @@ if($code =~ m/^\s*diff\s*$/i) {
} else { } else {
use Text::WordDiff; use Text::WordDiff;
my $diff = word_diff \$last_code[1], \$last_code[0], { STYLE => 'MARKUP' }; my $diff = word_diff \$last_code[1], \$last_code[0], { STYLE => 'MARKUP' };
$diff =~ s/<del>(.*?)<\/del><ins>(.*?)<\/ins>/<replaced `$1` with `$2`>/g; $diff =~ s/<del>([^\s]+)(\s+)<\/del>/<del>$1<\/del>$2/g;
$diff =~ s/<ins>([^\s]+)(\s+)<\/ins>/<ins>$1<\/ins>$2/g;
$diff =~ s/<del>(.*?)<\/del>\s*<ins>(.*?)<\/ins>/<replaced `$1` with `$2`>/g;
$diff =~ s/<del>(.*?)<\/del>/<removed `$1`>/g; $diff =~ s/<del>(.*?)<\/del>/<removed `$1`>/g;
$diff =~ s/<ins>(.*?)<\/ins>/<inserted `$1`>/g; $diff =~ s/<ins>(.*?)<\/ins>/<inserted `$1`>/g;