cocina_display 1.8.0 → 1.8.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b326b540fee8c0ad46a66aa4db50c2857328b08c42a57b0777b3f2e4ccc2a684
4
- data.tar.gz: e8c17b5bcee9af19b32c98a29d60424ee693131f703936dbe10c91fd9a67caa6
3
+ metadata.gz: 9b7ec735c0ad257e8313d365e8900790b9acc115f98607a61a3b4eb293a2cb9a
4
+ data.tar.gz: a9761a59329eb8095c055063ef63b5b9e9c99d1d754cc8af3b20d95f59ec1fa7
5
5
  SHA512:
6
- metadata.gz: aea3773bf3e3aa17c1e150a33da7c906f178a1814cc8c911fff1dd2cc5d08c5969970d9d68ecb07c72e29b4692654935f66b44f4445ea239ec437c5ab1e98017
7
- data.tar.gz: 409b98e5c82a5456cc137e07f5786ab2d5118ab267b5667938e0e1be9896a116b416a2bc73f077d61c4c434f83f1dc3a4f59abf05eeeb1ea3ec6195efd45aa09
6
+ metadata.gz: 1e522347186bddba536dd3139b6ce540a06724879d300caa296f96dbd29c866bc087756e3b95beb4b8b20541141b41ae60b1b892dcf49b30ffe8f26e3de67102
7
+ data.tar.gz: e87f404d0eaa5aaf3e7fbac2ff2effdfef1a644fa7ae02b4f29f9207804249eabcd25f9c992892a839a634750817d76c78e9e8f388a79a3e855f8cb5b782e23d
@@ -1,7 +1,8 @@
1
1
  # Map of language codes to language names used in Searchworks, ported from stanford-mods gem.
2
2
  # See: https://github.com/solrmarc/stanford-solr-marc/blob/master/stanford-sw/translation_maps/language_map.properties
3
3
 
4
- aaa: Afar
4
+ #???: null
5
+ aar: Afar
5
6
  abk: Abkhaz
6
7
  ace: Achinese
7
8
  ach: Acoli
@@ -11,7 +12,8 @@ afa: Afroasiatic (Other)
11
12
  afh: Afrihili (Artificial language)
12
13
  afr: Afrikaans
13
14
  ain: Ainu
14
- ajm: Aljamia
15
+ # ajm is deprecated
16
+ ajm: Aljamía
15
17
  aka: Akan
16
18
  akk: Akkadian
17
19
  alb: Albanian
@@ -24,12 +26,13 @@ anp: Angika
24
26
  apa: Apache languages
25
27
  ara: Arabic
26
28
  arc: Aramaic
27
- arg: Aragonese Spanish
29
+ arg: Aragonese
28
30
  arm: Armenian
29
31
  arn: Mapuche
30
32
  arp: Arapaho
31
33
  art: Artificial (Other)
32
34
  arw: Arawak
35
+ # ase from iso639-3
33
36
  ase: American Sign Language
34
37
  asm: Assamese
35
38
  ast: Bable
@@ -40,7 +43,7 @@ ave: Avestan
40
43
  awa: Awadhi
41
44
  aym: Aymara
42
45
  aze: Azerbaijani
43
- bad: Banda
46
+ bad: Banda languages
44
47
  bai: Bamileke languages
45
48
  bak: Bashkir
46
49
  bal: Baluchi
@@ -55,7 +58,7 @@ bem: Bemba
55
58
  ben: Bengali
56
59
  ber: Berber (Other)
57
60
  bho: Bhojpuri
58
- bih: Bihari
61
+ bih: Bihari (Other)
59
62
  bik: Bikol
60
63
  bin: Edo
61
64
  bis: Bislama
@@ -72,6 +75,7 @@ bur: Burmese
72
75
  byn: Bilin
73
76
  cad: Caddo
74
77
  cai: Central American Indian (Other)
78
+ # cam is deprecated
75
79
  cam: Khmer
76
80
  car: Carib
