sterile 1.0.25 → 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 +4 -4
- data/.github/workflows/test.yml +4 -4
- data/.idea/inspectionProfiles/Project_Default.xml +6 -0
- data/Gemfile.lock +1 -1
- data/lib/sterile/data/smart_format_rules.rb +8 -3
- data/lib/sterile/version.rb +1 -1
- data/test/test_sterile.rb +32 -0
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3217764c5d98385b4370583410521fc77e5c6f32c9a614b40f8ad091c2d463e2
|
|
4
|
+
data.tar.gz: 968a2433301ba635902d0bd04211c88086f314d5ce09c33562c2428b0f1d4dc1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2320eebe4664211f01bef43ff1b824c55a4c3a6bb0933d45d6b5685b2d31b6e7e5a3b5269844d5b6283e41bd7a9e81865cd14cf23217960a7cee729922f07a2a
|
|
7
|
+
data.tar.gz: 7324ee22466c0e9359da028980cac6eb6640189b7c36eaef30475612c2f34aff1a5c73fe07090ec5e8df4877827eaefa72893d9ec03d55fbf79bcba4150469df
|
data/.github/workflows/test.yml
CHANGED
|
@@ -14,13 +14,13 @@ jobs:
|
|
|
14
14
|
strategy:
|
|
15
15
|
max-parallel: 3
|
|
16
16
|
matrix:
|
|
17
|
-
os: [ubuntu, macos]
|
|
18
|
-
ruby-version: [head, 3.0, 2.7, 2.5]
|
|
17
|
+
os: [ubuntu-latest, macos-latest]
|
|
18
|
+
ruby-version: [head, 3.2, 3.1, 3.0, 2.7, 2.5]
|
|
19
19
|
runs-on: ${{ matrix.os }}-latest
|
|
20
20
|
steps:
|
|
21
|
-
- uses: actions/checkout@
|
|
21
|
+
- uses: actions/checkout@v3
|
|
22
22
|
- uses: ruby/setup-ruby@v1
|
|
23
23
|
with:
|
|
24
24
|
ruby-version: ${{ matrix.ruby-version }}
|
|
25
|
-
|
|
25
|
+
bundler-cache: true
|
|
26
26
|
- run: bundle exec rake test
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<component name="InspectionProjectProfileManager">
|
|
2
|
+
<profile version="1.0">
|
|
3
|
+
<option name="myName" value="Project Default" />
|
|
4
|
+
<inspection_tool class="RubyLiteralArrayInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
|
5
|
+
</profile>
|
|
6
|
+
</component>
|
data/Gemfile.lock
CHANGED
|
@@ -23,11 +23,16 @@ module Sterile
|
|
|
23
23
|
["...", "…"],
|
|
24
24
|
["(tm)", "™"],
|
|
25
25
|
["(TM)", "™"],
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
[
|
|
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
|
["'/'", "’/‘"],
|
|
34
|
+
[/([iI][nN]\s+)\'(\d\d\D)/, "\\1’\\2"],
|
|
35
|
+
[/([iI][nN]\s+)\'(\d\d)$/, "\\1’\\2"],
|
|
31
36
|
[/\'(\d\d)(?!’|\'|[^’\'\s]+[’\'][\p{P}\p{Z}])([\p{P}\p{Z}])/, "’\\1\\2"],
|
|
32
37
|
# [/<p>"/, "<p>\\1″"],
|
|
33
38
|
[/s\'([^a-zA-Z0-9])/, "s’\\1"],
|
data/lib/sterile/version.rb
CHANGED
data/test/test_sterile.rb
CHANGED
|
@@ -86,5 +86,37 @@ class TestSterile < Minitest::Test
|
|
|
86
86
|
assert_equal "‘one’/‘two’", Sterile.smart_format("'one'/'two'")
|
|
87
87
|
end
|
|
88
88
|
|
|
89
|
+
def test_number_single_quote
|
|
90
|
+
assert_equal "War in ’24", Sterile.smart_format("War in '24")
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def test_number_single_quote_in_double_quotes
|
|
94
|
+
assert_equal "“War in ’24”", Sterile.smart_format("\"War in '24\"")
|
|
95
|
+
end
|
|
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
|
+
|
|
89
121
|
end
|
|
90
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.
|
|
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:
|
|
11
|
+
date: 2026-11-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: nokogiri
|
|
@@ -35,6 +35,7 @@ files:
|
|
|
35
35
|
- ".github/workflows/test.yml"
|
|
36
36
|
- ".gitignore"
|
|
37
37
|
- ".idea/.gitignore"
|
|
38
|
+
- ".idea/inspectionProfiles/Project_Default.xml"
|
|
38
39
|
- ".idea/misc.xml"
|
|
39
40
|
- ".idea/modules.xml"
|
|
40
41
|
- ".idea/sterile.iml"
|
|
@@ -81,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
81
82
|
- !ruby/object:Gem::Version
|
|
82
83
|
version: '0'
|
|
83
84
|
requirements: []
|
|
84
|
-
rubygems_version: 3.4.
|
|
85
|
+
rubygems_version: 3.4.22
|
|
85
86
|
signing_key:
|
|
86
87
|
specification_version: 4
|
|
87
88
|
summary: Sterilize your strings! Transliterate, generate slugs, smart format, strip
|