anystyle-parser 0.6.1 → 0.6.2

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: c4dac8834fc3ffe33edaf02e3133d987ba7100a0
4
- data.tar.gz: c2c3134488eba94c5ba65edda683e3288bf64966
3
+ metadata.gz: 3157c9bbc6098612aac186fea98a8e43943f2262
4
+ data.tar.gz: 961f00097e44875c0e3e3aada77944f90ba2dfbc
5
5
  SHA512:
6
- metadata.gz: 9b77f3713edb75470badf89fdbb2c7affd74286c0712e5da56e6e4cd410adaa39ca206fd33aafed2ebaec22271416a7df545bc3b2e5bacbd36b765c10597e453
7
- data.tar.gz: d3d6d8297898490ff29edc5435dcc7b1c92037e1a95311cb0d81e92c97359609fd8fcf0e7aa7b9397d723d6907225e134cad1fbc57f43476571bcc45be39312a
6
+ metadata.gz: 801fa8446b680f8e21e8435d6d30b8af7e1d2a48976b27a034455a2f95913d9c71abe2ccc64927bbca0c20d7e67aa8c6ebc3c01c03adc6a6ec281ea8c5df93c6
7
+ data.tar.gz: 7f87f5cfb0094fc943a37c78a493f41a0c9444d60d59280516b5e7ef2d5f61386b7640a11a906211fb5ac0fcea25ae545f62172add438f8fd8074f1470838692
@@ -94,8 +94,8 @@ module Anystyle
94
94
 
95
95
  editors.gsub!(/^\W+|\W+$/, '')
96
96
  editors.gsub!(/^in:?\s+/i, '')
97
- editors.gsub!(/[^[:alpha:]]*[Ee]d(s|itors?|ited)?[^[:alpha:]]*/, '')
98
- editors.gsub!(/[^[:alpha:]]*([Hh]rsg|Herausgeber)[^[:alpha:]]*/, '')
97
+ editors.gsub!(/[^[:alpha:]]*[Ee]d(s|itors?|ited)?\b[^[:alpha:]]*/, '')
98
+ editors.gsub!(/[^[:alpha:]]*([Hh]rsg|Herausgeber)\b[^[:alpha:]]*/, '')
99
99
  editors.gsub!(/\bby\b/i, '')
100
100
 
101
101
  is_trans = !!editors.gsub!(/[^[:alpha:]]*trans(lated)?[^[:alpha:]]*/i, '')
@@ -110,7 +110,7 @@ module Anystyle
110
110
  translators = hash[:translator]
111
111
 
112
112
  translators.gsub!(/^\W+|\W+$/, '')
113
- translators.gsub!(/[^[:alpha:]]*trans(lated)?[^[:alpha:]]*/i, '')
113
+ translators.gsub!(/[^[:alpha:]]*trans(lated)?\b[^[:alpha:]]*/i, '')
114
114
  translators.gsub!(/\bby\b/i, '')
115
115
 
116
116
  hash[:translator] = normalize_names(translators)
@@ -121,7 +121,8 @@ module Anystyle
121
121
  directors = hash[:director]
122
122
 
123
123
  directors.gsub!(/^\W+|\W+$/, '')
124
- directors.gsub!(/[^[:alpha:]]*direct(or|ed)?[^[:alpha:]]*/i, '')
124
+ directors.gsub!(/[^[:alpha:]]*direct(or|ed)?\b:w
125
+ [^[:alpha:]]*/i, '')
125
126
  directors.gsub!(/\bby\b/i, '')
126
127
 
127
128
  hash[:director] = normalize_names(directors)
@@ -1,5 +1,5 @@
1
1
  module Anystyle
2
2
  module Parser
3
- VERSION = '0.6.1'.freeze
3
+ VERSION = '0.6.2'.freeze
4
4
  end
5
5
  end
@@ -52,6 +52,22 @@ module Anystyle
52
52
 
53
53
  end
54
54
 
55
+ describe '#normalize_editor' do
56
+ it "strips in from beginning" do
57
+ n.normalize_editor(:editor => 'In D. Knuth (ed.)').should == { :editor => 'Knuth, D.' }
58
+ n.normalize_editor(:editor => 'In: D. Knuth (ed.)').should == { :editor => 'Knuth, D.' }
59
+ n.normalize_editor(:editor => 'in: D. Knuth ed.').should == { :editor => 'Knuth, D.' }
60
+ n.normalize_editor(:editor => 'in D. Knuth (ed)').should == { :editor => 'Knuth, D.' }
61
+ end
62
+
63
+ it "does not strip ed from name" do
64
+ n.normalize_editor(:editor => 'In Edward Wood').should == { :editor => 'Wood, Edward' }
65
+ n.normalize_editor(:editor => 'ed by Edward Wood').should == { :editor => 'Wood, Edward' }
66
+ n.normalize_editor(:editor => 'ed. by Edward Wood').should == { :editor => 'Wood, Edward' }
67
+ n.normalize_editor(:editor => 'ed by Edward Wood').should == { :editor => 'Wood, Edward' }
68
+ end
69
+ end
70
+
55
71
  describe 'editors extraction' do
56
72
  it 'recognizes editors in the author field' do
57
73
  n.normalize_author(:author => 'D. Knuth (ed.)').should == { :editor => 'Knuth, D.' }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anystyle-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvester Keil