improve_typography 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/improve_typography/processors/nbsp.rb +4 -1
- data/lib/improve_typography/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3356f9e67bc37275321a30efdcaa9e96a181f58f
|
4
|
+
data.tar.gz: 48a6d0bba2ee01e056169cb78adb359fc0275460
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6539e909f5ce62f963cac1e8e3cc3f0751b7c9e5758b1f9ab3684e7613ccf20564ab40561480e9d2c0f24b3ea7c902d816d64d5ad27b04912aee1d9d9219e097
|
7
|
+
data.tar.gz: f4b2622c076fe28b039bef21b3e249d93a3c555132316dc92922db759695cebf7ae49cd80da53374f0bd76d6bd7afe7e44616874db150a641be14fb094eac961
|
@@ -2,7 +2,10 @@ module ImproveTypography
|
|
2
2
|
module Processors
|
3
3
|
class Nbsp < Processor
|
4
4
|
def call
|
5
|
-
str
|
5
|
+
str
|
6
|
+
.gsub(/(\s+)(.|\d+|.\.)(\s+)(.)/, '\1\2 \4') # in the middle of string
|
7
|
+
.gsub(/\A(.|\d+|.\.)(\s+)(.)/, '\1 \3') # at the beginning of string
|
8
|
+
.gsub(/(\s+)(.|\d+|.\.)(\z|[\.?!]\z|[\.?!]\s)/, ' \2\3') # at the end of string
|
6
9
|
end
|
7
10
|
end
|
8
11
|
end
|