use Encode;
use Mojo::DOM;
+use Mojo::Util qw(trim);
use HTML::Escape qw(escape_html);
use List::MoreUtils qw(any);
}
}
+my $MARKDOWN_OFF = quotemeta '#[markdown(off)]';
sub render_html {
my ($self, $markdown, $bug, $comment, $user) = @_;
my $parser = $self->markdown_parser;
return escape_html($markdown) unless $parser;
+ # This makes sure we never handle > foo text in the shortcuts code.
+ local $Bugzilla::Template::COLOR_QUOTES = 0;
+
+ if ($markdown =~ /^\s*$MARKDOWN_OFF\n/s) {
+ my $text = $self->bugzilla_shorthand->( trim($markdown) );
+ my @p = split(/\n{2,}/, $text);
+ my $html = join("\n", map { s/\n/<br>\n/gs; "<p>$_</p>\n" } @p );
+ return $html;
+ }
+
no warnings 'utf8'; # this is needed because our perl is so old.
# This is a bit faster since it doesn't engage the regex engine.
# Replace < with \x{FDD4}, and remove \x{FDD4}.
use constant FORMAT_2_SIZE => [19, 55];
our %SHARED_PROVIDERS;
+our $COLOR_QUOTES = 1;
# Pseudo-constant.
sub SAFE_URL_REGEXP {
$text = html_quote($text);
- # Color quoted text
- $text =~ s~^(>.+)$~<span class="quote">$1</span >~mg;
- $text =~ s~</span >\n<span class="quote">~\n~g;
+ if ($COLOR_QUOTES) {
+ # Color quoted text
+ $text =~ s~^(>.+)$~<span class="quote">$1</span >~mg;
+ $text =~ s~</span >\n<span class="quote">~\n~g;
+ }
# mailto:
# Use |<nothing> so that $1 is defined regardless