mods_display 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +0 -1
- data/Gemfile +0 -2
- data/lib/mods_display/fields/extent.rb +1 -1
- data/lib/mods_display/fields/form.rb +2 -2
- data/lib/mods_display/html.rb +1 -1
- data/lib/mods_display/version.rb +1 -1
- data/spec/fields/extent_spec.rb +2 -1
- data/spec/fields/form_spec.rb +20 -1
- data/spec/integration/html_spec.rb +9 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c2d5c102f64b65d4313c4aad186328f17edf6475908f360762591ec4ded1f044
|
4
|
+
data.tar.gz: fefe5bd0aa2a29fe4cb60ad94e40840a3a1fe4a12b30ffccfc08b32361d04a5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5230f9bda246de22ebaaab5d01f3dc8a6d02f7a92f56a6caa1aa8e7d39039d8cb2d2fd8f39e8797d0757fb49dea269e680191ba9d495ae45ddf20cdfbfb3ae55
|
7
|
+
data.tar.gz: 5d5144f39760608dcb3a628022d1e8335e54b23a0c6e2b172c7705c68bd1a2fc12fa8b3155635c77bae9c74842bb3aeefc61639ea3c717f0495df7860faf6853
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -5,7 +5,7 @@ module ModsDisplay
|
|
5
5
|
[
|
6
6
|
ModsDisplay::Values.new(
|
7
7
|
label: I18n.t('mods_display.form'),
|
8
|
-
values: form_fields.map(&:text)
|
8
|
+
values: form_fields.map(&:text).uniq { |x| x.downcase.gsub(/\s/, '').gsub(/[[:punct:]]/, '') }
|
9
9
|
)
|
10
10
|
]
|
11
11
|
end
|
@@ -13,7 +13,7 @@ module ModsDisplay
|
|
13
13
|
private
|
14
14
|
|
15
15
|
def form_fields
|
16
|
-
@values.map(&:form)
|
16
|
+
@values.map(&:form).flatten
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
data/lib/mods_display/html.rb
CHANGED
@@ -40,7 +40,7 @@ module ModsDisplay
|
|
40
40
|
def method_missing(method_name, *args, &block)
|
41
41
|
if to_s.respond_to?(method_name)
|
42
42
|
to_html.send(method_name, *args, &block)
|
43
|
-
elsif mods_display_fields.include?(method_name)
|
43
|
+
elsif method_name == :subTitle || mods_display_fields.include?(method_name)
|
44
44
|
mods_field(@xml, method_name).fields
|
45
45
|
else
|
46
46
|
super
|
data/lib/mods_display/version.rb
CHANGED
data/spec/fields/extent_spec.rb
CHANGED
@@ -6,6 +6,7 @@ describe ModsDisplay::Extent do
|
|
6
6
|
<mods>
|
7
7
|
<physicalDescription>
|
8
8
|
<extent>Extent Value</extent>
|
9
|
+
<extent>Extent Value 2</extent>
|
9
10
|
</physicalDescription>
|
10
11
|
</mods>
|
11
12
|
XML
|
@@ -24,7 +25,7 @@ describe ModsDisplay::Extent do
|
|
24
25
|
|
25
26
|
describe 'values' do
|
26
27
|
it 'returns the text of the extent element' do
|
27
|
-
expect(subject.first.values).to eq ['Extent Value']
|
28
|
+
expect(subject.first.values).to eq ['Extent Value', 'Extent Value 2']
|
28
29
|
end
|
29
30
|
end
|
30
31
|
end
|
data/spec/fields/form_spec.rb
CHANGED
@@ -6,6 +6,7 @@ describe ModsDisplay::Form do
|
|
6
6
|
<mods>
|
7
7
|
<physicalDescription>
|
8
8
|
<form>Form Value</form>
|
9
|
+
<form>Form Value 2</form>
|
9
10
|
</physicalDescription>
|
10
11
|
</mods>
|
11
12
|
XML
|
@@ -24,7 +25,25 @@ describe ModsDisplay::Form do
|
|
24
25
|
|
25
26
|
describe 'values' do
|
26
27
|
it 'returns the text of the form element' do
|
27
|
-
expect(subject.first.values).to eq ['Form Value']
|
28
|
+
expect(subject.first.values).to eq ['Form Value', 'Form Value 2']
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'duplicated data' do
|
32
|
+
let(:mods) do
|
33
|
+
<<-XML
|
34
|
+
<mods>
|
35
|
+
<physicalDescription>
|
36
|
+
<form authority="gmd">electronic resource.</form>
|
37
|
+
<form authority="zxy">electronicresource!</form>
|
38
|
+
<form authority="marccategory">electronic Resource</form>
|
39
|
+
</physicalDescription>
|
40
|
+
</mods>
|
41
|
+
XML
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'uses only unique form values, ignore differences in case, punctuation or whitespace' do
|
45
|
+
expect(subject.first.values).to match_array ['electronic resource.']
|
46
|
+
end
|
28
47
|
end
|
29
48
|
end
|
30
49
|
end
|
@@ -5,6 +5,7 @@ def html_from_mods(xml, locale = nil)
|
|
5
5
|
model = TestModel.new
|
6
6
|
model.modsxml = xml
|
7
7
|
I18n.locale = locale if locale
|
8
|
+
I18n.fallbacks[:fr] = [:fr, :en]
|
8
9
|
TestController.new.render_mods_display(model)
|
9
10
|
end
|
10
11
|
|
@@ -53,6 +54,14 @@ describe 'HTML Output' do
|
|
53
54
|
expect(@multiple_titles.body).not_to include('<dd>Main Title</dd>')
|
54
55
|
expect(@multiple_titles.body).to include('<dd>Alternate Title</dd>')
|
55
56
|
end
|
57
|
+
|
58
|
+
it 'should allow access to the subTitle independently from the title (for use with #body or fields)' do
|
59
|
+
sub_title = @multiple_titles.subTitle
|
60
|
+
expect(sub_title.length).to eq 1
|
61
|
+
expect(sub_title.first).to be_a ModsDisplay::Values
|
62
|
+
expect(sub_title.first.label).to match(/^Alternative title/i)
|
63
|
+
expect(sub_title.first.values).to eq(['Alternate Title'])
|
64
|
+
end
|
56
65
|
end
|
57
66
|
describe 'individual fields' do
|
58
67
|
it 'should return ModsDispaly::Values for the specefied field' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mods_display
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
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: 2018-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: stanford-mods
|
@@ -227,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
227
227
|
version: '0'
|
228
228
|
requirements: []
|
229
229
|
rubyforge_project:
|
230
|
-
rubygems_version: 2.6
|
230
|
+
rubygems_version: 2.7.6
|
231
231
|
signing_key:
|
232
232
|
specification_version: 4
|
233
233
|
summary: The MODS Display gem allows implementers to configure a customized display
|