bibtex-ruby 4.0.9 → 4.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of bibtex-ruby might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/bibtex/value.rb +3 -6
- data/lib/bibtex/version.rb +1 -1
- data/test/bibtex/test_value.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd0b7ed6fae8b54fe92038e224573b83cc8c1457
|
4
|
+
data.tar.gz: 307152a43c8441177761785ff7c111da8dc1264a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2a9dad80be0fb13d3df9aa82a7a450ed368700e5d8c9e67201f07cd2c094d7fecc2125df34253a6ce4cd57a5189ccc25be8649f74b7747112c4eb8aceace979
|
7
|
+
data.tar.gz: e39ab150cc93ccd7be0b498d73cc0e1097f53f3378faab7b04dd6a13ffe0d557cdd649a0c590518c0c26e58bccec3bc2634a756f08494659da4dfca600970165
|
data/lib/bibtex/value.rb
CHANGED
@@ -182,7 +182,7 @@ module BibTeX
|
|
182
182
|
def to_s(options = {})
|
183
183
|
return convert(options.delete(:filter)).to_s(options) if options.has_key?(:filter)
|
184
184
|
return value.to_s unless options.has_key?(:quotes) && atomic?
|
185
|
-
q =
|
185
|
+
q = Array(options[:quotes])
|
186
186
|
[q[0], value, q[-1]].compact.join
|
187
187
|
end
|
188
188
|
|
@@ -191,10 +191,7 @@ module BibTeX
|
|
191
191
|
# joined by a '#', additionally, all string tokens will be turned into
|
192
192
|
# string literals (i.e., delimitted by quotes).
|
193
193
|
def value
|
194
|
-
|
195
|
-
when numeric?
|
196
|
-
to_i
|
197
|
-
when atomic?
|
194
|
+
if atomic?
|
198
195
|
@tokens[0]
|
199
196
|
else
|
200
197
|
@tokens.map { |v| v.is_a?(::String) ? v.inspect : v }.join(' # ')
|
@@ -238,7 +235,7 @@ module BibTeX
|
|
238
235
|
|
239
236
|
# Returns true if the Value's content is numeric.
|
240
237
|
def numeric?
|
241
|
-
atomic? && @tokens[0] =~ /^\s*[+-]?\d
|
238
|
+
atomic? && @tokens[0] =~ /^\s*[+-]?\d+\s*$/
|
242
239
|
end
|
243
240
|
|
244
241
|
def to_i
|
data/lib/bibtex/version.rb
CHANGED
data/test/bibtex/test_value.rb
CHANGED
@@ -170,9 +170,9 @@ module BibTeX
|
|
170
170
|
end
|
171
171
|
|
172
172
|
describe "value" do
|
173
|
-
it 'returns numbers as
|
174
|
-
assert Value.new(
|
175
|
-
assert Value.new(
|
173
|
+
it 'returns numbers as strings' do
|
174
|
+
assert Value.new(42).v.is_a?(::String)
|
175
|
+
assert Value.new(-42).v.is_a?(::String)
|
176
176
|
assert Value.new('a42').v.is_a?(::String)
|
177
177
|
end
|
178
178
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bibtex-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvester Keil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: latex-decode
|