evil-front 0.3.5 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba55945f1cb274a3d38c7f889d313003b655183a
4
- data.tar.gz: 178093d89c225102612fed3db08386c6509d1384
3
+ metadata.gz: cbe12fe2c6e73339048942e618cd2d71af5a0a48
4
+ data.tar.gz: 6d44c469fed3bf9e79e105d717707011e21ff359
5
5
  SHA512:
6
- metadata.gz: d3d1e7166034f87df59b88da4f62add0c30900d102bc06f5320a0a4112da16c91ca749869a541df9193216f225a8833b6b4a0ff82dd25e60ebf770d86e2402da
7
- data.tar.gz: d212df5fee7afd603674eba0cd6cc471944badd250d5aec0d45ee953b7078a9a14a8610158f817aaf3807edd530d064f5f565e51e50cd0f6be38ec94dcf26643
6
+ metadata.gz: 8d053af5722b38cb46ae0daeb7c0947bb78cbadb5adf8078d1c48b95b63386f557dcfd352b6e71966228f1b39731a01ba97339966df4ee13cebf56b388347f06
7
+ data.tar.gz: 1135cbdff9e14a8c864d4dcfb221561cff3362bb32f28cd6f5bc94d125ee7a8638bb7a57f6bcdc1b8c92dfc61f2bd467f6c6011afc7fc364b29b3371720564f5
data/ChangeLog.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.3.6
2
+
3
+ * Russian typograph inserts non-break space before m-dash.
4
+
1
5
  ## 0.3.5
2
6
 
3
7
  * `$.fn.evil.ajax` and `$.fn.evil.tappable` return element’s jQuery node
@@ -37,7 +37,7 @@ module EvilFront
37
37
  @tiny_words ||= begin
38
38
  tiny = %w(ни не и но а или да как из-за про по за для
39
39
  на до при меж о у в во с со от ото из без
40
- безо к ко об обо под подо над перед передо)
40
+ безо к ко об обо под подо над перед передо это)
41
41
  tiny += tiny.map { |i| capitalize_first(i) }
42
42
  tiny.map { |i| Regexp.new("( | )(#{Regexp.quote i}) ") }
43
43
  end
@@ -46,6 +46,7 @@ module EvilFront
46
46
  # Replace symbols to right ones, like m-dash, quotes, etc.
47
47
  def self.use_right_symbols(text)
48
48
  StandaloneTypograf::Typograf.new(text).prepare
49
+ .gsub(' —', ' —') # nbsp before m-dash
49
50
  end
50
51
  end
51
52
  end
@@ -1,3 +1,3 @@
1
1
  module EvilFront
2
- VERSION = '0.3.5' unless defined? EvilFront::VERSION
2
+ VERSION = '0.3.6' unless defined? EvilFront::VERSION
3
3
  end
data/spec/english_spec.rb CHANGED
@@ -3,23 +3,26 @@
3
3
  require_relative 'spec_helper'
4
4
 
5
5
  describe EvilFront::English do
6
+ def nbsp_mark_typograph(str)
7
+ EvilFront::English.typograph(str).gsub(' ', '_')
8
+ end
6
9
 
7
10
  describe 'typograph' do
8
11
 
9
12
  it 'changes quotes' do
10
- EvilFront::English.typograph('"a".').should == '“a”.'
13
+ nbsp_mark_typograph('"a".').should == '“a”.'
11
14
  end
12
15
 
13
16
  it 'changes dashes' do
14
- EvilFront::English.typograph('a - b').should == 'a - b'
17
+ nbsp_mark_typograph('a - b').should == 'a - b'
15
18
  end
16
19
 
17
20
  it 'changes ellipsis' do
18
- EvilFront::English.typograph('a...').should == 'a…'
21
+ nbsp_mark_typograph('a...').should == 'a…'
19
22
  end
20
23
 
21
24
  it 'inserts non-break spaces' do
22
- EvilFront::English.typograph('he is a hero').should == 'he is a hero'
25
+ nbsp_mark_typograph('he is a hero').should == 'he is_a_hero'
23
26
  end
24
27
 
25
28
  end
data/spec/helpers_spec.rb CHANGED
@@ -64,8 +64,8 @@ describe EvilFront::Helpers do
64
64
  describe 'russian_typograph' do
65
65
 
66
66
  it 'typographs text inside tags' do
67
- tag = '<a title="а - б">а - б</a>'.html_safe
68
- russian_typograph(tag).should == '<a title="а - б">а — б</a>'
67
+ tag = '<a title="а...">а...</a>'.html_safe
68
+ russian_typograph(tag).should == '<a title="а...">а…</a>'
69
69
  end
70
70
 
71
71
  it 'escapes HTML' do
data/spec/russian_spec.rb CHANGED
@@ -54,22 +54,25 @@ describe EvilFront::Russian do
54
54
  end
55
55
 
56
56
  describe 'typograph' do
57
+ def nbsp_mark_typograph(str)
58
+ EvilFront::Russian.typograph(str).gsub(' ', '_')
59
+ end
57
60
 
58
61
  it 'changes quotes' do
59
- EvilFront::Russian.typograph('сказал "смотри "зорко"".').should ==
62
+ nbsp_mark_typograph('сказал "смотри "зорко"".').should ==
60
63
  'сказал «смотри „зорко“».'
61
64
  end
62
65
 
63
66
  it 'changes dashes' do
64
- EvilFront::Russian.typograph('а - это б').should == 'а — это б'
67
+ nbsp_mark_typograph('а - это б').should == 'а_— это_б'
65
68
  end
66
69
 
67
70
  it 'changes ellipsis' do
68
- EvilFront::Russian.typograph('а...').should == 'а…'
71
+ nbsp_mark_typograph('а...').should == 'а…'
69
72
  end
70
73
 
71
74
  it 'inserts non-break spaces' do
72
- EvilFront::Russian.typograph('оно не надо').should == 'оно не надо'
75
+ nbsp_mark_typograph('оно не надо').should == 'оно не_надо'
73
76
  end
74
77
 
75
78
  end
@@ -77,17 +80,17 @@ describe EvilFront::Russian do
77
80
  describe 'typograph_html' do
78
81
 
79
82
  it 'typographs plain text' do
80
- EvilFront::Russian.typograph_html('а - б').should == 'а — б'
83
+ EvilFront::Russian.typograph_html('а...').should == 'а…'
81
84
  end
82
85
 
83
86
  it 'typographs only in text nodes' do
84
- EvilFront::Russian.typograph_html('<a title="а - б">а - б</a>').should ==
85
- '<a title="а - б">а — б</a>'
87
+ EvilFront::Russian.typograph_html('<a title="а...">а...</a>').should ==
88
+ '<a title="а...">а…</a>'
86
89
  end
87
90
 
88
91
  it 'ignores code tags' do
89
- EvilFront::Russian.typograph_html('<code>а - б</code>').should ==
90
- '<code>а - б</code>'
92
+ EvilFront::Russian.typograph_html('<code>а...</code>').should ==
93
+ '<code>а...</code>'
91
94
  end
92
95
 
93
96
  it 'keeps escaping' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evil-front
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Sitnik