77
81
  cat: Catalan
@@ -83,7 +87,7 @@ chb: Chibcha
83
87
  che: Chechen
84
88
  chg: Chagatai
85
89
  chi: Chinese
86
- chk: Truk
90
+ chk: Chuukese
87
91
  chm: Mari
88
92
  chn: Chinook jargon
89
93
  cho: Choctaw
@@ -93,6 +97,7 @@ chu: Church Slavic
93
97
  chv: Chuvash
94
98
  chy: Cheyenne
95
99
  cmc: Chamic languages
100
+ cnr: Montenegrin
96
101
  cop: Coptic
97
102
  cor: Cornish
98
103
  cos: Corsican
@@ -110,8 +115,8 @@ dan: Danish
110
115
  dar: Dargwa
111
116
  day: Dayak
112
117
  del: Delaware
113
- den: Slave
114
- dgr: Dogrib
118
+ den: Slavey
119
+ dgr: Tlicho
115
120
  din: Dinka
116
121
  div: Divehi
117
122
  doi: Dogri
@@ -124,20 +129,25 @@ dyu: Dyula
124
129
  dzo: Dzongkha
125
130
  efi: Efik
126
131
  egy: Egyptian
132
+ # per RFC 5646 and ISO 15924
127
133
  egy-Egyd: Egyptian, Demotic
128
134
  eka: Ekajuk
129
135
  elx: Elamite
130
136
  eng: English
131
137
  enm: English, Middle (1100-1500)
132
138
  epo: Esperanto
139
+ # esk is deprecated
133
140
  esk: Eskimo languages
141
+ # esp is deprecated
134
142
  esp: Esperanto
135
143
  est: Estonian
144
+ # eth is deprecated
136
145
  eth: Ethiopic
137
146
  ewe: Ewe
138
147
  ewo: Ewondo
139
148
  fan: Fang
140
149
  fao: Faroese
150
+ # far is deprecated
141
151
  far: Faroese
142
152
  fat: Fanti
143
153
  fij: Fijian
@@ -146,17 +156,21 @@ fin: Finnish
146
156
  fiu: Finno-Ugrian (Other)
147
157
  fon: Fon
148
158
  fre: French
159
+ # fri is deprecated
149
160
  fri: Frisian
150
- frm: French, Middle (ca. 1400-1600)
151
- fro: French, Old (ca. 842-1400)
161
+ frm: French, Middle (ca. 1300-1600)
162
+ fro: French, Old (ca. 842-1300)
152
163
  frr: North Frisian
153
164
  frs: East Frisian
154
165
  fry: Frisian
155
166
  ful: Fula
156
167
  fur: Friulian
157
- gaa: Ga
168
+ gaa:
169
+ # gae is deprecated
158
170
  gae: Scottish Gaelic
171
+ # gag is deprecated
159
172
  gag: Galician
173
+ # gal is deprecated
160
174
  gal: Oromo
161
175
  gay: Gayo
162
176
  gba: Gbaya
@@ -176,12 +190,13 @@ gor: Gorontalo
176
190
  got: Gothic
177
191
  grb: Grebo
178
192
  grc: Greek, Ancient (to 1453)
179
- gre: Greek, Modern (1453- )
193
+ gre: Greek, Modern (1453-)
180
194
  grn: Guarani
181
195
  gsw: Swiss German
196
+ # gua is deprecated
182
197
  gua: Guarani
183
198
  guj: Gujarati
184
- gwi: Gwich'in
199
+ gwi: Gwich'in
185
200
  hai: Haida
186
201
  hat: Haitian French Creole
187
202
  hau: Hausa
@@ -189,7 +204,7 @@ haw: Hawaiian
189
204
  heb: Hebrew
190
205
  her: Herero
191
206
  hil: Hiligaynon
192
- him: Himachali
207
+ him: Western Pahari languages
193
208
  hin: Hindi
194
209
  hit: Hittite
195
210
  hmn: Hmong
