Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Ivlev
bugzilla
Commits
f5fc4a6d
Commit
f5fc4a6d
authored
Nov 04, 2014
by
David Lawrence
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert Bug 330707 - Add optional support for MarkDown
parent
fc62fd40
Show whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
30 additions
and
1116 deletions
+30
-1116
Bugzilla.pm
Bugzilla.pm
+0
-11
Bug.pm
Bugzilla/Bug.pm
+1
-6
Comment.pm
Bugzilla/Comment.pm
+0
-18
Constants.pm
Bugzilla/Constants.pm
+0
-6
Schema.pm
Bugzilla/DB/Schema.pm
+1
-2
Install.pm
Bugzilla/Install.pm
+0
-2
DB.pm
Bugzilla/Install/DB.pm
+0
-4
Requirements.pm
Bugzilla/Install/Requirements.pm
+0
-9
Markdown.pm
Bugzilla/Markdown.pm
+0
-520
Template.pm
Bugzilla/Template.pm
+2
-22
User.pm
Bugzilla/User.pm
+0
-14
Bug.pm
Bugzilla/WebService/Bug.pm
+5
-97
Constants.pm
Bugzilla/WebService/Constants.pm
+0
-1
using.rst
docs/en/rst/using.rst
+1
-18
field.js
js/field.js
+6
-30
post_bug.cgi
post_bug.cgi
+0
-1
process_bug.cgi
process_bug.cgi
+0
-4
global.css
skins/standard/global.css
+2
-15
004template.t
t/004template.t
+0
-1
008filter.t
t/008filter.t
+1
-1
comment.html.tmpl
template/en/default/bug/comment.html.tmpl
+1
-11
comments.html.tmpl
template/en/default/bug/comments.html.tmpl
+6
-48
midair.html.tmpl
template/en/default/bug/process/midair.html.tmpl
+0
-1
bugmail.html.tmpl
template/en/default/email/bugmail.html.tmpl
+1
-1
filterexceptions.pl
template/en/default/filterexceptions.pl
+1
-1
setting-descs.none.tmpl
template/en/default/global/setting-descs.none.tmpl
+0
-1
user-error.html.tmpl
template/en/default/global/user-error.html.tmpl
+0
-3
linked.html.tmpl
template/en/default/pages/linked.html.tmpl
+2
-2
markdown.html.tmpl
template/en/default/pages/markdown.html.tmpl
+0
-265
strings.txt.pl
template/en/default/setup/strings.txt.pl
+0
-1
No files found.
Bugzilla.pm
View file @
f5fc4a6d
...
@@ -397,13 +397,6 @@ sub logout_request {
...
@@ -397,13 +397,6 @@ sub logout_request {
# there. Don't rely on it: use Bugzilla->user->login instead!
# there. Don't rely on it: use Bugzilla->user->login instead!
}
}
sub
markdown
{
return
if
!
Bugzilla
->
feature
(
'markdown'
);
require
Bugzilla::
Markdown
;
return
$_
[
0
]
->
request_cache
->
{
markdown
}
||=
Bugzilla::
Markdown
->
new
();
}
sub
job_queue
{
sub
job_queue
{
require
Bugzilla::
JobQueue
;
require
Bugzilla::
JobQueue
;
return
$_
[
0
]
->
request_cache
->
{
job_queue
}
||=
Bugzilla::
JobQueue
->
new
();
return
$_
[
0
]
->
request_cache
->
{
job_queue
}
||=
Bugzilla::
JobQueue
->
new
();
...
@@ -954,10 +947,6 @@ Returns the local timezone of the Bugzilla installation,
...
@@ -954,10 +947,6 @@ Returns the local timezone of the Bugzilla installation,
as a DateTime::TimeZone object. This detection is very time
as a DateTime::TimeZone object. This detection is very time
consuming, so we cache this information for future references.
consuming, so we cache this information for future references.
=item C<markdown>
The current L<Markdown|Bugzilla::Markdown> object, to be used for Markdown rendering.
=item C<job_queue>
=item C<job_queue>
Returns a L<Bugzilla::JobQueue> that you can use for queueing jobs.
Returns a L<Bugzilla::JobQueue> that you can use for queueing jobs.
...
...
Bugzilla/Bug.pm
View file @
f5fc4a6d
...
@@ -694,8 +694,6 @@ sub create {
...
@@ -694,8 +694,6 @@ sub create {
unless
defined
$params
->
{
rep_platform
};
unless
defined
$params
->
{
rep_platform
};
# Make sure a comment is always defined.
# Make sure a comment is always defined.
$params
->
{
comment
}
=
''
unless
defined
$params
->
{
comment
};
$params
->
{
comment
}
=
''
unless
defined
$params
->
{
comment
};
$params
->
{
is_markdown
}
=
0
unless
defined
$params
->
{
is_markdown
}
&&
$params
->
{
is_markdown
}
eq
'1'
;
$class
->
check_required_create_fields
(
$params
);
$class
->
check_required_create_fields
(
$params
);
$params
=
$class
->
run_create_validators
(
$params
);
$params
=
$class
->
run_create_validators
(
$params
);
...
@@ -709,7 +707,6 @@ sub create {
...
@@ -709,7 +707,6 @@ sub create {
my
$blocked
=
delete
$params
->
{
blocked
};
my
$blocked
=
delete
$params
->
{
blocked
};
my
$keywords
=
delete
$params
->
{
keywords
};
my
$keywords
=
delete
$params
->
{
keywords
};
my
$creation_comment
=
delete
$params
->
{
comment
};
my
$creation_comment
=
delete
$params
->
{
comment
};
my
$is_markdown
=
delete
$params
->
{
is_markdown
};
my
$see_also
=
delete
$params
->
{
see_also
};
my
$see_also
=
delete
$params
->
{
see_also
};
# We don't want the bug to appear in the system until it's correctly
# We don't want the bug to appear in the system until it's correctly
...
@@ -797,7 +794,6 @@ sub create {
...
@@ -797,7 +794,6 @@ sub create {
# We now have a bug id so we can fill this out
# We now have a bug id so we can fill this out
$creation_comment
->
{
'bug_id'
}
=
$bug
->
id
;
$creation_comment
->
{
'bug_id'
}
=
$bug
->
id
;
$creation_comment
->
{
'is_markdown'
}
=
$is_markdown
;
# Insert the comment. We always insert a comment on bug creation,
# Insert the comment. We always insert a comment on bug creation,
# but sometimes it's blank.
# but sometimes it's blank.
...
@@ -2430,8 +2426,7 @@ sub set_all {
...
@@ -2430,8 +2426,7 @@ sub set_all {
# there are lots of things that want to check if we added a comment.
# there are lots of things that want to check if we added a comment.
$self
->
add_comment
(
$params
->
{
'comment'
}
->
{
'body'
},
$self
->
add_comment
(
$params
->
{
'comment'
}
->
{
'body'
},
{
isprivate
=>
$params
->
{
'comment'
}
->
{
'is_private'
},
{
isprivate
=>
$params
->
{
'comment'
}
->
{
'is_private'
},
work_time
=>
$params
->
{
'work_time'
},
work_time
=>
$params
->
{
'work_time'
}
});
is_markdown
=>
$params
->
{
'comment'
}
->
{
'is_markdown'
}
});
}
}
if
(
exists
$params
->
{
alias
}
&&
$params
->
{
alias
}{
set
})
{
if
(
exists
$params
->
{
alias
}
&&
$params
->
{
alias
}{
set
})
{
...
...
Bugzilla/Comment.pm
View file @
f5fc4a6d
...
@@ -43,7 +43,6 @@ use constant DB_COLUMNS => qw(
...
@@ -43,7 +43,6 @@ use constant DB_COLUMNS => qw(
already_wrapped
already_wrapped
type
type
extra_data
extra_data
is_markdown
)
;
)
;
use
constant
UPDATE_COLUMNS
=>
qw(
use
constant
UPDATE_COLUMNS
=>
qw(
...
@@ -66,7 +65,6 @@ use constant VALIDATORS => {
...
@@ -66,7 +65,6 @@ use constant VALIDATORS => {
work_time
=>
\&
_check_work_time
,
work_time
=>
\&
_check_work_time
,
thetext
=>
\&
_check_thetext
,
thetext
=>
\&
_check_thetext
,
isprivate
=>
\&
_check_isprivate
,
isprivate
=>
\&
_check_isprivate
,
is_markdown
=>
\&
Bugzilla::Object::
check_boolean
,
extra_data
=>
\&
_check_extra_data
,
extra_data
=>
\&
_check_extra_data
,
type
=>
\&
_check_type
,
type
=>
\&
_check_type
,
};
};
...
@@ -179,7 +177,6 @@ sub body { return $_[0]->{'thetext'}; }
...
@@ -179,7 +177,6 @@ sub body { return $_[0]->{'thetext'}; }
sub
bug_id
{
return
$_
[
0
]
->
{
'bug_id'
};
}
sub
bug_id
{
return
$_
[
0
]
->
{
'bug_id'
};
}
sub
creation_ts
{
return
$_
[
0
]
->
{
'bug_when'
};
}
sub
creation_ts
{
return
$_
[
0
]
->
{
'bug_when'
};
}
sub
is_private
{
return
$_
[
0
]
->
{
'isprivate'
};
}
sub
is_private
{
return
$_
[
0
]
->
{
'isprivate'
};
}
sub
is_markdown
{
return
$_
[
0
]
->
{
'is_markdown'
};
}
sub
work_time
{
sub
work_time
{
# Work time is returned as a string (see bug 607909)
# Work time is returned as a string (see bug 607909)
return
0
if
$_
[
0
]
->
{
'work_time'
}
+
0
==
0
;
return
0
if
$_
[
0
]
->
{
'work_time'
}
+
0
==
0
;
...
@@ -277,7 +274,6 @@ sub body_full {
...
@@ -277,7 +274,6 @@ sub body_full {
sub
set_is_private
{
$_
[
0
]
->
set
(
'isprivate'
,
$_
[
1
]);
}
sub
set_is_private
{
$_
[
0
]
->
set
(
'isprivate'
,
$_
[
1
]);
}
sub
set_type
{
$_
[
0
]
->
set
(
'type'
,
$_
[
1
]);
}
sub
set_type
{
$_
[
0
]
->
set
(
'type'
,
$_
[
1
]);
}
sub
set_extra_data
{
$_
[
0
]
->
set
(
'extra_data'
,
$_
[
1
]);
}
sub
set_extra_data
{
$_
[
0
]
->
set
(
'extra_data'
,
$_
[
1
]);
}
sub
set_is_markdown
{
$_
[
0
]
->
set
(
'is_markdown'
,
$_
[
1
]);
}
sub
add_tag
{
sub
add_tag
{
my
(
$self
,
$tag
)
=
@_
;
my
(
$self
,
$tag
)
=
@_
;
...
@@ -526,10 +522,6 @@ C<string> Time spent as related to this comment.
...
@@ -526,10 +522,6 @@ C<string> Time spent as related to this comment.
C<boolean> Comment is marked as private.
C<boolean> Comment is marked as private.
=item C<is_markdown>
C<boolean> Whether this comment needs L<Markdown|Bugzilla::Markdown> rendering to be applied.
=item C<already_wrapped>
=item C<already_wrapped>
If this comment is stored in the database word-wrapped, this will be C<1>.
If this comment is stored in the database word-wrapped, this will be C<1>.
...
@@ -625,16 +617,6 @@ A string, the full text of the comment as it would be displayed to an end-user.
...
@@ -625,16 +617,6 @@ A string, the full text of the comment as it would be displayed to an end-user.
=cut
=cut
=head2 Modifiers
=over
=item C<set_is_markdown>
Sets whether this comment needs L<Markdown|Bugzilla::Markdown> rendering to be applied.
=back
=head1 B<Methods in need of POD>
=head1 B<Methods in need of POD>
=over
=over
...
...
Bugzilla/Constants.pm
View file @
f5fc4a6d
...
@@ -193,8 +193,6 @@ use Memoize;
...
@@ -193,8 +193,6 @@ use Memoize;
AUDIT_REMOVE
AUDIT_REMOVE
MOST_FREQUENT_THRESHOLD
MOST_FREQUENT_THRESHOLD
MARKDOWN_TAB_WIDTH
)
;
)
;
@
Bugzilla::Constants::
EXPORT_OK
=
qw(contenttypes)
;
@
Bugzilla::Constants::
EXPORT_OK
=
qw(contenttypes)
;
...
@@ -637,10 +635,6 @@ use constant AUDIT_REMOVE => '__remove__';
...
@@ -637,10 +635,6 @@ use constant AUDIT_REMOVE => '__remove__';
# on the "Most frequently reported bugs" page.
# on the "Most frequently reported bugs" page.
use
constant
MOST_FREQUENT_THRESHOLD
=>
2
;
use
constant
MOST_FREQUENT_THRESHOLD
=>
2
;
# The number of spaces used to represent each tab character
# by Markdown engine
use
constant
MARKDOWN_TAB_WIDTH
=>
2
;
sub
bz_locations
{
sub
bz_locations
{
# Force memoize() to re-compute data per project, to avoid
# Force memoize() to re-compute data per project, to avoid
# sharing the same data across different installations.
# sharing the same data across different installations.
...
...
Bugzilla/DB/Schema.pm
View file @
f5fc4a6d
...
@@ -410,8 +410,7 @@ use constant ABSTRACT_SCHEMA => {
...
@@ -410,8 +410,7 @@ use constant ABSTRACT_SCHEMA => {
DEFAULT
=>
'FALSE'
},
DEFAULT
=>
'FALSE'
},
type
=>
{
TYPE
=>
'INT2'
,
NOTNULL
=>
1
,
type
=>
{
TYPE
=>
'INT2'
,
NOTNULL
=>
1
,
DEFAULT
=>
'0'
},
DEFAULT
=>
'0'
},
extra_data
=>
{
TYPE
=>
'varchar(255)'
},
extra_data
=>
{
TYPE
=>
'varchar(255)'
}
is_markdown
=>
{
TYPE
=>
'BOOLEAN'
,
NOTNULL
=>
1
,
DEFAULT
=>
'FALSE'
}
],
],
INDEXES
=>
[
INDEXES
=>
[
longdescs_bug_id_idx
=>
[
qw(bug_id work_time)
],
longdescs_bug_id_idx
=>
[
qw(bug_id work_time)
],
...
...
Bugzilla/Install.pm
View file @
f5fc4a6d
...
@@ -90,8 +90,6 @@ sub SETTINGS {
...
@@ -90,8 +90,6 @@ sub SETTINGS {
bugmail_new_prefix
=>
{
options
=>
[
'on'
,
'off'
],
default
=>
'on'
},
bugmail_new_prefix
=>
{
options
=>
[
'on'
,
'off'
],
default
=>
'on'
},
# 2013-07-26 joshi_sunil@in.com -- Bug 669535
# 2013-07-26 joshi_sunil@in.com -- Bug 669535
possible_duplicates
=>
{
options
=>
[
'on'
,
'off'
],
default
=>
'on'
},
possible_duplicates
=>
{
options
=>
[
'on'
,
'off'
],
default
=>
'on'
},
# 2014-05-24 koosha.khajeh@gmail.com -- Bug 1014164
use_markdown
=>
{
options
=>
[
'on'
,
'off'
],
default
=>
'on'
},
}
}
};
};
...
...
Bugzilla/Install/DB.pm
View file @
f5fc4a6d
...
@@ -726,10 +726,6 @@ sub update_table_definitions {
...
@@ -726,10 +726,6 @@ sub update_table_definitions {
# 2014-08-11 sgreen@redhat.com - Bug 1012506
# 2014-08-11 sgreen@redhat.com - Bug 1012506
_update_alias
();
_update_alias
();
# 2014-08-14 koosha.khajeh@gmail.com - Bug 330707
$dbh
->
bz_add_column
(
'longdescs'
,
'is_markdown'
,
{
TYPE
=>
'BOOLEAN'
,
NOTNULL
=>
1
,
DEFAULT
=>
'FALSE'
});
################################################################
################################################################
# New --TABLE-- changes should go *** A B O V E *** this point #
# New --TABLE-- changes should go *** A B O V E *** this point #
################################################################
################################################################
...
...
Bugzilla/Install/Requirements.pm
View file @
f5fc4a6d
...
@@ -396,14 +396,6 @@ sub OPTIONAL_MODULES {
...
@@ -396,14 +396,6 @@ sub OPTIONAL_MODULES {
version
=>
'0'
,
version
=>
'0'
,
feature
=>
[
'memcached'
],
feature
=>
[
'memcached'
],
},
},
# Markdown
{
package
=>
'Text-Markdown'
,
module
=>
'Text::Markdown'
,
version
=>
'1.0.26'
,
feature
=>
[
'markdown'
],
}
);
);
my
$extra_modules
=
_get_extension_requirements
(
'OPTIONAL_MODULES'
);
my
$extra_modules
=
_get_extension_requirements
(
'OPTIONAL_MODULES'
);
...
@@ -427,7 +419,6 @@ use constant FEATURE_FILES => (
...
@@ -427,7 +419,6 @@ use constant FEATURE_FILES => (
'Bugzilla/JobQueue/*'
,
'jobqueue.pl'
],
'Bugzilla/JobQueue/*'
,
'jobqueue.pl'
],
patch_viewer
=>
[
'Bugzilla/Attachment/PatchReader.pm'
],
patch_viewer
=>
[
'Bugzilla/Attachment/PatchReader.pm'
],
updates
=>
[
'Bugzilla/Update.pm'
],
updates
=>
[
'Bugzilla/Update.pm'
],
markdown
=>
[
'Bugzilla/Markdown.pm'
],
memcached
=>
[
'Bugzilla/Memcache.pm'
],
memcached
=>
[
'Bugzilla/Memcache.pm'
],
);
);
...
...
Bugzilla/Markdown.pm
deleted
100644 → 0
View file @
fc62fd40
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
package
Bugzilla::
Markdown
;
use
5.10.1
;
use
strict
;
use
warnings
;
use
Bugzilla::
Constants
;
use
Bugzilla::
Template
;
use
Digest::
MD5
qw(md5_hex)
;
use
parent
qw(Text::Markdown)
;
@
Bugzilla::Markdown::
EXPORT
=
qw(new)
;
# Regex to match balanced [brackets]. See Friedl's
# "Mastering Regular Expressions", 2nd Ed., pp. 328-331.
our
(
$g_nested_brackets
,
$g_nested_parens
);
$g_nested_brackets
=
qr{
(?> # Atomic matching
[^\[\]]+ # Anything other than brackets
|
\[
(??{ $g_nested_brackets }) # Recursive set of nested brackets
\]
)*
}
x
;
# Doesn't allow for whitespace, because we're using it to match URLs:
$g_nested_parens
=
qr{
(?> # Atomic matching
[^()\s]+ # Anything other than parens or whitespace
|
\(
(??{ $g_nested_parens }) # Recursive set of nested brackets
\)
)*
}
x
;
our
%
g_escape_table
;
foreach
my
$char
(
split
//
,
'\\`*_{}[]()>#+-.!~'
)
{
$g_escape_table
{
$char
}
=
md5_hex
(
$char
);
}
$g_escape_table
{
'<'
}
=
md5_hex
(
'<'
);
sub
new
{
my
$invocant
=
shift
;
my
$class
=
ref
$invocant
||
$invocant
;
return
$class
->
SUPER::
new
(
tab_width
=>
MARKDOWN_TAB_WIDTH
,
# Bugzilla uses HTML not XHTML
empty_element_suffix
=>
'>'
);
}
sub
markdown
{
my
$self
=
shift
;
my
$text
=
shift
;
my
$user
=
Bugzilla
->
user
;
if
(
$user
->
settings
->
{
use_markdown
}
->
{
is_enabled
}
&&
$user
->
setting
(
'use_markdown'
)
eq
'on'
)
{
return
$self
->
SUPER::
markdown
(
$text
,
@_
);
}
return
Bugzilla::Template::
quoteUrls
(
$text
);
}
sub
_Markdown
{
my
$self
=
shift
;
my
$text
=
shift
;
$text
=
Bugzilla::Template::
quoteUrls
(
$text
,
undef
,
undef
,
undef
,
undef
,
1
);
return
$self
->
SUPER::
_Markdown
(
$text
,
@_
);
}
sub
_RunSpanGamut
{
# These are all the transformations that occur *within* block-level
# tags like paragraphs, headers, and list items.
my
(
$self
,
$text
)
=
@_
;
$text
=
$self
->
_DoCodeSpans
(
$text
);
$text
=
$self
->
_EscapeSpecialCharsWithinTagAttributes
(
$text
);
$text
=
$self
->
_EscapeSpecialChars
(
$text
);
$text
=
$self
->
_DoAnchors
(
$text
);
# Strikethroughs is Bugzilla's extension
$text
=
$self
->
_DoStrikethroughs
(
$text
);
$text
=
$self
->
_DoAutoLinks
(
$text
);
$text
=
$self
->
_EncodeAmpsAndAngles
(
$text
);
$text
=
$self
->
_DoItalicsAndBold
(
$text
);
$text
=~
s/\n/<br$self->{empty_element_suffix}\n/g
;
return
$text
;
}
# Override to check for HTML-escaped <>" chars.
sub
_StripLinkDefinitions
{
#
# Strips link definitions from text, stores the URLs and titles in
# hash references.
#
my
(
$self
,
$text
)
=
@_
;
my
$less_than_tab
=
$self
->
{
tab_width
}
-
1
;
# Link defs are in the form: ^[id]: url "optional title"
while
(
$text
=~
s{
^[ ]{0,$less_than_tab}\[(.+)\
]:
# id = \$1
[
\
t
]
*
\
n
?
# maybe *one* newline
[
\
t
]
*
(?:
&
lt
;)?
<
a
\
s
+
href
=
"(.+?)"
>\
2
</
a
>
(?:
&
gt
;)?
# url = \$2
[
\
t
]
*
\
n
?
# maybe one newline
[
\
t
]
*
(?:
(?
<=\
s
)
# lookbehind for whitespace
(?:
&
quot
;
|\
()
(
.+
?)
# title = \$3
(?:
&
quot
;
|\
))
[
\
t
]
*
)?
# title is optional
(?:
\
n
+|\
Z
)
}{}
omx
)
{
$self
->
{
_urls
}{
lc
$1
}
=
$self
->
_EncodeAmpsAndAngles
(
$2
);
# Link IDs are case-insensitive
if
(
$3
)
{
$self
->
{
_titles
}{
lc
$1
}
=
$3
;
$self
->
{
_titles
}{
lc
$1
}
=~
s/"/"/g
;
}
}
return
$text
;
}
# We need to look for HTML-escaped '<' and '>' (i.e. < and >).
# We also remove Email linkification from the original implementation
# as it is already done in Bugzilla's quoteUrls().
sub
_DoAutoLinks
{
my
(
$self
,
$text
)
=
@_
;
$text
=~
s{(?:<|<)((?:https?|ftp):[^'">\s]+?)(?:>|>)}{<a href="$1">$1</a>}gi
;
return
$text
;
}
# The main reasons for overriding this method are
# resolving URL conflicts with Bugzilla's quoteUrls()
# and also changing '"' to '"' in regular expressions wherever needed.
sub
_DoAnchors
{
#
# Turn Markdown link shortcuts into <a> tags.
#
my
(
$self
,
$text
)
=
@_
;
# We revert linkifications of non-email links and only
# those links whose URL and title are the same because
# this way we can be sure that link is generated by quoteUrls()
$text
=~
s@<a \s+ href="(?! mailto ) (.+?)">\1</a>@$1@xmg
;
#
# First, handle reference-style links: [link text] [id]
#
$text
=~
s{
( # wrap whole match in $1
\[
($g_nested_brackets) # link text = $2
\]
[ ]? # one optional space
(?:\n[ ]*)? # one optional newline followed by spaces
\[
(.*?) # id = $3
\]
)
}{
my $whole_match = $1;
my $link_text = $2;
my $link_id = lc $3;
if ($link_id eq "") {
$link_id = lc $link_text; # for shortcut links like [this][].
}
$link_id
=~
s{[ ]*\n}{ }g
;
# turn embedded newlines into spaces
$self
->
_GenerateAnchor
(
$whole_match
,
$link_text
,
$link_id
);
}
xsge
;
#
# Next, inline-style links: [link text](url "optional title")
#
$text
=~
s{
( # wrap whole match in $1
\[
($g_nested_brackets) # link text = $2
\]
\( # literal paren
[ \t]*
($g_nested_parens) # href = $3
[ \t]*
( # $4
("|') # quote char = $5
(.*?) # Title = $6
\5 # matching quote
[ \t]* # ignore any spaces/tabs between closing quote and )
)? # title is optional
\)
)
}{
my $result;
my $whole_match = $1;
my $link_text = $2;
my $url = $3;
my $title = $6;
# Remove Bugzilla quoteUrls() linkification
if ($url =~ /^a href="/ && $url =~ m|</a$|) {
$url =~ s/^[^>]+>//;
$url =~ s@</a$@@;
}
# Limit URL to HTTP/HTTPS links
$url
=
"http://$url"
unless
$url
=~
m!^https?://!i
;
$self
->
_GenerateAnchor
(
$whole_match
,
$link_text
,
undef
,
$url
,
$title
);
}
xsge
;
#
# Last, handle reference-style shortcuts: [link text]
# These must come last in case you've also got [link test][1]
# or [link test](/foo)
#
$text
=~
s{
( # wrap whole match in $1
\[
([^\[\]]+) # link text = $2; can't contain '[' or ']'
\]
)
}{
my $result;
my $whole_match = $1;
my $link_text = $2;
(my $link_id = lc $2) =~ s{[ ]*\n}
{
}
g
;
# lower-case and turn embedded newlines into spaces
$self
->
_GenerateAnchor
(
$whole_match
,
$link_text
,
$link_id
);
}
xsge
;
return
$text
;
}
# The purpose of overriding this function is to add support
# for a Github Flavored Markdown (GFM) feature called 'Multiple
# underscores in words'. The standard markdown specification
# specifies the underscore for making the text emphasized/bold.
# However, some variable names in programming languages contain underscores
# and we do not want a part of those variables to look emphasized/bold.
# Instead, we render them as the way they originally are.
sub
_DoItalicsAndBold
{
my
(
$self
,
$text
)
=
@_
;
# Handle at beginning of lines:
$text
=~
s{ (^__ (?=\S) (.+?[*_]*) (?<=\S) __ (?!\S)) }
{
my $result = _has_multiple_underscores($2) ? $1 : "<strong>$2</strong>";
$result;
}gsxe
;
$text
=~
s{ ^\*\* (?=\S) (.+?[*_]*) (?<=\S) \*\* }{<strong>$1</strong>}gsx
;
$text
=~
s{ (^_ (?=\S) (.+?) (?<=\S) _ (?!\S)) }
{
my $result = _has_multiple_underscores($2) ? $1 : "<em>$2</em>";
$result;
}gsxe
;
$text
=~
s{ ^\* (?=\S) (.+?) (?<=\S) \* }{<em>$1</em>}gsx
;
# <strong> must go first:
$text
=~
s{ ( (?<=\W) __ (?=\S) (.+?[*_]*) (?<=\S) __ (?!\S) ) }
{
my $result = _has_multiple_underscores($2) ? $1 : "<strong>$2</strong>";
$result;
}gsxe
;
$text
=~
s{ (?<=\W) \*\* (?=\S) (.+?[*_]*) (?<=\S) \*\* }{<strong>$1</strong>}gsx
;
$text
=~
s{ ( (?<=\W) _ (?=\S) (.+?) (?<=\S) _ (?!\S) ) }
{
my $result = _has_multiple_underscores($2) ? $1 : "<em>$2</em>";
$result;
}gsxe
;
$text
=~
s{ (?<=\W) \* (?=\S) (.+?) (?<=\S) \* }{<em>$1</em>}gsx
;
# And now, a second pass to catch nested strong and emphasis special cases
$text
=~
s{ ( (?<=\W) __ (?=\S) (.+?[*_]*) (?<=\S) __ (\S*) ) }
{
my $result = _has_multiple_underscores($3) ? $1 : "<strong>$2</strong>$3";
$result;
}gsxe
;
$text
=~
s{ (?<=\W) \*\* (?=\S) (.+?[*_]*) (?<=\S) \*\* }{<strong>$1</strong>}gsx
;
$text
=~
s{ ( (?<=\W) _ (?=\S) (.+?) (?<=\S) _ (\S*) ) }
{
my $result = _has_multiple_underscores($3) ? $1 : "<em>$2</em>$3";
$result;
}gsxe
;
$text
=~
s{ (?<=\W) \* (?=\S) (.+?) (?<=\S) \* }{<em>$1</em>}gsx
;
return
$text
;
}
sub
_DoStrikethroughs
{
my
(
$self
,
$text
)
=
@_
;
$text
=~
s{ ^ ~~ (?=\S) ([^~]+?) (?<=\S) ~~ (?!~) }{<del>$1</del>}gsx
;
$text
=~
s{ (?<=_|[^~\w]) ~~ (?=\S) ([^~]+?) (?<=\S) ~~ (?!~) }{<del>$1</del>}gsx
;
return
$text
;
}
# The original _DoCodeSpans() uses the 's' modifier in its regex
# which prevents _DoCodeBlocks() to match GFM fenced code blocks.
# We copy the code from the original implementation and remove the
# 's' modifier from it.
sub
_DoCodeSpans
{
my
(
$self
,
$text
)
=
@_
;
$text
=~
s@
(?<!\\) # Character before opening ` can't be a backslash
(`+) # $1 = Opening run of `
(.+?) # $2 = The code block
(?<!`)
\1 # Matching closer
(?!`)
@
my $c = "$2";
$c =~ s/^[ \t]*//g; # leading whitespace
$c =~ s/[ \t]*$//g; # trailing whitespace
$c = $self->_EncodeCode($c);
"<code>$c</code>";
@egx
;
return
$text
;
}
# Override to add GFM Fenced Code Blocks
sub
_DoCodeBlocks
{
my
(
$self
,
$text
)
=
@_
;
$text
=~
s{
^ `{3,} [\s\t]
*
\
n
(
# $1 = the entire code block
(?:
.*
\
n
+
)
+
?
)
`
{
3
,}
[
\
s\t]* $
}{
my $codeblock = $1;
my $result;
$codeblock = $self->_EncodeCode($codeblock);
$codeblock = $self->_Detab($codeblock);
$codeblock =~ s/\n\
z
//
;
# remove the trailing newline
$result
=
"\n\n<pre><code>"
.
$codeblock
.
"</code></pre>\n\n"
;
$result
;
}
egmx
;
# And now do the standard code blocks
$text
=
$self
->
SUPER::
_DoCodeBlocks
(
$text
);
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 <pre> content, so we need to fix that:
$bq
=~
s{(\s*<pre>.+?</pre>)}{
my $pre = $1;
$pre =~ s/^ //mg;
$pre;
}egs
;
"<blockquote>\n$bq\n</blockquote>\n\n"
;
}
egmx
;
return
$text
;
}
sub
_EncodeCode
{
my
(
$self
,
$text
)
=
@_
;
# We need to unescape the escaped HTML characters in code blocks.
# These are the reverse of the escapings done in Bugzilla::Util::html_quote()
$text
=~
s/</</g
;
$text
=~
s/>/>/g
;
$text
=~
s/"/"/g
;
$text
=~
s/@/@/g
;
# '&' substitution must be the last one, otherwise a literal like '>'
# will turn to '>' because '&' is already changed to '&' in Bugzilla::Util::html_quote().
# In other words, html_quote() will change '>' to '&gt;' and then we will
# change '&gt' -> '>' -> '>' if we write this substitution as the first one.
$text
=~
s/&/&/g
;
$text
=~
s{<a \s+ href="(?:mailto:)? (.+?)"> \1 </a>}{$1}xmgi
;
$text
=
$self
->
SUPER::
_EncodeCode
(
$text
);
$text
=~
s/~/$g_escape_table{'~'}/go
;
# Encode '<' to prevent URLs from getting linkified in code spans
$text
=~
s/</$g_escape_table{'<'}/go
;
return
$text
;
}
sub
_EncodeBackslashEscapes
{
my
(
$self
,
$text
)
=
@_
;
$text
=
$self
->
SUPER::
_EncodeBackslashEscapes
(
$text
);
$text
=~
s/\\~/$g_escape_table{'~'}/go
;
return
$text
;
}
sub
_UnescapeSpecialChars
{
my
(
$self
,
$text
)
=
@_
;
$text
=
$self
->
SUPER::
_UnescapeSpecialChars
(
$text
);
$text
=~
s/$g_escape_table{'~'}/~/go
;
$text
=~
s/$g_escape_table{'<'}/</go
;
return
$text
;
}
# Check if the passed string is of the form multiple_underscores_in_a_word.
# To check that, we first need to make sure that the string does not contain
# any white-space. Then, if the string is composed of non-space chunks which
# are bound together with underscores, the string has the desired form.
sub
_has_multiple_underscores
{
my
$string
=
shift
;
return
0
unless
defined
(
$string
)
&&
length
(
$string
);
return
0
if
$string
=~
/[\t\s]+/
;
return
1
if
scalar
(
split
/_/
,
$string
)
>
1
;
return
0
;
}
1
;
__END__
=head1 NAME
Bugzilla::Markdown - Generates HTML output from structured plain-text input.
=head1 SYNOPSIS
use Bugzilla::Markdown;
my $markdown = Bugzilla::Markdown->new();
print $markdown->markdown($text);
=head1 DESCRIPTION
Bugzilla::Markdown implements a Markdown engine that produces
an HTML-based output from a given plain-text input.
The majority of the implementation is done by C<Text::Markdown>
CPAN module. It also applies the linkifications done in L<Bugzilla::Template>
to the input resulting in an output which is a combination of both Markdown
structures and those defined by Bugzilla itself.
=head2 Accessors
=over
=item C<markdown>
C<string> Produces an HTML-based output string based on the structures
and format defined in the given plain-text input.
=over
=item B<Params>
=over
=item C<text>
C<string> A plain-text string which includes Markdown structures.
=back
=back
=back
Bugzilla/Template.pm
View file @
f5fc4a6d
...
@@ -148,11 +148,10 @@ sub get_format {
...
@@ -148,11 +148,10 @@ sub get_format {
# If you want to modify this routine, read the comments carefully
# If you want to modify this routine, read the comments carefully
sub
quoteUrls
{
sub
quoteUrls
{
my
(
$text
,
$bug
,
$comment
,
$user
,
$bug_link_func
,
$for_markdown
)
=
@_
;
my
(
$text
,
$bug
,
$comment
,
$user
,
$bug_link_func
)
=
@_
;
return
$text
unless
$text
;
return
$text
unless
$text
;
$user
||=
Bugzilla
->
user
;
$user
||=
Bugzilla
->
user
;
$bug_link_func
||=
\&
get_bug_link
;
$bug_link_func
||=
\&
get_bug_link
;
$for_markdown
||=
0
;
# We use /g for speed, but uris can have other things inside them
# We use /g for speed, but uris can have other things inside them
# (http://foo/bug#3 for example). Filtering that out filters valid
# (http://foo/bug#3 for example). Filtering that out filters valid
...
@@ -223,11 +222,10 @@ sub quoteUrls {
...
@@ -223,11 +222,10 @@ sub quoteUrls {
$text
=
html_quote
(
$text
);
$text
=
html_quote
(
$text
);
unless
(
$for_markdown
)
{
# Color quoted text
# Color quoted text
$text
=~
s
~^
(
&
gt
;
.+
)
$~
<
span
class
=
"quote"
>
$1
</
span
>~
mg
;
$text
=~
s
~^
(
&
gt
;
.+
)
$~
<
span
class
=
"quote"
>
$1
</
span
>~
mg
;
$text
=~
s
~</
span
>\
n
<
span
class
=
"quote"
>~\
n
~
g
;
$text
=~
s
~</
span
>\
n
<
span
class
=
"quote"
>~\
n
~
g
;
}
# mailto:
# mailto:
# Use |<nothing> so that $1 is defined regardless
# Use |<nothing> so that $1 is defined regardless
# @ is the encoded '@' character.
# @ is the encoded '@' character.
...
@@ -858,24 +856,6 @@ sub create {
...
@@ -858,24 +856,6 @@ sub create {
1
1
],
],
markdown
=>
[
sub
{
my
(
$context
,
$bug
,
$comment
,
$user
)
=
@_
;
return
sub
{
my
$text
=
shift
;
return
unless
$text
;
if
(
Bugzilla
->
feature
(
'markdown'
)
&&
((
ref
(
$comment
)
eq
'HASH'
&&
$comment
->
{
is_markdown
})
||
(
ref
(
$comment
)
eq
'Bugzilla::Comment'
&&
$comment
->
is_markdown
)))
{
return
Bugzilla
->
markdown
->
markdown
(
$text
);
}
return
quoteUrls
(
$text
,
$bug
,
$comment
,
$user
);
};
},
1
],
bug_link
=>
[
sub
{
bug_link
=>
[
sub
{
my
(
$context
,
$bug
,
$options
)
=
@_
;
my
(
$context
,
$bug
,
$options
)
=
@_
;
return
sub
{
return
sub
{
...
...
Bugzilla/User.pm
View file @
f5fc4a6d
...
@@ -632,14 +632,6 @@ sub is_bug_ignored {
...
@@ -632,14 +632,6 @@ sub is_bug_ignored {
return
(
grep
{
$_
->
{
'id'
}
==
$bug_id
}
@
{
$self
->
bugs_ignored
})
?
1
:
0
;
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 #
# Saved Recent Bug Lists #
##########################
##########################
...
@@ -2631,12 +2623,6 @@ C<string> The current summary of the bug.
...
@@ -2631,12 +2623,6 @@ C<string> The current summary of the bug.
Returns true if the user does not want email notifications for the
Returns true if the user does not want email notifications for the
specified bug ID, else returns false.
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
=back
=head2 Saved Recent Bug Lists
=head2 Saved Recent Bug Lists
...
...
Bugzilla/WebService/Bug.pm
View file @
f5fc4a6d
...
@@ -331,9 +331,7 @@ sub render_comment {
...
@@ -331,9 +331,7 @@ sub render_comment {
Bugzilla
->
switch_to_shadow_db
();
Bugzilla
->
switch_to_shadow_db
();
my
$bug
=
$params
->
{
id
}
?
Bugzilla::
Bug
->
check
(
$params
->
{
id
})
:
undef
;
my
$bug
=
$params
->
{
id
}
?
Bugzilla::
Bug
->
check
(
$params
->
{
id
})
:
undef
;
my
$markdown
=
$params
->
{
markdown
}
?
1
:
0
;
my
$tmpl
=
'[% text FILTER quoteUrls(bug) %]'
;
my
$tmpl
=
$markdown
?
'[% text FILTER markdown(bug, { is_markdown => 1 }) %]'
:
'[% text FILTER markdown(bug) %]'
;
my
$html
;
my
$html
;
my
$template
=
Bugzilla
->
template
;
my
$template
=
Bugzilla
->
template
;
$template
->
process
(
$template
->
process
(
...
@@ -358,7 +356,6 @@ sub _translate_comment {
...
@@ -358,7 +356,6 @@ sub _translate_comment {
time
=>
$self
->
type
(
'dateTime'
,
$comment
->
creation_ts
),
time
=>
$self
->
type
(
'dateTime'
,
$comment
->
creation_ts
),
creation_time
=>
$self
->
type
(
'dateTime'
,
$comment
->
creation_ts
),
creation_time
=>
$self
->
type
(
'dateTime'
,
$comment
->
creation_ts
),
is_private
=>
$self
->
type
(
'boolean'
,
$comment
->
is_private
),
is_private
=>
$self
->
type
(
'boolean'
,
$comment
->
is_private
),
is_markdown
=>
$self
->
type
(
'boolean'
,
$comment
->
is_markdown
),
text
=>
$self
->
type
(
'string'
,
$comment
->
body_full
),
text
=>
$self
->
type
(
'string'
,
$comment
->
body_full
),
attachment_id
=>
$self
->
type
(
'int'
,
$attach_id
),
attachment_id
=>
$self
->
type
(
'int'
,
$attach_id
),
count
=>
$self
->
type
(
'int'
,
$comment
->
count
),
count
=>
$self
->
type
(
'int'
,
$comment
->
count
),
...
@@ -825,18 +822,8 @@ sub add_attachment {
...
@@ -825,18 +822,8 @@ sub add_attachment {
$attachment
->
update
(
$timestamp
);
$attachment
->
update
(
$timestamp
);
my
$comment
=
$params
->
{
comment
}
||
''
;
my
$comment
=
$params
->
{
comment
}
||
''
;
my
$is_markdown
=
0
;
if
(
ref
$params
->
{
comment
}
eq
'HASH'
)
{
$is_markdown
=
$params
->
{
comment
}
->
{
is_markdown
};
$comment
=
$params
->
{
comment
}
->
{
body
};
}
ThrowUserError
(
'markdown_disabled'
)
if
$is_markdown
&&
!
_is_markdown_enabled
();
$attachment
->
bug
->
add_comment
(
$comment
,
$attachment
->
bug
->
add_comment
(
$comment
,
{
is_markdown
=>
$is_markdown
,
{
isprivate
=>
$attachment
->
isprivate
,
isprivate
=>
$attachment
->
isprivate
,
type
=>
CMT_ATTACHMENT_CREATED
,
type
=>
CMT_ATTACHMENT_CREATED
,
extra_data
=>
$attachment
->
id
});
extra_data
=>
$attachment
->
id
});
push
(
@created
,
$attachment
);
push
(
@created
,
$attachment
);
...
@@ -884,14 +871,6 @@ sub update_attachment {
...
@@ -884,14 +871,6 @@ sub update_attachment {
my
$flags
=
delete
$params
->
{
flags
};
my
$flags
=
delete
$params
->
{
flags
};
my
$comment
=
delete
$params
->
{
comment
};
my
$comment
=
delete
$params
->
{
comment
};
my
$is_markdown
=
0
;
if
(
ref
$comment
eq
'HASH'
)
{
$is_markdown
=
$comment
->
{
is_markdown
};
$comment
=
$comment
->
{
body
};
}
ThrowUserError
(
'markdown_disabled'
)
if
$is_markdown
&&
!
_is_markdown_enabled
();
# Update the values
# Update the values
foreach
my
$attachment
(
@attachments
)
{
foreach
my
$attachment
(
@attachments
)
{
...
@@ -911,8 +890,7 @@ sub update_attachment {
...
@@ -911,8 +890,7 @@ sub update_attachment {
if
(
$comment
=
trim
(
$comment
))
{
if
(
$comment
=
trim
(
$comment
))
{
$attachment
->
bug
->
add_comment
(
$comment
,
$attachment
->
bug
->
add_comment
(
$comment
,
{
is_markdown
=>
$is_markdown
,
{
isprivate
=>
$attachment
->
isprivate
,
isprivate
=>
$attachment
->
isprivate
,
type
=>
CMT_ATTACHMENT_UPDATED
,
type
=>
CMT_ATTACHMENT_UPDATED
,
extra_data
=>
$attachment
->
id
});
extra_data
=>
$attachment
->
id
});
}
}
...
@@ -971,12 +949,8 @@ sub add_comment {
...
@@ -971,12 +949,8 @@ sub add_comment {
if
(
defined
$params
->
{
private
})
{
if
(
defined
$params
->
{
private
})
{
$params
->
{
is_private
}
=
delete
$params
->
{
private
};
$params
->
{
is_private
}
=
delete
$params
->
{
private
};
}
}
ThrowUserError
(
'markdown_disabled'
)
if
$params
->
{
is_markdown
}
&&
!
_is_markdown_enabled
();
# Append comment
# Append comment
$bug
->
add_comment
(
$comment
,
{
isprivate
=>
$params
->
{
is_private
},
$bug
->
add_comment
(
$comment
,
{
isprivate
=>
$params
->
{
is_private
},
is_markdown
=>
$params
->
{
is_markdown
},
work_time
=>
$params
->
{
work_time
}
});
work_time
=>
$params
->
{
work_time
}
});
# Capture the call to bug->update (which creates the new comment) in
# Capture the call to bug->update (which creates the new comment) in
...
@@ -1425,14 +1399,6 @@ sub _add_update_tokens {
...
@@ -1425,14 +1399,6 @@ sub _add_update_tokens {
}
}
}
}
sub
_is_markdown_enabled
{
my
$user
=
Bugzilla
->
user
;
return
Bugzilla
->
feature
(
'markdown'
)
&&
$user
->
settings
->
{
use_markdown
}
->
{
is_enabled
}
&&
$user
->
setting
(
'use_markdown'
)
eq
'on'
;
}
1
;
1
;
__END__
__END__
...
@@ -2110,10 +2076,6 @@ may be deprecated and removed in a future release.
...
@@ -2110,10 +2076,6 @@ may be deprecated and removed in a future release.
C<boolean> True if this comment is private (only visible to a certain
C<boolean> True if this comment is private (only visible to a certain
group called the "insidergroup"), False otherwise.
group called the "insidergroup"), False otherwise.
=item is_markdown
C<boolean> True if this comment needs Markdown processing, false otherwise.
=back
=back
=item B<Errors>
=item B<Errors>
...
@@ -3131,9 +3093,6 @@ don't want it to be assigned to the component owner.
...
@@ -3131,9 +3093,6 @@ don't want it to be assigned to the component owner.
=item C<comment_is_private> (boolean) - If set to true, the description
=item C<comment_is_private> (boolean) - If set to true, the description
is private, otherwise it is assumed to be public.
is private, otherwise it is assumed to be public.
=item C<is_markdown> (boolean) - If set to true, the description
has Markdown structures, otherwise it is a normal text.
=item C<groups> (array) - An array of group names to put this
=item C<groups> (array) - An array of group names to put this
bug into. You can see valid group names on the Permissions
bug into. You can see valid group names on the Permissions
tab of the Preferences screen, or, if you are an administrator,
tab of the Preferences screen, or, if you are an administrator,
...
@@ -3289,8 +3248,6 @@ Bugzilla B<4.4>.
...
@@ -3289,8 +3248,6 @@ Bugzilla B<4.4>.
=item REST API call added in Bugzilla B<5.0>.
=item REST API call added in Bugzilla B<5.0>.
=item C<is_markdown> option added in Bugzilla B<5.0>.
=back
=back
=back
=back
...
@@ -3350,21 +3307,7 @@ C<text/plain> or C<image/png>.
...
@@ -3350,21 +3307,7 @@ C<text/plain> or C<image/png>.
=item C<comment>
=item C<comment>
C<string> or hash. A comment to add along with this attachment. If C<comment>
C<string> A comment to add along with this attachment.
is a hash, it has the following keys:
=over
=item C<body>
C<string> The body of the comment.
=item C<is_markdown>
C<boolean> If set to true, the comment has Markdown structures; otherwise, it
is an ordinary text.
=back
=item C<is_patch>
=item C<is_patch>
...
@@ -3442,10 +3385,6 @@ the type id value to update or add a flag.
...
@@ -3442,10 +3385,6 @@ the type id value to update or add a flag.
The flag type is inactive and cannot be used to create new flags.
The flag type is inactive and cannot be used to create new flags.
=item 140 (Markdown Disabled)
You tried to set the C<is_markdown> flag of the comment to true but the Markdown feature is not enabled.
=item 600 (Attachment Too Large)
=item 600 (Attachment Too Large)
You tried to attach a file that was larger than Bugzilla will accept.
You tried to attach a file that was larger than Bugzilla will accept.
...
@@ -3481,8 +3420,6 @@ You set the "data" field to an empty string.
...
@@ -3481,8 +3420,6 @@ You set the "data" field to an empty string.
=item REST API call added in Bugzilla B<5.0>.
=item REST API call added in Bugzilla B<5.0>.
=item C<is_markdown> added in Bugzilla B<5.0>.
=back
=back
=back
=back
...
@@ -3529,21 +3466,7 @@ attachment.
...
@@ -3529,21 +3466,7 @@ attachment.
=item C<comment>
=item C<comment>
C<string> or hash: An optional comment to add to the attachment's bug. If C<comment> is
C<string> An optional comment to add to the attachment's bug.
a hash, it has the following keys:
=over
=item C<body>
C<string> The body of the comment to be added.
=item C<is_markdown>
C<boolean> If set to true, the comment has Markdown structures; otherwise it is a normal
text.
=back
=item C<content_type>
=item C<content_type>
...
@@ -3692,11 +3615,6 @@ the type id value to update or add a flag.
...
@@ -3692,11 +3615,6 @@ the type id value to update or add a flag.
The flag type is inactive and cannot be used to create new flags.
The flag type is inactive and cannot be used to create new flags.
=item 140 (Markdown Disabled)
You tried to set the C<is_markdown> flag of the C<comment> to true but Markdown feature is
not enabled.
=item 601 (Invalid MIME Type)
=item 601 (Invalid MIME Type)
You specified a C<content_type> argument that was blank, not a valid
You specified a C<content_type> argument that was blank, not a valid
...
@@ -3757,9 +3675,6 @@ you did not set the C<comment> parameter.
...
@@ -3757,9 +3675,6 @@ you did not set the C<comment> parameter.
=item C<is_private> (boolean) - If set to true, the comment is private,
=item C<is_private> (boolean) - If set to true, the comment is private,
otherwise it is assumed to be public.
otherwise it is assumed to be public.
=item C<is_markdown> (boolean) - If set to true, the comment has Markdown
structures, otherwise it is a normal text.
=item C<work_time> (double) - Adds this many hours to the "Hours Worked"
=item C<work_time> (double) - Adds this many hours to the "Hours Worked"
on the bug. If you are not in the time tracking group, this value will
on the bug. If you are not in the time tracking group, this value will
be ignored.
be ignored.
...
@@ -3801,11 +3716,6 @@ You tried to add a private comment, but don't have the necessary rights.
...
@@ -3801,11 +3716,6 @@ You tried to add a private comment, but don't have the necessary rights.
You tried to add a comment longer than the maximum allowed length
You tried to add a comment longer than the maximum allowed length
(65,535 characters).
(65,535 characters).
=item 140 (Markdown Disabled)
You tried to set the C<is_markdown> flag to true but the Markdown feature
is not enabled.
=back
=back
=item B<History>
=item B<History>
...
@@ -3828,8 +3738,6 @@ code of 32000.
...
@@ -3828,8 +3738,6 @@ code of 32000.
=item REST API call added in Bugzilla B<5.0>.
=item REST API call added in Bugzilla B<5.0>.
=item C<is_markdown> option added in Bugzilla B<5.0>.
=back
=back
=back
=back
...
...
Bugzilla/WebService/Constants.pm
View file @
f5fc4a6d
...
@@ -101,7 +101,6 @@ use constant WS_ERROR_CODE => {
...
@@ -101,7 +101,6 @@ use constant WS_ERROR_CODE => {
comment_id_invalid
=>
111
,
comment_id_invalid
=>
111
,
comment_too_long
=>
114
,
comment_too_long
=>
114
,
comment_invalid_isprivate
=>
117
,
comment_invalid_isprivate
=>
117
,
markdown_disabled
=>
140
,
# Comment tagging
# Comment tagging
comment_tag_disabled
=>
125
,
comment_tag_disabled
=>
125
,
comment_tag_invalid
=>
126
,
comment_tag_invalid
=>
126
,
...
...
docs/en/rst/using.rst
View file @
f5fc4a6d
...
@@ -404,7 +404,7 @@ You can use it to find a bug by its number or its alias, too.
...
@@ -404,7 +404,7 @@ You can use it to find a bug by its number or its alias, too.
You'll find the Quicksearch box in Bugzilla's footer area.
You'll find the Quicksearch box in Bugzilla's footer area.
On Bugzilla's front page, there is an additional
On Bugzilla's front page, there is an additional
`
quicksearcgh help <../
../../page.cgi?id=quicksearch.html>`_
`
Help <
../../page.cgi?id=quicksearch.html>`_
link which details how to use it.
link which details how to use it.
.. _casesensitivity:
.. _casesensitivity:
...
@@ -757,23 +757,6 @@ Don't use sigs in comments. Signing your name ("Bill") is acceptable,
...
@@ -757,23 +757,6 @@ Don't use sigs in comments. Signing your name ("Bill") is acceptable,
if you do it out of habit, but full mail/news-style
if you do it out of habit, but full mail/news-style
four line ASCII art creations are not.
four line ASCII art creations are not.
.. _markdown:
Markdown
--------
Markdown lets you write your comments in a structured plain-text format and
have your comments generated as HTML. For example, you may use Markdown for
making a part of your comment look italic or bold in the generated HTML. Bugzilla
supports most of the structures defined by `standard Markdown <http://daringfireball.net/projects/markdown/basics>`_.
but does NOT support inline images and inline HTML. For a complete reference on
supported Markdown structures, please see the `syntax help <../../../page.cgi?id=markdown.html>`_
link next to the markdown checkbox for new comments.
To use the Markdown feature, make sure that ``Enable Markdown support for comments`` is set to ``on``
in your :ref:`userpreferences` and that you also check the ``Use Markdown for this comment`` option below
the comment box when you want to submit a new comment.
.. _comment-wrapping:
.. _comment-wrapping:
Server-Side Comment Wrapping
Server-Side Comment Wrapping
...
...
js/field.js
View file @
f5fc4a6d
...
@@ -983,33 +983,17 @@ function initDirtyFieldTracking() {
...
@@ -983,33 +983,17 @@ function initDirtyFieldTracking() {
*/
*/
var
last_comment_text
=
''
;
var
last_comment_text
=
''
;
var
last_markdown_cb_value
=
null
;
var
comment_textarea_width
=
null
;
var
comment_textarea_height
=
null
;
function
refresh_markdown_preview
(
bug_id
)
{
function
show_comment_preview
(
bug_id
)
{
if
(
!
YAHOO
.
util
.
Dom
.
hasClass
(
'comment_preview_tab'
,
'active_comment_tab'
))
return
;
show_comment_preview
(
bug_id
,
1
);
}
function
show_comment_preview
(
bug_id
,
refresh
)
{
var
Dom
=
YAHOO
.
util
.
Dom
;
var
Dom
=
YAHOO
.
util
.
Dom
;
var
comment
=
document
.
getElementById
(
'comment'
);
var
comment
=
document
.
getElementById
(
'comment'
);
var
preview
=
document
.
getElementById
(
'comment_preview'
);
var
preview
=
document
.
getElementById
(
'comment_preview'
);
var
markdown_cb
=
document
.
getElementById
(
'use_markdown'
);
if
(
!
comment
||
!
preview
)
return
;
if
(
!
comment
||
!
preview
)
return
;
if
(
Dom
.
hasClass
(
'comment_preview_tab'
,
'active_comment_tab'
)
&&
!
refresh
)
if
(
Dom
.
hasClass
(
'comment_preview_tab'
,
'active_comment_tab'
))
return
;
return
;
if
(
!
comment_textarea_width
)
{
preview
.
style
.
width
=
(
comment
.
clientWidth
-
4
)
+
'px'
;
comment_textarea_width
=
(
comment
.
clientWidth
-
4
)
+
'px'
;
preview
.
style
.
height
=
comment
.
offsetHeight
+
'px'
;
comment_textarea_height
=
comment
.
offsetHeight
+
'px'
;
}
preview
.
style
.
width
=
comment_textarea_width
;
preview
.
style
.
height
=
comment_textarea_height
;
var
comment_tab
=
document
.
getElementById
(
'comment_tab'
);
var
comment_tab
=
document
.
getElementById
(
'comment_tab'
);
Dom
.
addClass
(
comment
,
'bz_default_hidden'
);
Dom
.
addClass
(
comment
,
'bz_default_hidden'
);
...
@@ -1023,7 +1007,7 @@ function show_comment_preview(bug_id, refresh) {
...
@@ -1023,7 +1007,7 @@ function show_comment_preview(bug_id, refresh) {
Dom
.
addClass
(
'comment_preview_error'
,
'bz_default_hidden'
);
Dom
.
addClass
(
'comment_preview_error'
,
'bz_default_hidden'
);
if
(
last_comment_text
==
comment
.
value
&&
last_markdown_cb_value
==
markdown_cb
.
checked
)
if
(
last_comment_text
==
comment
.
value
)
return
;
return
;
Dom
.
addClass
(
'comment_preview_text'
,
'bz_default_hidden'
);
Dom
.
addClass
(
'comment_preview_text'
,
'bz_default_hidden'
);
...
@@ -1043,14 +1027,7 @@ function show_comment_preview(bug_id, refresh) {
...
@@ -1043,14 +1027,7 @@ function show_comment_preview(bug_id, refresh) {
document
.
getElementById
(
'comment_preview_text'
).
innerHTML
=
data
.
result
.
html
;
document
.
getElementById
(
'comment_preview_text'
).
innerHTML
=
data
.
result
.
html
;
Dom
.
addClass
(
'comment_preview_loading'
,
'bz_default_hidden'
);
Dom
.
addClass
(
'comment_preview_loading'
,
'bz_default_hidden'
);
Dom
.
removeClass
(
'comment_preview_text'
,
'bz_default_hidden'
);
Dom
.
removeClass
(
'comment_preview_text'
,
'bz_default_hidden'
);
if
(
markdown_cb
.
checked
)
{
Dom
.
removeClass
(
'comment_preview_text'
,
'comment_preview_pre'
);
}
else
{
Dom
.
addClass
(
'comment_preview_text'
,
'comment_preview_pre'
);
}
last_comment_text
=
comment
.
value
;
last_comment_text
=
comment
.
value
;
last_markdown_cb_value
=
markdown_cb
.
checked
;
}
}
},
},
failure
:
function
(
res
)
{
failure
:
function
(
res
)
{
...
@@ -1066,8 +1043,7 @@ function show_comment_preview(bug_id, refresh) {
...
@@ -1066,8 +1043,7 @@ function show_comment_preview(bug_id, refresh) {
params
:
{
params
:
{
Bugzilla_api_token
:
BUGZILLA
.
api_token
,
Bugzilla_api_token
:
BUGZILLA
.
api_token
,
id
:
bug_id
,
id
:
bug_id
,
text
:
comment
.
value
,
text
:
comment
.
value
markdown
:
(
markdown_cb
!=
null
)
&&
markdown_cb
.
checked
?
1
:
0
}
}
})
})
);
);
...
...
post_bug.cgi
View file @
f5fc4a6d
...
@@ -118,7 +118,6 @@ foreach my $field (qw(cc groups)) {
...
@@ -118,7 +118,6 @@ foreach my $field (qw(cc groups)) {
$bug_params
{
$field
}
=
[
$cgi
->
param
(
$field
)];
$bug_params
{
$field
}
=
[
$cgi
->
param
(
$field
)];
}
}
$bug_params
{
'comment'
}
=
$comment
;
$bug_params
{
'comment'
}
=
$comment
;
$bug_params
{
'is_markdown'
}
=
$cgi
->
param
(
'use_markdown'
);
my
@multi_selects
=
grep
{
$_
->
type
==
FIELD_TYPE_MULTI_SELECT
&&
$_
->
enter_bug
}
my
@multi_selects
=
grep
{
$_
->
type
==
FIELD_TYPE_MULTI_SELECT
&&
$_
->
enter_bug
}
Bugzilla
->
active_custom_fields
;
Bugzilla
->
active_custom_fields
;
...
...
process_bug.cgi
View file @
f5fc4a6d
...
@@ -233,13 +233,9 @@ if (should_set('keywords')) {
...
@@ -233,13 +233,9 @@ if (should_set('keywords')) {
$set_all_fields
{
keywords
}
->
{
$action
}
=
$cgi
->
param
(
'keywords'
);
$set_all_fields
{
keywords
}
->
{
$action
}
=
$cgi
->
param
(
'keywords'
);
}
}
if
(
should_set
(
'comment'
))
{
if
(
should_set
(
'comment'
))
{
my
$is_markdown
=
(
$user
->
use_markdown
&&
$cgi
->
param
(
'use_markdown'
)
eq
'1'
)
?
1
:
0
;
$set_all_fields
{
comment
}
=
{
$set_all_fields
{
comment
}
=
{
body
=>
scalar
$cgi
->
param
(
'comment'
),
body
=>
scalar
$cgi
->
param
(
'comment'
),
is_private
=>
scalar
$cgi
->
param
(
'comment_is_private'
),
is_private
=>
scalar
$cgi
->
param
(
'comment_is_private'
),
is_markdown
=>
$is_markdown
,
};
};
}
}
if
(
should_set
(
'see_also'
))
{
if
(
should_set
(
'see_also'
))
{
...
...
skins/standard/global.css
View file @
f5fc4a6d
...
@@ -243,15 +243,6 @@
...
@@ -243,15 +243,6 @@
textarea
{
textarea
{
font-family
:
monospace
;
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) */
/* generic (end) */
/* Links that control whether or not something is visible. */
/* Links that control whether or not something is visible. */
...
@@ -319,7 +310,7 @@ div#docslinks {
...
@@ -319,7 +310,7 @@ div#docslinks {
}
}
/* tbody.file pre is for the Diff view of attachments. */
/* tbody.file pre is for the Diff view of attachments. */
pre
.bz_comment_text
,
.uneditable_textarea
,
tbody
.file
pre
{
.bz_comment_text
,
.uneditable_textarea
,
tbody
.file
pre
{
font-family
:
monospace
;
font-family
:
monospace
;
white-space
:
pre-wrap
;
white-space
:
pre-wrap
;
}
}
...
@@ -732,16 +723,12 @@ input.required, select.required, span.required_explanation {
...
@@ -732,16 +723,12 @@ input.required, select.required, span.required_explanation {
width
:
auto
;
width
:
auto
;
}
}
.comment_preview_pre
{
white-space
:
pre
;
}
#comment_preview_loading
{
#comment_preview_loading
{
font-style
:
italic
;
font-style
:
italic
;
}
}
#comment
{
#comment
{
margin
:
0
;
margin
:
0
px
0px
1em
0px
;
}
}
/*******************/
/*******************/
...
...
t/004template.t
View file @
f5fc4a6d
...
@@ -88,7 +88,6 @@ foreach my $include_path (@include_paths) {
...
@@ -88,7 +88,6 @@ foreach my $include_path (@include_paths) {
wrap_comment => sub { return $_ },
wrap_comment => sub { return $_ },
none => sub { return $_ } ,
none => sub { return $_ } ,
ics => [ sub { return sub { return $_; } }, 1] ,
ics => [ sub { return sub { return $_; } }, 1] ,
markdown => sub { return $_ } ,
},
},
}
}
);
);
...
...
t/008filter.t
View file @
f5fc4a6d
...
@@ -212,7 +212,7 @@ sub directive_ok {
...
@@ -212,7 +212,7 @@ sub directive_ok {
return 1 if $directive =~ /FILTER\ (html|csv|js|base64|css_class_quote|ics|
return 1 if $directive =~ /FILTER\ (html|csv|js|base64|css_class_quote|ics|
quoteUrls|time|uri|xml|lower|html_light|
quoteUrls|time|uri|xml|lower|html_light|
obsolete|inactive|closed|unitconvert|
obsolete|inactive|closed|unitconvert|
txt|html_linebreak|
markdown|
none)\b/x;
txt|html_linebreak|none)\b/x;
return 0;
return 0;
}
}
...
...
template/en/default/bug/comment.html.tmpl
View file @
f5fc4a6d
...
@@ -32,16 +32,6 @@
...
@@ -32,16 +32,6 @@
<div id="comment_preview" class="bz_default_hidden bz_comment">
<div id="comment_preview" class="bz_default_hidden bz_comment">
<div id="comment_preview_loading" class="bz_default_hidden">Generating Preview...</div>
<div id="comment_preview_loading" class="bz_default_hidden">Generating Preview...</div>
<div id="comment_preview_error" class="bz_default_hidden"></div>
<div id="comment_preview_error" class="bz_default_hidden"></div>
<div id="comment_preview_text" class="bz_comment_text"></div>
<pre id="comment_preview_text" class="bz_comment_text"></pre>
</div>
[% END %]
[% IF user.use_markdown %]
<div id="comment_markdown">
<input type="checkbox" name="use_markdown"
id="use_markdown" value="1" checked="checked"
onchange="refresh_markdown_preview([% bug.id FILTER none %])">
<label id="use_markdown_label" for="use_markdown">Use Markdown for this [% terms.comment %]</label>
(<a href="page.cgi?id=markdown.html" target="_blank" title="View Markdown Syntax Guide">help</a>)
</div>
</div>
[% END %]
[% END %]
template/en/default/bug/comments.html.tmpl
View file @
f5fc4a6d
...
@@ -14,16 +14,13 @@
...
@@ -14,16 +14,13 @@
<script type="text/javascript">
<script type="text/javascript">
<!--
<!--
/* Adds the reply text to the 'comment' textarea */
/* Adds the reply text to the 'comment' textarea */
function replyToComment(id, real_id, name
, text
) {
function replyToComment(id, real_id, name) {
var prefix = "(In reply to " + name + " from comment #" + id + ")\n";
var prefix = "(In reply to " + name + " from comment #" + id + ")\n";
var replytext = "";
var replytext = "";
[% IF user.settings.quote_replies.value == 'quoted_reply' %]
[% IF user.settings.quote_replies.value == 'quoted_reply' %]
/* pre id="comment_name_N" */
/* pre id="comment_name_N" */
if (text == null) {
var text_elem = document.getElementById('comment_text_'+id);
var text_elem = document.getElementById('comment_text_'+id);
text = getText(text_elem);
var text = getText(text_elem);
}
replytext = prefix + wrapReplyText(text);
replytext = prefix + wrapReplyText(text);
[% ELSIF user.settings.quote_replies.value == 'simple_reply' %]
[% ELSIF user.settings.quote_replies.value == 'simple_reply' %]
replytext = prefix;
replytext = prefix;
...
@@ -44,39 +41,6 @@
...
@@ -44,39 +41,6 @@
textarea.focus();
textarea.focus();
}
}
function replyToMarkdownComment(id, real_id, name) {
var textarea = document.getElementById('comment');
var comment = textarea.value;
textarea.value += "Fetching comment...";
YAHOO.util.Connect.setDefaultPostHeader('application/json', true);
YAHOO.util.Connect.asyncRequest('POST', 'jsonrpc.cgi',
{
success: function(res) {
var data = YAHOO.lang.JSON.parse(res.responseText);
if (!data.error) {
textarea.value = comment;
var text = data.result.comments[real_id].text;
replyToComment(id, real_id, name, text);
} else {
replyToComment(id, real_id, name, null);
}
},
failure: function(res) {
/* On failure, quote the comment as plain-text */
replyToComment(id, real_id, name, null);
}
},
YAHOO.lang.JSON.stringify({
version: "1.1",
method: "Bug.comments",
params: {
Bugzilla_api_token: BUGZILLA.api_token,
comment_ids: [real_id],
}
})
);
}
//-->
//-->
</script>
</script>
...
@@ -162,13 +126,7 @@
...
@@ -162,13 +126,7 @@
[% END %]
[% END %]
[<a class="bz_reply_link" href="#add_comment"
[<a class="bz_reply_link" href="#add_comment"
[% IF user.settings.quote_replies.value != 'off' %]
[% IF user.settings.quote_replies.value != 'off' %]
onclick="
onclick="replyToComment('[% comment.count %]', '[% comment.id %]', '[% comment.author.name || comment.author.nick FILTER html FILTER js %]'); return false;"
[% IF feature_enabled('jsonrpc') && comment.is_markdown %]
replyToMarkdownComment('[% comment.count %]', '[% comment.id %]', '[% comment.author.name || comment.author.nick FILTER html FILTER js %]'); return false;"
[% ELSE %]
replyToComment('[% comment.count %]', '[% comment.id %]', '[% comment.author.name || comment.author.nick FILTER html FILTER js %]', null); return false;"
[% END %]
[% END %]
[% END %]
>reply</a>]
>reply</a>]
[% END %]
[% END %]
...
@@ -267,12 +225,12 @@
...
@@ -267,12 +225,12 @@
[%# Don't indent the <pre> block, since then the spaces are displayed in the
[%# Don't indent the <pre> block, since then the spaces are displayed in the
# generated HTML
# generated HTML
#%]
#%]
<
[% user.use_markdown(comment) ? "div" : "pre" %]
class="bz_comment_text[% " collapsed" IF comment.collapsed %]"
<
pre
class="bz_comment_text[% " collapsed" IF comment.collapsed %]"
[% IF mode == "edit" || comment.collapsed %]
[% IF mode == "edit" || comment.collapsed %]
id="comment_text_[% comment.count FILTER none %]"
id="comment_text_[% comment.count FILTER none %]"
[% END %]>
[% END %]>
[%- comment_text FILTER
markdown
(bug, comment) -%]
[%- comment_text FILTER
quoteUrls
(bug, comment) -%]
</
[% user.use_markdown(comment) ? "div" : "pre" %]
>
</
pre
>
[% Hook.process('a_comment-end', 'bug/comments.html.tmpl') %]
[% Hook.process('a_comment-end', 'bug/comments.html.tmpl') %]
</div>
</div>
[% END %]
[% END %]
template/en/default/bug/process/midair.html.tmpl
View file @
f5fc4a6d
...
@@ -76,7 +76,6 @@ You have the following choices:
...
@@ -76,7 +76,6 @@ You have the following choices:
<input type="hidden" name="id" value="[% cgi.param("id") FILTER html %]">
<input type="hidden" name="id" value="[% cgi.param("id") FILTER html %]">
<input type="hidden" name="delta_ts" value="[% bug.delta_ts FILTER html %]">
<input type="hidden" name="delta_ts" value="[% bug.delta_ts FILTER html %]">
<input type="hidden" name="comment" value="[% cgi.param("comment") FILTER html %]">
<input type="hidden" name="comment" value="[% cgi.param("comment") FILTER html %]">
<input type="hidden" name="use_markdown" value="[% cgi.param("use_markdown") FILTER html %]">
<input type="hidden" name="comment_is_private"
<input type="hidden" name="comment_is_private"
value="[% cgi.param("comment_is_private") FILTER html %]">
value="[% cgi.param("comment_is_private") FILTER html %]">
<input type="hidden" name="token" value="[% cgi.param("token") FILTER html %]">
<input type="hidden" name="token" value="[% cgi.param("token") FILTER html %]">
...
...
template/en/default/email/bugmail.html.tmpl
View file @
f5fc4a6d
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
on [% "$terms.bug $bug.id" FILTER bug_link(bug, { full_url => 1, user => to_user }) FILTER none %]
on [% "$terms.bug $bug.id" FILTER bug_link(bug, { full_url => 1, user => to_user }) FILTER none %]
from [% INCLUDE global/user.html.tmpl user = to_user, who = comment.author %]
</b>
from [% INCLUDE global/user.html.tmpl user = to_user, who = comment.author %]
</b>
[% END %]
[% END %]
<pre>
[% comment.body_full({ wrap => 1 }) FILTER
markdown
(bug, comment, to_user) %]
</pre>
<pre>
[% comment.body_full({ wrap => 1 }) FILTER
quoteUrls
(bug, comment, to_user) %]
</pre>
</div>
</div>
[% END %]
[% END %]
</p>
</p>
...
...
template/en/default/filterexceptions.pl
View file @
f5fc4a6d
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
# [% foo.push() %]
# [% foo.push() %]
# TT loop variables - [% loop.count %]
# TT loop variables - [% loop.count %]
# Already-filtered stuff - [% wibble FILTER html %]
# Already-filtered stuff - [% wibble FILTER html %]
# where the filter is one of html|csv|js|quoteUrls|time|uri|xml|
markdown|
none
# where the filter is one of html|csv|js|quoteUrls|time|uri|xml|none
%::
safe
=
(
%::
safe
=
(
...
...
template/en/default/global/setting-descs.none.tmpl
View file @
f5fc4a6d
...
@@ -44,7 +44,6 @@
...
@@ -44,7 +44,6 @@
"requestee_cc" => "Automatically add me to the CC list of $terms.bugs I am requested to review",
"requestee_cc" => "Automatically add me to the CC list of $terms.bugs I am requested to review",
"bugmail_new_prefix" => "Add 'New:' to subject line of email sent when a new $terms.bug is filed",
"bugmail_new_prefix" => "Add 'New:' to subject line of email sent when a new $terms.bug is filed",
"possible_duplicates" => "Display possible duplicates when reporting a new $terms.bug",
"possible_duplicates" => "Display possible duplicates when reporting a new $terms.bug",
"use_markdown" => "Enable Markdown support for $terms.comments"
}
}
%]
%]
...
...
template/en/default/global/user-error.html.tmpl
View file @
f5fc4a6d
...
@@ -1181,9 +1181,6 @@
...
@@ -1181,9 +1181,6 @@
[%# Used for non-web-based LOGIN_REQUIRED situations. %]
[%# Used for non-web-based LOGIN_REQUIRED situations. %]
You must log in before using this part of [% terms.Bugzilla %].
You must log in before using this part of [% terms.Bugzilla %].
[% ELSIF error == "markdown_disabled" %]
Markdown feature is not enabled.
[% ELSIF error == "migrate_config_created" %]
[% ELSIF error == "migrate_config_created" %]
The file <kbd>[% file FILTER html %]</kbd> contains configuration
The file <kbd>[% file FILTER html %]</kbd> contains configuration
variables that must be set before continuing with the migration.
variables that must be set before continuing with the migration.
...
...
template/en/default/pages/linked.html.tmpl
View file @
f5fc4a6d
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
<p>
<p>
<pre class="bz_comment_text">
<pre class="bz_comment_text">
[%- cgi.param("text") FILTER
markdown
FILTER html -%]
[%- cgi.param("text") FILTER
quoteUrls
FILTER html -%]
</pre>
</pre>
</p>
</p>
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
<p>
<p>
<pre class="bz_comment_text">
<pre class="bz_comment_text">
[%- cgi.param("text") FILTER
markdown
-%]
[%- cgi.param("text") FILTER
quoteUrls
-%]
</pre>
</pre>
</p>
</p>
...
...
template/en/default/pages/markdown.html.tmpl
deleted
100644 → 0
View file @
fc62fd40
[%# this source code form is subject to the terms of the mozilla public
# license, v. 2.0. if a copy of the mpl was not distributed with this
# file, you can obtain one at http://mozilla.org/mpl/2.0/.
#
# this source code form is "incompatible with secondary licenses", as
# defined by the mozilla public license, v. 2.0.
#%]
[% INCLUDE global/header.html.tmpl
title = "Markdown Syntax Guide"
bodyclasses = ['narrow_page']
%]
<h2>What is Markdown?</h2>
Markdown is a simple text formatting language that enables you to write your
[%+ terms.comments %] in plain-text and have them generated as HTML. Markdown
in [%+ terms.Bugzilla %] supports the following structures:
<ul>
<li><a href="#headers">Headers</a></li>
<li><a href="#blockquotes">Blockquotes</a></li>
<li><a href="#emphasis">Emphasis</a></li>
<li><a href="#lists">Lists</a></li>
<li><a href="#code">Code</a></li>
<li><a href="#strikethroughs">Strikethroughs</a></li>
<li><a href="#links">Links</a></li>
</ul>
<h2 id="headers">Headers</h2>
You have two options for making headers. First, you may use any number of
equal signs (for first-level header) or dashes (for second-level headers).
<p>
<pre>
<code>
This is an H1 header
====================
This is an H2 header
--------------------
</code>
</pre>
</p>
Second, you can use hash signs at the beginning of the line to specify the
level of the header from 1 to 6.
<p>
<pre>
<code>
# This is the largest header (H1 level)
### This is a small header (H3 level)
###### This is the smallest header (H6 level)
</code>
</pre>
</p>
<h2 id="blockquotes">Blockquotes</h2>
Use a closing angle bracket (<code>></code>) at the beginning of the line
to indicate a line as quoted.
<p>
<pre>
<code>
> Some text to be quoted.
</code>
</pre>
</p>
<h2 id="emphasis">Emphasis</h2>
Single underscores or asterisks will make the text italic. Double underscores
or asterisks will make the text bold.
<p>
<pre>
<code>
_This text will become italic_
*This text also will become italic*
__But this one will be bold__
**And this one as well**
</code>
</pre>
</p>
Turns into
<p>
<pre>
<em>This text will become italic</em>
<em>This text also will become italic</em>
<br>
<strong>But this one will be bold</strong>
<strong>And this one as well</strong>
</pre>
</p>
Use different signs to combine them nestedly in order to avoid ambiguity:
<p>
<pre>
<code>
_This [% terms.bug %] **must** be resolved ASAP._
</code>
</pre>
</p>
<strong>Note:</strong> [% terms.Bugzilla %] will skip emphasizing words that
have the form of <code>multiple_underscore_in_a_word</code>. This measure is
taken to not emphasize words that are possible programming variables. If your
word has this form and you still want it to become emphasized/bold, you must
use single/double asterisks (<code>*</code>) instead of underscores
(<code>_</code>).
<h2 id="lists">Lists</h2>
Markdown supports both unordered and ordered lists.
<h3>Unordered Lists</h3>
Use asterisks (<code>*</code>), pluses (<code>+</code>) or hyphens
(<code>-</code>) to mark the items of an unordered list.
<p>
<pre>
<code>
+ First item
+ Second item
+ Third item
</code>
</pre>
</p>
<h3>Ordered Lists</h3>
Use a number followed by a period to denote an item of an ordered list.
<p>
<pre>
<code>
1. Item one
4. Item two
3. Item three
</code>
</pre>
</p>
<strong>Note:</strong> Your numbers have no effect on the rendered item
numbers and the rendered numbers are automatically generated. Your numbers
are only used to specify the items of an ordered list.<br>
<p>
A list item can have nested lists recursively:
</p>
<p>
<pre>
<code>
1. Item one
4. Item two
3. Item three
* First sub-item
* Second sub-item
5. Item four
</code>
</pre>
</p>
<h2 id="code">Code</h2>
To make a part of your text to get generated as a piece of code, use one or
more backticks (<code>`</code>) and close that
part with the same number of backticks.
<p>
<pre>
<code>Please see the manual for `printf` function.</code>
</pre>
</p>
If you want to make some lines of code, you need to use 3 or more backticks at
the beginning of a line followed by your code lines and concluded by 3 or more
backticks.
<p>
<pre>
<code>
See my function:
```
int sum(int x, int y) {
return x + y;
}
```
</code>
</pre>
</p>
You can also use a tab or [% constants.MARKDOWN_TAB_WIDTH FILTER html %] or
more spaces at the beginning of each line of your code to make the whole block
look as a code block. Please take care that you might make your lines as code
blocks by inadvertently indenting them.
<h2 id="strikethroughs">Strikethroughs</h2>
Surround your text between a pair of two tildes to have your text crossed out.
<p>
<pre>
<code>
Module ~~Foo~~ is deprecated.
</code>
</pre>
</p>
<h2 id="links">Links</h2>
Literal URLs and Email addresses get linkified automatically. Besides that,
you can define links with link texts and titles. You may define your links
either as inline or as a reference. To define a link as inline, put your link
text in square bracket immediately followed by a pair of parentheses which
containts the URL that you want your link to point to and an <em>optional</em>
link title surrounded by quotes.
<p>
<pre>
<code>
This is [Bugzilla](http://www.bugzilla.org "View Bugzilla Homepage")
[% terms.bug %] tracking system.</code>
This [example link](http://www.example.com) does not have title.
</code>
</pre>
</p>
To define your links in a reference style, define your links any where in
your [% terms.comment %] with the following format:
<p>
<pre>
<code>
[bz]: http://www.bugzilla.org "Bugzilla Homepage"
[mz]: http://www.mozilla.org (Mozilla Homepage)
</code>
</pre>
</p>
That is, define a unique ID for each link in square brackets with their
corresponding URL and optional title in quotes or parentheses. Then, point to
those links simply by writing your link text in square brackets followed by
the ID in another pair of square brackets.
<p>
<pre>
<code>
[Bugzilla][bz] is open-sourced server software designed to help groups
manage software development. [Mozilla][mz] uses [Bugzilla][bz] to track
issues with Firefox and other projects.
</code>
</pre>
</p>
[% PROCESS global/footer.html.tmpl %]
template/en/default/setup/strings.txt.pl
View file @
f5fc4a6d
...
@@ -101,7 +101,6 @@ END
...
@@ -101,7 +101,6 @@ END
feature_xmlrpc
=>
'XML-RPC Interface'
,
feature_xmlrpc
=>
'XML-RPC Interface'
,
feature_detect_charset
=>
'Automatic charset detection for text attachments'
,
feature_detect_charset
=>
'Automatic charset detection for text attachments'
,
feature_typesniffer
=>
'Sniff MIME type of attachments'
,
feature_typesniffer
=>
'Sniff MIME type of attachments'
,
feature_markdown
=>
'Markdown syntax support for comments'
,
file_remove
=>
'Removing ##name##...'
,
file_remove
=>
'Removing ##name##...'
,
file_rename
=>
'Renaming ##from## to ##to##...'
,
file_rename
=>
'Renaming ##from## to ##to##...'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment