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 +4 -4
- data/lib/auto-correct/format.rb +11 -0
- data/lib/auto-correct/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6cfd0f9b3b7e5735833941146fc8ffbc0188bf8efa6a1712057c52701f60a1ae
|
4
|
+
data.tar.gz: 344f28dd964417548579d7674b7132f341d96767eb67f4bcc623fa405249bd04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11a98b651910622f594359372211e3d87fed949c0a099cc0d2f286bb009f0e719ddf6ffa920ed02cc6893a1f6d3827b57a4f030150a1f83e53cd5a48dbf8043f
|
7
|
+
data.tar.gz: 3ab589612ae16edf4eb08ef9156c3b4025e3caf13b96e5497f739e11813d9011b37b2943f5b72a0afc7678d58173990f29c9eef8a7f181f08ec82749f40504c4
|
data/lib/auto-correct/format.rb
CHANGED
@@ -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
|
data/lib/auto-correct/version.rb
CHANGED