@@ -212,9 +227,11 @@ inc: Indic (Other)
212
227
  ind: Indonesian
213
228
  ine: Indo-European (Other)
214
229
  inh: Ingush
230
+ # int is deprecated
215
231
  int: Interlingua (International Auxiliary Language Association)
216
232
  ipk: Inupiaq
217
233
  ira: Iranian (Other)
234
+ # iri is deprecated
218
235
  iri: Irish
219
236
  iro: Iroquoian (Other)
220
237
  ita: Italian
@@ -226,10 +243,10 @@ jrb: Judeo-Arabic
226
243
  kaa: Kara-Kalpak
227
244
  kab: Kabyle
228
245
  kac: Kachin
229
- kal: Kalatdlisut
246
+ kal: Kalâtdlisut
230
247
  kam: Kamba
231
248
  kan: Kannada
232
- kar: Karen
249
+ kar: Karen languages
233
250
  kas: Kashmiri
234
251
  kau: Kanuri
235
252
  kaw: Kawi
@@ -247,22 +264,25 @@ kok: Konkani
247
264
  kom: Komi
248
265
  kon: Kongo
249
266
  kor: Korean
250
- kos: Kusaie
267
+ kos: Kosraean
251
268
  kpe: Kpelle
252
269
  krc: Karachay-Balkar
253
270
  krl: Karelian
254
- kro: Kru
271
+ kro: Kru (Other)
255
272
  kru: Kurukh
256
273
  kua: Kuanyama
257
274
  kum: Kumyk
258
275
  kur: Kurdish
276
+ # kus is deprecated
259
277
  kus: Kusaie
260
- kut: Kutenai
278
+ kut: Kootenai
261
279
  lad: Ladino
262
- lah: Lahnda
263
- lam: Lamba
264
- lan: Occitan (post-1500)
280
+ lah: Lahndā
281
+ lam: Lamba (Zambia and Congo)
282
+ # lan is deprecated
283
+ lan: Occitan (post 1500)
265
284
  lao: Lao
285
+ # lap is deprecated
266
286
  lap: Sami
267
287
  lat: Latin
268
288
  lav: Latvian
@@ -272,11 +292,11 @@ lin: Lingala
272
292
  lit: Lithuanian
273
293
  lol: Mongo-Nkundu
274
294
  loz: Lozi
275
- ltz: Letzeburgesch
295
+ ltz: Luxembourgish
276
296
  lua: Luba-Lulua
277
297
  lub: Luba-Katanga
278
298
  lug: Ganda
279
- lui: Luiseno
299
+ lui: Luiseño
280
300
  lun: Lunda
281
301
  luo: Luo (Kenya and Tanzania)
282
302
  lus: Lushai
@@ -291,7 +311,8 @@ man: Mandingo
291
311
  mao: Maori
292
312
  map: Austronesian (Other)
293
313
  mar: Marathi
294
- mas: Masai
314
+ mas: Maasai
315
+ # max is deprecated
295
316
  max: Manx
296
317
  may: Malay
297
318
  mdf: Moksha
@@ -302,6 +323,7 @@ mic: Micmac
302
323
  min: Minangkabau
303
324
  # mis: Miscellaneous languages
304
325
  mkh: Mon-Khmer (Other)
326
+ # mla is deprecated
305
327
  mla: Malagasy
306
328
  mlg: Malagasy
307
329
  mlt: Maltese
@@ -309,9 +331,10 @@ mnc: Manchu
309
331
  mni: Manipuri
310
332
  mno: Manobo languages
311
333
  moh: Mohawk
334
+ # mol is deprecated
312
335
  mol: Moldavian
313
336
  mon: Mongolian
314
- mos: Moore
337
+ mos: Mooré
315
338
  # mul: Multiple languages
316
339
  mun: Munda (Other)
317
340
  mus: Creek
@@ -334,7 +357,7 @@ nia: Nias
334
357
  nic: Niger-Kordofanian (Other)
