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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d0b86bbdb97f4f13e926b45802613872085aa2f
4
- data.tar.gz: 3dc5f26dad672ebfc39bd6346be7d7af5215e639
3
+ metadata.gz: 3356f9e67bc37275321a30efdcaa9e96a181f58f
4
+ data.tar.gz: 48a6d0bba2ee01e056169cb78adb359fc0275460
5
5
  SHA512:
6
- metadata.gz: 27f4db1db70ef24a7a1c9f7706760e16ccced0ec83817514f7e894f29e6aad0d44b622555815778ef7ae9752cbd65ab7c422cbd8ee99fa54a952e4cf43c6d480
7
- data.tar.gz: a3752fb36fa6bf7fd83d09710bae52c1fa5e45b18c9bd281df04c92e7def72a2a9e3f373a34b0788afdc81f062df2d0e0224e0e2c3e0231ce6971cb930ac8a22
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.gsub(/(\s+)(.|\d+|.\.)(\s+)(.)/, '\1\2&nbsp;\4')
5
+ str
6
+ .gsub(/(\s+)(.|\d+|.\.)(\s+)(.)/, '\1\2&nbsp;\4') # in the middle of string
7
+ .gsub(/\A(.|\d+|.\.)(\s+)(.)/, '\1&nbsp;\3') # at the beginning of string
8
+ .gsub(/(\s+)(.|\d+|.\.)(\z|[\.?!]\z|[\.?!]\s)/, '&nbsp;\2\3') # at the end of string
6
9
  end
7
10
  end
8
11
  end
@@ -1,3 +1,3 @@
1
1
  module ImproveTypography
2
- VERSION = '0.1.3'.freeze
2
+ VERSION = '0.1.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: improve_typography
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Celizna