bibtex-ruby 2.2.2 → 2.3.0

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.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ Mzc1YjdjZmZiYzYyY2UxODIwZWI4YmI2NDAyYmViNWQ1ZTMwNjQyZg==
5
+ data.tar.gz: !binary |-
6
+ NGEwOTAzMzNjMDk2YTkwYTc0ODJiYWQzOTYyYzBiYjNjZjU0NjFkMg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ZmUwOTM3YjhkY2Q1OWFmMGJkMDg1NDc3MjI4NTY0MTYzMzg5MmFhZWZlYmM4
10
+ MmFhZmQ5N2ViYWUyNmU2ZTI2NDgyNjFjNGViNTczOWU2ZDE1MzE0OGZkZTI0
11
+ OWIxOGZkNDEyODk3YzA3MTNhNzM0ZDIwOTVlNzcyNTAzZTZiZGQ=
12
+ data.tar.gz: !binary |-
13
+ MTU2Y2VmZmVkOTZiMzA1NmE2N2M5YzgyOTRlYzY1OGI0MjQ2YWZmM2ZlZDI3
14
+ MDFmMTlkY2UzM2EyYWFmN2Q5NjQ1YWFhMmViMjNlMmJlOTlmNzY3ZWVhNDkx
15
+ ZWQ5YWRkZjcyZTEzMTQzODkyNTk2ZjdhNmJmZjY5ODY1MGI4ZGY=
data/Gemfile CHANGED
@@ -1,11 +1,11 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
4
  # RDF Export
5
5
  gem 'rdf', '~>0.3'
6
6
 
7
7
  group :debug do
8
- gem 'debugger', :require => false, :platforms => [:mri_19]
8
+ gem 'debugger', :require => false, :platforms => [:mri_19, :mri_20]
9
9
  gem 'ruby-debug', :require => false, :platforms => [:mri_18]
10
10
  end
11
11
 
@@ -24,7 +24,7 @@ group :extra do
24
24
  end
25
25
 
26
26
  group :profile do
27
- gem 'ruby-prof', ['~>0.10'], :platforms => [:mri_19, :mri_19]
27
+ gem 'ruby-prof', ['~>0.10'], :platforms => [:mri_19, :mri_20]
28
28
  gem 'gnuplot', ['~>2.4']
29
29
  gem 'simplecov'
30
30
  end
@@ -1,78 +1,80 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bibtex-ruby (2.2.2)
4
+ bibtex-ruby (2.3.0)
5
5
  latex-decode (>= 0.0.6)
6
6
  multi_json (~> 1.3)
7
7
 
8
8
  GEM
9
- remote: http://rubygems.org/
9
+ remote: https://rubygems.org/
10
10
  specs:
11
- addressable (2.3.2)
12
- builder (3.0.0)
11
+ addressable (2.3.3)
12
+ builder (3.2.0)
13
+ coderay (1.0.9)
13
14
  columnize (0.3.6)
14
- cucumber (1.2.1)
15
+ cucumber (1.2.3)
15
16
  builder (>= 2.1.2)
16
17
  diff-lcs (>= 1.1.3)
17
- gherkin (~> 2.11.0)
18
- json (>= 1.4.6)
19
- debugger (1.2.0)
18
+ gherkin (~> 2.11.6)
19
+ multi_json (~> 1.3)
20
+ debugger (1.5.0)
20
21
  columnize (>= 0.3.1)
21
- debugger-linecache (~> 1.1.1)
22
- debugger-ruby_core_source (~> 1.1.3)
23
- debugger-linecache (1.1.2)
24
- debugger-ruby_core_source (>= 1.1.1)
25
- debugger-ruby_core_source (1.1.3)
26
- diff-lcs (1.1.3)
27
- ffi (1.1.5)
28
- gherkin (2.11.2)
29
- json (>= 1.4.6)
30
- gnuplot (2.5.0)
31
- guard (1.3.2)
32
- listen (>= 0.4.2)
22
+ debugger-linecache (~> 1.2.0)
23
+ debugger-ruby_core_source (~> 1.2.0)
24
+ debugger-linecache (1.2.0)
25
+ debugger-ruby_core_source (1.2.0)
26
+ diff-lcs (1.2.2)
27
+ formatador (0.2.4)
28
+ gherkin (2.11.7)
29
+ multi_json (~> 1.3)
30
+ gnuplot (2.6.2)
31
+ guard (1.7.0)
32
+ formatador (>= 0.2.4)
33
+ listen (>= 0.6.0)
34
+ lumberjack (>= 1.0.2)
35
+ pry (>= 0.9.10)
33
36
  thor (>= 0.14.6)
