]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
gitweb: Pass esc_html_hl_regions() options to esc_html()
[Gitweb] / gitweb.perl
index 91663a4d044681f218a5bbbbff8eba71f6ce3abbc408a4cfef6f7291d72c55da..0d86a7f111fa78e1646689001ce16fc33d6633e2d364f680622709dccc772c24 100755 (executable)
@@ -1733,7 +1733,9 @@ sub chop_and_escape_str {
 # '<span class="mark">foo</span>bar'
 sub esc_html_hl_regions {
        my ($str, $css_class, @sel) = @_;
-       return esc_html($str) unless @sel;
+       my %opts = grep { ref($_) ne 'ARRAY' } @sel;
+       @sel     = grep { ref($_) eq 'ARRAY' } @sel;
+       return esc_html($str, %opts) unless @sel;
 
        my $out = '';
        my $pos = 0;
@@ -1744,15 +1746,16 @@ sub esc_html_hl_regions {
                # Don't create empty <span> elements.
                next if $end <= $begin;
 
-               my $escaped = esc_html(substr($str, $begin, $end - $begin));
+               my $escaped = esc_html(substr($str, $begin, $end - $begin),
+                                      %opts);
 
-               $out .= esc_html(substr($str, $pos, $begin - $pos))
+               $out .= esc_html(substr($str, $pos, $begin - $pos), %opts)
                        if ($begin - $pos > 0);
                $out .= $cgi->span({-class => $css_class}, $escaped);
 
                $pos = $end;
        }
-       $out .= esc_html(substr($str, $pos))
+       $out .= esc_html(substr($str, $pos), %opts)
                if ($pos < length($str));
 
        return $out;
This page took 0.126595 seconds and 4 git commands to generate.