stanford-mods 3.1.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stanford-mods/concerns/origin_info.rb +6 -6
- data/lib/stanford-mods/date_parsing.rb +4 -4
- data/lib/stanford-mods/imprint.rb +8 -8
- data/lib/stanford-mods/version.rb +1 -1
- data/spec/fixtures/searchworks_imprint_data.rb +11 -11
- data/spec/fixtures/searchworks_pub_date_data.rb +14 -14
- data/spec/fixtures/spotlight_pub_date_data.rb +3 -3
- data/spec/imprint_spec.rb +11 -11
- data/spec/origin_info_spec.rb +2 -2
- data/stanford-mods.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57865ef64be3774919a58f9771243fb7f5090b09867fae098d3fa5ae6e2523cf
|
4
|
+
data.tar.gz: 1a09641f450a3739c9c61598ec4ad7a4f1f7b410c804d12df6d50530fb249cb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c86f9171a032d1349068b43f6cf1272fbdf4a24419a58f66040132d7de2ea745853707b803608ea3344a137e544eff0e7e291a7b9c3922c09fe0568c68409a5e
|
7
|
+
data.tar.gz: d031a52bb328ae6efa0e42e7050fc4f990295509e4ee0a4b4c1f93f51b2412049b16c87091f27b95a02ed95be1278ccd5cbcc11771f59272bf77f82d73bd3bb2
|
@@ -15,7 +15,7 @@ module Stanford
|
|
15
15
|
# look for a keyDate and use it if there is one; otherwise pick earliest date
|
16
16
|
# @param [Boolean] ignore_approximate true if approximate dates (per qualifier attribute) should be ignored; false if approximate dates should be included
|
17
17
|
# @return [Integer] publication year as an Integer
|
18
|
-
# @note for sorting: 5
|
18
|
+
# @note for sorting: 5 BCE => -5; 666 BCE => -666
|
19
19
|
def pub_year_int(fields = [:dateIssued, :dateCreated, :dateCaptured], ignore_approximate: false)
|
20
20
|
fields.each do |date_key|
|
21
21
|
values = mods_ng_xml.origin_info.send(date_key)
|
@@ -31,7 +31,7 @@ module Stanford
|
|
31
31
|
# look for a keyDate and use it if there is one; otherwise pick earliest date
|
32
32
|
# @param [Boolean] ignore_approximate true if approximate dates (per qualifier attribute) should be ignored; false if approximate dates should be included
|
33
33
|
# @return [String] single String containing publication year for lexical sorting
|
34
|
-
# @note for string sorting 5
|
34
|
+
# @note for string sorting 5 BCE = -5 => -995; 6 BCE => -994, so 6 BCE sorts before 5 BCE
|
35
35
|
# @deprecated use pub_year_int
|
36
36
|
def pub_year_sort_str(fields = [:dateIssued, :dateCreated, :dateCaptured], ignore_approximate: false)
|
37
37
|
fields.each do |date_key|
|
@@ -44,12 +44,12 @@ module Stanford
|
|
44
44
|
end
|
45
45
|
|
46
46
|
# return a single string intended for display of pub year
|
47
|
-
# 0 < year < 1000: add
|
48
|
-
# year < 0: add
|
47
|
+
# 0 < year < 1000: add CE suffix
|
48
|
+
# year < 0: add BCE suffix. ('-5' => '5 BCE', '700 BCE' => '700 BCE')
|
49
49
|
# 195u => 195x
|
50
50
|
# 19uu => 19xx
|
51
|
-
# '-5' => '5
|
52
|
-
# '700
|
51
|
+
# '-5' => '5 BCE'
|
52
|
+
# '700 BCE' => '700 BCE'
|
53
53
|
# '7th century' => '7th century'
|
54
54
|
# date ranges?
|
55
55
|
# prefer dateIssued (any) before dateCreated (any) before dateCaptured (any)
|
@@ -15,7 +15,7 @@ module Stanford
|
|
15
15
|
@xml = xml
|
16
16
|
end
|
17
17
|
|
18
|
-
# get display value for year, generally an explicit year or "17th century" or "5
|
18
|
+
# get display value for year, generally an explicit year or "17th century" or "5 BCE" or "1950s" or '845 CE'
|
19
19
|
# @return [String, nil] String value for year if we could parse one, nil otherwise
|
20
20
|
def date_str_for_display
|
21
21
|
date = xml&.as_object&.date
|
@@ -32,9 +32,9 @@ module Stanford
|
|
32
32
|
if !self.class.year_int_valid? date.year
|
33
33
|
xml.text
|
34
34
|
elsif date.year < 1
|
35
|
-
"#{date.year.abs + 1}
|
35
|
+
"#{date.year.abs + 1} BCE"
|
36
36
|
elsif date.year < 1000
|
37
|
-
"#{date.year}
|
37
|
+
"#{date.year} CE"
|
38
38
|
else
|
39
39
|
date.year.to_s
|
40
40
|
end
|
@@ -49,7 +49,7 @@ module Stanford
|
|
49
49
|
|
50
50
|
# get String sortable value year if we can parse date_str to get a year.
|
51
51
|
# SearchWorks currently uses a string field for pub date sorting; thus so does Spotlight.
|
52
|
-
# The values returned must *lexically* sort in chronological order, so the
|
52
|
+
# The values returned must *lexically* sort in chronological order, so the BCE dates are tricky
|
53
53
|
# @return [String, nil] String sortable year if we could parse one, nil otherwise
|
54
54
|
# note that these values must *lexically* sort to create a chronological sort.
|
55
55
|
def sortable_year_string_from_date_str
|
@@ -149,7 +149,7 @@ module Stanford
|
|
149
149
|
end
|
150
150
|
|
151
151
|
# Element text reduced to digits and hyphen. Captures date ranges and
|
152
|
-
# negative (
|
152
|
+
# negative (BCE) dates. Used for comparison/deduping.
|
153
153
|
def base_value
|
154
154
|
if text =~ /^\[?1\d{3}-\d{2}\??\]?$/
|
155
155
|
return text.sub(/(\d{2})(\d{2})-(\d{2})/, '\1\2-\1\3')
|
@@ -193,16 +193,16 @@ module Stanford
|
|
193
193
|
when :year
|
194
194
|
year = date.year
|
195
195
|
if year < 1
|
196
|
-
"#{year.abs + 1}
|
197
|
-
# Any dates before the year 1000 are explicitly marked
|
196
|
+
"#{year.abs + 1} BCE"
|
197
|
+
# Any dates before the year 1000 are explicitly marked CE
|
198
198
|
elsif year > 1 && year < 1000
|
199
|
-
"#{year}
|
199
|
+
"#{year} CE"
|
200
200
|
else
|
201
201
|
year.to_s
|
202
202
|
end
|
203
203
|
when :century
|
204
204
|
if date.year.negative?
|
205
|
-
"#{((date.year / 100).abs + 1).ordinalize} century
|
205
|
+
"#{((date.year / 100).abs + 1).ordinalize} century BCE"
|
206
206
|
else
|
207
207
|
"#{((date.year / 100) + 1).ordinalize} century"
|
208
208
|
end
|
@@ -211,7 +211,7 @@ module Stanford
|
|
211
211
|
end
|
212
212
|
end
|
213
213
|
|
214
|
-
# Decoded date with "
|
214
|
+
# Decoded date with "BCE" or "CE" and qualifier markers. See (outdated):
|
215
215
|
# https://consul.stanford.edu/display/chimera/MODS+display+rules#MODSdisplayrules-3b.%3CoriginInfo%3E
|
216
216
|
def qualified_value
|
217
217
|
qualified_format = case qualifier
|
@@ -250,7 +250,7 @@ module Stanford
|
|
250
250
|
@start&.encoding || @stop&.encoding
|
251
251
|
end
|
252
252
|
|
253
|
-
# Decoded dates with "
|
253
|
+
# Decoded dates with "BCE" or "CE" and qualifier markers applied to
|
254
254
|
# the entire range, or individually if dates differ.
|
255
255
|
def qualified_value
|
256
256
|
if @start&.qualifier == @stop&.qualifier
|
@@ -306,7 +306,7 @@ module Stanford
|
|
306
306
|
|
307
307
|
dates = dates - duplicated_ranges
|
308
308
|
|
309
|
-
# output formatted dates with qualifiers,
|
309
|
+
# output formatted dates with qualifiers, CE/BCE, etc.
|
310
310
|
dates.map(&:qualified_value)
|
311
311
|
end
|
312
312
|
end
|
@@ -700,7 +700,7 @@ SEARCHWORKS_IMPRINT_DATA = {
|
|
700
700
|
<dateIssued encoding="marc" point="start" keyDate="yes">0850</dateIssued>
|
701
701
|
<dateIssued encoding="marc" point="end">1499</dateIssued>
|
702
702
|
<issuance>monographic</issuance>' +
|
703
|
-
mods_origin_info_end_str => 'California, 850
|
703
|
+
mods_origin_info_end_str => 'California, 850 CE - 1499',
|
704
704
|
# coll rec bd001pp3337
|
705
705
|
# coll rec fn508pj9953
|
706
706
|
mods_origin_info_start_str +
|
@@ -728,7 +728,7 @@ SEARCHWORKS_IMPRINT_DATA = {
|
|
728
728
|
<dateCreated point="start" qualifier="approximate" keyDate="yes">850</dateCreated>
|
729
729
|
<dateCreated point="end" qualifier="approximate">1499</dateCreated>
|
730
730
|
<issuance>monographic</issuance>' +
|
731
|
-
mods_origin_info_end_str => 'England, [ca. 850
|
731
|
+
mods_origin_info_end_str => 'England, [ca. 850 CE - 1499]',
|
732
732
|
# sc582cv9633
|
733
733
|
mods_origin_info_start_str +
|
734
734
|
'<dateCreated keydate="yes">1314</dateCreated>
|
@@ -1055,7 +1055,7 @@ SEARCHWORKS_IMPRINT_DATA = {
|
|
1055
1055
|
<originInfo>
|
1056
1056
|
<dateCreated encoding="edtf" point="start" keyDate="yes">-18</dateCreated>
|
1057
1057
|
<dateCreated encoding="edtf" point="end">-17</dateCreated>' +
|
1058
|
-
mods_origin_info_end_str => 'Spain; 19
|
1058
|
+
mods_origin_info_end_str => 'Spain; 19 BCE - 18 BCE',
|
1059
1059
|
# bb408km1389
|
1060
1060
|
mods_origin_info_start_str +
|
1061
1061
|
' <place supplied="yes">
|
@@ -1065,7 +1065,7 @@ SEARCHWORKS_IMPRINT_DATA = {
|
|
1065
1065
|
<originInfo>
|
1066
1066
|
<dateCreated encoding="edtf" point="start" keyDate="yes">-1</dateCreated>
|
1067
1067
|
<dateCreated encoding="edtf" point="end">11</dateCreated>' +
|
1068
|
-
mods_origin_info_end_str => 'Lyon (France); 2
|
1068
|
+
mods_origin_info_end_str => 'Lyon (France); 2 BCE - 11 CE',
|
1069
1069
|
# cs470ng8064
|
1070
1070
|
mods_origin_info_start_str +
|
1071
1071
|
' <place supplied="yes">
|
@@ -1075,7 +1075,7 @@ SEARCHWORKS_IMPRINT_DATA = {
|
|
1075
1075
|
<originInfo>
|
1076
1076
|
<dateCreated encoding="edtf" point="start" keyDate="yes">-1</dateCreated>
|
1077
1077
|
<dateCreated encoding="edtf" point="end">0</dateCreated>' +
|
1078
|
-
mods_origin_info_end_str => 'Antioch (Turkey) (?); 2
|
1078
|
+
mods_origin_info_end_str => 'Antioch (Turkey) (?); 2 BCE - 1 BCE',
|
1079
1079
|
# vh834jh5059
|
1080
1080
|
mods_origin_info_start_str +
|
1081
1081
|
' <place supplied="yes">
|
@@ -1085,7 +1085,7 @@ SEARCHWORKS_IMPRINT_DATA = {
|
|
1085
1085
|
<originInfo>
|
1086
1086
|
<dateCreated encoding="edtf" point="start" keyDate="yes">13</dateCreated>
|
1087
1087
|
<dateCreated encoding="edtf" point="end">14</dateCreated>' +
|
1088
|
-
mods_origin_info_end_str => 'Lyon (France); 13
|
1088
|
+
mods_origin_info_end_str => 'Lyon (France); 13 CE - 14 CE',
|
1089
1089
|
# sk424bh9379
|
1090
1090
|
mods_origin_info_start_str +
|
1091
1091
|
' <place supplied="yes">
|
@@ -1095,7 +1095,7 @@ SEARCHWORKS_IMPRINT_DATA = {
|
|
1095
1095
|
<originInfo>
|
1096
1096
|
<dateCreated encoding="edtf" point="start" keyDate="yes">34</dateCreated>
|
1097
1097
|
<dateCreated encoding="edtf" point="end">35</dateCreated>' +
|
1098
|
-
mods_origin_info_end_str => 'Alexandria (Egypt); 34
|
1098
|
+
mods_origin_info_end_str => 'Alexandria (Egypt); 34 CE - 35 CE'
|
1099
1099
|
},
|
1100
1100
|
# rigler
|
1101
1101
|
'rumsey' =>
|
@@ -1235,7 +1235,7 @@ SEARCHWORKS_IMPRINT_DATA = {
|
|
1235
1235
|
'<dateIssued encoding="marc" point="start">800</dateIssued>
|
1236
1236
|
<dateIssued encoding="marc" point="end">1899</dateIssued>
|
1237
1237
|
<issuance>monographic</issuance>' +
|
1238
|
-
mods_origin_info_end_str => '800
|
1238
|
+
mods_origin_info_end_str => '800 CE - 1899',
|
1239
1239
|
# dc882bs3541
|
1240
1240
|
mods_origin_info_start_str +
|
1241
1241
|
'<place>
|
@@ -1245,7 +1245,7 @@ SEARCHWORKS_IMPRINT_DATA = {
|
|
1245
1245
|
<dateCreated encoding="w3cdtf" point="end" qualifier="approximate">0799</dateCreated>
|
1246
1246
|
<dateCreated encoding="w3cdtf" keyDate="yes"/>
|
1247
1247
|
<issuance>monographic</issuance>' +
|
1248
|
-
mods_origin_info_end_str => 'Egypt, [ca. 700
|
1248
|
+
mods_origin_info_end_str => 'Egypt, [ca. 700 CE - 799 CE]',
|
1249
1249
|
# hg026ds6978
|
1250
1250
|
mods_origin_info_start_str +
|
1251
1251
|
'<place>
|
@@ -1253,7 +1253,7 @@ SEARCHWORKS_IMPRINT_DATA = {
|
|
1253
1253
|
</place>
|
1254
1254
|
<dateCreated encoding="w3cdtf" keyDate="yes">0816</dateCreated>
|
1255
1255
|
<issuance>monographic</issuance>' +
|
1256
|
-
mods_origin_info_end_str => 'Central Arab lands, 816
|
1256
|
+
mods_origin_info_end_str => 'Central Arab lands, 816 CE',
|
1257
1257
|
# ch617yk2621
|
1258
1258
|
mods_origin_info_start_str +
|
1259
1259
|
'<place>
|
@@ -1273,7 +1273,7 @@ SEARCHWORKS_IMPRINT_DATA = {
|
|
1273
1273
|
<dateCreated encoding="w3cdtf" point="end" qualifier="approximate">1000</dateCreated>
|
1274
1274
|
<dateCreated encoding="w3cdtf" keyDate="yes"/>
|
1275
1275
|
<issuance>monographic</issuance>' +
|
1276
|
-
mods_origin_info_end_str => 'Byzantine Empire, [ca. 950
|
1276
|
+
mods_origin_info_end_str => 'Byzantine Empire, [ca. 950 CE - 1000]',
|
1277
1277
|
# hj537kj5737
|
1278
1278
|
mods_origin_info_start_str +
|
1279
1279
|
'<dateIssued>15th century CE</dateIssued>
|
@@ -607,7 +607,7 @@ SEARCHWORKS_PUB_DATE_DATA = {
|
|
607
607
|
mods_origin_info_start_str +
|
608
608
|
'<dateIssued encoding="marc" point="start" keyDate="yes">0850</dateIssued>' +
|
609
609
|
'<dateIssued encoding="marc" point="end">1499</dateIssued>' +
|
610
|
-
mods_origin_info_end_str => [850, '850
|
610
|
+
mods_origin_info_end_str => [850, '850 CE - 1499'],
|
611
611
|
# coll rec bd001pp3337
|
612
612
|
mods_origin_info_start_str +
|
613
613
|
'<dateIssued encoding="marc" keyDate="yes" point="start">1000</dateIssued>' +
|
@@ -637,7 +637,7 @@ SEARCHWORKS_PUB_DATE_DATA = {
|
|
637
637
|
mods_origin_info_start_str +
|
638
638
|
'<dateCreated point="start" qualifier="approximate" keyDate="yes">850</dateCreated>' +
|
639
639
|
'<dateCreated point="end" qualifier="approximate">1499</dateCreated>' +
|
640
|
-
mods_origin_info_end_str => [850, '850
|
640
|
+
mods_origin_info_end_str => [850, '850 CE - 1499'],
|
641
641
|
# sc582cv9633
|
642
642
|
mods_origin_info_start_str +
|
643
643
|
'<dateCreated keydate="yes">1314</dateCreated>' +
|
@@ -722,12 +722,12 @@ SEARCHWORKS_PUB_DATE_DATA = {
|
|
722
722
|
mods_origin_info_start_str +
|
723
723
|
'<dateCreated keyDate="yes" point="start" qualifier="approximate">199 B.C.</dateCreated>' +
|
724
724
|
'<dateCreated keyDate="yes" point="end" qualifier="approximate">100 B.C.</dateCreated>' +
|
725
|
-
mods_origin_info_end_str => [-198, '199
|
725
|
+
mods_origin_info_end_str => [-198, '199 BCE - 100 BCE'],
|
726
726
|
# ww728rz0477
|
727
727
|
mods_origin_info_start_str +
|
728
728
|
'<dateCreated keyDate="yes" point="start" qualifier="approximate">211 B.C.</dateCreated>' +
|
729
729
|
'<dateCreated keyDate="yes" point="end" qualifier="approximate">150 B.C.</dateCreated>' +
|
730
|
-
mods_origin_info_end_str => [-210, '211
|
730
|
+
mods_origin_info_end_str => [-210, '211 BCE - 150 BCE']
|
731
731
|
},
|
732
732
|
# pcc
|
733
733
|
# peace
|
@@ -796,27 +796,27 @@ SEARCHWORKS_PUB_DATE_DATA = {
|
|
796
796
|
mods_origin_info_start_str +
|
797
797
|
'<dateCreated encoding="edtf" point="start" keyDate="yes">-18</dateCreated>' +
|
798
798
|
'<dateCreated encoding="edtf" point="end">-17</dateCreated>' +
|
799
|
-
mods_origin_info_end_str => [-18, '19
|
799
|
+
mods_origin_info_end_str => [-18, '19 BCE - 17 BCE'],
|
800
800
|
# bb408km1389
|
801
801
|
mods_origin_info_start_str +
|
802
802
|
'<dateCreated encoding="edtf" point="start" keyDate="yes">-1</dateCreated>' +
|
803
803
|
'<dateCreated encoding="edtf" point="end">11</dateCreated>' +
|
804
|
-
mods_origin_info_end_str => [-1, '2
|
804
|
+
mods_origin_info_end_str => [-1, '2 BCE - 11 CE'],
|
805
805
|
# cs470ng8064
|
806
806
|
mods_origin_info_start_str +
|
807
807
|
'<dateCreated encoding="edtf" point="start" keyDate="yes">-1</dateCreated>' +
|
808
808
|
'<dateCreated encoding="edtf" point="end">0</dateCreated>' +
|
809
|
-
mods_origin_info_end_str => [-1, '2
|
809
|
+
mods_origin_info_end_str => [-1, '2 BCE - 0 CE'],
|
810
810
|
# vh834jh5059
|
811
811
|
mods_origin_info_start_str +
|
812
812
|
'<dateCreated encoding="edtf" point="start" keyDate="yes">13</dateCreated>' +
|
813
813
|
'<dateCreated encoding="edtf" point="end">14</dateCreated>' +
|
814
|
-
mods_origin_info_end_str => [13, '13
|
814
|
+
mods_origin_info_end_str => [13, '13 CE - 14 CE'],
|
815
815
|
# sk424bh9379
|
816
816
|
mods_origin_info_start_str +
|
817
817
|
'<dateCreated encoding="edtf" point="start" keyDate="yes">34</dateCreated>' +
|
818
818
|
'<dateCreated encoding="edtf" point="end">35</dateCreated>' +
|
819
|
-
mods_origin_info_end_str => [34, '34
|
819
|
+
mods_origin_info_end_str => [34, '34 CE - 35 CE']
|
820
820
|
},
|
821
821
|
# rigler
|
822
822
|
# rumsey
|
@@ -931,23 +931,23 @@ SEARCHWORKS_PUB_DATE_DATA = {
|
|
931
931
|
mods_origin_info_start_str +
|
932
932
|
'<dateIssued encoding="marc" point="start">800</dateIssued>' +
|
933
933
|
'<dateIssued encoding="marc" point="start">1899</dateIssued>' +
|
934
|
-
mods_origin_info_end_str => [800, '800
|
934
|
+
mods_origin_info_end_str => [800, '800 CE'],
|
935
935
|
# dc882bs3541
|
936
936
|
mods_origin_info_start_str +
|
937
937
|
'<dateCreated encoding="w3cdtf" point="start" qualifier="approximate" keyDate="yes">0700</dateCreated>' +
|
938
938
|
'<dateCreated encoding="w3cdtf" point="end" qualifier="approximate">0799</dateCreated>' +
|
939
939
|
'<dateCreated encoding="w3cdtf" keyDate="yes"/>' +
|
940
|
-
mods_origin_info_end_str => [700, '700
|
940
|
+
mods_origin_info_end_str => [700, '700 CE - 799 CE'],
|
941
941
|
# hg026ds6978
|
942
942
|
mods_origin_info_start_str +
|
943
943
|
'<dateCreated encoding="w3cdtf" keyDate="yes">0816</dateCreated>' +
|
944
|
-
mods_origin_info_end_str => [816, '816
|
944
|
+
mods_origin_info_end_str => [816, '816 CE'],
|
945
945
|
# ct437ht0445
|
946
946
|
mods_origin_info_start_str +
|
947
947
|
'<dateCreated encoding="w3cdtf" keyDate="yes" point="start" qualifier="approximate">0900</dateCreated>' +
|
948
948
|
'<dateCreated encoding="w3cdtf" point="end" qualifier="approximate">0999</dateCreated>' +
|
949
949
|
'<dateCreated encoding="w3cdtf" keyDate="yes"/>' +
|
950
|
-
mods_origin_info_end_str => [900, '900
|
950
|
+
mods_origin_info_end_str => [900, '900 CE - 999 CE'],
|
951
951
|
# ch617yk2621
|
952
952
|
mods_origin_info_start_str +
|
953
953
|
'<dateCreated encoding="w3cdtf" keyDate="yes" point="start" qualifier="approximate">1000</dateCreated>' +
|
@@ -959,7 +959,7 @@ SEARCHWORKS_PUB_DATE_DATA = {
|
|
959
959
|
'<dateCreated encoding="w3cdtf" keyDate="yes" point="start" qualifier="approximate">0950</dateCreated>' +
|
960
960
|
'<dateCreated encoding="w3cdtf" point="end" qualifier="approximate">1000</dateCreated>' +
|
961
961
|
'<dateCreated encoding="w3cdtf" keyDate="yes"/>' +
|
962
|
-
mods_origin_info_end_str => [950, '950
|
962
|
+
mods_origin_info_end_str => [950, '950 CE - 1000'],
|
963
963
|
# hj537kj5737
|
964
964
|
mods_origin_info_start_str +
|
965
965
|
'<dateIssued>15th century CE</dateIssued>' +
|
@@ -156,7 +156,7 @@ SPOTLIGHT_PUB_DATE_DATA = {
|
|
156
156
|
mods_origin_info_start_str +
|
157
157
|
'<dateIssued encoding="marc" point="start" keyDate="yes">0850</dateIssued>' +
|
158
158
|
'<dateIssued encoding="marc" point="end">1499</dateIssued>' +
|
159
|
-
mods_origin_info_end_str => ['0850', '850
|
159
|
+
mods_origin_info_end_str => ['0850', '850 CE'],
|
160
160
|
# nc881qb8504
|
161
161
|
mods_origin_info_start_str +
|
162
162
|
'<dateCreated point="start" qualifier="approximate" keyDate="yes">1000</dateCreated>' +
|
@@ -236,12 +236,12 @@ SPOTLIGHT_PUB_DATE_DATA = {
|
|
236
236
|
mods_origin_info_start_str +
|
237
237
|
'<dateCreated keyDate="yes" point="start" qualifier="approximate">200 B.C.</dateCreated>' +
|
238
238
|
'<dateCreated keyDate="yes" point="end" qualifier="approximate">180 B.C.</dateCreated>' +
|
239
|
-
mods_origin_info_end_str => ['-801', '200
|
239
|
+
mods_origin_info_end_str => ['-801', '200 BCE'],
|
240
240
|
# ww728rz0477
|
241
241
|
mods_origin_info_start_str +
|
242
242
|
'<dateCreated keyDate="yes" point="start" qualifier="approximate">211 B.C.</dateCreated>' +
|
243
243
|
'<dateCreated keyDate="yes" point="end" qualifier="approximate">150 B.C.</dateCreated>' +
|
244
|
-
mods_origin_info_end_str => ['-790', '211
|
244
|
+
mods_origin_info_end_str => ['-790', '211 BCE']
|
245
245
|
},
|
246
246
|
'renaissance' =>
|
247
247
|
{ # key is mods_xml; values = [pub date sortable facet value, pub date single string facet value]
|
data/spec/imprint_spec.rb
CHANGED
@@ -108,7 +108,7 @@ describe Stanford::Mods::Imprint do
|
|
108
108
|
it 'presents centuries' do
|
109
109
|
smods_rec.from_str <<-XML
|
110
110
|
#{mods_origin_info_start_str}
|
111
|
-
<dateIssued encoding="edtf">
|
111
|
+
<dateIssued encoding="edtf">18xx</dateIssued>
|
112
112
|
#{mods_origin_info_end_str}
|
113
113
|
XML
|
114
114
|
|
@@ -120,7 +120,7 @@ describe Stanford::Mods::Imprint do
|
|
120
120
|
it 'presents decades' do
|
121
121
|
smods_rec.from_str <<-XML
|
122
122
|
#{mods_origin_info_start_str}
|
123
|
-
<dateIssued encoding="edtf">
|
123
|
+
<dateIssued encoding="edtf">147x</dateIssued>
|
124
124
|
#{mods_origin_info_end_str}
|
125
125
|
XML
|
126
126
|
|
@@ -129,7 +129,7 @@ describe Stanford::Mods::Imprint do
|
|
129
129
|
expect(updated_element).to eq '1470s'
|
130
130
|
end
|
131
131
|
|
132
|
-
it 'adds
|
132
|
+
it 'adds CE to early years' do
|
133
133
|
smods_rec.from_str <<-XML
|
134
134
|
#{mods_origin_info_start_str}
|
135
135
|
<dateIssued encoding="edtf">988</dateIssued>
|
@@ -138,10 +138,10 @@ describe Stanford::Mods::Imprint do
|
|
138
138
|
|
139
139
|
imp = stanford_mods_imprint(smods_rec)
|
140
140
|
updated_element = imp.send(:date_str)
|
141
|
-
expect(updated_element).to eq '988
|
141
|
+
expect(updated_element).to eq '988 CE'
|
142
142
|
end
|
143
143
|
|
144
|
-
it 'adds
|
144
|
+
it 'adds BCE to BCE years' do
|
145
145
|
smods_rec.from_str <<-XML
|
146
146
|
#{mods_origin_info_start_str}
|
147
147
|
<dateIssued encoding="edtf">-5</dateIssued>
|
@@ -150,10 +150,10 @@ describe Stanford::Mods::Imprint do
|
|
150
150
|
|
151
151
|
imp = stanford_mods_imprint(smods_rec)
|
152
152
|
updated_element = imp.send(:date_str)
|
153
|
-
expect(updated_element).to eq '6
|
153
|
+
expect(updated_element).to eq '6 BCE'
|
154
154
|
end
|
155
155
|
|
156
|
-
it 'has special handling for the year 0 (1
|
156
|
+
it 'has special handling for the year 0 (1 BCE)' do
|
157
157
|
smods_rec.from_str <<-XML
|
158
158
|
#{mods_origin_info_start_str}
|
159
159
|
<dateIssued>0</dateIssued>
|
@@ -162,7 +162,7 @@ describe Stanford::Mods::Imprint do
|
|
162
162
|
|
163
163
|
imp = stanford_mods_imprint(smods_rec)
|
164
164
|
updated_element = imp.send(:date_str)
|
165
|
-
expect(updated_element).to eq '1
|
165
|
+
expect(updated_element).to eq '1 BCE'
|
166
166
|
end
|
167
167
|
|
168
168
|
it 'presents years + months' do
|
@@ -211,7 +211,7 @@ describe Stanford::Mods::Imprint do
|
|
211
211
|
|
212
212
|
imp = stanford_mods_imprint(smods_rec)
|
213
213
|
updated_element = imp.send(:date_str)
|
214
|
-
expect(updated_element).to eq '10th century
|
214
|
+
expect(updated_element).to eq '10th century BCE'
|
215
215
|
end
|
216
216
|
|
217
217
|
it 'handles the approximate qualifier' do
|
@@ -235,13 +235,13 @@ describe Stanford::Mods::Imprint do
|
|
235
235
|
|
236
236
|
imp = stanford_mods_imprint(smods_rec)
|
237
237
|
updated_element = imp.send(:date_str)
|
238
|
-
expect(updated_element).to eq '[322
|
238
|
+
expect(updated_element).to eq '[322 CE?]'
|
239
239
|
end
|
240
240
|
|
241
241
|
it 'handles the inferred qualifier' do
|
242
242
|
smods_rec.from_str <<-XML
|
243
243
|
#{mods_origin_info_start_str}
|
244
|
-
<dateIssued encoding="edtf" qualifier="inferred">
|
244
|
+
<dateIssued encoding="edtf" qualifier="inferred">190x</dateIssued>
|
245
245
|
#{mods_origin_info_end_str}
|
246
246
|
XML
|
247
247
|
|
data/spec/origin_info_spec.rb
CHANGED
@@ -89,7 +89,7 @@ describe "computations from /originInfo field" do
|
|
89
89
|
context '#pub_year_int' do
|
90
90
|
it_behaves_like "single pub date value", :pub_year_int, 0
|
91
91
|
# papyri - the only Spotlight data with BC dates
|
92
|
-
it '-
|
92
|
+
it '-199 for 200 B.C.' do
|
93
93
|
# hd778hw9236
|
94
94
|
mods_str = mods_origin_info_start_str +
|
95
95
|
'<dateCreated keyDate="yes" point="start" qualifier="approximate">200 B.C.</dateCreated>' +
|
@@ -98,7 +98,7 @@ describe "computations from /originInfo field" do
|
|
98
98
|
smods_rec.from_str(mods_str)
|
99
99
|
expect(smods_rec.pub_year_int).to eq(-199)
|
100
100
|
end
|
101
|
-
it '-
|
101
|
+
it '-210 for 211 B.C.' do
|
102
102
|
# ww728rz0477
|
103
103
|
mods_str = mods_origin_info_start_str +
|
104
104
|
'<dateCreated keyDate="yes" point="start" qualifier="approximate">211 B.C.</dateCreated>' +
|
data/stanford-mods.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.test_files = gem.files.grep(%r{^spec/})
|
17
17
|
gem.require_paths = ["lib"]
|
18
18
|
|
19
|
-
gem.add_dependency 'mods', '~> 3.0', '>= 3.0.
|
19
|
+
gem.add_dependency 'mods', '~> 3.0', '>= 3.0.3'
|
20
20
|
# active_support for .ordinalize, eg. 1 -> 1st, 2 -> 2nd for centuries
|
21
21
|
gem.add_dependency 'activesupport'
|
22
22
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stanford-mods
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naomi Dushay
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-07-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mods
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
version: '3.0'
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 3.0.
|
23
|
+
version: 3.0.3
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
version: '3.0'
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.0.
|
33
|
+
version: 3.0.3
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: activesupport
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -217,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
217
217
|
- !ruby/object:Gem::Version
|
218
218
|
version: '0'
|
219
219
|
requirements: []
|
220
|
-
rubygems_version: 3.
|
220
|
+
rubygems_version: 3.3.7
|
221
221
|
signing_key:
|
222
222
|
specification_version: 4
|
223
223
|
summary: Stanford specific wrangling of MODS metadata
|