camertron-eprun 2.0.0 → 2.0.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: 26933843a3512031c7c7d634c1fe12df78d39ee78639f673d1fb175b8df50c21
4
- data.tar.gz: 8ef34886023216ee7b39aee4d93b9fe1374c855528af2e5885be4cc4d7dd8ade
3
+ metadata.gz: d717364f04a54e9a735a051300e3e95a45da9b77ee684492dba168e2e022b399
4
+ data.tar.gz: 12d9342da34767b7f0d327d52a7a9f25b6780ea6b826b783048cc90b497c7dfd
5
5
  SHA512:
6
- metadata.gz: ce0baa5b5f798e53d8ab831f7e1865665a0aeaf673cf32cf1223dadeef983cd2cf99fc3be5415c2253370e6ae4da7a4546ba403ebb49df70a32b8e794d2aff54
7
- data.tar.gz: 06a218b4865a111ebf9696f9bd08b52bdab15a8b1eda0ea0d2250a36ab14856400dd8e11032dbd5f8cacd896238a3f99f507365e0f058165d9bfb5106907e4ea
6
+ metadata.gz: ccbe83e39877f83318a43a58879e12d274bab3f6bfb4d47f74994958302a82a733d355d14a6b2bbe8759f8c1f19d8fbffde636ef5e37143e756d6819425ffa6c
7
+ data.tar.gz: 134d37aea675f15ff462d9422a9e48de8c8a8b8069ad8ac77960b0572e5822e9ff6864091b635c05e428acaf68c39d0c212a48c6323ff88ef18607cbb2446db7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ == 2.0.1
2
+ * Fix bug in combining mark regex.
3
+
1
4
  == 2.0.0
2
5
  * Removed MRI 1.8 compatibility.
3
6
  * Big internal refactor, but same API.
data/Gemfile CHANGED
@@ -10,4 +10,5 @@ end
10
10
 
11
11
  group :test do
12
12
  gem "test-unit"
13
+ gem "m"
13
14
  end
@@ -73,11 +73,9 @@ module Eprun
73
73
  "\u0F35" \
74
74
  "\u0F37" \
75
75
  "\u0F39" \
76
- "\u0F71\u0F72" \
77
- "\u0F74" \
76
+ "\u0F71-\u0F75" \
78
77
  "\u0F7A-\u0F7D" \
79
- "\u0F80" \
80
- "\u0F82-\u0F84" \
78
+ "\u0F80-\u0F84" \
81
79
  "\u0F86\u0F87" \
82
80
  "\u0FC6" \
83
81
  "\u102E" \
@@ -73,11 +73,9 @@ module Eprun
73
73
  "\u0F35" \
74
74
  "\u0F37" \
75
75
  "\u0F39" \
76
- "\u0F71\u0F72" \
77
- "\u0F74" \
76
+ "\u0F71-\u0F75" \
78
77
  "\u0F7A-\u0F7D" \
79
- "\u0F80" \
80
- "\u0F82-\u0F84" \
78
+ "\u0F80-\u0F84" \
81
79
  "\u0F86\u0F87" \
82
80
  "\u0FC6" \
83
81
  "\u102E" \
@@ -73,11 +73,9 @@ module Eprun
73
73
  "\u0F35" \
74
74
  "\u0F37" \
75
75
  "\u0F39" \
76
- "\u0F71\u0F72" \
77
- "\u0F74" \
76
+ "\u0F71-\u0F75" \
78
77
  "\u0F7A-\u0F7D" \
79
- "\u0F80" \
80
- "\u0F82-\u0F84" \
78
+ "\u0F80-\u0F84" \
81
79
  "\u0F86\u0F87" \
82
80
  "\u0FC6" \
83
81
  "\u102E" \
@@ -73,11 +73,9 @@ module Eprun
73
73
  "\u0F35" \
74
74
  "\u0F37" \
75
75
  "\u0F39" \
76
- "\u0F71\u0F72" \
77
- "\u0F74" \
76
+ "\u0F71-\u0F75" \
78
77
  "\u0F7A-\u0F7D" \
79
- "\u0F80" \
80
- "\u0F82-\u0F84" \
78
+ "\u0F80-\u0F84" \
81
79
  "\u0F86\u0F87" \
82
80
  "\u0FC6" \
83
81
  "\u102E" \
@@ -73,11 +73,9 @@ module Eprun
73
73
  "\u0F35" \
74
74
  "\u0F37" \
75
75
  "\u0F39" \
76
- "\u0F71\u0F72" \
77
- "\u0F74" \
76
+ "\u0F71-\u0F75" \
78
77
  "\u0F7A-\u0F7D" \
