pygments.rb 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/pygments.rb +3 -7
- data/lib/pygments/lexer.rb +2 -0
- data/lib/pygments/popen.rb +3 -3
- data/lib/pygments/version.rb +3 -1
- data/test/test_pygments.rb +12 -9
- data/vendor/pygments-main/scripts/find_error.py +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5021687249edac6151faaec1cec0187dea8eb311
|
4
|
+
data.tar.gz: f61e48727a7eb866ee5c5bd549ddce136095efc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05ec911f5a0aa423dd24da7ad7a4228989170790dee007347e401745c64d5c5fbc29b43cbe9e6a43f499f46ca5af8c504d0e0e29c2272aeb82fbcee524401b69
|
7
|
+
data.tar.gz: b93056fd8b559770b234958660c4643ac400cbedfcf65df9e20dfcf859651b75d3361b1723506ed6bf18d7ab30de128d15ca65ae2454974f73e345b8cc4bed9b
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
changelog
|
2
2
|
===========
|
3
3
|
|
4
|
+
Version 1.1.1 (2016/12/28)
|
5
|
+
-----------------------------
|
6
|
+
|
7
|
+
* Suppress Ruby 2.4.0's warnings [#172](https://github.com/tmm1/pygments.rb/pull/172)
|
8
|
+
* Enable `frozen_string_literal` [#173](https://github.com/tmm1/pygments.rb/pull/173)
|
4
9
|
|
5
10
|
Version 1.1.0 (2016/12/24)
|
6
11
|
-----------------------------
|
data/lib/pygments.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
1
3
|
require File.join(File.dirname(__FILE__), 'pygments/popen')
|
2
4
|
require 'forwardable'
|
3
5
|
|
@@ -14,7 +16,6 @@ module Pygments
|
|
14
16
|
end
|
15
17
|
|
16
18
|
def_delegators :engine,
|
17
|
-
# public
|
18
19
|
:formatters,
|
19
20
|
:lexers,
|
20
21
|
:lexers!,
|
@@ -23,11 +24,6 @@ module Pygments
|
|
23
24
|
:css,
|
24
25
|
:lexer_name_for,
|
25
26
|
:highlight,
|
26
|
-
|
27
|
-
:start,
|
28
|
-
# only for testing
|
29
|
-
:size_check,
|
30
|
-
:get_fixed_bits_from_header,
|
31
|
-
:add_ids
|
27
|
+
:start
|
32
28
|
end
|
33
29
|
end
|
data/lib/pygments/lexer.rb
CHANGED
data/lib/pygments/popen.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
require 'open3'
|
3
5
|
require 'multi_json'
|
4
6
|
require 'timeout'
|
@@ -371,9 +373,7 @@ module Pygments
|
|
371
373
|
# id, with two padding also. This means we are sending over the 8 characters +
|
372
374
|
# code + 8 characters.
|
373
375
|
def add_ids(code, id)
|
374
|
-
code.freeze
|
375
|
-
code = id + " #{code} #{id}"
|
376
|
-
code
|
376
|
+
(id + " #{code} #{id}").freeze
|
377
377
|
end
|
378
378
|
|
379
379
|
# Write data to mentos, the Python process.
|
data/lib/pygments/version.rb
CHANGED
data/test/test_pygments.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
1
|
-
#coding: utf-8
|
1
|
+
# coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require 'test/unit'
|
4
5
|
require File.join(File.dirname(__FILE__), '..', '/lib/pygments.rb')
|
5
6
|
ENV['mentos-test'] = "yes"
|
6
7
|
|
8
|
+
|
7
9
|
P = Pygments
|
10
|
+
PE = Pygments.engine
|
8
11
|
|
9
12
|
class PygmentsHighlightTest < Test::Unit::TestCase
|
10
13
|
RUBY_CODE = "#!/usr/bin/ruby\nputs 'foo'"
|
@@ -129,44 +132,44 @@ end
|
|
129
132
|
# over the pipe I think it's necessary and informative.
|
130
133
|
class PygmentsValidityTest < Test::Unit::TestCase
|
131
134
|
def test_add_ids_with_padding
|
132
|
-
res =
|
135
|
+
res = PE.send(:add_ids, "herp derp baz boo foo", "ABCDEFGH")
|
133
136
|
assert_equal "ABCDEFGH herp derp baz boo foo ABCDEFGH", res
|
134
137
|
end
|
135
138
|
|
136
139
|
def test_add_ids_on_empty_string
|
137
|
-
res =
|
140
|
+
res = PE.send(:add_ids, "", "ABCDEFGH")
|
138
141
|
assert_equal "ABCDEFGH ABCDEFGH", res
|
139
142
|
end
|
140
143
|
|
141
144
|
def test_add_ids_with_unicode_data
|
142
|
-
res =
|
145
|
+
res = PE.send(:add_ids, "# ø ø ø", "ABCDEFGH")
|
143
146
|
assert_equal "ABCDEFGH # ø ø ø ABCDEFGH", res
|
144
147
|
end
|
145
148
|
|
146
149
|
def test_add_ids_with_starting_slashes
|
147
|
-
res =
|
150
|
+
res = PE.send(:add_ids, '\\# ø ø ø..//', "ABCDEFGH")
|
148
151
|
assert_equal "ABCDEFGH \\# ø ø ø..// ABCDEFGH", res
|
149
152
|
end
|
150
153
|
|
151
154
|
def test_get_fixed_bits_from_header
|
152
|
-
bits =
|
155
|
+
bits = PE.send(:get_fixed_bits_from_header, '{"herp": "derp"}')
|
153
156
|
assert_equal "00000000000000000000000000010000", bits
|
154
157
|
end
|
155
158
|
|
156
159
|
def test_get_fixed_bits_from_header_works_with_large_headers
|
157
|
-
bits =
|
160
|
+
bits = PE.send(:get_fixed_bits_from_header, '{"herp": "derp"}' * 10000)
|
158
161
|
assert_equal "00000000000000100111000100000000", bits
|
159
162
|
end
|
160
163
|
|
161
164
|
def test_size_check
|
162
165
|
size = "00000000000000000000000000100110"
|
163
|
-
res =
|
166
|
+
res = PE.send(:size_check, size)
|
164
167
|
assert_equal res, true
|
165
168
|
end
|
166
169
|
|
167
170
|
def test_size_check_bad
|
168
171
|
size = "some random thing"
|
169
|
-
res =
|
172
|
+
res = PE.send(:size_check, size)
|
170
173
|
assert_equal res, false
|
171
174
|
end
|
172
175
|
end
|
@@ -1 +1 @@
|
|
1
|
-
debug_lexer.py
|
1
|
+
vendor/pygments-main/scripts/debug_lexer.py
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pygments.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aman Gupta
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-12-
|
12
|
+
date: 2016-12-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -411,7 +411,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
411
411
|
version: '0'
|
412
412
|
requirements: []
|
413
413
|
rubyforge_project:
|
414
|
-
rubygems_version: 2.
|
414
|
+
rubygems_version: 2.6.8
|
415
415
|
signing_key:
|
416
416
|
specification_version: 4
|
417
417
|
summary: pygments wrapper for ruby
|