bibtex-ruby 2.1.1 → 2.1.2
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.lock +1 -1
- data/History.txt +5 -0
- data/Manifest +1 -0
- data/features/issues/whitespace_keys.feature +23 -0
- data/lib/bibtex/lexer.rb +3 -3
- data/lib/bibtex/version.rb +1 -1
- data/test/bibtex/test_lexer.rb +6 -2
- metadata +9 -2
data/Gemfile.lock
CHANGED
data/History.txt
CHANGED
data/Manifest
CHANGED
@@ -24,6 +24,7 @@ features/issues/number_keys.feature
|
|
24
24
|
features/issues/parse_months.feature
|
25
25
|
features/issues/slash_keys.feature
|
26
26
|
features/issues/trailing_comma.feature
|
27
|
+
features/issues/whitespace_keys.feature
|
27
28
|
features/names.feature
|
28
29
|
features/preambles.feature
|
29
30
|
features/query.feature
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Feature: Whitespace in before cite keys
|
2
|
+
As a hacker who works with bibliographies
|
3
|
+
I want to parse BibTeX entries with whitespace before the cite key
|
4
|
+
Because they frequently occur in the wild
|
5
|
+
|
6
|
+
Scenario: An entry with spaces before the cite key
|
7
|
+
When I parse the following file:
|
8
|
+
"""
|
9
|
+
@InCollection{ brown:family:1997,
|
10
|
+
address = {Princeton},
|
11
|
+
title = {Family Strategies and Religious Practice: Baptism and the
|
12
|
+
Lord's Supper in Early New England},
|
13
|
+
booktitle = {Lived Religion in America: Toward a History of Practice},
|
14
|
+
shorttitle = {Family Strategies},
|
15
|
+
publisher = {Princeton University Press},
|
16
|
+
author = {Brown, Anne S. and Hall, David D.},
|
17
|
+
editor = {Hall, David D.},
|
18
|
+
year = {1997},
|
19
|
+
pages = {41--68},
|
20
|
+
crossref = {hall:lived:1997}
|
21
|
+
}
|
22
|
+
"""
|
23
|
+
Then my bibliography should contain an incollection with id "brown:family:1997"
|
data/lib/bibtex/lexer.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#--
|
2
2
|
# BibTeX-Ruby
|
3
|
-
# Copyright (C) 2010-
|
3
|
+
# Copyright (C) 2010-2012 Sylvester Keil <http://sylvester.keil.or.at>
|
4
4
|
#
|
5
5
|
# This program is free software: you can redistribute it and/or modify
|
6
6
|
# it under the terms of the GNU General Public License as published by
|
@@ -59,8 +59,8 @@ module BibTeX
|
|
59
59
|
:string => /string/io,
|
60
60
|
:comment => /comment\b/io,
|
61
61
|
:preamble => /preamble\b/io,
|
62
|
-
:key =>
|
63
|
-
:optional_key =>
|
62
|
+
:key => /\s*[[:alpha:]\d \/:_!$\?\.%&\*-]+,/io,
|
63
|
+
:optional_key => /\s*[[:alpha:]\d \/:_!$\?\.%&\*-]*,/io
|
64
64
|
}.freeze
|
65
65
|
|
66
66
|
MODE = Hash.new(:meta).merge({
|
data/lib/bibtex/version.rb
CHANGED
data/test/bibtex/test_lexer.rb
CHANGED
@@ -21,11 +21,15 @@ module BibTeX
|
|
21
21
|
Lexer.new.analyse("@misc{foo, }").symbols.must_be :==, [:AT, :NAME, :LBRACE, :KEY, :RBRACE, false]
|
22
22
|
end
|
23
23
|
|
24
|
-
it '
|
24
|
+
it 'matches KEY tokens after whitespace' do
|
25
|
+
Lexer.new.analyse("@misc{ foo, }").symbols.must_be :==, [:AT, :NAME, :LBRACE, :KEY, :RBRACE, false]
|
26
|
+
end
|
27
|
+
|
28
|
+
it "doesn't start a comment for types starting with but not equal @comment" do
|
25
29
|
Lexer.new.analyse("@commentary{staudinger, }").symbols.must_be :==, [:AT, :NAME, :LBRACE, :KEY, :RBRACE, false]
|
26
30
|
end
|
27
31
|
|
28
|
-
it
|
32
|
+
it "doesn't start a preamble for types starting with but not equal @preamble" do
|
29
33
|
Lexer.new.analyse("@preamblestring{ preamble }").symbols.must_be :==, [:AT, :NAME, :LBRACE, :NAME, :RBRACE, false]
|
30
34
|
end
|
31
35
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bibtex-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: latex-decode
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- features/issues/parse_months.feature
|
91
91
|
- features/issues/slash_keys.feature
|
92
92
|
- features/issues/trailing_comma.feature
|
93
|
+
- features/issues/whitespace_keys.feature
|
93
94
|
- features/names.feature
|
94
95
|
- features/preambles.feature
|
95
96
|
- features/query.feature
|
@@ -159,12 +160,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
159
160
|
- - ! '>='
|
160
161
|
- !ruby/object:Gem::Version
|
161
162
|
version: '0'
|
163
|
+
segments:
|
164
|
+
- 0
|
165
|
+
hash: 3159089786637859707
|
162
166
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
167
|
none: false
|
164
168
|
requirements:
|
165
169
|
- - ! '>='
|
166
170
|
- !ruby/object:Gem::Version
|
167
171
|
version: '0'
|
172
|
+
segments:
|
173
|
+
- 0
|
174
|
+
hash: 3159089786637859707
|
168
175
|
requirements: []
|
169
176
|
rubyforge_project:
|
170
177
|
rubygems_version: 1.8.24
|