bibtex-ruby 1.1.0 → 1.1.1
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.
- data.tar.gz.sig +0 -0
- data/History.txt +6 -1
- data/Manifest +10 -3
- data/README.md +223 -0
- data/Rakefile +64 -15
- data/lib/bibtex.rb +1 -3
- data/lib/bibtex/bibliography.rb +8 -2
- data/lib/bibtex/bibtex.y +129 -0
- data/lib/{extensions/core.rb → bibtex/version.rb} +5 -17
- data/test/bib/10_bibdesk.bib +6 -3
- data/test/test_export.rb +10 -0
- metadata +26 -20
- metadata.gz.sig +0 -0
- data/README.rdoc +0 -154
- data/bibtex-ruby.gemspec +0 -39
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
=== 1.1.1 / 2011-01-25
|
2
|
+
|
3
|
+
* Improved JSON and XML export.
|
4
|
+
* Added more examples to README.
|
5
|
+
|
1
6
|
=== 1.1.0 / 2011-01-24
|
2
7
|
|
3
8
|
* Improved YAML export.
|
@@ -8,4 +13,4 @@
|
|
8
13
|
|
9
14
|
=== 1.0.0 / 2011-01-17
|
10
15
|
|
11
|
-
* Initial Release. See README.
|
16
|
+
* Initial Release. See README.md for further details.
|
data/Manifest
CHANGED
@@ -1,13 +1,16 @@
|
|
1
1
|
History.txt
|
2
2
|
LICENSE
|
3
3
|
Manifest
|
4
|
-
README.
|
4
|
+
README.md
|
5
5
|
Rakefile
|
6
|
+
examples
|
6
7
|
examples/bib2html.rb
|
7
8
|
examples/bib2yaml.rb
|
8
9
|
examples/markdown.bib
|
9
|
-
lib
|
10
|
+
lib
|
11
|
+
lib/bibtex
|
10
12
|
lib/bibtex/bibliography.rb
|
13
|
+
lib/bibtex/bibtex.y
|
11
14
|
lib/bibtex/elements.rb
|
12
15
|
lib/bibtex/entry.rb
|
13
16
|
lib/bibtex/error.rb
|
@@ -15,6 +18,10 @@ lib/bibtex/lexer.rb
|
|
15
18
|
lib/bibtex/parser.output
|
16
19
|
lib/bibtex/parser.rb
|
17
20
|
lib/bibtex/string_replacement.rb
|
21
|
+
lib/bibtex/version.rb
|
22
|
+
lib/bibtex.rb
|
23
|
+
test
|
24
|
+
test/bib
|
18
25
|
test/bib/00_empty.bib
|
19
26
|
test/bib/01_no_bibtex.bib
|
20
27
|
test/bib/02_string.bib
|
@@ -31,4 +38,4 @@ test/test_comment.rb
|
|
31
38
|
test/test_entry.rb
|
32
39
|
test/test_export.rb
|
33
40
|
test/test_preamble.rb
|
34
|
-
test/test_string.rb
|
41
|
+
test/test_string.rb
|
data/README.md
ADDED
@@ -0,0 +1,223 @@
|
|
1
|
+
BibTeX-Ruby
|
2
|
+
===========
|
3
|
+
|
4
|
+
The BibTeX-Ruby package contains a parser for BibTeX
|
5
|
+
bibliography files and a class structure to manage BibTeX objects in
|
6
|
+
Ruby. It is designed to support all BibTeX objects (including @comment,
|
7
|
+
string-replacements via @string, as well as string concatenation using '#')
|
8
|
+
and handles all content outside of BibTeX objects as 'meta comments' which may
|
9
|
+
be included in post-processing.
|
10
|
+
|
11
|
+
|
12
|
+
Quickstart
|
13
|
+
----------
|
14
|
+
|
15
|
+
$ irb
|
16
|
+
> require 'bibtex'
|
17
|
+
=> true
|
18
|
+
> bib = BibTeX::Bibliography.open('./ruby.bib')
|
19
|
+
=> book{pickaxe,
|
20
|
+
address {Raleigh, North Carolina},
|
21
|
+
author {Thomas, Dave, and Fowler, Chad, and Hunt, Andy},
|
22
|
+
date-added {2010-08-05 09:54:07 0200},
|
23
|
+
date-modified {2010-08-05 10:07:01 0200},
|
24
|
+
keywords {ruby},
|
25
|
+
publisher {The Pragmatic Bookshelf},
|
26
|
+
series {The Facets of Ruby},
|
27
|
+
title {Programming Ruby 1.9: The Pragmatic Programmers Guide},
|
28
|
+
year {2009}
|
29
|
+
}
|
30
|
+
> bib[:pickaxe][:author]
|
31
|
+
=> ["Thomas, Dave, and Fowler, Chad, and Hunt, Andy"]
|
32
|
+
|
33
|
+
|
34
|
+
Installation
|
35
|
+
------------
|
36
|
+
|
37
|
+
If you just want to use it:
|
38
|
+
|
39
|
+
$ [sudo] gem install bibtex-ruby
|
40
|
+
|
41
|
+
If you want to work with the sources:
|
42
|
+
|
43
|
+
$ [sudo] gem install racc
|
44
|
+
$ git clone http://github.com/inukshuk/bibtex-ruby.git
|
45
|
+
$ cd bibtex-ruby
|
46
|
+
$ rake racc
|
47
|
+
$ rake rdoc
|
48
|
+
$ rake test
|
49
|
+
|
50
|
+
Or, alternatively, fork the [project on github](http://github.com/inukshuk/bibtex-ruby.git).
|
51
|
+
|
52
|
+
|
53
|
+
Requirements
|
54
|
+
------------
|
55
|
+
|
56
|
+
* The parser generator [racc](http://i.loveruby.net/en/projects/racc/) is required to generate parser.
|
57
|
+
* The minitest gem is required to run the tests in older Ruby versions (prior to 1.9).
|
58
|
+
* The json gem is required on older ruby versions for JSON export.
|
59
|
+
|
60
|
+
|
61
|
+
Usage
|
62
|
+
-----
|
63
|
+
|
64
|
+
It is very easy to use BibTeX-Ruby. You can use the class method `BibTeX::Bibliography.open`
|
65
|
+
to open a '.bib' file. Normally, BibTeX-Ruby will discard all content outside of
|
66
|
+
regular BibTeX elements; however, if you wish to include everything, simply add
|
67
|
+
`:include => [:meta_comments]` to your invocation of `BibTeX::Bibliography.open`.
|
68
|
+
|
69
|
+
Once BibTeX-Ruby has parsed your '.bib' file, you can easily access individual entries.
|
70
|
+
For example, if your bibliography object `bib` contained the following entry:
|
71
|
+
|
72
|
+
@book{pickaxe,
|
73
|
+
address = {Raleigh, North Carolina},
|
74
|
+
author = {Thomas, Dave, and Fowler, Chad, and Hunt, Andy},
|
75
|
+
date-added = {2010-08-05 09:54:07 +0200},
|
76
|
+
date-modified = {2010-08-05 10:07:01 +0200},
|
77
|
+
keywords = {ruby},
|
78
|
+
publisher = {The Pragmatic Bookshelf},
|
79
|
+
series = {The Facets of Ruby},
|
80
|
+
title = {Programming Ruby 1.9: The Pragmatic Programmer's Guide},
|
81
|
+
year = {2009}
|
82
|
+
}
|
83
|
+
|
84
|
+
You could easily access it, using the entry's key, 'pickaxe', like so: `bib[:pickaxe]`;
|
85
|
+
you also have easy access to individual fields, for example: `bib[:pickaxe](:author)`.
|
86
|
+
|
87
|
+
If your bibliography contains BibTeX @string objects, you can let BibTeX-Ruby
|
88
|
+
replace the strings for you. You have access to a bibliography's strings via
|
89
|
+
`BibTeX::Bibliography#strings` and you can replace the strings of an entry using
|
90
|
+
the `BibTeX::Entry#replace!` method. Thus, to replace all strings defined in your
|
91
|
+
bibliography object `bib` your could use this code:
|
92
|
+
|
93
|
+
bib.entries.each do |entry|
|
94
|
+
entry.replace!(bib.strings)
|
95
|
+
end
|
96
|
+
|
97
|
+
Furthermore, BibTeX-Ruby allows you to export your bibliography for processing
|
98
|
+
by other tools. Currently supported formats include YAML, JSON, and XML.
|
99
|
+
Of course, you can also export your bibliography back to BibTeX; if you include
|
100
|
+
`:meta_comments', your export should be identical to the original '.bib' file,
|
101
|
+
except for whitespace, blank lines and letter case (BibTeX-Ruby will downcase
|
102
|
+
all keys).
|
103
|
+
|
104
|
+
In order to export your bibliography use `#to_s`, `#to_yaml`, `#to_json`, or
|
105
|
+
`#to_xml`, respectively.
|
106
|
+
|
107
|
+
Look at the 'examples' directory for a simple BibTeX to YAML and BibTeX to HTML converter.
|
108
|
+
|
109
|
+
|
110
|
+
The Parser
|
111
|
+
----------
|
112
|
+
|
113
|
+
The BibTeX-Ruby parser is generated using the wonderful
|
114
|
+
[racc](http://i.loveruby.net/en/projects/racc/) parser generator.
|
115
|
+
|
116
|
+
|
117
|
+
The BibTeX Format
|
118
|
+
_________________
|
119
|
+
|
120
|
+
At first glance, the BibTeX file format seems very clear and simple;
|
121
|
+
however, there are a number of peculiarities which warrant some
|
122
|
+
explanation. The best place to start reading is probably at [your closest
|
123
|
+
ctan server](http://www.ctan.org/get/biblio/bibtex/) where
|
124
|
+
the original `bibtex` from 1988 still lives. Additionally, Xavier Decoret
|
125
|
+
has written
|
126
|
+
[a great summary](http://artis.imag.fr/~Xavier.Decoret/resources/xdkbibtex/bibtex_summary.html)
|
127
|
+
of the format; another invaluable source of information is [Nicolas Markey's
|
128
|
+
website](http://www.lsv.ens-cachan.fr/~markey/bibla.php). Unfortunately,
|
129
|
+
even after consulting these documents, a number of issues remain.
|
130
|
+
Therefore, it is the purpose of this section to deliver the rationale
|
131
|
+
that went into some of the design decision in BibTeX-Ruby.
|
132
|
+
|
133
|
+
A BibTeX bibliography is typically stored in a file with the file
|
134
|
+
extension '.bib'. This file may contain any number of BibTeX objects;
|
135
|
+
everything that is not a BibTeX object is assumed to be a comment and
|
136
|
+
ignored.
|
137
|
+
|
138
|
+
The individual objects are discussed in further detail below. First, however, a
|
139
|
+
number of general remarks:
|
140
|
+
|
141
|
+
* BibTeX-Ruby begins in comment-mode, treating all text it encounters as comments.
|
142
|
+
Normally these comments are ignored; however, if you wish the parser to include
|
143
|
+
them, you can do so by adding the symbol `:meta_comments`` to the `:include`` array
|
144
|
+
in the parser's options.
|
145
|
+
* Note that string literals in BibTeX are either contained in quotes or braces;
|
146
|
+
nested quotes in a quoted literal are not escaped with a usual backslash but
|
147
|
+
must be placed inside braces. Nested braces must be balanced in literals, regardless
|
148
|
+
of whether they are surrounded by quotes or braces.
|
149
|
+
* Quoted strings and string constants (which are defined by @string objects) can be
|
150
|
+
concatted by the '#' symbol. String literals in braces can not be concatted in
|
151
|
+
this way.
|
152
|
+
* The '@' symbol may only occur in quoted string literals (not in braced out literals)
|
153
|
+
in the original BibTeX; note, however, that this is not true for BibTeX-Ruby (i.e.,
|
154
|
+
it will parse any string containing an '@').
|
155
|
+
|
156
|
+
### @comment
|
157
|
+
|
158
|
+
|
159
|
+
The purpose of the @comment object is not entirely clear, because everything
|
160
|
+
outside of an object is treated as a comment anyway. Nicolas Markay argues that
|
161
|
+
a @comment makes it possible to quickly comment out a number of consecutive
|
162
|
+
objects; however, as Xavier Decoret points out that this does not work with the
|
163
|
+
original `bibtex' program (following a @comment, it simply ignores everything
|
164
|
+
until the end of the line). Indeed, on page 13 of [the original
|
165
|
+
documentation](http://www.ctan.org/get/biblio/bibtex/contrib/doc/btxdoc.pdf),
|
166
|
+
Oren Patashnik explains that @comment objects are not really necessary; they
|
167
|
+
exist only for _Scribe_ system compatibility.
|
168
|
+
|
169
|
+
Because they would be useless otherwise, BibTeX-Ruby treats @comment objects
|
170
|
+
as Nicolas Markay describes them: thus, everything inside a @comment is treated
|
171
|
+
as a comment and is ignored -- everything,
|
172
|
+
that is, until the object is closed. For this reason, BibTeX-Ruby assumes that
|
173
|
+
braces inside a @comment are balanced! Obviously, BibTeX-Ruby differs from
|
174
|
+
`bibtex` in that respect; though, the gain is, that it is now possible to
|
175
|
+
comment out a sequence of entries, without removing their respective '@' symbols.
|
176
|
+
|
177
|
+
### @string
|
178
|
+
|
179
|
+
The @string object defines a single string constant (for multiple constant
|
180
|
+
assignments, it is necessary to define separate @string objects). These
|
181
|
+
constants can be used within string assignments in other @string or @preamble
|
182
|
+
objects, as well as in regular BibTeX entries. For example, this is a valid constant
|
183
|
+
definition and usage:
|
184
|
+
|
185
|
+
@string{ generator = "BibTeX-Ruby"}
|
186
|
+
@preamble{ "This bibliography was generated by " # generator }
|
187
|
+
|
188
|
+
|
189
|
+
### @preamble
|
190
|
+
|
191
|
+
Typically, the purpose of @preamble objects is to define LaTeX statements, which
|
192
|
+
will be put into the '.bbl' file by `bibtex`. A @preamble object may contain
|
193
|
+
a single string literal, a single string constant (defined by a @string object), or
|
194
|
+
a concatenation of literals and constants.
|
195
|
+
|
196
|
+
### Entries
|
197
|
+
|
198
|
+
These represent proper BibTeX objects (e.g., @book, @collection, etc.).
|
199
|
+
|
200
|
+
|
201
|
+
Credits
|
202
|
+
-------
|
203
|
+
|
204
|
+
The BibTeX-Ruby package was written by [Sylvester Keil](http://sylvester.keil.or.at/).
|
205
|
+
|
206
|
+
License
|
207
|
+
-------
|
208
|
+
|
209
|
+
BibTeX-Ruby
|
210
|
+
Copyright (C) 2010-2011 [Sylvester Keil](http://sylvester.keil.or.at)
|
211
|
+
|
212
|
+
This program is free software: you can redistribute it and/or modify
|
213
|
+
it under the terms of the GNU General Public License as published by
|
214
|
+
the Free Software Foundation, either version 3 of the License, or
|
215
|
+
(at your option) any later version.
|
216
|
+
|
217
|
+
This program is distributed in the hope that it will be useful,
|
218
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
219
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
220
|
+
GNU General Public License for more details.
|
221
|
+
|
222
|
+
You should have received a copy of the GNU General Public License
|
223
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
data/Rakefile
CHANGED
@@ -3,26 +3,65 @@
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'rake'
|
5
5
|
require 'rake/clean'
|
6
|
-
require 'rake/rdoctask'
|
7
6
|
require 'rake/testtask'
|
8
|
-
require '
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
7
|
+
require 'rake/rdoctask'
|
8
|
+
require 'rake/gempackagetask'
|
9
|
+
|
10
|
+
require './lib/bibtex/version.rb'
|
11
|
+
|
12
|
+
|
13
|
+
spec = Gem::Specification.new do |s|
|
14
|
+
s.platform = Gem::Platform::RUBY
|
15
|
+
s.name = 'bibtex-ruby'
|
16
|
+
s.rubyforge_project = s.name
|
17
|
+
s.version = BibTeX::Version::STRING
|
18
|
+
s.summary = "A BibTeX parser written in Ruby"
|
19
|
+
s.description = "A (fairly complete) BibTeX parser written in Ruby. Supports regular BibTeX entries, @comments, string replacement via @string, and simple export formats (e.g. YAML)."
|
20
|
+
s.homepage = 'http://github.com/inukshuk/bibtex-ruby'
|
21
|
+
s.authors = ["Sylvester Keil"]
|
22
|
+
s.email = 'http://sylvester.keil.or.at'
|
23
|
+
s.cert_chain = ["/Users/sylvester/.gem/keys/gem-public_cert.pem"]
|
24
|
+
s.signing_key = '/Users/sylvester/.gem/keys/gem-private_key.pem'
|
25
|
+
s.has_rdoc = true
|
26
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "BibTeX-Ruby Documentation", "--main", "README.rdoc"]
|
27
|
+
s.extra_rdoc_files = ["README.md"]
|
28
|
+
s.files = File.open('Manifest').readlines.map(&:chomp)
|
29
|
+
s.test_files = FileList['test/test*.rb']
|
30
|
+
s.require_paths = ["lib"]
|
31
|
+
s.date = Time.now
|
32
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
33
|
+
|
34
|
+
if s.respond_to? :specification_version then
|
35
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
36
|
+
s.specification_version = 3
|
37
|
+
|
38
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
39
|
+
s.add_development_dependency('racc', [">= 1.4.6"])
|
40
|
+
s.add_development_dependency('minitest', [">= 2.0.2"])
|
41
|
+
s.add_development_dependency('json', [">= 1.5.0"])
|
42
|
+
else
|
43
|
+
s.add_dependency('racc', [">= 1.4.6"])
|
44
|
+
s.add_dependency('minitest', [">= 2.0.2"])
|
45
|
+
s.add_dependency('json', [">= 1.5.0"])
|
46
|
+
end
|
47
|
+
else
|
48
|
+
s.add_dependency('racc', [">= 1.4.6"])
|
49
|
+
s.add_dependency('minitest', [">= 2.0.2"])
|
50
|
+
s.add_dependency('json', [">= 1.5.0"])
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
56
|
+
pkg.need_zip = true
|
57
|
+
pkg.need_tar = true
|
58
|
+
pkg.package_dir = 'build'
|
20
59
|
end
|
21
60
|
|
22
61
|
Rake::RDocTask.new(:rdoc_task) do |rd|
|
23
|
-
rd.main = 'README.
|
62
|
+
rd.main = 'README.md'
|
24
63
|
rd.title = "BibTeX-Ruby Documentation"
|
25
|
-
rd.rdoc_files.include('README.
|
64
|
+
rd.rdoc_files.include('README.md',"lib/**/*.rb")
|
26
65
|
rd.rdoc_dir = "doc/html"
|
27
66
|
rd.options << '--webcvs=http://github.com/inukshuk/bibtex-ruby/tree/master/'
|
28
67
|
end
|
@@ -43,13 +82,23 @@ task :rdoc => ['clean','racc','rdoc_task']
|
|
43
82
|
|
44
83
|
task :test => ['racc','test_task']
|
45
84
|
|
85
|
+
file 'lib/bibtex/parser.output' => ['lib/bibtex/parser.rb']
|
46
86
|
file 'lib/bibtex/parser.rb' => ['lib/bibtex/bibtex.y'] do
|
47
87
|
sh 'racc -v -g -o lib/bibtex/parser.rb lib/bibtex/bibtex.y'
|
48
88
|
end
|
49
89
|
|
90
|
+
desc 'Updates the Manifest file'
|
91
|
+
task :manifest => ['clean', 'racc'] do
|
92
|
+
m = File.open('Manifest', 'w')
|
93
|
+
m.print FileList['**/*'].join("\n")
|
94
|
+
m.close
|
95
|
+
end
|
96
|
+
|
97
|
+
|
50
98
|
CLEAN.include('lib/bibtex/parser.rb')
|
51
99
|
CLEAN.include('lib/bibtex/parser.output')
|
52
100
|
CLEAN.include('doc/html')
|
101
|
+
CLEAN.include('build')
|
53
102
|
|
54
103
|
|
55
104
|
# vim: syntax=ruby
|
data/lib/bibtex.rb
CHANGED
@@ -32,11 +32,9 @@ $:.unshift(File.dirname(__FILE__)) unless
|
|
32
32
|
# License:: GNU GPL 3.0
|
33
33
|
#
|
34
34
|
module BibTeX
|
35
|
+
require 'bibtex/version'
|
35
36
|
require 'logger'
|
36
37
|
|
37
|
-
# The current library version.
|
38
|
-
VERSION = '1.1.0'
|
39
|
-
|
40
38
|
#
|
41
39
|
# An instance of the Ruby core class +Logger+.
|
42
40
|
# Used for logging by BibTeX-Ruby.
|
data/lib/bibtex/bibliography.rb
CHANGED
@@ -153,12 +153,18 @@ module BibTeX
|
|
153
153
|
def to_yaml
|
154
154
|
@entries.values.map(&:to_hash).to_yaml
|
155
155
|
end
|
156
|
-
|
156
|
+
|
157
|
+
# Returns a JSON representation of the bibliography. Only BibTeX entries are exported.
|
158
|
+
def to_json
|
159
|
+
@entries.values.map(&:to_hash).to_json
|
160
|
+
end
|
161
|
+
|
162
|
+
# Returns an XML representation of the bibliography. Only BibTeX entries are exported.
|
157
163
|
def to_xml
|
158
164
|
xml = REXML::Document.new
|
159
165
|
xml << REXML::XMLDecl.new('1.0','UTF-8')
|
160
166
|
root = REXML::Element.new('bibliography')
|
161
|
-
@
|
167
|
+
@entries.values.each { |e| root.add_element(e.to_xml) }
|
162
168
|
xml << root
|
163
169
|
xml
|
164
170
|
end
|
data/lib/bibtex/bibtex.y
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
#--
|
2
|
+
# BibTeX-Ruby
|
3
|
+
# Copyright (C) 2010 Sylvester Keil <http://sylvester.keil.or.at>
|
4
|
+
#
|
5
|
+
# This program is free software: you can redistribute it and/or modify
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
8
|
+
# (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This program is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License
|
16
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
#++
|
18
|
+
#
|
19
|
+
# A BibTeX grammar for the parser generator +racc+
|
20
|
+
#
|
21
|
+
|
22
|
+
# -*- racc -*-
|
23
|
+
|
24
|
+
class BibTeX::Parser
|
25
|
+
|
26
|
+
token AT COMMA COMMENT CONTENT ERROR EQ LBRACE META_COMMENT
|
27
|
+
NAME NUMBER PREAMBLE RBRACE SHARP STRING STRING_LITERAL
|
28
|
+
|
29
|
+
expect 0
|
30
|
+
|
31
|
+
rule
|
32
|
+
|
33
|
+
bibliography : /* empty */ { result = Bibliography.new }
|
34
|
+
| objects { result = val[0] }
|
35
|
+
|
36
|
+
objects : object { result = Bibliography.new << val[0] }
|
37
|
+
| objects object { result << val[1] }
|
38
|
+
|
39
|
+
object : AT at_object { result = val[1] }
|
40
|
+
| META_COMMENT { result = BibTeX::MetaComment.new(val[0]) }
|
41
|
+
| ERROR { result = BibTeX::Error.new(val[0]) }
|
42
|
+
|
43
|
+
at_object : comment { result = val[0] }
|
44
|
+
| string { result = val[0] }
|
45
|
+
| preamble { result = val[0] }
|
46
|
+
| entry { result = val[0] }
|
47
|
+
|
48
|
+
comment : COMMENT LBRACE content RBRACE { result = BibTeX::Comment.new(val[2]) }
|
49
|
+
|
50
|
+
content : /* empty */ { result = '' }
|
51
|
+
| CONTENT { result = val[0] }
|
52
|
+
|
53
|
+
preamble : PREAMBLE LBRACE string_value RBRACE { result = BibTeX::Preamble.new(val[2]) }
|
54
|
+
|
55
|
+
string : STRING LBRACE string_assignment RBRACE { result = BibTeX::String.new(val[2][0],val[2][1]); }
|
56
|
+
|
57
|
+
string_assignment : NAME EQ string_value { result = [val[0].downcase.to_sym, val[2]] }
|
58
|
+
|
59
|
+
string_value : string_literal { result = [val[0]] }
|
60
|
+
| string_value SHARP string_literal { result << val[2] }
|
61
|
+
|
62
|
+
string_literal : NAME { result = val[0].downcase.to_sym }
|
63
|
+
| STRING_LITERAL { result = val[0] }
|
64
|
+
|
65
|
+
entry : entry_head assignments RBRACE { result = val[0] << val[1] }
|
66
|
+
| entry_head assignments COMMA RBRACE { result = val[0] << val[1] }
|
67
|
+
| entry_head RBRACE { result = val[0] }
|
68
|
+
|
69
|
+
entry_head : NAME LBRACE key COMMA { result = BibTeX::Entry.new(val[0].downcase.to_sym,val[2]) }
|
70
|
+
|
71
|
+
key : NAME { result = val[0] }
|
72
|
+
| NUMBER { result = val[0] }
|
73
|
+
|
74
|
+
assignments : assignment { result = val[0] }
|
75
|
+
| assignments COMMA assignment { result.merge!(val[2]) }
|
76
|
+
|
77
|
+
assignment : NAME EQ value { result = { val[0].downcase.to_sym => val[2] } }
|
78
|
+
|
79
|
+
value : string_value { result = val[0] }
|
80
|
+
| NUMBER { result = val[0] }
|
81
|
+
| LBRACE content RBRACE { result = val[1] }
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
---- header
|
86
|
+
require 'bibtex/lexer'
|
87
|
+
|
88
|
+
---- inner
|
89
|
+
|
90
|
+
attr_reader :lexer
|
91
|
+
|
92
|
+
def initialize(options={})
|
93
|
+
@options = options
|
94
|
+
@options[:include] ||= [:errors]
|
95
|
+
@lexer = Lexer.new(options)
|
96
|
+
end
|
97
|
+
|
98
|
+
def parse(input)
|
99
|
+
@yydebug = self.debug?
|
100
|
+
|
101
|
+
self.lexer.src = input
|
102
|
+
self.lexer.analyse
|
103
|
+
|
104
|
+
do_parse
|
105
|
+
end
|
106
|
+
|
107
|
+
def next_token
|
108
|
+
token = self.lexer.next_token
|
109
|
+
if token[0] == :ERROR
|
110
|
+
self.include_errors? ? token : next_token
|
111
|
+
else
|
112
|
+
[token[0],token[1][0]]
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def debug?
|
117
|
+
@options[:debug] == true || ENV['DEBUG'] == true
|
118
|
+
end
|
119
|
+
|
120
|
+
def include_errors?
|
121
|
+
@options[:include].include?(:errors)
|
122
|
+
end
|
123
|
+
|
124
|
+
def on_error(tid, val, vstack)
|
125
|
+
#raise(ParseError, "Failed to parse BibTeX on value %s (%s) %s" % [val.inspect, token_to_str(tid) || '?', vstack.inspect])
|
126
|
+
Log.error("Failed to parse BibTeX on value %s (%s) %s" % [val.inspect, token_to_str(tid) || '?', vstack.inspect])
|
127
|
+
end
|
128
|
+
|
129
|
+
# -*- racc -*-
|
@@ -1,5 +1,6 @@
|
|
1
|
+
#--
|
1
2
|
# BibTeX-Ruby
|
2
|
-
# Copyright (C) 2010-2011 Sylvester Keil <
|
3
|
+
# Copyright (C) 2010-2011 Sylvester Keil <sylvester.keil.or.at>
|
3
4
|
#
|
4
5
|
# This program is free software: you can redistribute it and/or modify
|
5
6
|
# it under the terms of the GNU General Public License as published by
|
@@ -15,21 +16,8 @@
|
|
15
16
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
17
|
#++
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
class StringScanner
|
23
|
-
|
24
|
-
alias orig_scan_until scan_until
|
25
|
-
|
26
|
-
def pre_match_offset(offset)
|
27
|
-
self.pre_match[offset..-1]
|
28
|
-
end
|
29
|
-
|
30
|
-
# Like the original +scan_until+ but sets the start of `pre_match' to the
|
31
|
-
# current position not to zero
|
32
|
-
def scan_until(pattern)
|
33
|
-
|
19
|
+
module BibTeX
|
20
|
+
module Version
|
21
|
+
STRING = '1.1.1'
|
34
22
|
end
|
35
23
|
end
|
data/test/bib/10_bibdesk.bib
CHANGED
@@ -21,7 +21,8 @@
|
|
21
21
|
Publisher = {The Pragmatic Bookshelf},
|
22
22
|
Series = {The Facets of Ruby},
|
23
23
|
Title = {Agile Web Development with Rails},
|
24
|
-
Year = {2009}
|
24
|
+
Year = {2009}
|
25
|
+
}
|
25
26
|
|
26
27
|
@book{dragon,
|
27
28
|
Address = {Boston},
|
@@ -33,7 +34,8 @@
|
|
33
34
|
Keywords = {compiler, lex, yacc},
|
34
35
|
Publisher = {Addison Wesley},
|
35
36
|
Title = {Compilers: Principles, Techniques, and Tools},
|
36
|
-
Year = {2007}
|
37
|
+
Year = {2007}
|
38
|
+
}
|
37
39
|
|
38
40
|
@book{pickaxe,
|
39
41
|
Address = {Raleigh, North Carolina},
|
@@ -44,4 +46,5 @@
|
|
44
46
|
Publisher = {The Pragmatic Bookshelf},
|
45
47
|
Series = {The Facets of Ruby},
|
46
48
|
Title = {Programming Ruby 1.9: The Pragmatic Programmer's Guide},
|
47
|
-
Year = {2009}
|
49
|
+
Year = {2009}
|
50
|
+
}
|
data/test/test_export.rb
CHANGED
@@ -3,6 +3,7 @@ require 'rubygems'
|
|
3
3
|
require 'minitest/unit'
|
4
4
|
require 'minitest/autorun'
|
5
5
|
require 'yaml'
|
6
|
+
require 'json'
|
6
7
|
|
7
8
|
class TestString < MiniTest::Unit::TestCase
|
8
9
|
|
@@ -20,4 +21,13 @@ class TestString < MiniTest::Unit::TestCase
|
|
20
21
|
assert_equal(['dragon', 'pickaxe', 'rails'], yaml.map { |y| y['key'] }.sort)
|
21
22
|
assert_equal('{The Facets of Ruby}', yaml[0]['series'])
|
22
23
|
end
|
24
|
+
|
25
|
+
def test_json
|
26
|
+
bib = BibTeX::Bibliography.open('test/bib/10_bibdesk.bib', :debug => true)
|
27
|
+
json = JSON.parse(bib.to_json)
|
28
|
+
refute_nil(json)
|
29
|
+
assert_equal(3, json.length)
|
30
|
+
assert_equal(['dragon', 'pickaxe', 'rails'], json.map { |y| y['key'] }.sort)
|
31
|
+
assert_equal('{The Facets of Ruby}', json[0]['series'])
|
32
|
+
end
|
23
33
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 1.1.
|
8
|
+
- 1
|
9
|
+
version: 1.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Sylvester Keil
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
J/FeJ8pSGMcNlQbhGpGIX+ARJK5ArG0Aq4214ttgefkdQJvw5r9hG3J4AgM=
|
36
36
|
-----END CERTIFICATE-----
|
37
37
|
|
38
|
-
date: 2011-01-
|
38
|
+
date: 2011-01-25 00:00:00 +01:00
|
39
39
|
default_executable:
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
@@ -62,10 +62,27 @@ dependencies:
|
|
62
62
|
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
segments:
|
65
|
+
- 2
|
65
66
|
- 0
|
66
|
-
|
67
|
+
- 2
|
68
|
+
version: 2.0.2
|
67
69
|
type: :development
|
68
70
|
version_requirements: *id002
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: json
|
73
|
+
prerelease: false
|
74
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
segments:
|
80
|
+
- 1
|
81
|
+
- 5
|
82
|
+
- 0
|
83
|
+
version: 1.5.0
|
84
|
+
type: :development
|
85
|
+
version_requirements: *id003
|
69
86
|
description: A (fairly complete) BibTeX parser written in Ruby. Supports regular BibTeX entries, @comments, string replacement via @string, and simple export formats (e.g. YAML).
|
70
87
|
email: http://sylvester.keil.or.at
|
71
88
|
executables: []
|
@@ -73,30 +90,18 @@ executables: []
|
|
73
90
|
extensions: []
|
74
91
|
|
75
92
|
extra_rdoc_files:
|
76
|
-
-
|
77
|
-
- README.rdoc
|
78
|
-
- lib/bibtex.rb
|
79
|
-
- lib/bibtex/bibliography.rb
|
80
|
-
- lib/bibtex/elements.rb
|
81
|
-
- lib/bibtex/entry.rb
|
82
|
-
- lib/bibtex/error.rb
|
83
|
-
- lib/bibtex/lexer.rb
|
84
|
-
- lib/bibtex/parser.output
|
85
|
-
- lib/bibtex/parser.rb
|
86
|
-
- lib/bibtex/string_replacement.rb
|
87
|
-
- lib/extensions/core.rb
|
93
|
+
- README.md
|
88
94
|
files:
|
89
95
|
- History.txt
|
90
96
|
- LICENSE
|
91
97
|
- Manifest
|
92
|
-
- README.
|
98
|
+
- README.md
|
93
99
|
- Rakefile
|
94
|
-
- bibtex-ruby.gemspec
|
95
100
|
- examples/bib2html.rb
|
96
101
|
- examples/bib2yaml.rb
|
97
102
|
- examples/markdown.bib
|
98
|
-
- lib/bibtex.rb
|
99
103
|
- lib/bibtex/bibliography.rb
|
104
|
+
- lib/bibtex/bibtex.y
|
100
105
|
- lib/bibtex/elements.rb
|
101
106
|
- lib/bibtex/entry.rb
|
102
107
|
- lib/bibtex/error.rb
|
@@ -104,7 +109,8 @@ files:
|
|
104
109
|
- lib/bibtex/parser.output
|
105
110
|
- lib/bibtex/parser.rb
|
106
111
|
- lib/bibtex/string_replacement.rb
|
107
|
-
- lib/
|
112
|
+
- lib/bibtex/version.rb
|
113
|
+
- lib/bibtex.rb
|
108
114
|
- test/bib/00_empty.bib
|
109
115
|
- test/bib/01_no_bibtex.bib
|
110
116
|
- test/bib/02_string.bib
|
metadata.gz.sig
CHANGED
Binary file
|
data/README.rdoc
DELETED
@@ -1,154 +0,0 @@
|
|
1
|
-
= BibTeX-Ruby
|
2
|
-
|
3
|
-
The BibTeX-Ruby package contains a parser for BibTeX
|
4
|
-
bibliography files and a class structure to manage BibTeX objects in
|
5
|
-
Ruby. It is designed to support all BibTeX objects (including @comment and
|
6
|
-
string-replacements via @string) and handles all content outside of BibTeX
|
7
|
-
objects as `meta comments' which may be included in post-processing.
|
8
|
-
|
9
|
-
|
10
|
-
== Quickstart
|
11
|
-
|
12
|
-
* require 'bibtex'
|
13
|
-
* bib = BibTeX::Bibliography.open('file.bib')
|
14
|
-
* bib.to_yaml
|
15
|
-
|
16
|
-
|
17
|
-
== Installation
|
18
|
-
|
19
|
-
If you just want to use it:
|
20
|
-
|
21
|
-
* gem install bibtex-ruby
|
22
|
-
|
23
|
-
If you want to work with the sources:
|
24
|
-
|
25
|
-
* gem install racc
|
26
|
-
* git clone http://github.com/inukshuk/bibtex-ruby.git
|
27
|
-
* cd bibtex-ruby
|
28
|
-
* rake racc
|
29
|
-
* rake rdoc
|
30
|
-
* rake test
|
31
|
-
|
32
|
-
Or, alternatively, fork the (project on github)[http://github.com/inukshuk/bibtex-ruby.git].
|
33
|
-
|
34
|
-
|
35
|
-
== Requirements
|
36
|
-
|
37
|
-
* The parser generator {+racc+}[http://i.loveruby.net/en/projects/racc/] is required to generate parser.
|
38
|
-
* The +minitest+ gem is required to run the tests in older Ruby versions (prior to 1.9).
|
39
|
-
* The +json+ gem is required on older ruby versions for JSON export.
|
40
|
-
|
41
|
-
|
42
|
-
== Usage
|
43
|
-
|
44
|
-
Look at the `examples' directory for a simple BibTeX to YAML and BibTeX to HTML converter.
|
45
|
-
|
46
|
-
|
47
|
-
== The Parser
|
48
|
-
|
49
|
-
The BibTeX-Ruby parser is generated using the wonderful
|
50
|
-
{+racc+}[http://i.loveruby.net/en/projects/racc/] parser generator.
|
51
|
-
|
52
|
-
== The BibTeX Format
|
53
|
-
|
54
|
-
At first glance, the BibTeX file format seems very clear and simple;
|
55
|
-
however, there are a number of peculiarities which warrant some
|
56
|
-
explanation. The best place to start reading is probably at {your closest
|
57
|
-
ctan server}[http://www.ctan.org/get/biblio/bibtex/] where
|
58
|
-
the original +bibtex+ from 1988 still lives. Additionally, Xavier Decoret
|
59
|
-
has written
|
60
|
-
{a great summary}[http://artis.imag.fr/~Xavier.Decoret/resources/xdkbibtex/bibtex_summary.html]
|
61
|
-
of the format; another invaluable source of information is Nicolas Markey's
|
62
|
-
website[http://www.lsv.ens-cachan.fr/~markey/bibla.php]. Unfortunately,
|
63
|
-
even after consulting these documents, a number of issues remain.
|
64
|
-
Therefore, it is the purpose of this section to deliver the rationale
|
65
|
-
that went into some of the design decision in BibTeX-Ruby.
|
66
|
-
|
67
|
-
A BibTeX bibliography is typically stored in a file with the file
|
68
|
-
extension `.bib'. This file may contain any number of BibTeX objects;
|
69
|
-
everything that is not a BibTeX object is assumed to be a comment and
|
70
|
-
ignored.
|
71
|
-
|
72
|
-
The individual objects are discussed in further detail below. First, however, a
|
73
|
-
number of general remarks:
|
74
|
-
|
75
|
-
* BibTeX-Ruby begins in comment-mode, treating all text it encounters as comments.
|
76
|
-
Normally these comments are ignored; however, if you wish the parser to include
|
77
|
-
them, you can do so by adding the symbol +:meta_comments+ to the +:include+ array
|
78
|
-
in the parser's options.
|
79
|
-
* Note that string literals in BibTeX are either contained in quotes or braces;
|
80
|
-
nested quotes in a quoted literal are not escaped with a usual backslash but
|
81
|
-
must be placed inside braces. Nested braces must be balanced in literals, regardless
|
82
|
-
of whether they are surrounded by quotes or braces.
|
83
|
-
* Quoted strings and string constants (which are defined by @string objects) can be
|
84
|
-
concatted by the `#' symbol. String literals in braces can not be concatted in
|
85
|
-
this way.
|
86
|
-
* The `@' symbol may only occur in quoted string literals (not in braced out literals)
|
87
|
-
in the original BibTeX; note, however, that this is not true for BibTeX-Ruby (i.e.,
|
88
|
-
it will parse any string containing an `@').
|
89
|
-
|
90
|
-
=== @comment
|
91
|
-
|
92
|
-
The purpose of the @comment object is not entirely clear, because everything
|
93
|
-
outside of an object is treated as a comment anyway. Nicolas Markay argues that
|
94
|
-
a @comment makes it possible to quickly comment out a number of consecutive
|
95
|
-
objects; however, as Xavier Decoret points out that this does not work with the
|
96
|
-
original +bibtex+ program (following a @comment, it simply ignores everything
|
97
|
-
until the end of the line). Indeed, on page 13 of {the original
|
98
|
-
documentation}[http://www.ctan.org/get/biblio/bibtex/contrib/doc/btxdoc.pdf],
|
99
|
-
Oren Patashnik explains that @comment objects are not really necessary; they
|
100
|
-
exist only for _Scribe_ system compatibility.
|
101
|
-
|
102
|
-
Because they would be useless otherwise, BibTeX-Ruby treats @comment objects
|
103
|
-
as Nicolas Markay describes them: thus, everything inside a @comment is treated
|
104
|
-
as a comment and is ignored—everything,
|
105
|
-
that is, until the object is closed. For this reason, BibTeX-Ruby assumes that
|
106
|
-
braces inside a @comment are balanced! Obviously, BibTeX-Ruby differs from
|
107
|
-
+bibtex+ in that respect; though, the gain is, that it is now possible to
|
108
|
-
comment out a sequence of entries, without removing their respective `@' symbols.
|
109
|
-
|
110
|
-
=== @string
|
111
|
-
|
112
|
-
The @string object defines a single string constant (for multiple constant
|
113
|
-
assignments, it is necessary to define separate @string objects). These
|
114
|
-
constants can be used within string assignments in other @string or @preamble
|
115
|
-
objects, as well as in regular BibTeX entries. For example, this is a valid constant
|
116
|
-
definition and usage:
|
117
|
-
|
118
|
-
* @string{ generator = "BibTeX-Ruby"}
|
119
|
-
* @preamble{ "This bibliography was generated by " # generator }
|
120
|
-
|
121
|
-
|
122
|
-
=== @preamble
|
123
|
-
|
124
|
-
Typically, the purpose of @preamble objects is to define LaTeX statements, which
|
125
|
-
will be put into the `.bbl' file by +bibtex+. A @preamble object may contain
|
126
|
-
a single string literal, a single string constant (defined by a @string object), or
|
127
|
-
a concatenation of literals and constants.
|
128
|
-
|
129
|
-
=== Entries
|
130
|
-
|
131
|
-
These represent proper BibTeX objects (e.g., @book, @collection, etc.).
|
132
|
-
|
133
|
-
|
134
|
-
== Credits
|
135
|
-
|
136
|
-
The BibTeX-Ruby package was written by {Sylvester Keil}[http://sylvester.keil.or.at/].
|
137
|
-
|
138
|
-
== License
|
139
|
-
|
140
|
-
BibTeX-Ruby
|
141
|
-
Copyright (C) 2010-2011 {Sylvester Keil}[http://sylvester.keil.or.at]
|
142
|
-
|
143
|
-
This program is free software: you can redistribute it and/or modify
|
144
|
-
it under the terms of the GNU General Public License as published by
|
145
|
-
the Free Software Foundation, either version 3 of the License, or
|
146
|
-
(at your option) any later version.
|
147
|
-
|
148
|
-
This program is distributed in the hope that it will be useful,
|
149
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
150
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
151
|
-
GNU General Public License for more details.
|
152
|
-
|
153
|
-
You should have received a copy of the GNU General Public License
|
154
|
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
data/bibtex-ruby.gemspec
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
Gem::Specification.new do |s|
|
4
|
-
s.name = %q{bibtex-ruby}
|
5
|
-
s.version = "1.1.0"
|
6
|
-
|
7
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
-
s.authors = ["Sylvester Keil"]
|
9
|
-
s.cert_chain = ["/Users/sylvester/.gem/keys/gem-public_cert.pem"]
|
10
|
-
s.date = %q{2011-01-24}
|
11
|
-
s.description = %q{A (fairly complete) BibTeX parser written in Ruby. Supports regular BibTeX entries, @comments, string replacement via @string, and simple export formats (e.g. YAML).}
|
12
|
-
s.email = %q{http://sylvester.keil.or.at}
|
13
|
-
s.extra_rdoc_files = ["LICENSE", "README.rdoc", "lib/bibtex.rb", "lib/bibtex/bibliography.rb", "lib/bibtex/elements.rb", "lib/bibtex/entry.rb", "lib/bibtex/error.rb", "lib/bibtex/lexer.rb", "lib/bibtex/parser.output", "lib/bibtex/parser.rb", "lib/bibtex/string_replacement.rb", "lib/extensions/core.rb"]
|
14
|
-
s.files = ["History.txt", "LICENSE", "Manifest", "README.rdoc", "Rakefile", "bibtex-ruby.gemspec", "examples/bib2html.rb", "examples/bib2yaml.rb", "examples/markdown.bib", "lib/bibtex.rb", "lib/bibtex/bibliography.rb", "lib/bibtex/elements.rb", "lib/bibtex/entry.rb", "lib/bibtex/error.rb", "lib/bibtex/lexer.rb", "lib/bibtex/parser.output", "lib/bibtex/parser.rb", "lib/bibtex/string_replacement.rb", "lib/extensions/core.rb", "test/bib/00_empty.bib", "test/bib/01_no_bibtex.bib", "test/bib/02_string.bib", "test/bib/03_string.bib", "test/bib/04_string_replacement.bib", "test/bib/05_comment.bib", "test/bib/06_preamble.bib", "test/bib/07_entry.bib", "test/bib/08_decoret.bib", "test/bib/09_errors.bib", "test/bib/10_bibdesk.bib", "test/test_bibtex.rb", "test/test_comment.rb", "test/test_entry.rb", "test/test_export.rb", "test/test_preamble.rb", "test/test_string.rb"]
|
15
|
-
s.homepage = %q{http://github.com/inukshuk/bibtex-ruby}
|
16
|
-
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "BibTeX-Ruby Documentation", "--main", "README.rdoc"]
|
17
|
-
s.require_paths = ["lib"]
|
18
|
-
s.rubyforge_project = %q{bibtex-ruby}
|
19
|
-
s.rubygems_version = %q{1.3.7}
|
20
|
-
s.signing_key = %q{/Users/sylvester/.gem/keys/gem-private_key.pem}
|
21
|
-
s.summary = %q{A BibTeX parser written in Ruby}
|
22
|
-
s.test_files = ["test/test_bibtex.rb", "test/test_comment.rb", "test/test_entry.rb", "test/test_export.rb", "test/test_preamble.rb", "test/test_string.rb"]
|
23
|
-
|
24
|
-
if s.respond_to? :specification_version then
|
25
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
26
|
-
s.specification_version = 3
|
27
|
-
|
28
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
29
|
-
s.add_development_dependency(%q<racc>, [">= 1.4.6"])
|
30
|
-
s.add_development_dependency(%q<minitest>, [">= 0"])
|
31
|
-
else
|
32
|
-
s.add_dependency(%q<racc>, [">= 1.4.6"])
|
33
|
-
s.add_dependency(%q<minitest>, [">= 0"])
|
34
|
-
end
|
35
|
-
else
|
36
|
-
s.add_dependency(%q<racc>, [">= 1.4.6"])
|
37
|
-
s.add_dependency(%q<minitest>, [">= 0"])
|
38
|
-
end
|
39
|
-
end
|