bibtex-ruby 1.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bibtex-ruby might be problematic. Click here for more details.

@@ -0,0 +1,24 @@
1
+ require 'rubygems'
2
+ require 'bibtex'
3
+ require 'minitest/unit'
4
+ require 'minitest/autorun'
5
+
6
+ class TestComment < MiniTest::Unit::TestCase
7
+
8
+ def setup
9
+ end
10
+
11
+ def teardown
12
+ end
13
+
14
+ def test_explicit
15
+ bib = BibTeX::Bibliography.open('test/bib/05_comment.bib', :debug => true)
16
+ refute_nil(bib)
17
+ assert_equal(BibTeX::Bibliography, bib.class)
18
+ assert_equal(2, bib.data.length)
19
+ assert_equal([BibTeX::Comment], bib.data.map(&:class).uniq)
20
+ assert_equal(' A comment can contain pretty much anything ', bib.data[0].content)
21
+ assert_equal("\n@string{ foo = \"bar\" }\n\n@string{ bar = \"foo\" }\n", bib.data[1].content)
22
+ end
23
+
24
+ end
@@ -0,0 +1,35 @@
1
+ require 'rubygems'
2
+ require 'bibtex'
3
+ require 'minitest/unit'
4
+ require 'minitest/autorun'
5
+
6
+ class TestEntry < MiniTest::Unit::TestCase
7
+
8
+ def setup
9
+ end
10
+
11
+ def teardown
12
+ end
13
+
14
+ def test_simple
15
+ bib = BibTeX::Bibliography.open('test/bib/07_entry.bib', :debug => true)
16
+ refute_nil(bib)
17
+ assert_equal(BibTeX::Bibliography, bib.class)
18
+ assert_equal(3, bib.data.length)
19
+ assert_equal([BibTeX::Entry], bib.data.map(&:class).uniq)
20
+ assert_equal('key:0', bib.data[0].key)
21
+ assert_equal('key:1', bib.data[1].key)
22
+ assert_equal('foo', bib.data[2].key)
23
+ assert_equal(:book, bib.data[0].type)
24
+ assert_equal(:article, bib.data[1].type)
25
+ assert_equal(:article, bib.data[2].type)
26
+ assert_equal(['Poe, Edgar A.'], bib.data[0].fields[:author])
27
+ assert_equal(['Hawthorne, Nathaniel'], bib.data[1].fields[:author])
28
+ assert_equal(['2003'], bib.data[0].fields[:year])
29
+ assert_equal(['2001'], bib.data[1].fields[:year])
30
+ assert_equal(['American Library'], bib.data[0].fields[:publisher])
31
+ assert_equal(['American Library'], bib.data[1].fields[:publisher])
32
+ assert_equal(['Selected \\emph{Poetry} and `Tales\''], bib.data[0].fields[:title])
33
+ assert_equal(['Tales and Sketches'], bib.data[1].fields[:title])
34
+ end
35
+ end
@@ -0,0 +1,24 @@
1
+ require 'rubygems'
2
+ require 'bibtex'
3
+ require 'minitest/unit'
4
+ require 'minitest/autorun'
5
+
6
+ class TestPreamble < MiniTest::Unit::TestCase
7
+
8
+ def setup
9
+ end
10
+
11
+ def teardown
12
+ end
13
+
14
+ def test_simple
15
+ bib = BibTeX::Bibliography.open('test/bib/06_preamble.bib', :debug => true, :strict => false)
16
+ refute_nil(bib)
17
+ assert_equal(BibTeX::Bibliography, bib.class)
18
+ assert_equal(4, bib.data.length)
19
+ assert_equal([BibTeX::Preamble,BibTeX::String], bib.data.map(&:class).uniq)
20
+ assert_equal(["This bibliography was created \\today"], bib.data[0].value)
21
+ assert_equal(["Bib\\TeX"], bib.data[1].value)
22
+ assert_equal(["Maintained by ",:maintainer], bib.data[3].value)
23
+ end
24
+ end
@@ -0,0 +1,77 @@
1
+ require 'rubygems'
2
+ require 'bibtex'
3
+ require 'minitest/unit'
4
+ require 'minitest/autorun'
5
+
6
+ class TestString < MiniTest::Unit::TestCase
7
+
8
+ def setup
9
+ end
10
+
11
+ def teardown
12
+ end
13
+
14
+ def test_simple
15
+ bib = BibTeX::Bibliography.open('test/bib/02_string.bib', :debug => true)
16
+ refute_nil(bib)
17
+ assert(bib.kind_of? BibTeX::Bibliography)
18
+ refute(bib.empty?)
19
+ assert_equal(bib.data.length,1)
20
+ assert(bib.data.first.kind_of?(BibTeX::String))
21
+ assert_equal(bib.data.first.key, :foo)
22
+ assert_equal(bib.data.first.value, ['bar'])
23
+ end
24
+
25
+ def test_assignment
26
+ bib = BibTeX::Bibliography.open('test/bib/03_string.bib', :debug => true)
27
+ refute_nil(bib)
28
+ assert(bib.kind_of? BibTeX::Bibliography)
29
+ refute(bib.empty?)
30
+ assert_equal(bib.data.length,17)
31
+ assert_equal(bib.data.map(&:class).uniq, [BibTeX::String])
32
+ assert_equal(bib.data.map(&:key).uniq, [:foo])
33
+ (0..10).each { |i| assert_equal(bib.data[i].value, ['bar']) }
34
+ assert_equal(bib.data[11].value, ['\'bar\''])
35
+ assert_equal(bib.data[12].value, ['{"}bar{"}'])
36
+ assert_equal(bib.data[13].value, ['@bar@'])
37
+ assert_equal(bib.data[14].value, ['\'bar\''])
38
+ assert_equal(bib.data[15].value, ['{"}bar{"}'])
39
+ assert_equal(bib.data[16].value, ['{bar}'])
40
+ end
41
+
42
+ def test_replacement
43
+ bib = BibTeX::Bibliography.open('test/bib/04_string_replacement.bib', :debug => true)
44
+ refute_nil(bib)
45
+ assert(bib.kind_of?(BibTeX::Bibliography))
46
+ refute(bib.empty?)
47
+ assert_equal(7,bib.length)
48
+ assert_equal([BibTeX::String,BibTeX::Preamble,BibTeX::Entry], bib.data.map(&:class).uniq)
49
+ assert_equal(bib.strings[:foo], ['foo'])
50
+ assert_equal(bib.strings[:bar], ['bar'])
51
+ assert_equal(bib.strings[:foobar], [:foo,'bar'])
52
+ assert_equal(bib.strings[:foobarfoo], [:foobar,:foo])
53
+ assert_equal(bib.strings[:barfoobar], [:bar,'foo',:bar])
54
+ assert_equal(['foo',:foo,:foobarfoo,'bar'], bib.preamble[0].value)
55
+ assert_equal(['foo',:barfoobar], bib.entries['manual:1'][:title])
56
+
57
+ bib.replace_strings({ :include => [BibTeX::Preamble]})
58
+ assert_equal(bib.strings[:foo], ['foo'])
59
+ assert_equal(bib.strings[:bar], ['bar'])
60
+ assert_equal(bib.strings[:foobar], [:foo,'bar'])
61
+ assert_equal(bib.strings[:foobarfoo], [:foobar,:foo])
62
+ assert_equal(bib.strings[:barfoobar], [:bar,'foo',:bar])
63
+ assert_equal(['foo','foo',:foobar,:foo,'bar'], bib.preamble[0].value)
64
+ assert_equal(['foo',:barfoobar], bib.entries['manual:1'][:title])
65
+
66
+ bib.replace_strings({ :include => [BibTeX::String]})
67
+ assert_equal(bib.strings[:foobar], ['foo','bar'])
68
+ assert_equal(bib.strings[:foobarfoo], ['foo', 'bar','foo'])
69
+ assert_equal(bib.strings[:barfoobar], ['bar','foo','bar'])
70
+ assert_equal(['foo','foo',:foobar,:foo,'bar'], bib.preamble[0].value)
71
+ assert_equal(['foo',:barfoobar], bib.entries['manual:1'][:title])
72
+
73
+ bib.replace_strings({ :include => [BibTeX::Preamble,BibTeX::Entry]})
74
+ assert_equal(['foo','foo','foo','bar','foo','bar'], bib.preamble[0].value)
75
+ assert_equal(['foo','bar','foo','bar'], bib.entries['manual:1'][:title])
76
+ end
77
+ end
metadata ADDED
@@ -0,0 +1,155 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bibtex-ruby
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 0
9
+ version: 1.0.0
10
+ platform: ruby
11
+ authors:
12
+ - Sylvester Keil
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain:
16
+ - |
17
+ -----BEGIN CERTIFICATE-----
18
+ MIIDWDCCAkCgAwIBAgIBADANBgkqhkiG9w0BAQUFADBSMRIwEAYDVQQDDAlzeWx2
19
+ ZXN0ZXIxFDASBgoJkiaJk/IsZAEZFgRrZWlsMRIwEAYKCZImiZPyLGQBGRYCb3Ix
20
+ EjAQBgoJkiaJk/IsZAEZFgJhdDAeFw0xMTAxMTcyMjA0NTZaFw0xMjAxMTcyMjA0
21
+ NTZaMFIxEjAQBgNVBAMMCXN5bHZlc3RlcjEUMBIGCgmSJomT8ixkARkWBGtlaWwx
22
+ EjAQBgoJkiaJk/IsZAEZFgJvcjESMBAGCgmSJomT8ixkARkWAmF0MIIBIjANBgkq
23
+ hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuIMMSeXUwsC07Uh+tEh1IlK3hRFKtcr1
24
+ OLXPoZEuxr46Tdtic2JTGP6boGr8LkUZAo5EUU+K8lU3/Td0VdtmpBt920g1DX5a
25
+ WvzN9kIGHQY4NVHOy5sknbESDjkmJOWc6IHzjR14l3eLCD7HVK+P1G5xptyAJqEL
26
+ dLrj3cY17Gj2+6NtN4nul00SbaJL8pKzNDZzeUO0NM/DMmWpJbNQJAoNRDsmFofr
27
+ Kzy5aIBdr9bEhJ7CNVLdizECeLi3lV8IshC26sWnKGN2W2GN78rK6szL1wxLb2o1
28
+ OiPgk7Yv3KQHgi8+XgxRzDlMuMEKVY5Ko0E6cTF86LIJwI3oSQo50QIDAQABozkw
29
+ NzAJBgNVHRMEAjAAMB0GA1UdDgQWBBRRGnEGI1I2u2ndth2wBJJMcXZLHzALBgNV
30
+ HQ8EBAMCBLAwDQYJKoZIhvcNAQEFBQADggEBALTRbtbuZcCPfotZfxLjDhYKcxwH
31
+ kJf2ZplSIz3yCurOVMGXDKKyQGyBpP0fa+tVJlg5DRho6+PUK1jgpUXa0Y9TXG9M
32
+ 9lyXtFv2vU/x7qqJggqAdzRSjrd2nh1h1olnzkDmqifsfIme0hprJw4j0p10gjxD
33
+ eStgQaIJ+lTSkTZgKROs4gvqeG2TvWomXhTzt11tBR5vd/J4AuE3Exf2BkT7nf6S
34
+ c+3GE3GuUq6oef+pFfPxfyfWzqkmzX7eXZ8iu+ySUdoNWz6lnCrYtRup+23ZJZG5
35
+ J/FeJ8pSGMcNlQbhGpGIX+ARJK5ArG0Aq4214ttgefkdQJvw5r9hG3J4AgM=
36
+ -----END CERTIFICATE-----
37
+
38
+ date: 2011-01-18 00:00:00 +01:00
39
+ default_executable:
40
+ dependencies:
41
+ - !ruby/object:Gem::Dependency
42
+ name: racc
43
+ prerelease: false
44
+ requirement: &id001 !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ segments:
50
+ - 1
51
+ - 4
52
+ - 6
53
+ version: 1.4.6
54
+ type: :development
55
+ version_requirements: *id001
56
+ description: A (fairly complete) BibTeX parser written in Ruby
57
+ email: http://sylvester.keil.or.at
58
+ executables: []
59
+
60
+ extensions: []
61
+
62
+ extra_rdoc_files:
63
+ - LICENSE
64
+ - README.rdoc
65
+ - lib/bibtex.rb
66
+ - lib/bibtex/bibliography.rb
67
+ - lib/bibtex/bibtex.y
68
+ - lib/bibtex/elements.rb
69
+ - lib/bibtex/entry.rb
70
+ - lib/bibtex/error.rb
71
+ - lib/bibtex/lexer.rb
72
+ - lib/bibtex/parser.output
73
+ - lib/bibtex/parser.rb
74
+ - lib/bibtex/string_replacement.rb
75
+ - lib/extensions/core.rb
76
+ files:
77
+ - History.txt
78
+ - LICENSE
79
+ - Manifest
80
+ - README.rdoc
81
+ - Rakefile
82
+ - examples/bib2html.rb
83
+ - examples/markdown.bib
84
+ - lib/bibtex.rb
85
+ - lib/bibtex/bibliography.rb
86
+ - lib/bibtex/bibtex.y
87
+ - lib/bibtex/elements.rb
88
+ - lib/bibtex/entry.rb
89
+ - lib/bibtex/error.rb
90
+ - lib/bibtex/lexer.rb
91
+ - lib/bibtex/parser.output
92
+ - lib/bibtex/parser.rb
93
+ - lib/bibtex/string_replacement.rb
94
+ - lib/extensions/core.rb
95
+ - test/bib/00_empty.bib
96
+ - test/bib/01_no_bibtex.bib
97
+ - test/bib/02_string.bib
98
+ - test/bib/03_string.bib
99
+ - test/bib/04_string_replacement.bib
100
+ - test/bib/05_comment.bib
101
+ - test/bib/06_preamble.bib
102
+ - test/bib/07_entry.bib
103
+ - test/bib/08_decoret.bib
104
+ - test/bib/09_errors.bib
105
+ - test/bib/10_bibdesk.bib
106
+ - test/test_bibtex.rb
107
+ - test/test_comment.rb
108
+ - test/test_entry.rb
109
+ - test/test_preamble.rb
110
+ - test/test_string.rb
111
+ - bibtex-ruby.gemspec
112
+ has_rdoc: true
113
+ homepage: http://github.com/inukshuk/bibtex-ruby
114
+ licenses: []
115
+
116
+ post_install_message:
117
+ rdoc_options:
118
+ - --line-numbers
119
+ - --inline-source
120
+ - --title
121
+ - BibTeX-Ruby Documentation
122
+ - --main
123
+ - README.rdoc
124
+ require_paths:
125
+ - lib
126
+ required_ruby_version: !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ segments:
132
+ - 0
133
+ version: "0"
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ none: false
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ segments:
140
+ - 1
141
+ - 2
142
+ version: "1.2"
143
+ requirements: []
144
+
145
+ rubyforge_project: bibtex-ruby
146
+ rubygems_version: 1.3.7
147
+ signing_key:
148
+ specification_version: 3
149
+ summary: A BibTeX parser written in Ruby
150
+ test_files:
151
+ - test/test_bibtex.rb
152
+ - test/test_comment.rb
153
+ - test/test_entry.rb
154
+ - test/test_preamble.rb
155
+ - test/test_string.rb
Binary file