Skip to content

Commit 65eeaca

Browse files
committed
add python binary string
1 parent 40bd2ef commit 65eeaca

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/coderay/scanners/python.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,12 @@ def scan_tokens encoder, options
157157
encoder.text_token match, :operator
158158

159159
elsif match = scan(/(u?r?|b)?("""|"|'''|')/i)
160+
modifiers = self[1]
160161
string_delimiter = self[2]
161-
string_type = docstring_coming ? :docstring : :string
162+
string_type = docstring_coming ? :docstring : (modifiers == 'b' ? :binary : :string)
162163
docstring_coming = false if docstring_coming
163164
encoder.begin_group string_type
164165
string_raw = false
165-
modifiers = self[1]
166166
unless modifiers.empty?
167167
string_raw = !!modifiers.index(?r)
168168
encoder.text_token modifiers, :modifier

lib/coderay/styles/alpha.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ class Alpha < Style
5656
.annotation { color:#007 }
5757
.attribute-name { color:#b48 }
5858
.attribute-value { color:#700 }
59-
.binary { color:#509 }
59+
.binary { color:#549 }
60+
.binary .delimiter { color:#325 }
61+
.binary .char { color:#325 }
6062
.char .content { color:#D20 }
6163
.char .delimiter { color:#710 }
6264
.char { color:#D20 }

0 commit comments

Comments
 (0)