Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
e31a9dd2
Commit
e31a9dd2
authored
Aug 14, 2012
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GFM refactor: Update pattern to avoid an extra HTML entities check
parent
d1d19aec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
7 deletions
+4
-7
app/helpers/gitlab_markdown_helper.rb
app/helpers/gitlab_markdown_helper.rb
+4
-7
No files found.
app/helpers/gitlab_markdown_helper.rb
View file @
e31a9dd2
module
GitlabMarkdownHelper
REFERENCE_PATTERN
=
%r{
(
\W
)?
# Prefix (1)
(
[^
\w
&;])?
# Prefix (1)
( # Reference (2)
@([
\w\.
_]+) | # User name (3)
[#!$](
\d
+) | # Issue/MR/Snippet ID (4)
[
\h
]{6,40} # Commit ID (2)
)
(
\W
)?
# Suffix (5)
(
[^
\w
&;])?
# Suffix (5)
}x
.
freeze
def
gfm
(
text
,
html_options
=
{})
...
...
@@ -86,11 +86,8 @@ module GitlabMarkdownHelper
# issue: #123
when
/^#/
# avoid HTML entities
unless
vals
[
:prefix
].
try
(
:end_with?
,
"&"
)
&&
vals
[
:suffix
].
try
(
:start_with?
,
";"
)
issue
=
@project
.
issues
.
where
(
id:
vals
[
:reference_id
]).
first
link_to
(
"#
#{
issue
.
id
}
"
,
project_issue_path
(
@project
,
issue
),
html_options
.
merge
(
title:
"Issue:
#{
issue
.
title
}
"
,
class:
"gfm gfm-issue
#{
html_options
[
:class
]
}
"
))
if
issue
end
issue
=
@project
.
issues
.
where
(
id:
vals
[
:reference_id
]).
first
link_to
(
"#
#{
issue
.
id
}
"
,
project_issue_path
(
@project
,
issue
),
html_options
.
merge
(
title:
"Issue:
#{
issue
.
title
}
"
,
class:
"gfm gfm-issue
#{
html_options
[
:class
]
}
"
))
if
issue
# merge request: !123
when
/^!/
...
...
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