Commit 57f8b24f authored by Tony Rom's avatar Tony Rom

Fix minors

parent d90d141c
...@@ -19,21 +19,19 @@ ...@@ -19,21 +19,19 @@
.gfm-color_chip { .gfm-color_chip {
display: inline-block; display: inline-block;
margin-left: 4px; margin: 0 0 2px 4px;
margin-bottom: 2px;
vertical-align: middle; vertical-align: middle;
border-radius: 3px; border-radius: 3px;
$side: 0.9em; $chip-size: 0.9em;
$bg-size: $side / 0.9; $bg-size: $chip-size / 0.9;
$bg-pos: $bg-size / 2; $bg-pos: $bg-size / 2;
$bg-color: $gray-dark;
width: $side; width: $chip-size;
height: $side; height: $chip-size;
background: $white-light; background: $white-light;
background-image: 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, $bg-color 25%, transparent 0%, transparent 75%, $bg-color 0%); linear-gradient(135deg, $gray-dark 25%, transparent 0%, transparent 75%, $gray-dark 0%);
background-size: $bg-size $bg-size; background-size: $bg-size $bg-size;
background-position: 0 0, $bg-pos $bg-pos; background-position: 0 0, $bg-pos $bg-pos;
......
...@@ -30,21 +30,15 @@ module Banzai ...@@ -30,21 +30,15 @@ module Banzai
FORMATS = [HEX_FORMAT, RGB_FORMAT, HSL_FORMAT].freeze 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. # Public: Analyzes whether the String is a color code.
# #
# text - The String to be parsed. # text - The String to be parsed.
# #
# Returns the recognized color String or nil if none was found. # Returns the recognized color String or nil if none was found.
def parse(text) def self.parse(text)
text if color_format =~ text text if COLOR_FORMAT =~ text
end
private
def color_format
@color_format ||= /\A(#{Regexp.union(FORMATS)})\z/ix
end
end end
end end
end end
...@@ -130,11 +130,11 @@ describe('GfmAutoComplete', function () { ...@@ -130,11 +130,11 @@ describe('GfmAutoComplete', function () {
}); });
describe('should not match special sequences', () => { describe('should not match special sequences', () => {
const ShouldNotBeFollowedBy = flags.concat(['\x00', '\x10', '\x3f', '\n', ' ']); const shouldNotBeFollowedBy = flags.concat(['\x00', '\x10', '\x3f', '\n', ' ']);
const ShouldNotBePrependedBy = ['`']; const shouldNotBePrependedBy = ['`'];
flagsUseDefaultMatcher.forEach((atSign) => { flagsUseDefaultMatcher.forEach((atSign) => {
ShouldNotBeFollowedBy.forEach((followedSymbol) => { shouldNotBeFollowedBy.forEach((followedSymbol) => {
const seq = atSign + followedSymbol; const seq = atSign + followedSymbol;
it(`should not match "${seq}"`, () => { it(`should not match "${seq}"`, () => {
...@@ -142,7 +142,7 @@ describe('GfmAutoComplete', function () { ...@@ -142,7 +142,7 @@ describe('GfmAutoComplete', function () {
}); });
}); });
ShouldNotBePrependedBy.forEach((prependedSymbol) => { shouldNotBePrependedBy.forEach((prependedSymbol) => {
const seq = prependedSymbol + atSign; const seq = prependedSymbol + atSign;
it(`should not match "${seq}"`, () => { it(`should not match "${seq}"`, () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment