anystyle-parser 0.6.12 → 0.6.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83251b73e40d965406a15d0bc89d2692f8c33bb4
4
- data.tar.gz: ccf86a26b4044c644965be1404659b2f08310608
3
+ metadata.gz: 5c1af591f965670f8ec9463f412b95e5f3f95c9e
4
+ data.tar.gz: 5e61d0dae3c5bf8fac0b3e038ec02538031ac702
5
5
  SHA512:
6
- metadata.gz: b17d5efec156aa15fce9b64809ee78c0b3109f1b03f551721fc27bf5e2025c8b3c6cbed08f652b477ed040b90b820ee3fcb46198e9520fbac6bae5c38aba77a8
7
- data.tar.gz: ff4522110cba991cdd74a4d77b218db16bd73a870ecac622ed955d25fa8ce7679335978cae979bcd6fffc3ef2f00e28f57d6f5d893eb4f7197f0874458eb847e
6
+ metadata.gz: b08d209cb523f7aad6b9c92533e361958feca1ca80e52b165f3fc2eba31d7623a0add19c3e3173190beeeb64ce0769763e3f0724f656fbe7c9b96198d5e7e457
7
+ data.tar.gz: 6cb39624162a081ea0c55452ee7f7727b5bb1783f4647a1e5970b5d93627c856631feed611416307b1d5b68f1f6317bbd8ae23245ed93be1e9351446308eddf4
@@ -91,7 +91,7 @@ module Anystyle
91
91
  authors, *dangling = hash[:author]
92
92
  unmatched(:author, hash, dangling) unless dangling.empty?
93
93
 
94
- if authors =~ /\b[Ee]d(s|itors)?\b/ && !hash.has_key?(:editor)
94
+ if authors =~ /\b[Ee]d((s|itors?|ited)\b|\.)/ && !hash.has_key?(:editor)
95
95
  hash[:editor] = hash.delete(:author)
96
96
  hash = normalize_editor(hash)
97
97
  else
@@ -1,5 +1,5 @@
1
1
  module Anystyle
2
2
  module Parser
3
- VERSION = '0.6.12'.freeze
3
+ VERSION = '0.6.13'.freeze
4
4
  end
5
5
  end
@@ -64,6 +64,33 @@ module Anystyle
64
64
 
65
65
  end
66
66
 
67
+ describe '#normalize_author' do
68
+ it "detects editors" do
69
+ expect(n.normalize_author(:author => 'In D. Knuth (ed.)'))
70
+ .to eq({ :editor => 'Knuth, D.' })
71
+
72
+ expect(n.normalize_author(:author => 'D. Knuth (editor)'))
73
+ .to eq({ :editor => 'Knuth, D.' })
74
+
75
+ expect(n.normalize_author(:author => 'D. Knuth (eds.)'))
76
+ .to eq({ :editor => 'Knuth, D.' })
77
+
78
+ expect(n.normalize_author(:author => 'Ed. by D. Knuth'))
79
+ .to eq({ :editor => 'Knuth, D.' })
80
+
81
+ expect(n.normalize_author(:author => 'Edited by D. Knuth'))
82
+ .to eq({ :editor => 'Knuth, D.' })
83
+ end
84
+
85
+ it "does not erroneously detect editors" do
86
+ expect(n.normalize_author(:author => 'Eisenberger, P. and Read, W.A.'))
87
+ .to eq({ :author => 'Eisenberger, P. and Read, W.A.' })
88
+
89
+ expect(n.normalize_author(:author => 'K. S. Sohn, D. G. Dempsey, L. Kleinman and Ed Caruthers'))
90
+ .to eq({ :author => 'Sohn, K.S. and Dempsey, D.G. and Kleinman, L. and Caruthers, Ed' })
91
+ end
92
+ end
93
+
67
94
  describe '#normalize_editor' do
68
95
  it "strips in from beginning" do
69
96
  expect(n.normalize_editor(:editor => 'In D. Knuth (ed.)')).to eq({ :editor => 'Knuth, D.' })
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anystyle-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.12
4
+ version: 0.6.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvester Keil
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-24 00:00:00.000000000 Z
11
+ date: 2015-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bibtex-ruby