auto-correct 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0601f319b91d591f58b600938a273a7f2865b98c836271718addbd1113ba0ee0
4
- data.tar.gz: 36acc277500cc855010af480979dae9c47b7fa941703d5459a2c302050bbc86a
3
+ metadata.gz: 6cfd0f9b3b7e5735833941146fc8ffbc0188bf8efa6a1712057c52701f60a1ae
4
+ data.tar.gz: 344f28dd964417548579d7674b7132f341d96767eb67f4bcc623fa405249bd04
5
5
  SHA512:
6
- metadata.gz: e08ebc0e999f36ecd8b64fd82e6433044c99d53a47c80f1114557a483958647454888bfd577729805c140416e5160f0acc9ad302dbfec090807bfff919de051a
7
- data.tar.gz: 358a903572c678ea9b233c69d71e714dd5265d97d7c644c8214e838f7928656b7a86029096a1fc9181489c684d884587002593d6b8bb4c58a96d433dd8cab7ec
6
+ metadata.gz: 11a98b651910622f594359372211e3d87fed949c0a099cc0d2f286bb009f0e719ddf6ffa920ed02cc6893a1f6d3827b57a4f030150a1f83e53cd5a48dbf8043f
7
+ data.tar.gz: 3ab589612ae16edf4eb08ef9156c3b4025e3caf13b96e5497f739e11813d9011b37b2943f5b72a0afc7678d58173990f29c9eef8a7f181f08ec82749f40504c4
@@ -15,6 +15,9 @@ class AutoCorrect
15
15
 
16
16
  class << self
17
17
  FULLDATE_RE = /[\s]{0,}\d+[\s]{0,}年[\s]{0,}\d+[\s]{0,}月[\s]{0,}\d+[\s]{0,}[日号][\s]{0,}/u
18
+ DASH_HAN_RE = /([\p{Han})】」》”’])([\-]+)([\p{Han}(【「《“‘])/
19
+ LEFT_QUOTE_RE = /\s([(【「《])/
20
+ RIGHT_QUOTE_RE = /([)】」》])\s/
18
21
 
19
22
  def format(str)
20
23
  out = str
@@ -22,6 +25,7 @@ class AutoCorrect
22
25
  out = s.format(out)
23
26
  end
24
27
  out = remove_full_date_spacing(out)
28
+ out = space_dash_with_hans(out)
25
29
  out
26
30
  end
27
31
 
@@ -32,5 +36,12 @@ class AutoCorrect
32
36
  m.gsub(/\s+/, "")
33
37
  end
34
38
  end
39
+
40
+ def space_dash_with_hans(str)
41
+ str = str.gsub(DASH_HAN_RE, '\1 \2 \3')
42
+ str = str.gsub(LEFT_QUOTE_RE, '\1')
43
+ str = str.gsub(RIGHT_QUOTE_RE, '\1')
44
+ str
45
+ end
35
46
  end
36
47
  end
@@ -1,3 +1,3 @@
1
1
  class AutoCorrect
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auto-correct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luikore