bibtex-ruby 3.0.0 → 3.0.1
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/Gemfile +1 -1
- data/History.txt +5 -0
- data/README.md +7 -5
- data/lib/bibtex/bibliography.rb +7 -2
- data/lib/bibtex/name_parser.rb +1 -1
- data/lib/bibtex/parser.rb +1 -1
- data/lib/bibtex/version.rb +1 -1
- data/test/bibtex/test_bibliography.rb +54 -0
- 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: ae103a8c9230f10e182351e8c51e2d221d346bec
|
4
|
+
data.tar.gz: 81648119699714f234735ba3734bb317ab44786c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a5367f8a072bf8bd4bc941159d4741b221716c452f1c7feef319990c7c9cf5b20f0dacaa996673199e1b138ead4a406955f313f9b04c60d5e3a5267ebafbd2c
|
7
|
+
data.tar.gz: 7d1c9b931e9a42ee05e577fea66b193b9858feff69ab36337c2664c57219abf9e082869c5571a91426f8b1bc3999e14c1964b58c39da651e5af7a7a865d6056c
|
data/Gemfile
CHANGED
data/History.txt
CHANGED
data/README.md
CHANGED
@@ -97,14 +97,16 @@ Save a bibliography to a file:
|
|
97
97
|
|
98
98
|
Compatibility
|
99
99
|
-------------
|
100
|
-
The BibTeX-Ruby gem has been developed and tested on Ruby 2.
|
101
|
-
|
102
|
-
|
103
|
-
been confirmed to work with JRuby, Rubinius, and REE, however, there have
|
104
|
-
been repeated [issues](https://github.com/inukshuk/bibtex-ruby/issues)
|
100
|
+
The BibTeX-Ruby gem has been developed and tested on Ruby 2.x, 1.9.3, and 1.8;
|
101
|
+
it has been confirmed to work with JRuby, Rubinius, and REE, however, there
|
102
|
+
have been repeated [issues](https://github.com/inukshuk/bibtex-ruby/issues)
|
105
103
|
(performance mostly) with MacRuby caused by MacRuby's current StringScanner
|
106
104
|
implementation.
|
107
105
|
|
106
|
+
Starting with BibTeX-Ruby version 3.0, support for Ruby versions 1.9.2 and
|
107
|
+
earlier has been dropped; most features will likely continue to work, but
|
108
|
+
compliance with old Rubies is not a priority going forward.
|
109
|
+
|
108
110
|
|
109
111
|
Documentation
|
110
112
|
-------------
|
data/lib/bibtex/bibliography.rb
CHANGED
@@ -377,8 +377,13 @@ module BibTeX
|
|
377
377
|
groups
|
378
378
|
end
|
379
379
|
|
380
|
-
def sort(*arguments, &block)
|
381
|
-
data.sort(*arguments, &block)
|
380
|
+
def sort!(*arguments, &block)
|
381
|
+
data.sort!(*arguments, &block)
|
382
|
+
self
|
383
|
+
end
|
384
|
+
|
385
|
+
def sort_by!(*arguments, &block)
|
386
|
+
data.sort_by!(*arguments, &block)
|
382
387
|
self
|
383
388
|
end
|
384
389
|
|
data/lib/bibtex/name_parser.rb
CHANGED
data/lib/bibtex/parser.rb
CHANGED
data/lib/bibtex/version.rb
CHANGED
@@ -329,6 +329,60 @@ module BibTeX
|
|
329
329
|
|
330
330
|
end
|
331
331
|
|
332
|
+
describe 'sorting' do
|
333
|
+
|
334
|
+
before do
|
335
|
+
@small_bib = BibTeX.parse <<-END
|
336
|
+
@book{flanagan2008,
|
337
|
+
title={{The ruby programming language}},
|
338
|
+
author={Flanagan, D. and Matsumoto, Y.},
|
339
|
+
keywords = {ruby},
|
340
|
+
year={2008},
|
341
|
+
publisher={O'Reilly}
|
342
|
+
}
|
343
|
+
@book{rails,
|
344
|
+
address = {Raleigh, North Carolina},
|
345
|
+
author = {Ruby, Sam, and Thomas, Dave, and Hansson Heinemeier, David},
|
346
|
+
booktitle = {Agile Web Development with Rails},
|
347
|
+
edition = {third},
|
348
|
+
keywords = {ruby, rails},
|
349
|
+
publisher = {The Pragmatic Bookshelf},
|
350
|
+
series = {The Facets of Ruby},
|
351
|
+
title = {Agile Web Development with Rails},
|
352
|
+
year = {2009}
|
353
|
+
}
|
354
|
+
@article{segaran2007,
|
355
|
+
title={{Programming collective intelligence}},
|
356
|
+
author={Segaran, T.},
|
357
|
+
year={2007},
|
358
|
+
publisher={O'Reilly}
|
359
|
+
}
|
360
|
+
END
|
361
|
+
end
|
362
|
+
|
363
|
+
it 'can be sorted destructively' do
|
364
|
+
@small_bib.sort!
|
365
|
+
@small_bib.map(&:key).must_equal [ 'segaran2007', 'flanagan2008', 'rails']
|
366
|
+
end
|
367
|
+
|
368
|
+
it 'can be sorted by field destructively' do
|
369
|
+
@small_bib.sort_by! { |e| -e[:year].to_i }
|
370
|
+
@small_bib.map(&:key).must_equal [ 'rails', 'flanagan2008', 'segaran2007' ]
|
371
|
+
end
|
372
|
+
|
373
|
+
it 'can be sorted non-destructively' do
|
374
|
+
sorted_entries = @small_bib.sort
|
375
|
+
sorted_entries.map(&:key).must_equal [ 'segaran2007', 'flanagan2008', 'rails']
|
376
|
+
@small_bib.map(&:key).must_equal [ 'flanagan2008', 'rails', 'segaran2007']
|
377
|
+
end
|
378
|
+
|
379
|
+
it 'can be sorted by field non-destructively' do
|
380
|
+
sorted_entries = @small_bib.sort_by { |e| -e[:year].to_i }
|
381
|
+
sorted_entries.map(&:key).must_equal [ 'rails', 'flanagan2008', 'segaran2007' ]
|
382
|
+
@small_bib.map(&:key).must_equal [ 'flanagan2008', 'rails', 'segaran2007']
|
383
|
+
end
|
384
|
+
end
|
385
|
+
|
332
386
|
describe 'LaTeX filter' do
|
333
387
|
before do
|
334
388
|
@bib['rails'].keywords = 'r\\"uby'
|
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: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvester Keil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: latex-decode
|
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
154
|
version: '0'
|
155
155
|
requirements: []
|
156
156
|
rubyforge_project:
|
157
|
-
rubygems_version: 2.0.
|
157
|
+
rubygems_version: 2.0.14
|
158
158
|
signing_key:
|
159
159
|
specification_version: 4
|
160
160
|
summary: A BibTeX parser, converter and API for Ruby.
|