34
- guard-cucumber (1.2.0)
37
+ guard-cucumber (1.4.0)
35
38
  cucumber (>= 1.2.0)
36
39
  guard (>= 1.1.0)
37
40
  guard-minitest (0.5.0)
38
41
  guard (>= 0.4)
39
- json (1.7.5)
40
- latex-decode (0.0.12)
42
+ latex-decode (0.1.0)
41
43
  unicode (~> 0.4)
42
44
  linecache (0.46)
43
45
  rbx-require-relative (> 0.0.4)
44
- listen (0.4.7)
45
- rb-fchange (~> 0.0.5)
46
- rb-fsevent (~> 0.9.1)
47
- rb-inotify (~> 0.8.8)
48
- minitest (2.12.1)
49
- minitest-colorize (0.0.4)
50
- minitest (~> 2.0)
51
- multi_json (1.3.6)
52
- racc (1.4.8)
53
- rake (0.9.2.2)
54
- rb-fchange (0.0.5)
55
- ffi
56
- rb-fsevent (0.9.1)
57
- rb-inotify (0.8.8)
58
- ffi (>= 0.5.0)
46
+ listen (0.7.3)
47
+ lumberjack (1.0.3)
48
+ method_source (0.8.1)
49
+ minitest (4.7.0)
50
+ minitest-colorize (0.0.5)
51
+ minitest (>= 2.0)
52
+ multi_json (1.7.2)
53
+ pry (0.9.12)
54
+ coderay (~> 1.0.5)
55
+ method_source (~> 0.8)
56
+ slop (~> 3.4)
57
+ racc (1.4.9)
58
+ rake (10.0.4)
59
+ rb-fsevent (0.9.3)
59
60
  rbx-require-relative (0.0.9)
60
- rdf (0.3.8)
61
+ rdf (0.3.11.1)
61
62
  addressable (>= 2.2.6)
62
- redcarpet (2.1.1)
63
+ redcarpet (2.2.2)
63
64
  ruby-debug (0.10.4)
64
65
  columnize (>= 0.1)
65
66
  ruby-debug-base (~> 0.10.4.0)
66
67
  ruby-debug-base (0.10.4)
67
68
  linecache (>= 0.3)
68
- ruby-prof (0.11.2)
69
- simplecov (0.6.4)
69
+ ruby-prof (0.13.0)
70
+ simplecov (0.7.1)
70
71
  multi_json (~> 1.0)
71
- simplecov-html (~> 0.5.3)
72
- simplecov-html (0.5.3)
73
- thor (0.16.0)
74
- unicode (0.4.3)
75
- yard (0.8.2.1)
72
+ simplecov-html (~> 0.7.1)
73
+ simplecov-html (0.7.1)
74
+ slop (3.4.4)
75
+ thor (0.18.1)
76
+ unicode (0.4.4)
77
+ yard (0.8.5.2)
76
78
 
77
79
  PLATFORMS
78
80
  ruby
@@ -1,3 +1,9 @@
1
+ 2.3.0 / 2013-06-04
2
+ ==================
3
+
4
+ * Add attribute-only queries (thanks to @ashinkarov)
5
+ * Add negated queries (thanks to @ashinkarov)
6
+
1
7
  2.2.2 / 2013-15-01
2
8
  ==================
3
9
 
data/Manifest CHANGED
@@ -37,6 +37,7 @@ features/support
37
37
  features/support/env.rb
38
38
  lib
39
39
  lib/bibtex
40
+ lib/bibtex.rb
40
41
  lib/bibtex/bibliography.rb
41
42
  lib/bibtex/bibtex.y
42
43
  lib/bibtex/compatibility.rb
@@ -45,9 +46,9 @@ lib/bibtex/entry.rb
45
46
  lib/bibtex/error.rb
46
47
  lib/bibtex/extensions.rb
47
48
  lib/bibtex/filters
49
+ lib/bibtex/filters.rb
48
50
  lib/bibtex/filters/latex.rb
49
51
  lib/bibtex/filters/linebreaks.rb
50
- lib/bibtex/filters.rb
51
52
  lib/bibtex/lexer.rb
52
53
  lib/bibtex/name_parser.rb
53
54
  lib/bibtex/names.rb
@@ -58,7 +59,6 @@ lib/bibtex/ruby.rb
58
59
  lib/bibtex/utilities.rb
59
60
  lib/bibtex/value.rb
60
61
  lib/bibtex/version.rb
61
- lib/bibtex.rb
62
62
  test
63
63
  test/benchmark.rb
64
64
  test/bibtex
data/README.md CHANGED
@@ -211,24 +211,39 @@ query functionality with the exception of yielding to a block. For instance:
211
211
  => Returns the second and third elements or nil
212
212
  bib[1..2]
213
213
  => Same as above
214
+
214
215
  bib[:key]
215
216
  => Returns the first entry with key 'key' or nil
216
217
  bib['key']
217
218
  => Returns all entries with key 'key' or []
219
+
218
220
  bib['@article']
219
221
  => Returns all entries of type 'article' or []
222
+ bib['!@book']
223
+ => Returns all entries of any type other than 'book' or []
220
224
  bib['@preamble']
221
225
  => Returns all preamble objects (this is the same as Bibliography#preambles) or []
222
226
  bib[/ruby/]
223
227
  => Returns all objects that match 'ruby' anywhere or []
228
+
229
+ bib['@incollection[booktitle]']
230
+ => Returns all in-collection entries with a booktitle or []
231
+
232
+ # note that the above includes entries inheriting the book title
233
+ # from a cross-referenced entry!
234
+
224
235
  bib['@book[keywords=ruby]']
225
236
  => Returns all books whose keywords attribute equals 'ruby' or []
226
237
  bib['@book[keywords!=ruby]']
227
238
  => Returns all books whose keywords attribute does not equal 'ruby'
228
239
  bib['@book[keywords/=ruby]']
229
240
  => Same as above
230
- bib.q('@book[keywords^=ruby]')
241
+
242
+ bib.q('@book[keywords ^= ruby]')
243
+ => Returns all books whose keywords attribute matches /^ruby/
244
+ bib.q('@book[keywords ~= ruby]')
231
245
  => Returns all books whose keywords attribute matches /ruby/
246
+
232
247
  bib.q('@article[year<=2007]')
233
248
  => Returns all articles published in 2007 or earlier
234
249
  bib.query('@book') { |e| e.keywords.split(/,/).length > 1 }
@@ -227,7 +227,7 @@ module BibTeX
227
227
  nil
228
228
  when arguments[0].is_a?(Symbol)
229
229
  entries[arguments[0]]
230
- when arguments[0].respond_to?(:start_with?) && !arguments[0].start_with?('@')
230
+ when arguments[0].respond_to?(:start_with?) && !arguments[0].start_with?('@', '!@')
231
231
  entries[arguments[0]]
232
232
  else
233
233
  query(*arguments)
@@ -448,8 +448,8 @@ module BibTeX
448
448
  # bib.query('@*') #=> same as above
449
449
  # bib.query(:first, '@book, @article')
450
450
  # #=> returns the first book or article or nil
451
- # bib.query('@book[year=2011], @article)
452
- # #=> returns all books published in 2011 and all articles
451
+ # bib.query('@book[year<=2011], @article)
452
+ # #=> returns all books published in 2011 or earlier and all articles
453
453
  # bib.query('@book, @article) { |o| o.year == '2011' }
454
454
  # #=> returns all books and articles published in 2011
455
455
  # bib.query('@book[year=2011], @article[year=2011])
@@ -102,8 +102,8 @@ module BibTeX
102
102
  when /^\/(.+)\/$/
103
103
  to_s.match(Regexp.new($1))
104
104
  when /@(\*|\w+)(?:\[([^\]]*)\])?/
105
- query.scan(/@(\*|\w+)(?:\[([^\]]*)\])?/).any? do |type, condition|
106
- if has_type?(type)
105
+ query.scan(/(!)?@(\*|\w+)(?:\[([^\]]*)\])?/).any? do |non, type, condition|
106
+ if (non ? !has_type?(type) : has_type?(type))
107
107
  if condition.nil? || condition.empty?
108
108
  true
109
109
  else
@@ -192,21 +192,25 @@ module BibTeX
192
192
  if property.nil?
