shoes-highlighter 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 06db840874b7b465b090576dc13bba0274542c67
4
- data.tar.gz: 0252050fbd61257f89648d4076fd41338b399e12
3
+ metadata.gz: 17121d48a9b7cd4917902d1a31c8dcaeece4bbd1
4
+ data.tar.gz: 66910b8f22dbf4f7265a97ac561980960d775e8a
5
5
  SHA512:
6
- metadata.gz: ee92054f48c6b63d9618c38e3246c6e814fbdcbb6d90466c7b29ae272c1efe966db378299d3011b37060683d33697b67f3048f05d1ac71127adc5afbd8fa52c2
7
- data.tar.gz: 7b4a67cded1f6f77106419e48e5b46e3ad4fa428a4123f95ed56ad0f194c79143cd9b46e96500fb5ecb37c4a7359da856d6492ba037da1539c6e577a8c7480e7
6
+ metadata.gz: 4b8959e9c7ecf530852855b7b899e5852239213d006426a074964c1dfb55c251537864806718c6f9af4b767a17b392d3dc3b3a9432ec6e200e3a993b9f9787ea
7
+ data.tar.gz: 29ec2c6c1f00ae89a5ad45a7186d04ffde0cb142971465ba7874ca355608718d7b5609e1a61b0d0c0a2b7710029a8c2e6658724734827b688f9eac61ea33b204
@@ -5,25 +5,25 @@ class Shoes
5
5
  module Markup
6
6
  TOKENIZER = Shoes::Highlighter::Syntax.load "ruby"
7
7
  COLORS = {
8
- comment: { stroke: "#887" },
9
- keyword: { stroke: "#111" },
10
- method: { stroke: "#C09", weight: "bold" },
11
- # :class => {:stroke => "#0c4", :weight => "bold"},
12
- # :module => {:stroke => "#050"},
13
- # :punct => {:stroke => "#668", :weight => "bold"},
14
- symbol: { stroke: "#C30" },
15
- string: { stroke: "#C90" },
16
- number: { stroke: "#396" },
17
- regex: { stroke: "#000", fill: "#FFC" },
18
- # :char => {:stroke => "#f07"},
19
- attribute: { stroke: "#369" },
20
- # :global => {:stroke => "#7FB" },
21
- expr: { stroke: "#722" },
22
- # :escape => {:stroke => "#277" }
23
- ident: { stroke: "#994c99" },
24
- constant: { stroke: "#630", weight: "bold" },
25
- class: { stroke: "#630", weight: "bold" },
26
- matching: { stroke: "#ff0", weight: "bold" },
8
+ comment: { stroke: "#887" },
9
+ keyword: { stroke: "#111" },
10
+ method: { stroke: "#C09", weight: "bold" },
11
+ # :class => {:stroke => "#0c4", :weight => "bold"},
12
+ # :module => {:stroke => "#050"},
13
+ # :punct => {:stroke => "#668", :weight => "bold"},
14
+ symbol: { stroke: "#C30" },
15
+ string: { stroke: "#C90" },
16
+ number: { stroke: "#396" },
17
+ regex: { stroke: "#000", fill: "#FFC" },
18
+ # :char => {:stroke => "#f07"},
19
+ attribute: { stroke: "#369" },
20
+ # :global => {:stroke => "#7FB" },
21
+ expr: { stroke: "#722" },
22
+ # :escape => {:stroke => "#277" }
23
+ ident: { stroke: "#994c99" },
24
+ constant: { stroke: "#630", weight: "bold" },
25
+ class: { stroke: "#630", weight: "bold" },
26
+ matching: { stroke: "#ff0", weight: "bold" },
27
27
  }
28
28
 
29
29
  def highlight(str, pos = nil, colors = COLORS)
@@ -43,13 +43,9 @@ class Shoes
43
43
  tokens.each do |token|
44
44
  res <<
45
45
  if colors[token.group]
46
- # span(token, colors[token.group])
47
- tmp = fg(token, colors[token.group][:stroke])
48
- colors[token.group][:fill] ? bg(tmp, colors[token.group][:fill]) : tmp
46
+ span(token, colors[token.group])
49
47
  elsif colors[:any]
50
- # span(token, colors[:any])
51
- tmp = fg(token, colors[:any][:stroke])
52
- colors[:any][:fill] ? bg(tmp, colors[:any][:fill]) : tmp
48
+ span(token, colors[:any])
53
49
  else
54
50
  token
55
51
  end
@@ -62,13 +58,9 @@ class Shoes
62
58
  token_index, matching_index = matching_token(tokens, pos)
63
59
 
64
60
  if token_index
65
- # res[token_index] = span(tokens[token_index], colors[:matching])
66
- tmp = fg(tokens[token_index], colors[:matching][:stroke])
67
- res[token_index] = colors[:matching][:fill] ? bg(tmp, colors[:matching][:fill]) : tmp
61
+ res[token_index] = span(tokens[token_index], colors[:matching])
68
62
  if matching_index
69
- # res[matching_index] = span(tokens[matching_index], colors[:matching])
70
- tmp = fg(tokens[matching_index], colors[:matching][:stroke])
71
- res[matching_index] = colors[:matching][:fill] ? bg(tmp, colors[:matching][:fill]) : tmp
63
+ res[matching_index] = span(tokens[matching_index], colors[:matching])
72
64
  end
73
65
  end
74
66
 
@@ -182,9 +174,9 @@ class Shoes
182
174
  end
183
175
 
184
176
  OPEN_BRACKETS = {
185
- '{' => '}',
186
- '(' => ')',
187
- '[' => ']',
177
+ '{' => '}',
178
+ '(' => ')',
179
+ '[' => ']',
188
180
  }
189
181
 
190
182
  # close_bracket = {}
@@ -192,9 +184,9 @@ class Shoes
192
184
  # CLOSE_BRACKETS = opens_bracket
193
185
  # the following is more readable :)
194
186
  CLOSE_BRACKETS = {
195
- '}' => '{',
196
- ')' => '(',
197
- ']' => '[',
187
+ '}' => '{',
188
+ ')' => '(',
189
+ ']' => '[',
198
190
  }
199
191
 
200
192
  BRACKETS = CLOSE_BRACKETS.keys + OPEN_BRACKETS.keys
@@ -1,5 +1,5 @@
1
1
  class Shoes
2
2
  module Highlighter
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shoes-highlighter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Team Shoes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-14 00:00:00.000000000 Z
11
+ date: 2015-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  version: '0'
78
78
  requirements: []
79
79
  rubyforge_project:
80
- rubygems_version: 2.4.2
80
+ rubygems_version: 2.4.5
81
81
  signing_key:
82
82
  specification_version: 4
83
83
  summary: A syntax highlighting library used by Shoes