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.
- checksums.yaml +4 -4
- data/.version +1 -1
- data/lib/neu/mods/projection.rb +26 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ebf2bf82cd0b9c0e5593307ecc9a986cefcb16f4035a5004f233bdd7f9d4d8ea
|
|
4
|
+
data.tar.gz: 7087e35df1b2f34430a53acfa49e9c97be12dd9b8bdc36b3ffa69d05e98189e0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 63b83e54cdf64af06856fe1de2cb3763cc36a1f1f0a73403fb7836fac9e910dcd2f0ebd0a4fd5fb928b7714ddec20ad281ac1cc42b47a18fcda21cbc8ad8589f
|
|
7
|
+
data.tar.gz: 3d6ecb5f48c1c4cff669add4adc7bfa2a90bf29045b17bb1b1047a58f02820c85fbe303ec0c0e7665f7045e27d03531fe32759f6bc023d91032038baf4466c65
|
data/.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.3.0
|
data/lib/neu/mods/projection.rb
CHANGED
|
@@ -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]
|
|
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.
|
|
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-
|
|
11
|
+
date: 2026-08-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: nokogiri
|