bibtex-ruby 2.1.1 → 2.1.2

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/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bibtex-ruby (2.1.0)
4
+ bibtex-ruby (2.1.2)
5
5
  latex-decode (>= 0.0.6)
6
6
  multi_json (~> 1.3)
7
7
 
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ 2.1.1 / 2012-11-02
2
+ ==================
3
+
4
+ * Fixed lexer issue with whitespace before cite keys (@lmullen)
5
+
1
6
  2.1.1 / 2012-09-14
2
7
  ==================
3
8
 
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-2011 Sylvester Keil <http://sylvester.keil.or.at>
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 => /[[:alpha:]\d \/:_!$\?\.%&\*-]+,/io,
63
- :optional_key => /[[:alpha:]\d \/:_!$\?\.%&\*-]*,/io
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({
@@ -20,7 +20,7 @@ module BibTeX
20
20
  module Version
21
21
  MAJOR = 2
22
22
  MINOR = 1
23
- PATCH = 1
23
+ PATCH = 2
24
24
  BUILD = nil
25
25
 
26
26
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.').freeze
@@ -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 'doesn\'t start a comment for types starting with but not equal @comment' do
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 'doesn\'t start a preamble for types starting with but not equal @preamble' do
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.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-09-14 00:00:00.000000000 Z
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