193
193
  true
194
194
  else
195
- actual = respond_to?(property) ? send(property) : nil
196
-
197
- case operator
198
- when '!=', '/='
199
- actual.nil? || actual.to_s != value
200
- when '^='
201
- !actual.nil? && actual.to_s.match("^#{value}")
202
- when '~='
203
- !actual.nil? && actual.to_s.match(value)
204
- when '<='
205
- !actual.nil? && actual.to_i <= value.to_i
206
- when '>='
207
- !actual.nil? && actual.to_i >= value.to_i
195
+ if operator.nil? && value.nil?
196
+ respond_to?(:provides?) && provides?(property)
208
197
  else
209
- !actual.nil? && actual.to_s == value
198
+ actual = respond_to?(property) ? send(property) : nil
199
+
200
+ case operator
201
+ when '!=', '/='
202
+ actual.nil? || actual.to_s != value
203
+ when '^='
204
+ !actual.nil? && actual.to_s.match("^#{value}")
205
+ when '~='
206
+ !actual.nil? && actual.to_s.match(value)
207
+ when '<='
208
+ !actual.nil? && actual.to_i <= value.to_i
209
+ when '>='
210
+ !actual.nil? && actual.to_i >= value.to_i
211
+ else
212
+ !actual.nil? && actual.to_s == value
213
+ end
210
214
  end
211
215
  end
212
216
  end
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by Racc 1.4.8
3
+ # This file is automatically generated by Racc 1.4.9
4
4
  # from Racc grammer file "".
5
5
  #
6
6
 
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by Racc 1.4.8
3
+ # This file is automatically generated by Racc 1.4.9
4
4
  # from Racc grammer file "".
5
5
  #
6
6
 
@@ -19,8 +19,8 @@
19
19
  module BibTeX
20
20
  module Version
21
21
  MAJOR = 2
22
- MINOR = 2
23
- PATCH = 2
22
+ MINOR = 3
23
+ PATCH = 0
24
24
  BUILD = nil
25
25
 
26
26
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.').freeze
@@ -70,11 +70,11 @@ module BibTeX
70
70
  @string{ foo = "foobar" }
71
71
  @misc{flanagan-1,
72
72
  title={{Foo Bar}},
73
- author={Flanagan, Dav}
73
+ author={Flanagan, Dav and Thomas Segaran}
74
74
  }
75
75
  @misc{flanagan-2,
76
76
  title={{Foo Bar}},
77
- author={Flanagan, David}
77
+ author={Flanagan, David and Matsumoto, Yukihiro}
78
78
  }
79
79
  END
80
80
  end
@@ -95,7 +95,7 @@ module BibTeX
95
95
 
96
96
  describe '#extend_initials!' do
97
97
  it 'extends the initials of all names to the longest prototype' do
98
- assert_equal "Ruby, Sam Thomas, Dave Hansson Heinemeier, David Flanagan, David Matsumoto, Y. Segaran, T.",
98
+ assert_equal "Ruby, Sam Thomas, Dave Hansson Heinemeier, David Flanagan, David Matsumoto, Yukihiro Segaran, Thomas",
99
99
  @bib.extend_initials!.names.map(&:sort_order).uniq.join(' ')
100
100
  end
101
101
  end
@@ -170,6 +170,16 @@ module BibTeX
170
170
  assert_equal 2, @bib['@book'].length
171
171
  assert_equal 1, @bib['@article'].length
172
172
  assert_equal 0, @bib['@collection'].length
173
+ assert_equal 1, @bib['@string'].length
174
+ end
175
+
176
+ it 'supports queries by negated type string' do
177
+ assert_equal 4, @bib['!@book'].length
178
+ assert_equal 5, @bib['!@article'].length
179
+ assert_equal 6, @bib['!@collection'].length
180
+ assert_equal 1, @bib['!@*'].length
181
+ assert_equal 4, @bib['!@misc'].length
182
+ assert_equal 5, @bib['!@string'].length
173
183
  end
174
184
 
175
185
  it 'supports queries by type string and selector' do
@@ -199,6 +209,11 @@ module BibTeX
199
209
  assert_equal 1, @bib['@*[keywords~=rails]'].length
200
210
  end
201
211
 
