neu-mods 0.2.0 → 0.3.0

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/.version +1 -1
  3. data/lib/neu/mods/projection.rb +26 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb4c30744c189d3e0b4bfc0f84bb75175685bcb142dd6dc35dc55cfbcbdaf0a2
4
- data.tar.gz: a5cd73f764edf2da97e05787788124bed168c9dba8caf997307fc53591f05661
3
+ metadata.gz: ebf2bf82cd0b9c0e5593307ecc9a986cefcb16f4035a5004f233bdd7f9d4d8ea
4
+ data.tar.gz: 7087e35df1b2f34430a53acfa49e9c97be12dd9b8bdc36b3ffa69d05e98189e0
5
5
  SHA512:
6
- metadata.gz: 785e3c7485886be0fd7946b61463e2e2b66319cf4c4f30980b6e4b2b0b8ed2ae4348be41a48caa9fbad536901a89e9c73d4d4fd005283bc2cc0dc9c9102d6ff6
7
- data.tar.gz: 7a331ed220702dbab23bd6d16637f33a3da2f431a17939647ee7d1fd21898b9cf76a4594b26300eb01f8c9ad1b50d0cabcd298cdbff9c363a01a7f7bba6229a7
6
+ metadata.gz: 63b83e54cdf64af06856fe1de2cb3763cc36a1f1f0a73403fb7836fac9e910dcd2f0ebd0a4fd5fb928b7714ddec20ad281ac1cc42b47a18fcda21cbc8ad8589f
7
+ data.tar.gz: 3d6ecb5f48c1c4cff669add4adc7bfa2a90bf29045b17bb1b1047a58f02820c85fbe303ec0c0e7665f7045e27d03531fe32759f6bc023d91032038baf4466c65
data/.version CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
@@ -45,7 +45,32 @@ module NEU
45
45
 
46
46
  optional = { ": " => parts[:subtitle], " - " => parts[:part_name], ", " => parts[:part_number] }
47
47
  suffix = optional.filter_map { |sep, val| "#{sep}#{val}" unless val.to_s.strip.empty? }.join
48
- "#{parts[:non_sort]}#{parts[:title]}#{suffix}"
48
+ "#{join_non_sort(parts[:non_sort], parts[:title])}#{suffix}"
49
+ end
50
+
51
+ # Characters that bind a nonSort to the word after it. An elided article
52
+ # takes no space -- "L'Etranger", not "L' Etranger" -- and the same holds
53
+ # for a hyphenated prefix. U+2019 is the curly apostrophe, escaped rather
54
+ # than literal to keep lib/ pure ASCII (see the source-purity spec).
55
+ NON_SORT_BINDING = ["'", "\u2019", "-"].freeze
56
+
57
+ # MODS says a nonSort carries whatever separator it needs, so the historical
58
+ # composition simply concatenated. That only holds while the authored
59
+ # trailing space survives, and it does not: #child_text canonicalizes
60
+ # whitespace on read, so `<nonSort>The </nonSort>` arrives here as "The" and
61
+ # the title came out as "TheHobbit". Composing the separator instead makes
62
+ # the output right whether or not the source kept one -- which matters,
63
+ # because an invisible trailing space is not something a curator, a
64
+ # hand-edit or a third-party producer can be relied on to preserve.
65
+ #
66
+ # Callers that DO pass the space (Atlas's access-copy model) are unaffected:
67
+ # a nonSort already ending in whitespace is joined as-is.
68
+ def self.join_non_sort(non_sort, title)
69
+ prefix = non_sort.to_s
70
+ return title.to_s if prefix.empty?
71
+ return "#{prefix}#{title}" if prefix.end_with?(" ") || prefix.end_with?(*NON_SORT_BINDING)
72
+
73
+ "#{prefix} #{title}"
49
74
  end
50
75
 
51
76
  # --- Abstract / access ---------------------------------------------------
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neu-mods
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cliff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-06-09 00:00:00.000000000 Z
11
+ date: 2026-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri