bibtex-ruby 1.1.2 → 1.2.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.
Potentially problematic release.
This version of bibtex-ruby might be problematic. Click here for more details.
- data/Gemfile +2 -0
- data/Gemfile.lock +20 -0
- data/Manifest +9 -2
- data/README.md +146 -68
- data/Rakefile +13 -54
- data/bibtex-ruby.gemspec +36 -0
- data/examples/bib2html.rb +2 -2
- data/examples/bib2yaml.rb +1 -1
- data/lib/bibtex.rb +6 -1
- data/lib/bibtex/bibliography.rb +23 -7
- data/lib/bibtex/bibtex.y +1 -1
- data/lib/bibtex/elements.rb +57 -41
- data/lib/bibtex/entry.rb +32 -24
- data/lib/bibtex/extensions.rb +60 -0
- data/lib/bibtex/parser.rb +1 -1
- data/lib/bibtex/utilities.rb +38 -0
- data/lib/bibtex/version.rb +1 -1
- data/test/bib/03_string.bib +0 -1
- data/test/bib/11_roundtrip.bib +11 -0
- data/test/helper.rb +4 -0
- data/test/test_bibtex.rb +60 -10
- data/test/test_comment.rb +1 -4
- data/test/test_entry.rb +11 -14
- data/test/test_export.rb +2 -4
- data/test/test_preamble.rb +25 -10
- data/test/test_string.rb +55 -35
- data/test/test_utilities.rb +36 -0
- metadata +21 -53
- data.tar.gz.sig +0 -0
- data/lib/bibtex/string_replacement.rb +0 -43
- metadata.gz.sig +0 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'helper.rb'
|
2
|
+
|
3
|
+
class TestBibtex < MiniTest::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
end
|
7
|
+
|
8
|
+
def teardown
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_empty
|
12
|
+
bib = BibTeX.open('test/bib/00_empty.bib', :debug => true)
|
13
|
+
refute_nil(bib)
|
14
|
+
assert_equal(BibTeX::Bibliography, bib.class)
|
15
|
+
assert(bib.empty?)
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_parse
|
19
|
+
bib = BibTeX.parse %q[ @book{ id, author = {Poe, Edgar Allen}, title = "Ligeia" } ]
|
20
|
+
refute_nil(bib)
|
21
|
+
assert_equal(BibTeX::Bibliography, bib.class)
|
22
|
+
[
|
23
|
+
[1, bib.length],
|
24
|
+
['Ligeia', bib[:id].title],
|
25
|
+
['Poe, Edgar Allen', bib[:id].author]
|
26
|
+
].each { |a| assert_equal(a[0], a[1]) }
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_validate
|
30
|
+
refute BibTeX.parse(%q[ @book{ id, author = {Poe, Edgar Allen}, title = "Ligeia" } ]).valid?
|
31
|
+
assert BibTeX.parse(%q[ @book{ id, author = {Poe, Edgar Allen}, title = "Ligeia", publisher = "Penguin", year = 1996 } ]).valid?
|
32
|
+
refute BibTeX.parse(%q[ @book{ id, author = {Poe, Edgar Allen}, title = "Lig"eia", publisher = "Penguin", year = 1996 } ]).valid?
|
33
|
+
assert BibTeX.valid?('test/bib/10_bibdesk.bib')
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
metadata
CHANGED
@@ -1,41 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bibtex-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 1
|
7
|
-
- 1
|
8
|
-
- 2
|
9
|
-
version: 1.1.2
|
4
|
+
prerelease:
|
5
|
+
version: 1.2.0
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Sylvester Keil
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
|
-
cert_chain:
|
16
|
-
- |
|
17
|
-
-----BEGIN CERTIFICATE-----
|
18
|
-
MIIDWDCCAkCgAwIBAgIBADANBgkqhkiG9w0BAQUFADBSMRIwEAYDVQQDDAlzeWx2
|
19
|
-
ZXN0ZXIxFDASBgoJkiaJk/IsZAEZFgRrZWlsMRIwEAYKCZImiZPyLGQBGRYCb3Ix
|
20
|
-
EjAQBgoJkiaJk/IsZA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ZJZG5
|
35
|
-
J/FeJ8pSGMcNlQbhGpGIX+ARJK5ArG0Aq4214ttgefkdQJvw5r9hG3J4AgM=
|
36
|
-
-----END CERTIFICATE-----
|
11
|
+
cert_chain: []
|
37
12
|
|
38
|
-
date: 2011-
|
13
|
+
date: 2011-02-12 00:00:00 +01:00
|
39
14
|
default_executable:
|
40
15
|
dependencies:
|
41
16
|
- !ruby/object:Gem::Dependency
|
@@ -46,10 +21,6 @@ dependencies:
|
|
46
21
|
requirements:
|
47
22
|
- - ">="
|
48
23
|
- !ruby/object:Gem::Version
|
49
|
-
segments:
|
50
|
-
- 1
|
51
|
-
- 4
|
52
|
-
- 6
|
53
24
|
version: 1.4.6
|
54
25
|
type: :development
|
55
26
|
version_requirements: *id001
|
@@ -61,10 +32,6 @@ dependencies:
|
|
61
32
|
requirements:
|
62
33
|
- - ">="
|
63
34
|
- !ruby/object:Gem::Version
|
64
|
-
segments:
|
65
|
-
- 2
|
66
|
-
- 0
|
67
|
-
- 2
|
68
35
|
version: 2.0.2
|
69
36
|
type: :development
|
70
37
|
version_requirements: *id002
|
@@ -76,14 +43,10 @@ dependencies:
|
|
76
43
|
requirements:
|
77
44
|
- - ">="
|
78
45
|
- !ruby/object:Gem::Version
|
79
|
-
segments:
|
80
|
-
- 1
|
81
|
-
- 5
|
82
|
-
- 0
|
83
46
|
version: 1.5.0
|
84
47
|
type: :development
|
85
48
|
version_requirements: *id003
|
86
|
-
description: A (fairly complete) BibTeX parser written in Ruby. Supports regular BibTeX entries, @comments, string replacement via @string
|
49
|
+
description: A (fairly complete) BibTeX parser written in Ruby. Supports regular BibTeX entries, @comments, string replacement via @string. Allows for easy export/conversion to formats such as YAML, JSON, and XML.
|
87
50
|
email: http://sylvester.keil.or.at
|
88
51
|
executables: []
|
89
52
|
|
@@ -92,11 +55,14 @@ extensions: []
|
|
92
55
|
extra_rdoc_files:
|
93
56
|
- README.md
|
94
57
|
files:
|
58
|
+
- Gemfile
|
59
|
+
- Gemfile.lock
|
95
60
|
- History.txt
|
96
61
|
- LICENSE
|
97
62
|
- Manifest
|
98
63
|
- README.md
|
99
64
|
- Rakefile
|
65
|
+
- bibtex-ruby.gemspec
|
100
66
|
- examples/bib2html.rb
|
101
67
|
- examples/bib2yaml.rb
|
102
68
|
- examples/markdown.bib
|
@@ -105,10 +71,11 @@ files:
|
|
105
71
|
- lib/bibtex/elements.rb
|
106
72
|
- lib/bibtex/entry.rb
|
107
73
|
- lib/bibtex/error.rb
|
74
|
+
- lib/bibtex/extensions.rb
|
108
75
|
- lib/bibtex/lexer.rb
|
109
76
|
- lib/bibtex/parser.output
|
110
77
|
- lib/bibtex/parser.rb
|
111
|
-
- lib/bibtex/
|
78
|
+
- lib/bibtex/utilities.rb
|
112
79
|
- lib/bibtex/version.rb
|
113
80
|
- lib/bibtex.rb
|
114
81
|
- test/bib/00_empty.bib
|
@@ -122,12 +89,15 @@ files:
|
|
122
89
|
- test/bib/08_decoret.bib
|
123
90
|
- test/bib/09_errors.bib
|
124
91
|
- test/bib/10_bibdesk.bib
|
92
|
+
- test/bib/11_roundtrip.bib
|
93
|
+
- test/helper.rb
|
125
94
|
- test/test_bibtex.rb
|
126
95
|
- test/test_comment.rb
|
127
96
|
- test/test_entry.rb
|
128
97
|
- test/test_export.rb
|
129
98
|
- test/test_preamble.rb
|
130
99
|
- test/test_string.rb
|
100
|
+
- test/test_utilities.rb
|
131
101
|
has_rdoc: true
|
132
102
|
homepage: http://inukshuk.github.com/bibtex-ruby
|
133
103
|
licenses: []
|
@@ -137,9 +107,11 @@ rdoc_options:
|
|
137
107
|
- --line-numbers
|
138
108
|
- --inline-source
|
139
109
|
- --title
|
140
|
-
- BibTeX-Ruby
|
110
|
+
- "\"BibTeX-Ruby"
|
111
|
+
- Documentation"
|
141
112
|
- --main
|
142
|
-
- README.
|
113
|
+
- README.md
|
114
|
+
- --webcvs=http://github.com/inukshuk/bibtex-ruby/tree/master/
|
143
115
|
require_paths:
|
144
116
|
- lib
|
145
117
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -147,25 +119,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
147
119
|
requirements:
|
148
120
|
- - ">="
|
149
121
|
- !ruby/object:Gem::Version
|
150
|
-
segments:
|
151
|
-
- 0
|
152
122
|
version: "0"
|
153
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
124
|
none: false
|
155
125
|
requirements:
|
156
126
|
- - ">="
|
157
127
|
- !ruby/object:Gem::Version
|
158
|
-
|
159
|
-
- 1
|
160
|
-
- 2
|
161
|
-
version: "1.2"
|
128
|
+
version: 1.3.6
|
162
129
|
requirements: []
|
163
130
|
|
164
131
|
rubyforge_project: bibtex-ruby
|
165
|
-
rubygems_version: 1.
|
132
|
+
rubygems_version: 1.5.0
|
166
133
|
signing_key:
|
167
134
|
specification_version: 3
|
168
|
-
summary: A BibTeX parser written in Ruby
|
135
|
+
summary: A BibTeX parser and converter written in Ruby.
|
169
136
|
test_files:
|
170
137
|
- test/test_bibtex.rb
|
171
138
|
- test/test_comment.rb
|
@@ -173,3 +140,4 @@ test_files:
|
|
173
140
|
- test/test_export.rb
|
174
141
|
- test/test_preamble.rb
|
175
142
|
- test/test_string.rb
|
143
|
+
- test/test_utilities.rb
|
data.tar.gz.sig
DELETED
Binary file
|
@@ -1,43 +0,0 @@
|
|
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
|
-
module BibTeX
|
20
|
-
# This module contains functions to manipulate BibTeX
|
21
|
-
# string literals.
|
22
|
-
module StringReplacement
|
23
|
-
|
24
|
-
# Returns a string representation of the literal.
|
25
|
-
def self.to_s(value,options={})
|
26
|
-
return if value.nil?
|
27
|
-
options[:delimiter] ||= ['"','"']
|
28
|
-
#options[:delimiter] ||= ['{','}']
|
29
|
-
|
30
|
-
if value.empty? || (value.length == 1 && !value[0].kind_of?(Symbol))
|
31
|
-
[options[:delimiter][0],value,options[:delimiter][1]].join
|
32
|
-
else
|
33
|
-
value.map { |s| s.kind_of?(Symbol) ? s.to_s : s.inspect}.join(' # ')
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
# Replaces all string constants in +value+ which are defined in +hsh+.
|
38
|
-
def self.replace(value,hsh)
|
39
|
-
return if value.nil?
|
40
|
-
value.map { |s| s.kind_of?(Symbol) && hsh.has_key?(s) ? hsh[s] : s }.flatten
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
metadata.gz.sig
DELETED
Binary file
|