mods_display 0.0.1.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +19 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +26 -0
- data/README.md +136 -0
- data/Rakefile +5 -0
- data/lib/mods_display.rb +30 -0
- data/lib/mods_display/configuration.rb +73 -0
- data/lib/mods_display/configuration/base.rb +23 -0
- data/lib/mods_display/configuration/subject.rb +11 -0
- data/lib/mods_display/controller_extension.rb +32 -0
- data/lib/mods_display/fields/abstract.rb +32 -0
- data/lib/mods_display/fields/audience.rb +7 -0
- data/lib/mods_display/fields/cartographics.rb +21 -0
- data/lib/mods_display/fields/collection.rb +21 -0
- data/lib/mods_display/fields/contents.rb +7 -0
- data/lib/mods_display/fields/description.rb +30 -0
- data/lib/mods_display/fields/field.rb +89 -0
- data/lib/mods_display/fields/format.rb +34 -0
- data/lib/mods_display/fields/identifier.rb +60 -0
- data/lib/mods_display/fields/imprint.rb +68 -0
- data/lib/mods_display/fields/language.rb +33 -0
- data/lib/mods_display/fields/location.rb +25 -0
- data/lib/mods_display/fields/name.rb +97 -0
- data/lib/mods_display/fields/note.rb +49 -0
- data/lib/mods_display/fields/related_item.rb +24 -0
- data/lib/mods_display/fields/related_location.rb +14 -0
- data/lib/mods_display/fields/subject.rb +103 -0
- data/lib/mods_display/fields/title.rb +49 -0
- data/lib/mods_display/fields/values.rb +11 -0
- data/lib/mods_display/html.rb +87 -0
- data/lib/mods_display/model_extension.rb +20 -0
- data/lib/mods_display/version.rb +3 -0
- data/mods_display.gemspec +24 -0
- data/spec/configuration/base_spec.rb +29 -0
- data/spec/fields/abstract_spec.rb +21 -0
- data/spec/fields/audience_spec.rb +21 -0
- data/spec/fields/cartographics_spec.rb +39 -0
- data/spec/fields/collection_spec.rb +31 -0
- data/spec/fields/contents_spec.rb +21 -0
- data/spec/fields/description_spec.rb +37 -0
- data/spec/fields/format_spec.rb +35 -0
- data/spec/fields/identifier_spec.rb +49 -0
- data/spec/fields/imprint_spec.rb +78 -0
- data/spec/fields/language_spec.rb +55 -0
- data/spec/fields/location_spec.rb +25 -0
- data/spec/fields/name_spec.rb +88 -0
- data/spec/fields/note_spec.rb +53 -0
- data/spec/fields/related_item_spec.rb +37 -0
- data/spec/fields/related_location_spec.rb +31 -0
- data/spec/fields/subject_spec.rb +89 -0
- data/spec/fields/title_spec.rb +47 -0
- data/spec/fixtures/cartographics_fixtures.rb +52 -0
- data/spec/fixtures/imprint_fixtures.rb +89 -0
- data/spec/fixtures/name_fixtures.rb +3 -0
- data/spec/fixtures/subjects_fixtures.rb +70 -0
- data/spec/integration/configuration_spec.rb +37 -0
- data/spec/integration/installation_spec.rb +26 -0
- data/spec/spec_helper.rb +35 -0
- metadata +182 -0
@@ -0,0 +1,53 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
def mods_display_note(mods_record)
|
4
|
+
ModsDisplay::Note.new(mods_record, ModsDisplay::Configuration::Base.new, mock("controller"))
|
5
|
+
end
|
6
|
+
|
7
|
+
describe ModsDisplay::Note do
|
8
|
+
before(:all) do
|
9
|
+
@note = Stanford::Mods::Record.new.from_str("<mods><note>Note Field</note></mods>", false).note
|
10
|
+
@display_label = Stanford::Mods::Record.new.from_str("<mods><note displayLabel='Special Label'>Note Field</note></mods>", false).note
|
11
|
+
@sor_label = Stanford::Mods::Record.new.from_str("<mods><note type='statement of responsibility'>Note Field</note></mods>", false).note
|
12
|
+
@type_label = Stanford::Mods::Record.new.from_str("<mods><note type='Some other Type'>Note Field</note></mods>", false).note
|
13
|
+
@complex_label = Stanford::Mods::Record.new.from_str("<mods><note>Note Field</note><note>2nd Note Field</note><note type='statement of responsibility'>SoR</note><note>Another Note</note></mods>", false).note
|
14
|
+
end
|
15
|
+
describe "label" do
|
16
|
+
it "should have a default label" do
|
17
|
+
mods_display_note(@note).fields.first.label.should == "Note"
|
18
|
+
end
|
19
|
+
it "should use the displayLabel attribute when one is available" do
|
20
|
+
mods_display_note(@display_label).fields.first.label.should == "Special Label"
|
21
|
+
end
|
22
|
+
it "should use get a label from a list of translations" do
|
23
|
+
mods_display_note(@sor_label).fields.first.label.should == "Statement of Responsibility"
|
24
|
+
end
|
25
|
+
it "should use use the raw type attribute if one is present" do
|
26
|
+
mods_display_note(@type_label).fields.first.label.should == "Some other Type"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "fields" do
|
31
|
+
it "should handle single values" do
|
32
|
+
fields = mods_display_note(@note).fields
|
33
|
+
fields.length.should == 1
|
34
|
+
fields.first.values.should == ["Note Field"]
|
35
|
+
end
|
36
|
+
it "should handle complex grouping" do
|
37
|
+
fields = mods_display_note(@complex_label).fields
|
38
|
+
fields.length.should == 3
|
39
|
+
fields.first.label.should == "Note"
|
40
|
+
fields.first.values.length == 2
|
41
|
+
fields.first.values.should == ["Note Field", "2nd Note Field"]
|
42
|
+
|
43
|
+
fields[1].label == "Statement of Responsibility"
|
44
|
+
fields[1].values.length == 1
|
45
|
+
fields[1].values.should == ["SoR"]
|
46
|
+
|
47
|
+
fields.last.label.should == "Note"
|
48
|
+
fields.last.values.length == 1
|
49
|
+
fields.last.values.should == ["Another Note"]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
def mods_display_item(mods_record)
|
4
|
+
ModsDisplay::RelatedItem.new(mods_record, ModsDisplay::Configuration::Base.new, mock("controller"))
|
5
|
+
end
|
6
|
+
|
7
|
+
describe ModsDisplay::RelatedItem do
|
8
|
+
before(:all) do
|
9
|
+
@item = Stanford::Mods::Record.new.from_str("<mods><relatedItem><titleInfo>A Related Item</titleInfo></relatedItem></mods>", false).related_item
|
10
|
+
@linked_item = Stanford::Mods::Record.new.from_str("<mods><relatedItem><titleInfo>A Related Item</titleInfo><location><url>http://library.stanford.edu/</url></location></relatedItem></mods>", false).related_item
|
11
|
+
@collection = Stanford::Mods::Record.new.from_str("<mods><relatedItem><titleInfo>This is a Collection</titleInfo><typeOfResource collection='yes' /></relatedItem></mods>", false).related_item
|
12
|
+
@display_label = Stanford::Mods::Record.new.from_str("<mods><relatedItem displayLabel='Special Item'><titleInfo>A Related Item</titleInfo></relatedItem></mods>", false).related_item
|
13
|
+
end
|
14
|
+
describe "label" do
|
15
|
+
it "should default to Related Item" do
|
16
|
+
mods_display_item(@item).fields.first.label.should == "Related Item"
|
17
|
+
end
|
18
|
+
it "should get the displayLabel if available" do
|
19
|
+
mods_display_item(@display_label).fields.first.label.should == "Special Item"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
describe "fields" do
|
23
|
+
it "should get a location if it is available" do
|
24
|
+
fields = mods_display_item(@item).fields
|
25
|
+
fields.length.should == 1
|
26
|
+
fields.first.values.should == ["A Related Item"]
|
27
|
+
end
|
28
|
+
it "should return a link if there is a location/url present" do
|
29
|
+
fields = mods_display_item(@linked_item).fields
|
30
|
+
fields.length.should == 1
|
31
|
+
fields.first.values.should == ["<a href='http://library.stanford.edu/'>A Related Item</a>"]
|
32
|
+
end
|
33
|
+
it "should not return any fields if the described related item is a collection" do
|
34
|
+
mods_display_item(@collection).fields.should == []
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
def mods_display_related_location(mods_record)
|
4
|
+
ModsDisplay::RelatedLocation.new(mods_record, ModsDisplay::Configuration::Base.new, mock("controller"))
|
5
|
+
end
|
6
|
+
|
7
|
+
describe ModsDisplay::RelatedLocation do
|
8
|
+
before(:all) do
|
9
|
+
@location = Stanford::Mods::Record.new.from_str("<mods><relatedItem><location>The Location</location></relatedItem></mods>", false).related_item
|
10
|
+
@non_location = Stanford::Mods::Record.new.from_str("<mods><relatedItem><title>No Location</title></relatedItem></mods>", false).related_item
|
11
|
+
@display_label = Stanford::Mods::Record.new.from_str("<mods><relatedItem displayLabel='Special Location'><location>The Location</location></relatedItem></mods>", false).related_item
|
12
|
+
end
|
13
|
+
describe "label" do
|
14
|
+
it "should default to Location" do
|
15
|
+
mods_display_related_location(@location).fields.first.label.should == "Location"
|
16
|
+
end
|
17
|
+
it "should get the displayLabel if available" do
|
18
|
+
mods_display_related_location(@display_label).label.should == "Special Location"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
describe "fields" do
|
22
|
+
it "should get a location if it is available" do
|
23
|
+
fields = mods_display_related_location(@location).fields
|
24
|
+
fields.length.should == 1
|
25
|
+
fields.first.values.should == ["The Location"]
|
26
|
+
end
|
27
|
+
it "should not return any fields if there is no location" do
|
28
|
+
mods_display_related_location(@non_location).fields.should == []
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "fixtures/subjects_fixtures"
|
3
|
+
include SubjectsFixtures
|
4
|
+
|
5
|
+
def mods_display_subject(mods_record)
|
6
|
+
config = ModsDisplay::Configuration::Subject.new do
|
7
|
+
link :link_method, "%value%"
|
8
|
+
end
|
9
|
+
ModsDisplay::Subject.new(mods_record, config, TestController.new)
|
10
|
+
end
|
11
|
+
|
12
|
+
def mods_display_hierarchical_subject(mods_record)
|
13
|
+
config = ModsDisplay::Configuration::Subject.new do
|
14
|
+
hierarchical_link true
|
15
|
+
link :link_method, "%value%"
|
16
|
+
end
|
17
|
+
ModsDisplay::Subject.new(mods_record, config, TestController.new)
|
18
|
+
end
|
19
|
+
|
20
|
+
describe ModsDisplay::Subject do
|
21
|
+
before(:all) do
|
22
|
+
@subject = Stanford::Mods::Record.new.from_str(subjects, false).subject
|
23
|
+
@emdash_subject = Stanford::Mods::Record.new.from_str(emdash_subjects, false).subject
|
24
|
+
@geo_subject = Stanford::Mods::Record.new.from_str(hierarchical_geo_subjects, false).subject
|
25
|
+
@name_subject = Stanford::Mods::Record.new.from_str(name_subjects, false).subject
|
26
|
+
@complex_subject = Stanford::Mods::Record.new.from_str(complex_subjects, false).subject
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "fields" do
|
30
|
+
it "should split individual child elments of subject into separate parts" do
|
31
|
+
fields = mods_display_subject(@subject).fields
|
32
|
+
fields.length.should == 1
|
33
|
+
fields.first.values.should == [["Jazz", "Japan", "History and criticism"]]
|
34
|
+
end
|
35
|
+
it "should split horizontalized subjects split with an emdash into separate parts" do
|
36
|
+
fields = mods_display_subject(@emdash_subject).fields
|
37
|
+
fields.length.should == 1
|
38
|
+
fields.first.values.should == [["Jazz", "Japan", "History and criticism"]]
|
39
|
+
end
|
40
|
+
it "should handle hierarchicalGeogaphic subjects properly" do
|
41
|
+
fields = mods_display_subject(@geo_subject).fields
|
42
|
+
fields.length.should == 1
|
43
|
+
fields.first.values.should == [["United States", "California", "Stanford"]]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "name subjects" do
|
48
|
+
it "should handle name subjects properly" do
|
49
|
+
fields = mods_display_subject(@name_subject).fields
|
50
|
+
fields.length.should == 1
|
51
|
+
fields.first.values.first.first.should be_a(ModsDisplay::Name::Person)
|
52
|
+
fields.first.values.first.first.name.should == "John Doe"
|
53
|
+
fields.first.values.first.first.role.should == "Depicted"
|
54
|
+
end
|
55
|
+
it "should link the name (and not the role) correctly" do
|
56
|
+
html = mods_display_subject(@name_subject).to_html
|
57
|
+
html.should match(/<a href='.*\?John Doe'>John Doe<\/a> \(Depicted\)/)
|
58
|
+
html.should match(/<a href='.*\?Anonymous People'>Anonymous People<\/a>/)
|
59
|
+
end
|
60
|
+
it "should linke the name (and not the role) correctly when linking hierarchicaly" do
|
61
|
+
html = mods_display_hierarchical_subject(@name_subject).to_html
|
62
|
+
html.should match(/<a href='.*\?John Doe'>John Doe<\/a> \(Depicted\)/)
|
63
|
+
html.should match(/<a href='.*\?John Doe Anonymous People'>Anonymous People<\/a>/)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe "to_html" do
|
68
|
+
it "should link the values when requested" do
|
69
|
+
html = mods_display_subject(@subject).to_html
|
70
|
+
html.should match(/<a href='http:\/\/library.stanford.edu\?Jazz'>Jazz<\/a>/)
|
71
|
+
html.should match(/<a href='http:\/\/library.stanford.edu\?Japan'>Japan<\/a>/)
|
72
|
+
html.should match(/<a href='http:\/\/library.stanford.edu\?History and criticism'>History and criticism<\/a>/)
|
73
|
+
end
|
74
|
+
it "does something" do
|
75
|
+
html = mods_display_hierarchical_subject(@subject).to_html
|
76
|
+
html.should match(/<a href='http:\/\/library.stanford.edu\?Jazz'>Jazz<\/a>/)
|
77
|
+
html.should match(/<a href='http:\/\/library.stanford.edu\?Jazz Japan'>Japan<\/a>/)
|
78
|
+
html.should match(/<a href='http:\/\/library.stanford.edu\?Jazz Japan History and criticism'>History and criticism<\/a>/)
|
79
|
+
end
|
80
|
+
it "should collapse fields into the same label" do
|
81
|
+
html = mods_display_subject(@complex_subject).to_html
|
82
|
+
html.scan(/<dt title='Subject'>Subject:<\/dt>/).length.should == 1
|
83
|
+
html.scan(/<dd>/).length.should == 1
|
84
|
+
html.scan(/<br\/>/).length.should == 1
|
85
|
+
html.scan(/ > /).length.should == 3
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
def mods_display_title(mods_record)
|
4
|
+
ModsDisplay::Title.new(mods_record, ModsDisplay::Configuration::Base.new, mock("controller"))
|
5
|
+
end
|
6
|
+
|
7
|
+
describe ModsDisplay::Title do
|
8
|
+
before(:all) do
|
9
|
+
@title = Stanford::Mods::Record.new.from_str("<mods><titleInfo><title>Title</title></titleInfo></mods>", false).title_info
|
10
|
+
@title_parts = Stanford::Mods::Record.new.from_str("<mods><titleInfo><nonSort>The</nonSort><title>Title</title><subTitle>For</subTitle><partName>Something</partName><partNumber>62</partNumber></titleInfo></mods>", false).title_info
|
11
|
+
@display_label = Stanford::Mods::Record.new.from_str("<mods><titleInfo displayLabel='MyTitle'><title>Title</title></titleInfo></mods>", false).title_info
|
12
|
+
@display_form = Stanford::Mods::Record.new.from_str("<mods><titleInfo><title>Title</title><displayForm>The Title of This Item</displayForm></titleInfo></mods>", false).title_info
|
13
|
+
@alt_title = Stanford::Mods::Record.new.from_str("<mods><titleInfo type='alternative'><title>Title</title></titleInfo></mods>", false).title_info
|
14
|
+
end
|
15
|
+
describe "labels" do
|
16
|
+
it "should return a default label of Title if nothing else is available" do
|
17
|
+
mods_display_title(@title).fields.first.label.should == "Title"
|
18
|
+
end
|
19
|
+
it "should return an appropriate label from the type attribute" do
|
20
|
+
mods_display_title(@alt_title).fields.first.label.should == "Alternative Title"
|
21
|
+
end
|
22
|
+
it "should return the label held in the displayLabel attribute of the titleInfo element when available" do
|
23
|
+
mods_display_title(@display_label).fields.first.label.should == "MyTitle"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
describe "fields" do
|
27
|
+
it "should return an array of label/value objects" do
|
28
|
+
values = mods_display_title(@display_label).fields
|
29
|
+
values.length.should == 1
|
30
|
+
values.first.should be_a ModsDisplay::Values
|
31
|
+
values.first.label.should == "MyTitle"
|
32
|
+
values.first.values.should == ["Title"]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
describe "text" do
|
36
|
+
it "should construct all the elements in titleInfo" do
|
37
|
+
mods_display_title(@title_parts).fields.first.values.should include "The Title : For. Something, 62"
|
38
|
+
end
|
39
|
+
it "should use the displayForm when available" do
|
40
|
+
mods_display_title(@display_form).fields.first.values.should include "The Title of This Item"
|
41
|
+
end
|
42
|
+
it "should return the basic text held in a sub element of titleInfo" do
|
43
|
+
mods_display_title(@title).fields.first.values.should include "Title"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module CartographicsFixtures
|
2
|
+
def full_cartographic
|
3
|
+
<<-MODS
|
4
|
+
<mods>
|
5
|
+
<subject>
|
6
|
+
<cartographics>
|
7
|
+
<scale>The scale</scale>
|
8
|
+
<coordinates>the coordinates</coordinates>
|
9
|
+
<projection>the projection</projection>
|
10
|
+
</cartographics>
|
11
|
+
</subject>
|
12
|
+
</mods>
|
13
|
+
MODS
|
14
|
+
end
|
15
|
+
|
16
|
+
def no_scale_cartographic
|
17
|
+
<<-MODS
|
18
|
+
<mods>
|
19
|
+
<subject>
|
20
|
+
<cartographics>
|
21
|
+
<coordinates>the coordinates</coordinates>
|
22
|
+
<projection>the projection</projection>
|
23
|
+
</cartographics>
|
24
|
+
</subject>
|
25
|
+
</mods>
|
26
|
+
MODS
|
27
|
+
end
|
28
|
+
|
29
|
+
def coordinates_only
|
30
|
+
<<-MODS
|
31
|
+
<mods>
|
32
|
+
<subject>
|
33
|
+
<cartographics>
|
34
|
+
<coordinates>the coordinates</coordinates>
|
35
|
+
</cartographics>
|
36
|
+
</subject>
|
37
|
+
</mods>
|
38
|
+
MODS
|
39
|
+
end
|
40
|
+
|
41
|
+
def scale_only
|
42
|
+
<<-MODS
|
43
|
+
<mods>
|
44
|
+
<subject>
|
45
|
+
<cartographics>
|
46
|
+
<scale>The scale</scale>
|
47
|
+
</cartographics>
|
48
|
+
</subject>
|
49
|
+
</mods>
|
50
|
+
MODS
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
module ImprintFixtures
|
2
|
+
def imprint_mods
|
3
|
+
<<-MODS
|
4
|
+
<mods>
|
5
|
+
<originInfo>
|
6
|
+
<place>A Place</place>
|
7
|
+
<publisher>A Publisher</publisher>
|
8
|
+
<dateCreated>A Create Date</dateCreated>
|
9
|
+
<dateIssued>An Issue Date</dateIssued>
|
10
|
+
<dateCaptured>A Capture Date</dateCaptured>
|
11
|
+
<dateOther>Another Date</dateOther>
|
12
|
+
</originInfo>
|
13
|
+
</mods>
|
14
|
+
MODS
|
15
|
+
end
|
16
|
+
def origin_info_mods
|
17
|
+
<<-MODS
|
18
|
+
<mods>
|
19
|
+
<originInfo>
|
20
|
+
<dateValid>A Valid Date</dateValid>
|
21
|
+
</originInfo>
|
22
|
+
<originInfo>
|
23
|
+
<edition>The Edition</edition>
|
24
|
+
</originInfo>
|
25
|
+
</mods>
|
26
|
+
MODS
|
27
|
+
end
|
28
|
+
def encoded_date
|
29
|
+
<<-MODS
|
30
|
+
<mods>
|
31
|
+
<originInfo>
|
32
|
+
<place>A Place</place>
|
33
|
+
<dateIssued encoding="an-encoding">An Encoded Date</dateIssued>
|
34
|
+
</originInfo>
|
35
|
+
</mods>
|
36
|
+
MODS
|
37
|
+
end
|
38
|
+
def only_encoded_data
|
39
|
+
<<-MODS
|
40
|
+
<mods>
|
41
|
+
<originInfo>
|
42
|
+
<dateIssued encoding="an-encoding">An Encoded Date</dateIssued>
|
43
|
+
</originInfo>
|
44
|
+
</mods>
|
45
|
+
MODS
|
46
|
+
end
|
47
|
+
def mixed_mods
|
48
|
+
<<-MODS
|
49
|
+
<mods>
|
50
|
+
<originInfo>
|
51
|
+
<place>A Place</place>
|
52
|
+
<publisher>A Publisher</publisher>
|
53
|
+
<edition>The Edition</edition>
|
54
|
+
</originInfo>
|
55
|
+
</mods>
|
56
|
+
MODS
|
57
|
+
end
|
58
|
+
def display_form
|
59
|
+
<<-MODS
|
60
|
+
<mods>
|
61
|
+
<originInfo>
|
62
|
+
<place>A Place</place>
|
63
|
+
<publisher>A Publisher</publisher>
|
64
|
+
<displayForm>The Display Form</displayForm>
|
65
|
+
</originInfo>
|
66
|
+
<originInfo displayLabel="TheLabel">
|
67
|
+
<place>A Place</place>
|
68
|
+
<publisher>A Publisher</publisher>
|
69
|
+
<displayForm>The Display Form</displayForm>
|
70
|
+
</originInfo>
|
71
|
+
</mods>
|
72
|
+
MODS
|
73
|
+
end
|
74
|
+
def display_label
|
75
|
+
<<-MODS
|
76
|
+
<mods>
|
77
|
+
<originInfo displayLabel="TheLabel">
|
78
|
+
<place>A Place</place>
|
79
|
+
<publisher>A Publisher</publisher>
|
80
|
+
</originInfo>
|
81
|
+
<originInfo displayLabel="EditionLabel">
|
82
|
+
<place>A Place</place>
|
83
|
+
<publisher>A Publisher</publisher>
|
84
|
+
<edition>The Edition</edition>
|
85
|
+
</originInfo>
|
86
|
+
</mods>
|
87
|
+
MODS
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module SubjectsFixtures
|
2
|
+
def subjects
|
3
|
+
<<-XML
|
4
|
+
<mods>
|
5
|
+
<subject>
|
6
|
+
<topic>Jazz</topic>
|
7
|
+
<geographical>Japan</geographical>
|
8
|
+
<topic>History and criticism</topic>
|
9
|
+
</subject>
|
10
|
+
</mods>
|
11
|
+
XML
|
12
|
+
end
|
13
|
+
|
14
|
+
def emdash_subjects
|
15
|
+
<<-XML
|
16
|
+
<mods>
|
17
|
+
<subject>
|
18
|
+
<topic>Jazz -- Japan -- History and criticism</topic>
|
19
|
+
</subject>
|
20
|
+
</mods>
|
21
|
+
XML
|
22
|
+
end
|
23
|
+
|
24
|
+
def hierarchical_geo_subjects
|
25
|
+
<<-XML
|
26
|
+
<mods>
|
27
|
+
<subject>
|
28
|
+
<hierarchicalGeographic>
|
29
|
+
<country>United States</country>
|
30
|
+
<state>California</state>
|
31
|
+
<city>Stanford</city>
|
32
|
+
</hierarchicalGeographic>
|
33
|
+
</subject>
|
34
|
+
</mods>
|
35
|
+
XML
|
36
|
+
end
|
37
|
+
|
38
|
+
def name_subjects
|
39
|
+
<<-XML
|
40
|
+
<mods>
|
41
|
+
<subject>
|
42
|
+
<name>
|
43
|
+
<role>
|
44
|
+
<roleTerm type='text'>Depicted</roleTerm>
|
45
|
+
</role>
|
46
|
+
<namePart>John Doe</namePart>
|
47
|
+
</name>
|
48
|
+
<topic>Anonymous People</topic>
|
49
|
+
</subject>
|
50
|
+
</mods>
|
51
|
+
XML
|
52
|
+
end
|
53
|
+
|
54
|
+
def complex_subjects
|
55
|
+
<<-XML
|
56
|
+
<mods>
|
57
|
+
<subject>
|
58
|
+
<topic>Jazz</topic>
|
59
|
+
<geographical>Japan</geographical>
|
60
|
+
<topic>History and criticism</topic>
|
61
|
+
</subject>
|
62
|
+
<subject>
|
63
|
+
<topic>Bay Area</topic>
|
64
|
+
<geographical>Stanford</geographical>
|
65
|
+
</subject>
|
66
|
+
</mods>
|
67
|
+
XML
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|