335
358
  niu: Niuean
336
359
  nno: Norwegian (Nynorsk)
337
- nob: Norwegian (Bokmal)
360
+ nob: Norwegian (Bokmål)
338
361
  nog: Nogai
339
362
  non: Old Norse
340
363
  nor: Norwegian
@@ -368,10 +391,10 @@ phi: Philippine (Other)
368
391
  phn: Phoenician
369
392
  pli: Pali
370
393
  pol: Polish
371
- pon: Ponape
394
+ pon: Pohnpeian
372
395
  por: Portuguese
373
396
  pra: Prakrit languages
374
- pro: Provencal (to 1500)
397
+ pro: Provençal (to 1500)
375
398
  pus: Pushto
376
399
  que: Quechua
377
400
  raj: Rajasthani
@@ -391,18 +414,22 @@ sai: South American Indian (Other)
391
414
  sal: Salishan languages
392
415
  sam: Samaritan Aramaic
393
416
  san: Sanskrit
417
+ # sao is deprecated
394
418
  sao: Samoan
395
419
  sas: Sasak
396
420
  sat: Santali
421
+ # scc is deprecated
397
422
  scc: Serbian
398
423
  scn: Sicilian Italian
399
424
  sco: Scots
425
+ # scr is deprecated
400
426
  scr: Croatian
401
427
  sel: Selkup
402
428
  sem: Semitic (Other)
403
429
  sga: Irish, Old (to 1100)
404
430
  sgn: Sign languages
405
431
  shn: Shan
432
+ # sho is deprecated
406
433
  sho: Shona
407
434
  sid: Sidamo
408
435
  sin: Sinhalese
@@ -420,6 +447,7 @@ smo: Samoan
420
447
  sms: Skolt Sami
421
448
  sna: Shona
422
449
  snd: Sindhi
450
+ # snh is deprecated
423
451
  snh: Sinhalese
424
452
  snk: Soninke
425
453
  sog: Sogdian
@@ -432,6 +460,7 @@ srn: Sranan
432
460
  srp: Serbian
433
461
  srr: Serer
434
462
  ssa: Nilo-Saharan (Other)
463
+ # sso is deprecated
435
464
  sso: Sotho
436
465
  ssw: Swazi
437
466
  suk: Sukuma
@@ -440,14 +469,18 @@ sus: Susu
440
469
  sux: Sumerian
441
470
  swa: Swahili
442
471
  swe: Swedish
472
+ # swz is deprecated
443
473
  swz: Swazi
444
474
  syc: Syriac
445
475
  syr: Syriac, Modern
476
+ # tag is deprecated
446
477
  tag: Tagalog
447
478
  tah: Tahitian
448
479
  tai: Tai (Other)
480
+ # taj is deprecated
449
481
  taj: Tajik
450
482
  tam: Tamil
483
+ # tar is deprecated
451
484
  tar: Tatar
452
485
  tat: Tatar
453
486
  tel: Telugu
@@ -458,7 +491,7 @@ tgk: Tajik
458
491
  tgl: Tagalog
459
492
  tha: Thai
460
493
  tib: Tibetan
461
- tig: Tigre
494
+ tig: Tigré
462
495
  tir: Tigrinya
463
496
  tiv: Tiv
464
497
  tkl: Tokelauan
@@ -468,10 +501,12 @@ tmh: Tamashek
468
501
  tog: Tonga (Nyasa)
469
502
  ton: Tongan
470
503
  tpi: Tok Pisin
504
+ # tru is deprecated
471
505
  tru: Truk
472
506
  tsi: Tsimshian
473
507
  tsn: Tswana
474
508
  tso: Tsonga
509
+ # tsw is deprecated
475
510
  tsw: Tswana
476
511
  tuk: Turkmen
477
512
  tum: Tumbuka
@@ -492,17 +527,17 @@ uzb: Uzbek
492
527
  vai: Vai
493
528
  ven: Venda
