stanford-mods 1.1.2 → 1.1.3

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: a37eaf09a19f5e1e8e50891f0ef28425948e42c3
4
- data.tar.gz: f2755028e3be130cf43717add967bcee0d98b732
3
+ metadata.gz: 9722c214d739a32c67490100bccdf57afb4b65ba
4
+ data.tar.gz: 76b4d92135bba2f46582d8e88358bba16c4c8502
5
5
  SHA512:
6
- metadata.gz: fef67c154af774b7da571e1dea581f0fccb6b1be8478beded54cc3368355b5cb943fd0192d478e69303d0ca90fe339226b7f272258465142b41679a2bd97460a
7
- data.tar.gz: b4b8ca850013ed590ff79b3e5a63ec0567e65616fdfdc9486362efb2bf32dd8cd86b579687b39e720065fe43cd31b6b8b62b56db9171cd99bfe190537e3090fd
6
+ metadata.gz: 9e31936949c817eac3eba720ff0e65b5aa9ce9a423c47fc77a2e13d5782b1f7a1c65f02ee30830c2bdd0035c2aa0f1a8fb4cb0d16ccf59c42eddfec20398709c
7
+ data.tar.gz: 2a47a14e8f912f9b7e8c528107d47ea0cf19ceeea10a291ae060d442ac96474da8356f047f63ff1a7c00e3d52996dffadc434071e7e91102fbfbbee5ec17fd81
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/README.rdoc CHANGED
@@ -26,30 +26,29 @@ Or install it yourself as:
26
26
 
27
27
  1. add stanford-mods to your gemfile
28
28
  2. require 'stanford-mods'
