From 42d5e45576b519f19879d2b0eba529932da81644 Mon Sep 17 00:00:00 2001 From: Koosha KM Date: Tue, 14 Oct 2014 20:42:46 +0000 Subject: Bug 1059723: Reply button should become AJAX-based r=dkl,a=sgreen --- Bugzilla/Markdown.pm | 32 ++++++++++++++++++- Bugzilla/Template.pm | 12 ++++--- skins/standard/global.css | 9 ++++++ template/en/default/bug/comments.html.tmpl | 50 +++++++++++++++++++++++++++--- 4 files changed, 93 insertions(+), 10 deletions(-) diff --git a/Bugzilla/Markdown.pm b/Bugzilla/Markdown.pm index 5f1a7d955..3023d98e2 100644 --- a/Bugzilla/Markdown.pm +++ b/Bugzilla/Markdown.pm @@ -75,7 +75,7 @@ sub _Markdown { my $self = shift; my $text = shift; - $text = Bugzilla::Template::quoteUrls($text); + $text = Bugzilla::Template::quoteUrls($text, undef, undef, undef, undef, 1); return $self->SUPER::_Markdown($text, @_); } @@ -392,6 +392,36 @@ sub _DoCodeBlocks { return $text; } +sub _DoBlockQuotes { + my ($self, $text) = @_; + + $text =~ s{ + ( # Wrap whole match in $1 + (?: + ^[ \t]*>[ \t]? # '>' at the start of a line + .+\n # rest of the first line + (?:.+\n)* # subsequent consecutive lines + \n* # blanks + )+ + ) + }{ + my $bq = $1; + $bq =~ s/^[ \t]*>[ \t]?//gm; # trim one level of quoting + $bq =~ s/^[ \t]+$//mg; # trim whitespace-only lines + $bq = $self->_RunBlockGamut($bq, {wrap_in_p_tags => 1}); # recurse + $bq =~ s/^/ /mg; + # These leading spaces screw with
 content, so we need to fix that:
+            $bq =~ s{(\s*
.+?
)}{ + my $pre = $1; + $pre =~ s/^ //mg; + $pre; + }egs; + "
\n$bq\n
\n\n"; + }egmx; + + return $text; +} + sub _EncodeCode { my ($self, $text) = @_; diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index ca467577f..660767afd 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -148,10 +148,11 @@ sub get_format { # If you want to modify this routine, read the comments carefully sub quoteUrls { - my ($text, $bug, $comment, $user, $bug_link_func) = @_; + my ($text, $bug, $comment, $user, $bug_link_func, $for_markdown) = @_; return $text unless $text; $user ||= Bugzilla->user; $bug_link_func ||= \&get_bug_link; + $for_markdown ||= 0; # We use /g for speed, but uris can have other things inside them # (http://foo/bug#3 for example). Filtering that out filters valid @@ -222,10 +223,11 @@ sub quoteUrls { $text = html_quote($text); - # Color quoted text - $text =~ s~^(>.+)$~$1~mg; - $text =~ s~\n~\n~g; - + unless ($for_markdown) { + # Color quoted text + $text =~ s~^(>.+)$~$1~mg; + $text =~ s~\n~\n~g; + } # mailto: # Use | so that $1 is defined regardless # @ is the encoded '@' character. diff --git a/skins/standard/global.css b/skins/standard/global.css index 45aeb2634..28c406b1d 100644 --- a/skins/standard/global.css +++ b/skins/standard/global.css @@ -243,6 +243,15 @@ textarea { font-family: monospace; } + + blockquote { + border-left: 0.2em solid #CCC; + color: #65379C; + padding: 0; + margin-left: 0.5em; + margin-bottom: -1em; + white-space: pre; + } /* generic (end) */ /* Links that control whether or not something is visible. */ diff --git a/template/en/default/bug/comments.html.tmpl b/template/en/default/bug/comments.html.tmpl index 8f5742fee..617f49471 100644 --- a/template/en/default/bug/comments.html.tmpl +++ b/template/en/default/bug/comments.html.tmpl @@ -14,13 +14,16 @@ @@ -126,7 +162,13 @@ [% END %] [reply] [% END %] -- cgit v1.2.3-24-g4f1b