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
Boxiang Sun
gitlab-ce
Commits
57f8b24f
Commit
57f8b24f
authored
Feb 01, 2018
by
Tony Rom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix minors
parent
d90d141c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
27 deletions
+19
-27
app/assets/stylesheets/framework/gfm.scss
app/assets/stylesheets/framework/gfm.scss
+7
-9
lib/banzai/color_parser.rb
lib/banzai/color_parser.rb
+8
-14
spec/javascripts/gfm_auto_complete_spec.js
spec/javascripts/gfm_auto_complete_spec.js
+4
-4
No files found.
app/assets/stylesheets/framework/gfm.scss
View file @
57f8b24f
...
...
@@ -19,21 +19,19 @@
.gfm-color_chip
{
display
:
inline-block
;
margin-left
:
4px
;
margin-bottom
:
2px
;
margin
:
0
0
2px
4px
;
vertical-align
:
middle
;
border-radius
:
3px
;
$
sid
e
:
0
.9em
;
$bg-size
:
$
sid
e
/
0
.9
;
$
chip-siz
e
:
0
.9em
;
$bg-size
:
$
chip-siz
e
/
0
.9
;
$bg-pos
:
$bg-size
/
2
;
$bg-color
:
$gray-dark
;
width
:
$
sid
e
;
height
:
$
sid
e
;
width
:
$
chip-siz
e
;
height
:
$
chip-siz
e
;
background
:
$white-light
;
background-image
:
linear-gradient
(
135deg
,
$
bg-color
25%
,
transparent
0%
,
transparent
75%
,
$bg-color
0%
)
,
linear-gradient
(
135deg
,
$
bg-color
25%
,
transparent
0%
,
transparent
75%
,
$bg-color
0%
);
background-image
:
linear-gradient
(
135deg
,
$
gray-dark
25%
,
transparent
0%
,
transparent
75%
,
$gray-dark
0%
)
,
linear-gradient
(
135deg
,
$
gray-dark
25%
,
transparent
0%
,
transparent
75%
,
$gray-dark
0%
);
background-size
:
$bg-size
$bg-size
;
background-position
:
0
0
,
$bg-pos
$bg-pos
;
...
...
lib/banzai/color_parser.rb
View file @
57f8b24f
...
...
@@ -30,21 +30,15 @@ module Banzai
FORMATS
=
[
HEX_FORMAT
,
RGB_FORMAT
,
HSL_FORMAT
].
freeze
class
<<
self
COLOR_FORMAT
=
/\A(
#{
Regexp
.
union
(
FORMATS
)
}
)\z/ix
# Public: Analyzes whether the String is a color code.
#
# text - The String to be parsed.
#
# Returns the recognized color String or nil if none was found.
def
parse
(
text
)
text
if
color_format
=~
text
end
private
def
color_format
@color_format
||=
/\A(
#{
Regexp
.
union
(
FORMATS
)
}
)\z/ix
end
def
self
.
parse
(
text
)
text
if
COLOR_FORMAT
=~
text
end
end
end
spec/javascripts/gfm_auto_complete_spec.js
View file @
57f8b24f
...
...
@@ -130,11 +130,11 @@ describe('GfmAutoComplete', function () {
});
describe
(
'
should not match special sequences
'
,
()
=>
{
const
S
houldNotBeFollowedBy
=
flags
.
concat
([
'
\
x00
'
,
'
\
x10
'
,
'
\
x3f
'
,
'
\n
'
,
'
'
]);
const
S
houldNotBePrependedBy
=
[
'
`
'
];
const
s
houldNotBeFollowedBy
=
flags
.
concat
([
'
\
x00
'
,
'
\
x10
'
,
'
\
x3f
'
,
'
\n
'
,
'
'
]);
const
s
houldNotBePrependedBy
=
[
'
`
'
];
flagsUseDefaultMatcher
.
forEach
((
atSign
)
=>
{
S
houldNotBeFollowedBy
.
forEach
((
followedSymbol
)
=>
{
s
houldNotBeFollowedBy
.
forEach
((
followedSymbol
)
=>
{
const
seq
=
atSign
+
followedSymbol
;
it
(
`should not match "
${
seq
}
"`
,
()
=>
{
...
...
@@ -142,7 +142,7 @@ describe('GfmAutoComplete', function () {
});
});
S
houldNotBePrependedBy
.
forEach
((
prependedSymbol
)
=>
{
s
houldNotBePrependedBy
.
forEach
((
prependedSymbol
)
=>
{
const
seq
=
prependedSymbol
+
atSign
;
it
(
`should not match "
${
seq
}
"`
,
()
=>
{
...
...
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