29
- 3. (I don't think you will also need to require 'mods', but you might)
30
29
 
31
30
  > m = Stanford::Mods::Record.new
32
31
  > m.from_str('<mods><genre>ape</genre></mods>')
33
32
  > m.genre
34
- => [#<Nokogiri::XML::Element:0x3fe07b48bb24 name="genre" children=[#<Nokogiri::XML::Text:0x3fe07a09a7dc "ape">]>]
35
- > m.genre.text
36
- => "ape"
33
+ => [#<Nokogiri::XML::Element:0x3fe07b48bb24 name="genre" children=[#<Nokogiri::XML::Text:0x3fe07a09a7dc "ape">]>]
34
+ > m.genre.text
35
+ => "ape"
37
36
 
38
37
  > m.to_be_removed <-- method I wrote in stanford-mods for proof of concept
39
38
  in foo!
40
- => nil
39
+ => nil
41
40
 
42
41
  Example Using SearchWorks Mixins:
43
42
 
44
43
  > require 'stanford-mods/searchworks'
45
- > m = Stanford::Mods::Record.new
46
- > m.from_str('<mods><language><languageTerm authority="iso639-2b" type="code">dut</languageTerm></language></mods>')
47
- > m.language_facet <-- from Searchworks mixin
48
- => ['Dutch']
49
- > m.languages <-- from mods gem
50
- => ['Dutch; Flemish']
51
-
52
- ## Contributing
44
+ > m = Stanford::Mods::Record.new
45
+ > m.from_str('<mods><language><languageTerm authority="iso639-2b" type="code">dut</languageTerm></language></mods>')
46
+ > m.language_facet <-- from Searchworks mixin
47
+ => ['Dutch']
48
+ > m.languages <-- from mods gem
49
+ => ['Dutch; Flemish']
50
+
51
+ == Contributing
53
52
 
54
53
  1. Fork it
55
54
  2. Create your feature branch (`git checkout -b my-new-feature`)
data/Rakefile CHANGED
@@ -1,7 +1,5 @@
1
1
  #!/usr/bin/env rake
2
2
  require "bundler/gem_tasks"
3
-
4
- require 'rake'
5
3
  require 'bundler'
6
4
 
7
5
  require 'rspec/core/rake_task'
@@ -16,9 +14,9 @@ rescue Bundler::BundlerError => e
16
14
  exit e.status_code
17
15
  end
18
16
 
19
- task :default => :ci
17
+ task :default => :ci
20
18
 
21
- desc "run continuous integration suite (tests, coverage, docs)"
19
+ desc "run continuous integration suite (tests, coverage, docs)"
22
20
  task :ci => [:rspec, :doc]
23
21
 
24
22
  task :spec => :rspec
@@ -42,5 +40,5 @@ rescue LoadError
42
40
  task :doc do
43
41
  abort "Please install the YARD gem to generate rdoc."
44
42
  end
45
- end
43
+ end
46
44
 
@@ -12,27 +12,27 @@ name_to_xpath = {
12
12
  'type_of_resource' => '//typeOfResource/text()', # .to_s
13
13
 
14
14
  # name
15
- 'corporate_authors' => '//mods/name[@type="corporate"]', # .ea .xpath('namePart').collect{ |a| a.text }.join(' ')
16
- 'personal_authors' => '//mods/name[@type="personal"]', # .ea .xpath('namePart').collect{ |a| a.text }.join(' ')
15
+ 'corporate_authors' => '//mods/name[@type="corporate"]', # .ea .xpath('namePart').collect{ |a| a.text }.join(' ')
16
+ 'personal_authors' => '//mods/name[@type="personal"]', # .ea .xpath('namePart').collect{ |a| a.text }.join(' ')
17
17
 
18
18
  # titleInfo
19
- 'title' => '//mods/titleInfo[not(@type="alternative")]', # .first, extract_title_from_title_info(node)
20
- 'subtitle' => '//mods/titleInfo/subTitle' #.first.text
21
- 'full_title' => '//mods/titleInfo', # .first, extract_full_title_from_title_info(node)
19
+ 'title' => '//mods/titleInfo[not(@type="alternative")]', # .first, extract_title_from_title_info(node)
20
+ 'subtitle' => '//mods/titleInfo/subTitle' #.first.text
21
+ 'full_title' => '//mods/titleInfo', # .first, extract_full_title_from_title_info(node)
22
22
  'title_variant' => '//mods/titleInfo[@type="alternative"]', # .first, extract_title_from_title_info(node)
23
23
 
24
24
  # language
25
- 'language_codes' => "//language/languageTerm[@authority='iso639-2b'][@type='code']/text()",
26
- 'language_words' => "//language/languageTerm[@type='text']/text()|//language/text()",
25
+ 'language_codes' => "//language/languageTerm[@authority='iso639-2b'][@type='code']/text()",
26
+ 'language_words' => "//language/languageTerm[@type='text']/text()|//language/text()",
27
27
 
28
28
  # physicalDescription
29
- 'physical_description_extent' => '//physicalDescription/extent/text()', # .to_s
30
- 'physical_description_form' => '//physicalDescription/form/text()', # .to_s
29
+ 'physical_description_extent' => '//physicalDescription/extent/text()', # .to_s
30
+ 'physical_description_form' => '//physicalDescription/form/text()', # .to_s
31
31
  'physical_description_media_type' => '//physicalDescription/internetMediaType/text()', # .to_s
32
32
 
33
33
  # location
34
34
  'physical_location' => '//location/physicalLocation/text()', # .to_s
35
- 'location_url' => '//location/url/text()', # .to_s
35
+ 'location_url' => '//location/url/text()', # .to_s
36
36
 
37
37
  # relatedItem
38
38
  'relateditem_location_url' => '//relatedItem/location/url/text()', # .to_s
@@ -40,17 +40,17 @@ name_to_xpath = {
40
40
 
41
41
  # originInfo
42
42
  'create_start_date' => '//originInfo/dateCreated[@point="start"]/text()', #.to_s - comes from passed node, not root
43
- 'create_end_date' => '//originInfo/dateCreated[@point="end"]/text()', #.to_s - comes from passed node, not root
44
- 'date_issued' => '//originInfo/dateIssued/text()', #.to_s - comes from passed node, not root
45
- 'place_terms' => '//originInfo/place/placeTerm/text()', # .to_s put in array, then .flatten.uniq
46
- 'publishers' => '//originInfo/publisher/text()', # .to_s put in array, then .flatten.uniq
43
+ 'create_end_date' => '//originInfo/dateCreated[@point="end"]/text()', #.to_s - comes from passed node, not root
44
+ 'date_issued' => '//originInfo/dateIssued/text()', #.to_s - comes from passed node, not root
45
+ 'place_terms' => '//originInfo/place/placeTerm/text()', # .to_s put in array, then .flatten.uniq
46
+ 'publishers' => '//originInfo/publisher/text()', # .to_s put in array, then .flatten.uniq
47
47
  # pub_date / pub_year
48
48
 
49
49
  # subject
50
- 'subject_names' => '//subject/name', # .ea .xpath('namePart/text().to_a.join(' ') then .uniq
51
- 'subject_topics' => '//subject/topic/text()', # .ea .to_s as array then .uniq
50
+ 'subject_names' => '//subject/name', # .ea .xpath('namePart/text().to_a.join(' ') then .uniq
51
+ 'subject_topics' => '//subject/topic/text()', # .ea .to_s as array then .uniq
52
52
  'subject_geographic' => '//subject/geographic/text()', # .ea .to_s as array then .uniq
53
- 'subject_temporal' => '//subject/temporal/text()', # .ea .to_s as array then .uniq
53
+ 'subject_temporal' => '//subject/temporal/text()', # .ea .to_s as array then .uniq
54
54
  # # TODO: subject/temporal can be either a string or an iso8601 date
55
55
  # At some point we may need to handle date parsing here, but as a first
56
56
  # pass, just assume everything is a string
@@ -62,18 +62,17 @@ name_to_xpath = {
62
62
  # end
63
63
  # else
64
64
  'subject_title_info' => '//subject/titleInfo', # .ea extract_full_title_from_title_info(node), then .flatten.uniq
65
-
65
+
66
66
  'fulltext' => '//text()', # .collect { |n| n.to_s }.join(' ')
67
-
67
+
68
68
  # TODO: simple element variants:
69
- #
69
+ #
70
70
  # genre authority
71
71
  # accessCondition type
72
72
  # note displayLabel
73
73
  # MISSING:
74
74
  # date_created
75
-
75
+
76
76
  # TODO: collections
77
-
78
- }
79
77
 
78
+ }