212
+ it 'supports queries with attribute conditions' do
213
+ assert_equal 2, @bib['@*[keywords]'].length
214
+ assert_equal 0, @bib['@*[foobar]'].length
215
+ end
216
+
202
217
  it 'supports queries with start-pattern conditions' do
203
218
  assert_equal 2, @bib['@*[keywords^=ruby]'].length
204
219
  end
@@ -492,5 +492,36 @@ module BibTeX
492
492
  end
493
493
  end
494
494
 
495
+ describe '#meet?' do
496
+ before { @e = Entry.new }
497
+
498
+ it 'returns true for an empty condition list' do
499
+ assert @e.meet? []
500
+ assert @e.meet? ['']
501
+ end
502
+
503
+ it 'it returns true when all conditions hold' do
504
+ refute @e.meet? ['author = Edgar']
505
+
506
+ @e.author = 'Poe, Edgar A.'
507
+
508
+ refute @e.meet? ['author = Edgar']
509
+ refute @e.meet? ['author = Poe, Edgar']
510
+
511
+ assert @e.meet? ['author = Poe, Edgar A.']
512
+
513
+ assert @e.meet? ['author ^= Poe']
514
+ refute @e.meet? ['author ^= Edgar']
515
+
516
+ assert @e.meet? ['author ~= Edgar']
517
+
518
+ assert @e.meet? ['author ~= .']
519
+ assert @e.meet? ['author ~= [a-z]*']
520
+
521
+ assert @e.meet? ['author ^= P\w+']
522
+
523
+ end
524
+
525
+ end
495
526
  end
496
527
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bibtex-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
5
- prerelease:
4
+ version: 2.3.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Sylvester Keil
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-01-15 00:00:00.000000000 Z
11
+ date: 2013-04-06 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: latex-decode
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: multi_json
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -99,6 +94,7 @@ files:
99
94
  - features/step_definitions/name_steps.rb
100
95
  - features/strings.feature
101
96
  - features/support/env.rb
97
+ - lib/bibtex.rb
102
98
  - lib/bibtex/bibliography.rb
103
99
  - lib/bibtex/bibtex.y
104
100
  - lib/bibtex/compatibility.rb
@@ -106,9 +102,9 @@ files:
106
102
  - lib/bibtex/entry.rb
107
103
  - lib/bibtex/error.rb
108
104
  - lib/bibtex/extensions.rb
105
+ - lib/bibtex/filters.rb
109
106
  - lib/bibtex/filters/latex.rb
110
107
  - lib/bibtex/filters/linebreaks.rb
111
- - lib/bibtex/filters.rb
112
108
  - lib/bibtex/lexer.rb
113
109
  - lib/bibtex/name_parser.rb
114
110
  - lib/bibtex/names.rb
@@ -119,7 +115,6 @@ files:
119
115
  - lib/bibtex/utilities.rb
120
116
  - lib/bibtex/value.rb
121
117
  - lib/bibtex/version.rb
122
- - lib/bibtex.rb
123
118
  - test/benchmark.rb
124
119
  - test/bibtex/test_bibliography.rb
125
120
  - test/bibtex/test_elements.rb
@@ -150,33 +145,26 @@ files:
150
145
  homepage: http://inukshuk.github.com/bibtex-ruby
151
146
  licenses:
152
147
  - GPL-3
148
+ metadata: {}
153
149
  post_install_message:
154
150
  rdoc_options: []
155
151
  require_paths:
156
152
  - lib
157
153
  required_ruby_version: !ruby/object:Gem::Requirement
158
- none: false
159
154
  requirements:
160
155
  - - ! '>='
161
156
  - !ruby/object:Gem::Version
162
157
  version: '0'
163
- segments:
164
- - 0
165
- hash: -2827953330493505322
166
158
  required_rubygems_version: !ruby/object:Gem::Requirement
167
- none: false
168
159
  requirements:
169
160
  - - ! '>='
170
161
  - !ruby/object:Gem::Version
171
162
  version: '0'
172
- segments:
173
- - 0
174
- hash: -2827953330493505322
175
163
  requirements: []
176
164
  rubyforge_project:
177
- rubygems_version: 1.8.24
165
+ rubygems_version: 2.0.3
178
166
  signing_key:
179
- specification_version: 3
167
+ specification_version: 4
180
168
  summary: A BibTeX parser, converter and API for Ruby.
181
169
  test_files:
182
170
  - test/bibtex/test_bibliography.rb