mods 0.0.11 → 0.0.12
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.
- data/README.rdoc +2 -1
- data/Rakefile +1 -1
- data/lib/mods/nom_terminology.rb +17 -6
- data/lib/mods/version.rb +1 -1
- data/spec/reader_spec.rb +5 -2
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -37,7 +37,8 @@ TODO: Write usage instructions here
|
|
37
37
|
|
38
38
|
== Releases
|
39
39
|
|
40
|
-
(0.0.
|
40
|
+
(0.0.13 make namespace aware processing the default)
|
41
|
+
0.0.12 fix failing jruby test
|
41
42
|
0.0.11 fix remove xsi:schemaLocation attribute from mods element when not using namespaces
|
42
43
|
0.0.10 remove xsi:schemaLocation attribute from mods element when not using namespaces
|
43
44
|
0.0.9 implement from_nk_node as way to load record object
|
data/Rakefile
CHANGED
@@ -24,7 +24,7 @@ task :ci => [:rspec, :doc]
|
|
24
24
|
task :spec => :rspec
|
25
25
|
|
26
26
|
RSpec::Core::RakeTask.new(:rspec) do |spec|
|
27
|
-
spec.rspec_opts = ["-c", "-f progress", "-r ./spec/spec_helper.rb"]
|
27
|
+
spec.rspec_opts = ["-c", "-f progress", "--tty", "-r ./spec/spec_helper.rb"]
|
28
28
|
end
|
29
29
|
|
30
30
|
# Use yard to build docs
|
data/lib/mods/nom_terminology.rb
CHANGED
@@ -17,30 +17,34 @@ module Mods
|
|
17
17
|
class Record
|
18
18
|
|
19
19
|
# set the NOM terminology; do NOT use namespaces
|
20
|
+
# NOTES:
|
21
|
+
# 1. certain words, such as 'type' 'name' 'description' are reserved words in jruby or nokogiri
|
22
|
+
# when the terminology would use these words, a suffix of '_at' is added if it is an attribute,
|
23
|
+
# (e.g. 'type_at' for @type) and a suffix of '_el' is added if it is an element.
|
24
|
+
# 2. the underscore prefix variant terms are a way of making subterms for a node available
|
25
|
+
# to any instance of said node and are not intended to be used externally
|
20
26
|
# @param mods_ng_xml a Nokogiri::Xml::Document object containing MODS (without namespaces)
|
21
27
|
def set_terminology_no_ns(mods_ng_xml)
|
22
28
|
mods_ng_xml.set_terminology() do |t|
|
23
29
|
|
24
30
|
# FIXME: may want to deal with camelcase vs. underscore in method_missing
|
25
|
-
|
26
|
-
# These elements have no subelements - w00t!
|
27
|
-
Mods::TOP_LEVEL_ELEMENTS_SIMPLE.each { |elname|
|
28
|
-
t.send elname, :path => "/mods/#{elname}"
|
29
|
-
}
|
30
|
-
|
31
|
+
|
31
32
|
# ABSTRACT -------------------------------------------------------------------------------
|
33
|
+
t.abstract :path => '/mods/abstract'
|
32
34
|
t._abstract :path => '//abstract' do |n|
|
33
35
|
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
34
36
|
n.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
35
37
|
end
|
36
38
|
|
37
39
|
# ACCESS_CONDITION -----------------------------------------------------------------------
|
40
|
+
t.accessCondition :path => '/mods/accessCondition'
|
38
41
|
t._accessCondition :path => '//accessCondition' do |n|
|
39
42
|
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
40
43
|
n.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
41
44
|
end
|
42
45
|
|
43
46
|
# CLASSIFICATION -------------------------------------------------------------------------
|
47
|
+
t.classification :path => '/mods/classification'
|
44
48
|
t._classification :path => '//classification' do |n|
|
45
49
|
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
46
50
|
n.edition :path => '@edition', :accessor => lambda { |a| a.text }
|
@@ -50,11 +54,13 @@ module Mods
|
|
50
54
|
end
|
51
55
|
|
52
56
|
# EXTENSION ------------------------------------------------------------------------------
|
57
|
+
t.extension :path => '/mods/extension'
|
53
58
|
t._extension :path => '//extension' do |n|
|
54
59
|
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
55
60
|
end
|
56
61
|
|
57
62
|
# GENRE ----------------------------------------------------------------------------------
|
63
|
+
t.genre :path => '/mods/genre'
|
58
64
|
t._genre :path => '//genre' do |n|
|
59
65
|
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
60
66
|
n.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
@@ -65,6 +71,7 @@ module Mods
|
|
65
71
|
end
|
66
72
|
|
67
73
|
# IDENTIIER ------------------------------------------------------------------------------
|
74
|
+
t.identifier :path => '/mods/identifier'
|
68
75
|
t._identifier :path => '//identifier' do |n|
|
69
76
|
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
70
77
|
n.invalid :path => '@invalid', :accessor => lambda { |a| a.text }
|
@@ -146,6 +153,7 @@ module Mods
|
|
146
153
|
t._conference_name :path => '//name[@type="conference"]'
|
147
154
|
|
148
155
|
# NOTE ---------------------------------------------------------------------------------
|
156
|
+
t.note :path => '/mods/note'
|
149
157
|
t._note :path => '//note' do |n|
|
150
158
|
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
151
159
|
n.id_at :path => '@ID', :accessor => lambda { |a| a.text }
|
@@ -389,6 +397,7 @@ module Mods
|
|
389
397
|
end # t.subject
|
390
398
|
|
391
399
|
# TABLE_OF_CONTENTS ---------------------------------------------------------------------
|
400
|
+
t.tableOfContents :path => '/mods/tableOfContents'
|
392
401
|
t._tableOfContents :path => '//tableOfContents' do |n|
|
393
402
|
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
394
403
|
n.shareable :path => '@shareable', :accessor => lambda { |a| a.text }
|
@@ -396,6 +405,7 @@ module Mods
|
|
396
405
|
end
|
397
406
|
|
398
407
|
# TARGET_AUDIENCE -----------------------------------------------------------------------
|
408
|
+
t.targetAudience :path => '//targetAudience'
|
399
409
|
t._targetAudience :path => '//targetAudience' do |n|
|
400
410
|
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
401
411
|
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
@@ -443,6 +453,7 @@ module Mods
|
|
443
453
|
end # t._title_info
|
444
454
|
|
445
455
|
# TYPE_OF_RESOURCE --------------------------------------------------------------------
|
456
|
+
t.typeOfResource :path => '/mods/typeOfResource'
|
446
457
|
t._typeOfResource :path => '//typeOfResource' do |n|
|
447
458
|
n.collection :path => '@collection', :accessor => lambda { |a| a.text }
|
448
459
|
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
data/lib/mods/version.rb
CHANGED
data/spec/reader_spec.rb
CHANGED
@@ -94,8 +94,11 @@ describe "Mods::Reader" do
|
|
94
94
|
r = Mods::Reader.new
|
95
95
|
r.namespace_aware = true
|
96
96
|
r.from_nk_node(ng_xml)
|
97
|
-
|
98
|
-
r.mods_ng_xml.has_attribute?('
|
97
|
+
# the below are different depending on jruby or ruby ... oy
|
98
|
+
has_a = r.mods_ng_xml.has_attribute?('schemaLocation')
|
99
|
+
has_a.should == false if has_a
|
100
|
+
has = r.mods_ng_xml.has_attribute?('xsi:schemaLocation')
|
101
|
+
has_a.should == false if has_a
|
99
102
|
end
|
100
103
|
end
|
101
104
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mods
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -214,7 +214,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
214
214
|
version: '0'
|
215
215
|
segments:
|
216
216
|
- 0
|
217
|
-
hash:
|
217
|
+
hash: 926175670330081860
|
218
218
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
219
219
|
none: false
|
220
220
|
requirements:
|
@@ -223,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
223
|
version: '0'
|
224
224
|
segments:
|
225
225
|
- 0
|
226
|
-
hash:
|
226
|
+
hash: 926175670330081860
|
227
227
|
requirements: []
|
228
228
|
rubyforge_project:
|
229
229
|
rubygems_version: 1.8.24
|