aboutsummaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2014-10-28 03:03:39 +0000
committerDavid Lawrence <dkl@mozilla.com>2014-10-28 03:03:39 +0000
commit3eb1f9f9c91fb630090420a8c726091f23c29263 (patch)
treec0d1aa40f6424eaf3c8020ea6805ea6c5d66a2c5 /Bugzilla
parentbacbb85f219ef5924633672e61491a63ebb6f50a (diff)
downloadbugs-3eb1f9f9c91fb630090420a8c726091f23c29263.tar
bugs-3eb1f9f9c91fb630090420a8c726091f23c29263.tar.gz
bugs-3eb1f9f9c91fb630090420a8c726091f23c29263.tar.bz2
bugs-3eb1f9f9c91fb630090420a8c726091f23c29263.tar.xz
bugs-3eb1f9f9c91fb630090420a8c726091f23c29263.zip
Bug 1059684 - markdown text should not be rendered within a <pre> tag
r=glob,a=glob
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Markdown.pm9
-rw-r--r--Bugzilla/User.pm14
2 files changed, 15 insertions, 8 deletions
diff --git a/Bugzilla/Markdown.pm b/Bugzilla/Markdown.pm
index 3023d98e2..353c2ff6a 100644
--- a/Bugzilla/Markdown.pm
+++ b/Bugzilla/Markdown.pm
@@ -99,7 +99,7 @@ sub _RunSpanGamut {
$text = $self->_EncodeAmpsAndAngles($text);
$text = $self->_DoItalicsAndBold($text);
- $text =~ s/ {2,}\n/ <br$self->{empty_element_suffix}\n/g;
+ $text =~ s/\n/<br$self->{empty_element_suffix}\n/g;
return $text;
}
@@ -323,13 +323,6 @@ sub _DoItalicsAndBold {
return $text;
}
-# Override this function to ignore 'wrap_in_p_tags' from
-# the caller and to not generate <p> tags around the output.
-sub _FormParagraphs {
- my ($self, $text) = @_;
- return $self->SUPER::_FormParagraphs($text, { wrap_in_p_tags => 0 });
-}
-
sub _DoStrikethroughs {
my ($self, $text) = @_;
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index acedc65f2..fa2674366 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -632,6 +632,14 @@ sub is_bug_ignored {
return (grep {$_->{'id'} == $bug_id} @{$self->bugs_ignored}) ? 1 : 0;
}
+sub use_markdown {
+ my ($self, $comment) = @_;
+ return Bugzilla->feature('markdown')
+ && $self->settings->{use_markdown}->{is_enabled}
+ && $self->settings->{use_markdown}->{value} eq 'on'
+ && (!defined $comment || $comment->is_markdown);
+}
+
##########################
# Saved Recent Bug Lists #
##########################
@@ -2623,6 +2631,12 @@ C<string> The current summary of the bug.
Returns true if the user does not want email notifications for the
specified bug ID, else returns false.
+=item C<use_markdown>
+
+Returns true if the user has set their preferences to use Markdown
+for rendering comments. If an optional C<comment> object is passed
+then it returns true if the comment has markdown enabled.
+
=back
=head2 Saved Recent Bug Lists