79
- "\u0F80" \
80
- "\u0F82-\u0F84" \
78
+ "\u0F80-\u0F84" \
81
79
  "\u0F86\u0F87" \
82
80
  "\u0FC6" \
83
81
  "\u102E" \
data/lib/eprun/version.rb CHANGED
@@ -5,7 +5,7 @@
5
5
  # (see http://www.ruby-lang.org/en/LICENSE.txt)
6
6
 
7
7
  module Eprun
8
- VERSION = "2.0.0"
8
+ VERSION = "2.0.1"
9
9
  UCD_VERSIONS = [
10
10
  "18.0.0",
11
11
  "17.0.0",
data/lib/eprun.rb CHANGED
@@ -17,11 +17,11 @@ module Eprun
17
17
 
18
18
  class << self
19
19
  def current_version
20
- Thread.current[:__eprun_current_version__]
20
+ Fiber[:__eprun_current_version__]
21
21
  end
22
22
 
23
23
  def current_version=(new_version)
24
- Thread.current[:__eprun_current_version__] = Eprun::UcdVersion.get(new_version)
24
+ Fiber[:__eprun_current_version__] = Eprun::UcdVersion.get(new_version)
25
25
  end
26
26
 
27
27
  def normalize(*args)
@@ -58,7 +58,11 @@ class TestNormalize < Test::Unit::TestCase
58
58
  end
59
59
  end
60
60
 
61
- Eprun::UCD_VERSIONS.each do |ucd_version|
61
+ def self.ucd_versions
62
+ Array(ENV.fetch("UCD_VERSION", Eprun::UCD_VERSIONS))
63
+ end
64
+
65
+ ucd_versions.each do |ucd_version|
62
66
  Eprun.with_version(ucd_version) do
63
67
  # source; NFC; NFD; NFKC; NFKD
64
68
  #
@@ -147,7 +151,7 @@ class TestNormalize < Test::Unit::TestCase
147
151
  end
148
152
  end
149
153
 
150
- Eprun::UCD_VERSIONS.each do |ucd_version|
154
+ ucd_versions.each do |ucd_version|
151
155
  Eprun.with_version(ucd_version) do
152
156
  generate_test_check_true :NFC, :nfc
153
157
  generate_test_check_true :NFD, :nfd
@@ -195,4 +199,24 @@ class TestNormalize < Test::Unit::TestCase
195
199
  assert_equal utf8('\u1100\u1161\u0323\u0300'), Eprun.normalize(utf8('\uAC00\u0300\u0323'), :nfd)
196
200
  assert_equal utf8('\u1100\u1161\u0323\u0300'), Eprun.normalize(utf8('\u1100\u1161\u0300\u0323'), :nfd)
197
201
  end
202
+
203
+ def test_combining_sequences_ordered_together
204
+ # The following example comes from the Unicode collation tests. In this example,
205
+ # the 0F81 decomposes into 0F71 0F80, which have combining classes of 129 and 130
206
+ # respectively. The 0591 that comes logically earlier in the codepoint sequence
207
+ # has a combining class of 220. Because Ruby's NFD normalization algorithm decomposes
208
+ # subsections of the string rather than the entire string at once, earlier
209
+ # implementations processed 0FB2 and 0591 in isolation, which generated a string
210
+ # with combining classes 0 220 129 130 0, which is not the correct canonical order;
211
+ # 0591 (combining class of 220) should be ordered after 0F80 (combining class of
212
+ # 130). This test ensures correct ordering is observed for such cases.
213
+ a = "\u0FB2\u0591\u0F81\u0061"
214
+ assert_equal("\u0FB2\u0F71\u0F80\u0591\u0061", Eprun.normalize(a, :nfd))
215
+
216
+ # This tests that the logic above holds when the sequence starts with a decomposition
217
+ # starter. 00C0 decomposes to 0041 0300 and 0F81 decomposes to 0F71 0F80, all of
218
+ # which have combining classes > 0 and must be ordered with 0591.
219
+ a = "\u00C0\u0591\u0F81"
220
+ assert_equal("\u0041\u0F71\u0F80\u0591\u0300", Eprun.normalize(a, :nfd))
221
+ end
198
222
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: camertron-eprun
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ayumu Nojima (野島 歩)
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  requirements: []
63
- rubygems_version: 4.0.3
63
+ rubygems_version: 4.0.23
64
64
  specification_version: 4
65
65
  summary: Efficient pure Ruby Unicode normalization.
66
66
  test_files: []