improve_typography 0.1.11 → 0.1.12

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
- SHA1:
3
- metadata.gz: cec41c6f83e217ebd03670350795cf31a2ea1637
4
- data.tar.gz: 3013e3167e6a390cae35834756dcdd20a25a6281
2
+ SHA256:
3
+ metadata.gz: 444052f9e0f44575f6e7e25bfa3a73cdf934a145d4031fdd1c657608447fe828
4
+ data.tar.gz: 525d059d1f1043f6da8ad407c2f5ac6772962400a4ade6c118cc24db2d24c679
5
5
  SHA512:
6
- metadata.gz: 8590ddac3b2f8d3d19f4d70fd9a7e9792f284364dc81cb87b2601aeeffc71536c65687de540196faafb765ab383c5dd681c12537576bb3b8a247fca81af4408b
7
- data.tar.gz: 06ed93b83a3e05dac8d149dbd1ab56a7ce33b3a2e79ef329c79df47c0559924a69d6373fc0fa8522af8119136c46b0488c50c6daa1bbb3fd7124f1b1ce924274
6
+ metadata.gz: 115d8acbe0c3c573ca6fe0949ae9371838cfcd4926fee8611d468d3549a500af97c6970cd90164b05831b545dcd48e46e1ebdbe91abfa7acc0bc9c05c01429c0
7
+ data.tar.gz: b11ba1332885e995a37ad381200036ca1ec7b72c1a9327a73b33ae631773f852696823e4dfc47da0202d1d091433f2e1da1f3d06be647dc49f02b5eae27e3db2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.1.12
4
+
5
+ * Improve `Multiply` processor to match fractions
6
+ * Improve `SingleQuotes` and `DoubleQuotes` processor to respect locale
7
+
3
8
  ## 0.1.11
4
9
 
5
10
  * Fix `Nbsp` bug
data/README.md CHANGED
@@ -66,7 +66,7 @@ module ImproveTypography
66
66
  end
67
67
  ```
68
68
 
69
- ### Configuation
69
+ ### Configuration
70
70
 
71
71
  You can configure applied processors (and their order).
72
72
 
@@ -1,4 +1,9 @@
1
1
  cs:
2
2
  improve_typography:
3
+ apostrophe_sign: '’'
4
+ ellipsis_sign: '…'
5
+ multiply_sign: ' × '
6
+ em_dash_sign: '—'
7
+ en_dash_sign: ' – '
3
8
  single_quotes: '‚‘'
4
9
  double_quotes: '„“'
@@ -1,8 +1,6 @@
1
1
  module ImproveTypography
2
2
  module Processors
3
3
  class DoubleQuotes < Processor
4
- REGEXP = /["“”](.*?)["“”]/i
5
-
6
4
  def call
7
5
  replace_double_quotes
8
6
  end
@@ -10,7 +8,11 @@ module ImproveTypography
10
8
  private
11
9
 
12
10
  def replace_double_quotes
13
- str.gsub(REGEXP, "#{double_quotes[0]}\\1#{double_quotes[1]}" )
11
+ str.gsub(regexp, "#{double_quotes[0]}\\1#{double_quotes[1]}" )
12
+ end
13
+
14
+ def regexp
15
+ @regexp ||= Regexp.new("[\"#{double_quotes[0]}#{double_quotes[1]}](.*?)[\"#{double_quotes[0]}#{double_quotes[1]}](?!\\w)")
14
16
  end
15
17
 
16
18
  def double_quotes
@@ -1,7 +1,7 @@
1
1
  module ImproveTypography
2
2
  module Processors
3
3
  class MultiplySign < Processor
4
- REGEXP = /(\d+)(\s*)x(\s*)(\d+)/i
4
+ REGEXP = /(\d+|[½⅓¼⅔⅛⅜⅝⅞])(\s*)x(\s*)(\d+|[½⅓¼⅔⅛⅜⅝⅞])/i
5
5
 
6
6
  def call
7
7
  return str unless multiply_sign
@@ -1,8 +1,6 @@
1
1
  module ImproveTypography
2
2
  module Processors
3
3
  class SingleQuotes < Processor
4
- REGEXP = /['’‘](.*?)['’‘](?!\w)/i
5
-
6
4
  def call
7
5
  replace_single_quotes
8
6
  end
@@ -10,7 +8,11 @@ module ImproveTypography
10
8
  private
11
9
 
12
10
  def replace_single_quotes
13
- str.gsub(REGEXP, "#{single_quotes[0]}\\1#{single_quotes[1]}")
11
+ str.gsub(regexp, "#{single_quotes[0]}\\1#{single_quotes[1]}")
12
+ end
13
+
14
+ def regexp
15
+ @regexp ||= Regexp.new("['#{single_quotes[0]}#{single_quotes[1]}](.*?)['#{single_quotes[0]}#{single_quotes[1]}](?!\\w)")
14
16
  end
15
17
 
16
18
  def single_quotes
@@ -1,3 +1,3 @@
1
1
  module ImproveTypography
2
- VERSION = '0.1.11'.freeze
2
+ VERSION = '0.1.12'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: improve_typography
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Celizna
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-11 00:00:00.000000000 Z
11
+ date: 2018-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
164
  version: '0'
165
165
  requirements: []
166
166
  rubyforge_project:
167
- rubygems_version: 2.5.2
167
+ rubygems_version: 2.7.6
168
168
  signing_key:
169
169
  specification_version: 4
170
170
  summary: Improves typography (quotes, hyphens, etc.) of a given string. Works well