494
529
  vie: Vietnamese
495
- vol: Volapuk
530
+ vol: Volapük
496
531
  vot: Votic
497
532
  wak: Wakashan languages
498
- wal: Walamo
533
+ wal: Wolayta
499
534
  war: Waray
500
- was: Washo
535
+ was: Washoe
501
536
  wel: Welsh
502
- wen: Sorbian languages
537
+ wen: Sorbian (Other)
503
538
  wln: Walloon
504
539
  wol: Wolof
505
- xal: Kalmyk
540
+ xal: Oirat
506
541
  xho: Xhosa
507
542
  yao: Yao (Africa)
508
543
  yap: Yapese
@@ -513,7 +548,7 @@ zap: Zapotec
513
548
  zbl: Blissymbolics
514
549
  zen: Zenaga
515
550
  zha: Zhuang
516
- znd: Zande
551
+ znd: Zande languages
517
552
  zul: Zulu
518
553
  zun: Zuni
519
554
  # zxx: null
@@ -13,9 +13,10 @@ module CocinaDisplay
13
13
 
14
14
  # All valid coordinate data formatted for indexing into a Solr RPT field.
15
15
  # @note This type of field accommodates both points and bounding boxes.
16
+ # @note In WKT, points have longitude first, unlike {coordinates_as_point}.
16
17
  # @see https://solr.apache.org/guide/solr/latest/query-guide/spatial-search.html#rpt
17
18
  # @return [Array<String>]
18
- # @example ["POINT(34.0522 -118.2437)", "POLYGON((-118.2437 34.0522, -118.2437 34.1996, -117.9522 34.1996, -117.9522 34.0522, -118.2437 34.0522))"]
19
+ # @example ["POINT(-118.2437 34.0522)", "POLYGON((-118.2437 34.0522, -118.2437 34.1996, -117.9522 34.1996, -117.9522 34.0522, -118.2437 34.0522))"]
19
20
  def coordinates_as_wkt
20
21
  coordinate_objects.map(&:as_wkt).uniq
21
22
  end
@@ -44,7 +44,7 @@ module CocinaDisplay
44
44
  # @see CocinaDisplay::Date#value
45
45
  # @return [Array<String>]
46
46
  def value
47
- [start&.value, stop&.value]
47
+ [start&.value, stop&.value].compact
48
48
  end
49
49
 
50
50
  # Key used to sort this date range. Respects BCE/CE ordering and precision.
@@ -52,7 +52,7 @@ module CocinaDisplay
52
52
  # @see CocinaDisplay::Date#sort_key
53
53
  # @return [String]
54
54
  def sort_key
55
- [start&.sort_key, stop&.sort_key].join(" - ")
55
+ [start&.sort_key, stop&.sort_key].compact.join(" - ")
56
56
  end
57
57
 
58
58
  # Base values of start/end as single string. Used for comparison/deduping.
@@ -116,7 +116,7 @@ module CocinaDisplay
116
116
  [
117
117
  start&.decoded_value(**kwargs),
118
118
  stop&.decoded_value(**kwargs)
119
- ].uniq.join(" - ")
119
+ ].uniq.join(" - ").strip
120
120
  end
121
121
 
122
122
  # Decoded range with "BCE" or "CE" and qualifier markers applied.
@@ -139,29 +139,23 @@ module CocinaDisplay
139
139
 
140
140
  # Earliest possible date encoded in data, respecting unspecified/imprecise info.
141
141
  # @return [Date]
142
- # @return [nil] if open start
142
+ # @return [nil] if no start or stop date is parsable
143
143
  def earliest_date
144
- start&.earliest_date
144
+ start&.earliest_date || stop&.earliest_date
145
145
  end
146
146
 
147
147
  # Latest possible date encoded in data, respecting unspecified/imprecise info.
148
+ # @note If the range is open-ended, uses today's date as the end date.
148
149
  # @return [Date]
