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
Léo-Paul Géneau
gitlab-ce
Commits
ad7fcc7b
Commit
ad7fcc7b
authored
Jun 27, 2018
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use monospaced font for MR diff commit link ref on GFM
parent
07de43a7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
3 deletions
+22
-3
changelogs/unreleased/18141-osw-use-monospaced-font-on-diffs-commit-ref.yml
...sed/18141-osw-use-monospaced-font-on-diffs-commit-ref.yml
+5
-0
lib/banzai/filter/merge_request_reference_filter.rb
lib/banzai/filter/merge_request_reference_filter.rb
+4
-1
lib/banzai/filter/reference_filter.rb
lib/banzai/filter/reference_filter.rb
+6
-2
spec/lib/banzai/filter/merge_request_reference_filter_spec.rb
.../lib/banzai/filter/merge_request_reference_filter_spec.rb
+7
-0
No files found.
changelogs/unreleased/18141-osw-use-monospaced-font-on-diffs-commit-ref.yml
0 → 100644
View file @
ad7fcc7b
---
title
:
Use monospaced font for MR diff commit link ref on GFM
merge_request
:
author
:
type
:
other
lib/banzai/filter/merge_request_reference_filter.rb
View file @
ad7fcc7b
...
@@ -25,7 +25,10 @@ module Banzai
...
@@ -25,7 +25,10 @@ module Banzai
extras
=
super
extras
=
super
if
commit_ref
=
object_link_commit_ref
(
object
,
matches
)
if
commit_ref
=
object_link_commit_ref
(
object
,
matches
)
return
extras
.
unshift
(
commit_ref
)
klass
=
reference_class
(
:commit
,
tooltip:
false
)
commit_ref_tag
=
%(<span class="#{klass}">#{commit_ref}</span>)
return
extras
.
unshift
(
commit_ref_tag
)
end
end
path
=
matches
[
:path
]
if
matches
.
names
.
include?
(
"path"
)
path
=
matches
[
:path
]
if
matches
.
names
.
include?
(
"path"
)
...
...
lib/banzai/filter/reference_filter.rb
View file @
ad7fcc7b
...
@@ -65,8 +65,12 @@ module Banzai
...
@@ -65,8 +65,12 @@ module Banzai
context
[
:skip_project_check
]
context
[
:skip_project_check
]
end
end
def
reference_class
(
type
)
def
reference_class
(
type
,
tooltip:
true
)
"gfm gfm-
#{
type
}
has-tooltip"
gfm_klass
=
"gfm gfm-
#{
type
}
"
return
gfm_klass
unless
tooltip
"
#{
gfm_klass
}
has-tooltip"
end
end
# Ensure that a :project key exists in context
# Ensure that a :project key exists in context
...
...
spec/lib/banzai/filter/merge_request_reference_filter_spec.rb
View file @
ad7fcc7b
...
@@ -210,6 +210,13 @@ describe Banzai::Filter::MergeRequestReferenceFilter do
...
@@ -210,6 +210,13 @@ describe Banzai::Filter::MergeRequestReferenceFilter do
.
to
eq
reference
.
to
eq
reference
end
end
it
'commit ref tag is valid'
do
doc
=
reference_filter
(
"See
#{
reference
}
"
)
commit_ref_tag
=
doc
.
css
(
'a'
).
first
.
css
(
'span.gfm.gfm-commit'
)
expect
(
commit_ref_tag
.
text
).
to
eq
(
commit
.
short_id
)
end
it
'has valid text'
do
it
'has valid text'
do
doc
=
reference_filter
(
"See
#{
reference
}
"
)
doc
=
reference_filter
(
"See
#{
reference
}
"
)
...
...
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