mods_display 0.3.1 → 0.3.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.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/config/locales/en.yml +1 -0
- data/lib/mods_display.rb +1 -1
- data/lib/mods_display/configuration.rb +2 -2
- data/lib/mods_display/configuration/title.rb +5 -0
- data/lib/mods_display/fields/imprint.rb +2 -2
- data/lib/mods_display/version.rb +1 -1
- data/spec/fields/imprint_spec.rb +6 -0
- data/spec/fixtures/imprint_fixtures.rb +10 -0
- metadata +16 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0846e2b92576d1d40de21c10bf70cfa9a62413de
|
4
|
+
data.tar.gz: 8fc10c5ae9a5b62476817ba578a83ed1c62033c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b88965874892d9b9b1ebdf43d13193e50bf43c1a781c81b8838949ff7c494b5be996c6c014f82c2c5f70dbdd2035ee580119c01712a81bcbed889a3ccbc54e8
|
7
|
+
data.tar.gz: c7136275008ad79043fd17af5d52a9355733bea7e68a8969750b0ef743f859a45c9389e3a8977ec3b9dff9aea1a333cbb2a8a4498aa81da79c9c4b6f4aab2eda
|
data/.travis.yml
CHANGED
data/config/locales/en.yml
CHANGED
data/lib/mods_display.rb
CHANGED
@@ -14,6 +14,7 @@ require "mods_display/configuration/name"
|
|
14
14
|
require "mods_display/configuration/note"
|
15
15
|
require "mods_display/configuration/related_item"
|
16
16
|
require "mods_display/configuration/subject"
|
17
|
+
require "mods_display/configuration/title"
|
17
18
|
require "mods_display/fields/field"
|
18
19
|
require "mods_display/fields/abstract"
|
19
20
|
require "mods_display/fields/access_condition"
|
@@ -42,5 +43,4 @@ require "i18n"
|
|
42
43
|
require "i18n/backend/fallbacks"
|
43
44
|
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
|
44
45
|
I18n.load_path += Dir["#{File.expand_path('../..', __FILE__)}/config/locales/*.yml"]
|
45
|
-
I18n.default_locale = :en
|
46
46
|
I18n.backend.load_translations
|
@@ -6,11 +6,11 @@ class ModsDisplay::Configuration
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def title &title
|
9
|
-
@title ||= ModsDisplay::Configuration::
|
9
|
+
@title ||= ModsDisplay::Configuration::Title.new(&title || Proc.new{})
|
10
10
|
end
|
11
11
|
|
12
12
|
def sub_title &sub_title
|
13
|
-
@sub_title ||= ModsDisplay::Configuration::
|
13
|
+
@sub_title ||= ModsDisplay::Configuration::Title.new(&sub_title || Proc.new{})
|
14
14
|
end
|
15
15
|
|
16
16
|
def name &name
|
@@ -80,10 +80,10 @@ class ModsDisplay::Imprint < ModsDisplay::Field
|
|
80
80
|
end_date = date_fields.find{|d| d.attributes["point"] && d.attributes["point"].value == "end"}
|
81
81
|
date_fields.map do |date|
|
82
82
|
date = date.clone # clone the date object so we don't append the same one
|
83
|
-
if normalize_date(date.text) == start_date.text
|
83
|
+
if normalize_date(date.text) == normalize_date(start_date.text)
|
84
84
|
date.content = [start_date.text, end_date.text].join("-")
|
85
85
|
date
|
86
|
-
elsif normalize_date(date.text) != end_date.text
|
86
|
+
elsif normalize_date(date.text) != normalize_date(end_date.text)
|
87
87
|
date
|
88
88
|
end
|
89
89
|
end.compact
|
data/lib/mods_display/version.rb
CHANGED
data/spec/fields/imprint_spec.rb
CHANGED
@@ -21,6 +21,7 @@ describe ModsDisplay::Imprint do
|
|
21
21
|
@display_label = Stanford::Mods::Record.new.from_str(display_label, false).origin_info
|
22
22
|
@date_range = Stanford::Mods::Record.new.from_str(date_range, false).origin_info
|
23
23
|
@open_date_range = Stanford::Mods::Record.new.from_str(open_date_range, false).origin_info
|
24
|
+
@encoded_date_range = Stanford::Mods::Record.new.from_str(encoded_date_range, false).origin_info
|
24
25
|
@dup_qualified_date = Stanford::Mods::Record.new.from_str(dup_qualified_date, false).origin_info
|
25
26
|
@dup_unencoded_date = Stanford::Mods::Record.new.from_str(dup_unencoded_date, false).origin_info
|
26
27
|
@dup_copyright_date = Stanford::Mods::Record.new.from_str(dup_copyright_date, false).origin_info
|
@@ -104,6 +105,11 @@ describe ModsDisplay::Imprint do
|
|
104
105
|
fields.length.should == 1
|
105
106
|
fields.first.values.should == ["1820-1825"]
|
106
107
|
end
|
108
|
+
it "should handle encoded dates properly" do
|
109
|
+
fields = mods_display_imprint(@encoded_date_range).fields
|
110
|
+
fields.length.should eq 1
|
111
|
+
fields.first.values.should eq ["February 01, 2008-December 02, 2009"]
|
112
|
+
end
|
107
113
|
end
|
108
114
|
describe "duplication" do
|
109
115
|
it "should only return the qualified date when present" do
|
@@ -101,6 +101,16 @@ module ImprintFixtures
|
|
101
101
|
</mods>
|
102
102
|
MODS
|
103
103
|
end
|
104
|
+
def encoded_date_range
|
105
|
+
<<-MODS
|
106
|
+
<mods>
|
107
|
+
<originInfo>
|
108
|
+
<dateCreated encoding="w3cdtf" keyDate="yes" point="start">2008-02-01</dateCreated>
|
109
|
+
<dateCreated encoding="w3cdtf" point="end">2009-12-02</dateCreated>
|
110
|
+
</originInfo>
|
111
|
+
</mods>
|
112
|
+
MODS
|
113
|
+
end
|
104
114
|
def dup_qualified_date
|
105
115
|
<<-MODS
|
106
116
|
<mods>
|
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mods_display
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jessie Keck
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: stanford-mods
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: i18n
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
description: MODS Display is a gem to centralize the display logic of MODS medadata.
|
@@ -73,8 +73,8 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
-
- .gitignore
|
77
|
-
- .travis.yml
|
76
|
+
- ".gitignore"
|
77
|
+
- ".travis.yml"
|
78
78
|
- Gemfile
|
79
79
|
- LICENSE.txt
|
80
80
|
- README.md
|
@@ -91,6 +91,7 @@ files:
|
|
91
91
|
- lib/mods_display/configuration/note.rb
|
92
92
|
- lib/mods_display/configuration/related_item.rb
|
93
93
|
- lib/mods_display/configuration/subject.rb
|
94
|
+
- lib/mods_display/configuration/title.rb
|
94
95
|
- lib/mods_display/controller_extension.rb
|
95
96
|
- lib/mods_display/country_codes.rb
|
96
97
|
- lib/mods_display/fields/abstract.rb
|
@@ -162,17 +163,17 @@ require_paths:
|
|
162
163
|
- lib
|
163
164
|
required_ruby_version: !ruby/object:Gem::Requirement
|
164
165
|
requirements:
|
165
|
-
- -
|
166
|
+
- - ">="
|
166
167
|
- !ruby/object:Gem::Version
|
167
168
|
version: '0'
|
168
169
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
170
|
requirements:
|
170
|
-
- -
|
171
|
+
- - ">="
|
171
172
|
- !ruby/object:Gem::Version
|
172
173
|
version: '0'
|
173
174
|
requirements: []
|
174
175
|
rubyforge_project:
|
175
|
-
rubygems_version: 2.0
|
176
|
+
rubygems_version: 2.2.0
|
176
177
|
signing_key:
|
177
178
|
specification_version: 4
|
178
179
|
summary: The MODS Display gem allows implementers to configure a customized display
|