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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
33ccfc23
Commit
33ccfc23
authored
Jun 05, 2020
by
Aleksei Lipniagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move caching into model
parent
b53f9d90
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
9 deletions
+7
-9
app/models/project.rb
app/models/project.rb
+5
-4
lib/banzai/filter/project_reference_filter.rb
lib/banzai/filter/project_reference_filter.rb
+2
-5
No files found.
app/models/project.rb
View file @
33ccfc23
...
...
@@ -675,10 +675,11 @@ class Project < ApplicationRecord
# '>' or its escaped form ('>') are checked for because '>' is sometimes escaped
# when the reference comes from an external source.
def
markdown_reference_pattern
%r{
#{
reference_pattern
}
(
#{
reference_postfix
}
|
#{
reference_postfix_escaped
}
)
}x
@markdown_reference_pattern
||=
%r{
#{
reference_pattern
}
(
#{
reference_postfix
}
|
#{
reference_postfix_escaped
}
)
}x
end
def
trending
...
...
lib/banzai/filter/project_reference_filter.rb
View file @
33ccfc23
...
...
@@ -24,6 +24,7 @@ module Banzai
end
def
call
ref_pattern
=
Project
.
markdown_reference_pattern
ref_pattern_start
=
/\A
#{
ref_pattern
}
\z/
nodes
.
each
do
|
node
|
...
...
@@ -82,7 +83,7 @@ module Banzai
refs
=
Set
.
new
nodes
.
each
do
|
node
|
node
.
to_html
.
scan
(
ref
_pattern
)
do
node
.
to_html
.
scan
(
Project
.
markdown_reference
_pattern
)
do
refs
<<
"
#{
$~
[
:namespace
]
}
/
#{
$~
[
:project
]
}
"
end
end
...
...
@@ -111,10 +112,6 @@ module Banzai
def
link_tag
(
url
,
data
,
link_content
,
title
)
%(<a href="#{url}" #{data} class="#{link_class}" title="#{escape_once(title)}">#{link_content}</a>)
end
def
ref_pattern
@ref_pattern
||=
Project
.
markdown_reference_pattern
end
end
end
end
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