[Bps-public-commit] App-Changeloggr branch, master, updated. 49e0ab9c05fdf85434039c0c6ced8cec9a0ebfc8

sartak at bestpractical.com sartak at bestpractical.com
Thu Apr 30 15:34:54 EDT 2009


The branch, master has been updated
       via  49e0ab9c05fdf85434039c0c6ced8cec9a0ebfc8 (commit)
      from  de8c2303b740b1dd25b7c8e20c15a0989f4e3da4 (commit)

Summary of changes:
 lib/App/Changeloggr/View.pm |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit 49e0ab9c05fdf85434039c0c6ced8cec9a0ebfc8
Author: Shawn M Moore <sartak at gmail.com>
Date:   Thu Apr 30 15:34:41 2009 -0400

    Be more robust in coloring + and - in diffstat

diff --git a/lib/App/Changeloggr/View.pm b/lib/App/Changeloggr/View.pm
index 848af69..50aefac 100644
--- a/lib/App/Changeloggr/View.pm
+++ b/lib/App/Changeloggr/View.pm
@@ -139,8 +139,14 @@ template '/change/more' => sub {
 
     pre {
         my $diffstat = Jifty->web->escape($change->diffstat);
-        $diffstat =~ s{(\++)}{<span class="diffadd">$1</span>}g;
-        $diffstat =~ s{(\-+)}{<span class="diffsub">$1</span>}g;
+
+        for (['+', 'diffadd'], ['-', 'diffsub']) {
+            my ($char, $class) = @$_;
+
+            # this regex avoids coloring the symbols in filenames
+            $diffstat =~ s{(\|\s+\d+ |</span>)(\Q$char\E+)}
+                          {$1<span class="$class">$2</span>}g;
+        }
 
         outs_raw $diffstat;
     };

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list