149
- # @return [nil] if open-ended range
150
+ # @return [nil] if open-ended range or stop is not parsable
150
151
  def latest_date
151
- stop&.latest_date
152
- end
153
-
154
- # Express the range as an EDTF::Interval between the start and stop dates.
155
- # @return [EDTF::Interval]
156
- def as_interval
157
- interval_start = start&.date&.edtf || "open"
158
- interval_stop = stop&.date&.edtf || "open"
159
- ::Date.edtf("#{interval_start}/#{interval_stop}")
152
+ stop&.latest_date || ::Date.today
160
153
  end
161
154
 
162
155
  # Array of all individual {Date}s that are described by the data.
163
156
  # @note Output dates will have the same precision as the input date (e.g. year vs day).
164
157
  # @note {EDTF::Set}s can be disjoint ranges; unlike {#as_range} this method will respect any gaps.
158
+ # @note If the range is open-ended, uses today's date as the end date.
165
159
  # @return [Array<Date>]
166
160
  def to_a
167
161
  start_dates = start&.to_a || []
@@ -23,7 +23,7 @@ module CocinaDisplay
23
23
  # The date portion of the imprint statement, comprising all unique dates.
24
24
  # @return [String]
25
25
  def date_str
26
- Utils.compact_and_join(unique_dates_for_display.map(&:qualified_value))
26
+ Utils.compact_and_join(unique_dates_for_display.map(&:qualified_value), delimiter: "; ")
27
27
  end
28
28
 
29
29
  # The editions portion of the imprint statement, combining all edition notes.
@@ -71,7 +71,7 @@ module CocinaDisplay
71
71
  # Remove any ranges that duplicate part of an unencoded non-range date
72
72
  ranges, singles = deduped_dates.partition { |date| date.is_a?(CocinaDisplay::Dates::DateRange) }
73
73
  unencoded_singles_dates = singles.reject(&:encoding?).flat_map(&:to_a)
74
- ranges.reject! { |range| unencoded_singles_dates.any? { |date| range.as_interval.include?(date) } }
74
+ ranges.reject! { |date_range| unencoded_singles_dates.any? { |date| date_range.as_range.include?(date) } }
75
75
 
76
76
  (singles + ranges).sort
77
77
  end
@@ -117,10 +117,10 @@ module CocinaDisplay
117
117
  # Format using the Well-Known Text (WKT) representation.
118
118
  # @note Limits decimals to 6 places.
119
119
  # @see https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry
120
- # @example "POINT(34.0522 -118.2437)"
120
+ # @example "POINT(-118.2437 34.0522)"
121
121
  # @return [String]
122
122
  def as_wkt
123
- "POINT(%.6f %.6f)" % [point.lat, point.lng]
123
+ "POINT(%.6f %.6f)" % [point.lng, point.lat]
124
124
  end
125
125
 
126
126
  # Format using the CQL ENVELOPE representation.
@@ -2,5 +2,5 @@
2
2
 
3
3
  # :nodoc:
4
4
  module CocinaDisplay
5
- VERSION = "1.8.0" # :nodoc:
5
+ VERSION = "1.8.1" # :nodoc:
6
6
  end
@@ -6,8 +6,7 @@ require "janeway"
6
6
  require "json"
7
7
  require "net/http"
8
8
  require "active_support"
9
- require "active_support/core_ext/object/blank"
10
- require "active_support/core_ext/hash/conversions"
9
+ require "active_support/core_ext"
11
10
  require "geo/coord"
12
11
  require "edtf"
13
12
  require "i18n"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocina_display
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Budak
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
10
+ date: 2026-02-13 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: janeway-jsonpath
@@ -298,7 +298,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
298
298
  - !ruby/object:Gem::Version
299
299
  version: '0'
300
300
  requirements: []
301
- rubygems_version: 4.0.3
301
+ rubygems_version: 3.6.2
302
302
  specification_version: 4
303
303
  summary: Helpers for rendering Cocina metadata
304
304
  test_files: []