sterile 1.0.26 → 1.0.27

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: 80dc35ba4862f316494b3de4c438279931d258e93c8bb82d8efe61e69706855c
4
- data.tar.gz: f3a78cdfd802b5dae8ffb91a838eb931b02328f154dfb4aed6fde64bc0ced030
3
+ metadata.gz: 3217764c5d98385b4370583410521fc77e5c6f32c9a614b40f8ad091c2d463e2
4
+ data.tar.gz: 968a2433301ba635902d0bd04211c88086f314d5ce09c33562c2428b0f1d4dc1
5
5
  SHA512:
6
- metadata.gz: b426ba9b0c9281bd9fac1e8fb568470eed98ef9aabab6965c61ca16848f67a8252e0f28350ee46ae0dfafef6fe4ebcbd51f9bb7e485b602235c5db2c19a48e67
7
- data.tar.gz: 4270732de1d8ae39317f94fc374848021e14806205c183e52787f2a243507a55de4d8b211adefd8c0cb1e1b4a1c380172fec3eda6e889d11c2ee0c88ba75bc68
6
+ metadata.gz: 2320eebe4664211f01bef43ff1b824c55a4c3a6bb0933d45d6b5685b2d31b6e7e5a3b5269844d5b6283e41bd7a9e81865cd14cf23217960a7cee729922f07a2a
7
+ data.tar.gz: 7324ee22466c0e9359da028980cac6eb6640189b7c36eaef30475612c2f34aff1a5c73fe07090ec5e8df4877827eaefa72893d9ec03d55fbf79bcba4150469df
@@ -23,9 +23,12 @@ module Sterile
23
23
  ["...", "…"],
24
24
  ["(tm)", "™"],
25
25
  ["(TM)", "™"],
26
- ["(c)", "©"],
27
- ["(r)", "®"],
28
- ["(R)", "®"],
26
+ # Only where it's clearly a copyright notice, so list markers like
27
+ # "(a) … (b) … (c) …" survive.
28
+ [/\([cC]\)(?=[\p{Z}\s]*\d)/, "©"],
29
+ [/(copyright[\p{Z}\s]+)\([cC]\)/i, "\\1©"],
30
+ # Only when attached to the preceding word (e.g. "Acme(R)").
31
+ [/(?<=[^\p{Z}\s(])\([rR]\)/, "®"],
29
32
  ['"/"', "”/“"],
30
33
  ["'/'", "’/‘"],
31
34
  [/([iI][nN]\s+)\'(\d\d\D)/, "\\1’\\2"],
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  module Sterile
4
- VERSION = "1.0.26"
4
+ VERSION = "1.0.27"
5
5
  end
6
6
 
data/test/test_sterile.rb CHANGED
@@ -94,5 +94,29 @@ class TestSterile < Minitest::Test
94
94
  assert_equal "“War in ’24”", Sterile.smart_format("\"War in '24\"")
95
95
  end
96
96
 
97
+ def test_copyright_symbol
98
+ assert_equal "© 2016 PCG", Sterile.smart_format("(c) 2016 PCG")
99
+ assert_equal "©2016", Sterile.smart_format("(c)2016")
100
+ assert_equal "© 2016", Sterile.smart_format("(C) 2016")
101
+ assert_equal "Copyright © PCG", Sterile.smart_format("Copyright (c) PCG")
102
+ assert_equal "copyright © PCG", Sterile.smart_format("copyright (C) PCG")
103
+ end
104
+
105
+ def test_enumerated_c_is_not_copyright
106
+ s = "(a) a king, (b) people, within (c) a territory, with (d) laws"
107
+ assert_equal s, Sterile.smart_format(s)
108
+ assert_equal "(c) the third point", Sterile.smart_format("(c) the third point")
109
+ end
110
+
111
+ def test_registered_symbol
112
+ assert_equal "Acme® widgets", Sterile.smart_format("Acme(r) widgets")
113
+ assert_equal "Acme®", Sterile.smart_format("Acme(R)")
114
+ end
115
+
116
+ def test_enumerated_r_is_not_registered
117
+ s = "(q) one, (r) two"
118
+ assert_equal s, Sterile.smart_format(s)
119
+ end
120
+
97
121
  end
98
122
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sterile
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.26
4
+ version: 1.0.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Hogan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-20 00:00:00.000000000 Z
11
+ date: 2026-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  requirements: []
85
- rubygems_version: 3.5.3
85
+ rubygems_version: 3.4.22
86
86
  signing_key:
87
87
  specification_version: 4
88
88
  summary: Sterilize your strings! Transliterate, generate slugs, smart format, strip