evil-front 0.3.6 → 0.3.7

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: cbe12fe2c6e73339048942e618cd2d71af5a0a48
4
- data.tar.gz: 6d44c469fed3bf9e79e105d717707011e21ff359
3
+ metadata.gz: 5d96eb4951a8bdbffddf9a0ef42f019779815c47
4
+ data.tar.gz: be71847e890181a430ffb82dd809aef78a653dcd
5
5
  SHA512:
6
- metadata.gz: 8d053af5722b38cb46ae0daeb7c0947bb78cbadb5adf8078d1c48b95b63386f557dcfd352b6e71966228f1b39731a01ba97339966df4ee13cebf56b388347f06
7
- data.tar.gz: 1135cbdff9e14a8c864d4dcfb221561cff3362bb32f28cd6f5bc94d125ee7a8638bb7a57f6bcdc1b8c92dfc61f2bd467f6c6011afc7fc364b29b3371720564f5
6
+ metadata.gz: ac095442776a4cc72d4ad17fe0a0c568cfe2218cefca03b2782074ebf27c89d68d481f640459638b2de202211e723326e5270f9471b203b2e228144fdc58d46f
7
+ data.tar.gz: 9f7b2aab0ca2560f2c2a6502ccd6f1553d3ff3df60e6a3be3c83afe518c6487c47731dcbd7ccdc1d2aceeb4d7595c33f725c98d141ef7cb990e3a128c35e4181
data/ChangeLog.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.3.7
2
+
3
+ * Use non-break dash only in Russian words.
4
+
1
5
  ## 0.3.6
2
6
 
3
7
  * Russian typograph inserts non-break space before m-dash.
@@ -1,6 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require 'unicode_utils'
4
+ # encoding: utf-8
5
+
4
6
  require 'standalone_typograf'
5
7
 
6
8
  module EvilFront
@@ -46,7 +48,8 @@ module EvilFront
46
48
  # Replace symbols to right ones, like m-dash, quotes, etc.
47
49
  def self.use_right_symbols(text)
48
50
  StandaloneTypograf::Typograf.new(text).prepare
49
- .gsub(' —', ' —') # nbsp before m-dash
51
+ .gsub(' —', ' —') # nbsp before m-dash
52
+ .gsub(/([а-яА-Я])-([а-яА-Я])/, '\1‑\2') # non-break dash
50
53
  end
51
54
  end
52
55
  end
@@ -20,7 +20,6 @@ module EvilFront
20
20
 
21
21
  text.gsub! '"', '"'
22
22
  text = use_right_symbols(text)
23
- text.gsub!(/([^\s" ]+)-([^\s" ]+)/, '\1‑\2')
24
23
  tiny_words.each { |regexp| text.gsub! regexp, "\\1\\2 " }
25
24
 
26
25
  text
@@ -1,3 +1,3 @@
1
1
  module EvilFront
2
- VERSION = '0.3.6' unless defined? EvilFront::VERSION
2
+ VERSION = '0.3.7' unless defined? EvilFront::VERSION
3
3
  end
data/spec/english_spec.rb CHANGED
@@ -10,19 +10,19 @@ describe EvilFront::English do
10
10
  describe 'typograph' do
11
11
 
12
12
  it 'changes quotes' do
13
- nbsp_mark_typograph('"a".').should == '“a”.'
13
+ expect(nbsp_mark_typograph('"a".')).to eq '“a”.'
14
14
  end
15
15
 
16
16
  it 'changes dashes' do
17
- nbsp_mark_typograph('a - b').should == 'a - b'
17
+ expect(nbsp_mark_typograph('a - b')).to eq 'a - b'
18
18
  end
19
19
 
20
20
  it 'changes ellipsis' do
21
- nbsp_mark_typograph('a...').should == 'a…'
21
+ expect(nbsp_mark_typograph('a...')).to eq 'a…'
22
22
  end
23
23
 
24
24
  it 'inserts non-break spaces' do
25
- nbsp_mark_typograph('he is a hero').should == 'he is_a_hero'
25
+ expect(nbsp_mark_typograph('he is a hero')).to eq 'he is_a_hero'
26
26
  end
27
27
 
28
28
  end
data/spec/helpers_spec.rb CHANGED
@@ -9,7 +9,7 @@ describe EvilFront::Helpers do
9
9
  describe 'capitalize_first' do
10
10
 
11
11
  it 'capitalizes Russian' do
12
- capitalize_first('тест').should == 'Тест'
12
+ expect(capitalize_first('тест')).to eq 'Тест'
13
13
  end
14
14
 
15
15
  end
@@ -17,7 +17,7 @@ describe EvilFront::Helpers do
17
17
  describe 'disable_mobile_zoom' do
18
18
 
19
19
  it 'returns viewport meta tag' do
20
- disable_mobile_zoom.should =~ /^<meta name="viewport" /
20
+ expect(disable_mobile_zoom).to match(/^<meta name="viewport" /)
21
21
  end
22
22
 
23
23
  end
@@ -25,14 +25,15 @@ describe EvilFront::Helpers do
25
25
  describe 'flying_quotes' do
26
26
 
27
27
  it 'set quotes to text' do
28
- flying_quotes('a').should == '<span class="space-before-quote"> </span>' +
29
- '<span class="quotes">«a»</span>'
28
+ expect(flying_quotes('a')).to eq(
29
+ '<span class="space-before-quote"> </span>' +
30
+ '<span class="quotes">«a»</span>')
30
31
  end
31
32
 
32
33
  it 'escapes HTML' do
33
- flying_quotes('<br>').should ==
34
+ expect(flying_quotes('<br>')).to eq(
34
35
  '<span class="space-before-quote"> </span>' +
35
- '<span class="quotes">«&lt;br&gt;»</span>'
36
+ '<span class="quotes">«&lt;br&gt;»</span>')
36
37
  end
37
38
 
38
39
  end
@@ -40,15 +41,15 @@ describe EvilFront::Helpers do
40
41
  describe 'auto_flying_quotes' do
41
42
 
42
43
  it 'set quotes to text' do
43
- auto_flying_quotes('от «a»').should ==
44
+ expect(auto_flying_quotes('от «a»')).to eq(
44
45
  'от<span class="space-before-quote"> </span>' +
45
- '<span class="quotes">«a»</span>'
46
+ '<span class="quotes">«a»</span>')
46
47
  end
47
48
 
48
49
  it 'escapes HTML' do
49
- auto_flying_quotes('от «<br>»').should ==
50
+ expect(auto_flying_quotes('от «<br>»')).to eq(
50
51
  'от<span class="space-before-quote"> </span>' +
51
- '<span class="quotes">«&lt;br&gt;»</span>'
52
+ '<span class="quotes">«&lt;br&gt;»</span>')
52
53
  end
53
54
 
54
55
  end
@@ -56,7 +57,7 @@ describe EvilFront::Helpers do
56
57
  describe 'ruble' do
57
58
 
58
59
  it 'returns span' do
59
- ruble.should be_a(String)
60
+ expect(ruble).to be_a(String)
60
61
  end
61
62
 
62
63
  end
@@ -65,11 +66,11 @@ describe EvilFront::Helpers do
65
66
 
66
67
  it 'typographs text inside tags' do
67
68
  tag = '<a title="а...">а...</a>'.html_safe
68
- russian_typograph(tag).should == '<a title="а...">а…</a>'
69
+ expect(russian_typograph(tag)).to eq'<a title="а...">а…</a>'
69
70
  end
70
71
 
71
72
  it 'escapes HTML' do
72
- russian_typograph('<a>').should == '&lt;a&gt;'
73
+ expect(russian_typograph('<a>')).to eq '&lt;a&gt;'
73
74
  end
74
75
 
75
76
  end
@@ -78,11 +79,11 @@ describe EvilFront::Helpers do
78
79
 
79
80
  it 'typographs text inside tags' do
80
81
  tag = '<a title="a...">a...</a>'.html_safe
81
- english_typograph(tag).should == '<a title="a...">a…</a>'
82
+ expect(english_typograph(tag)).to eq '<a title="a...">a…</a>'
82
83
  end
83
84
 
84
85
  it 'escapes HTML' do
85
- english_typograph('<a>').should == '&lt;a&gt;'
86
+ expect(english_typograph('<a>')).to eq '&lt;a&gt;'
86
87
  end
87
88
 
88
89
  end
@@ -94,15 +95,15 @@ describe EvilFront::Helpers do
94
95
 
95
96
  it 'typographs by current locale' do
96
97
  I18n.locale = :en
97
- typograph_by_locale('"a"').should == '“a”'
98
+ expect(typograph_by_locale('"a"')).to eq '“a”'
98
99
 
99
100
  I18n.locale = :ru
100
- typograph_by_locale('"a"').should == '«a»'
101
+ expect(typograph_by_locale('"a"')).to eq '«a»'
101
102
  end
102
103
 
103
104
  it 'returns origin text on unknown locale' do
104
105
  I18n.locale = :fr
105
- typograph_by_locale('"a"').should == '"a"'
106
+ expect(typograph_by_locale('"a"')).to eq '"a"'
106
107
  end
107
108
 
108
109
  end
@@ -114,37 +115,37 @@ describe EvilFront::Helpers do
114
115
  end
115
116
 
116
117
  it 'shows site name' do
117
- title_tag('Site').should == '<title>Site</title>'
118
+ expect(title_tag('Site')).to eq '<title>Site</title>'
118
119
  end
119
120
 
120
121
  it 'shows site names' do
121
- title_tag('One', 'Two').should == '<title>One - Two</title>'
122
+ expect(title_tag('One', 'Two')).to eq '<title>One - Two</title>'
122
123
  end
123
124
 
124
125
  it 'shows page name' do
125
126
  title 'Page', 'Section'
126
- title_tag('Site').should == '<title>Page - Section - Site</title>'
127
+ expect(title_tag('Site')).to eq '<title>Page - Section - Site</title>'
127
128
  end
128
129
 
129
130
  it 'shows Russian separator' do
130
131
  I18n.locale = :ru
131
132
  title 'Страница', 'Раздел'
132
- title_tag('Сайт').should == '<title>Страница — Раздел — Сайт</title>'
133
+ expect(title_tag('Сайт')).to eq '<title>Страница — Раздел — Сайт</title>'
133
134
  end
134
135
 
135
136
  it 'shows custom separator' do
136
137
  title 'One', 'Two'
137
- title_tag(separator: ' | ').should == '<title>One | Two</title>'
138
+ expect(title_tag(separator: ' | ')).to eq '<title>One | Two</title>'
138
139
  end
139
140
 
140
141
  it 'escapes HTML' do
141
142
  title '<B>'
142
- title_tag.should == '<title>&lt;B&gt;</title>'
143
+ expect(title_tag).to eq '<title>&lt;B&gt;</title>'
143
144
  end
144
145
 
145
146
  it 'hides site name on request' do
146
147
  title 'Page', no_site: true
147
- title_tag('Site').should == '<title>Page</title>'
148
+ expect(title_tag('Site')).to eq '<title>Page</title>'
148
149
  end
149
150
 
150
151
  end
data/spec/russian_spec.rb CHANGED
@@ -7,7 +7,7 @@ describe EvilFront::Russian do
7
7
  describe 'capitalize_first' do
8
8
 
9
9
  it 'capitalizes first letter in russian text' do
10
- EvilFront::Russian.capitalize_first('тест тест').should == 'Тест тест'
10
+ expect(EvilFront::Russian.capitalize_first('тест тест')).to eq 'Тест тест'
11
11
  end
12
12
 
13
13
  end
@@ -15,20 +15,20 @@ describe EvilFront::Russian do
15
15
  describe 'flying_quotes' do
16
16
 
17
17
  it 'inserts tags and quotes with space by default' do
18
- EvilFront::Russian.flying_quotes('тест').should ==
18
+ expect(EvilFront::Russian.flying_quotes('тест')).to eq(
19
19
  '<span class="space-before-quote"> </span>' +
20
- '<span class="quotes">«тест»</span>'
20
+ '<span class="quotes">«тест»</span>')
21
21
  end
22
22
 
23
23
  it 'inserts specified space' do
24
- EvilFront::Russian.flying_quotes('тест', space: '-').should ==
24
+ expect(EvilFront::Russian.flying_quotes('тест', space: '-')).to eq(
25
25
  '<span class="space-before-quote">-</span>' +
26
- '<span class="quotes">«тест»</span>'
26
+ '<span class="quotes">«тест»</span>')
27
27
  end
28
28
 
29
29
  it 'ignores space on request' do
30
- EvilFront::Russian.flying_quotes('тест', space: '').should ==
31
- '<span class="quotes">«тест»</span>'
30
+ expect(EvilFront::Russian.flying_quotes('тест', space: '')).to eq(
31
+ '<span class="quotes">«тест»</span>')
32
32
  end
33
33
 
34
34
  end
@@ -36,19 +36,19 @@ describe EvilFront::Russian do
36
36
  describe 'auto_flying_quotes' do
37
37
 
38
38
  it 'replaces quotes on start' do
39
- EvilFront::Russian.auto_flying_quotes('«тест»').should ==
40
- '<span class="quotes">«тест»</span>'
39
+ expect(EvilFront::Russian.auto_flying_quotes('«тест»')).to eq(
40
+ '<span class="quotes">«тест»</span>')
41
41
  end
42
42
 
43
43
  it 'replaces quotes in middle' do
44
- EvilFront::Russian.auto_flying_quotes('на «тесте».').should ==
44
+ expect(EvilFront::Russian.auto_flying_quotes('на «тесте».')).to eq(
45
45
  'на<span class="space-before-quote"> </span>' +
46
- '<span class="quotes">«тесте»</span>.'
46
+ '<span class="quotes">«тесте»</span>.')
47
47
  end
48
48
 
49
49
  it 'works with HTML' do
50
- EvilFront::Russian.auto_flying_quotes('<a>«ссылка»</a>').should ==
51
- '<a><span class="quotes">«ссылка»</span></a>'
50
+ expect(EvilFront::Russian.auto_flying_quotes('<a>«ссылка»</a>')).to eq(
51
+ '<a><span class="quotes">«ссылка»</span></a>')
52
52
  end
53
53
 
54
54
  end
@@ -59,20 +59,25 @@ describe EvilFront::Russian do
59
59
  end
60
60
 
61
61
  it 'changes quotes' do
62
- nbsp_mark_typograph('сказал "смотри "зорко"".').should ==
63
- 'сказал «смотри „зорко“».'
62
+ expect(nbsp_mark_typograph('сказал "смотри "зорко"".')).to eq(
63
+ 'сказал «смотри „зорко“».')
64
64
  end
65
65
 
66
66
  it 'changes dashes' do
67
- nbsp_mark_typograph('а - это б').should == 'а_— это_б'
67
+ expect(nbsp_mark_typograph('а - это б')).to eq 'а_— это_б'
68
68
  end
69
69
 
70
70
  it 'changes ellipsis' do
71
- nbsp_mark_typograph('а...').should == 'а…'
71
+ expect(nbsp_mark_typograph('а...')).to eq 'а…'
72
72
  end
73
73
 
74
74
  it 'inserts non-break spaces' do
75
- nbsp_mark_typograph('оно не надо').should == 'оно не_надо'
75
+ expect(nbsp_mark_typograph('оно не надо')).to eq 'оно не_надо'
76
+ end
77
+
78
+ it 'uses non-break dash on for Russian' do
79
+ expect(nbsp_mark_typograph('web-standards.ru')).to eq 'web-standards.ru'
80
+ expect(nbsp_mark_typograph('а-то')).to eq 'а‑то'
76
81
  end
77
82
 
78
83
  end
@@ -80,22 +85,22 @@ describe EvilFront::Russian do
80
85
  describe 'typograph_html' do
81
86
 
82
87
  it 'typographs plain text' do
83
- EvilFront::Russian.typograph_html('а...').should == 'а…'
88
+ expect(EvilFront::Russian.typograph_html('а...')).to eq 'а…'
84
89
  end
85
90
 
86
91
  it 'typographs only in text nodes' do
87
- EvilFront::Russian.typograph_html('<a title="а...">а...</a>').should ==
88
- '<a title="а...">а…</a>'
92
+ expect(EvilFront::Russian.typograph_html('<a title="а...">а...</a>')).
93
+ to eq '<a title="а...">а…</a>'
89
94
  end
90
95
 
91
96
  it 'ignores code tags' do
92
- EvilFront::Russian.typograph_html('<code>а...</code>').should ==
93
- '<code>а...</code>'
97
+ expect(EvilFront::Russian.typograph_html('<code>а...</code>')).
98
+ to eq '<code>а...</code>'
94
99
  end
95
100
 
96
101
  it 'keeps escaping' do
97
- EvilFront::Russian.typograph_html('<b>&lt;a&gt;</b>').should ==
98
- '<b>&lt;a&gt;</b>'
102
+ expect(EvilFront::Russian.typograph_html('<b>&lt;a&gt;</b>')).
103
+ to eq '<b>&lt;a&gt;</b>'
99
104
  end
100
105
 
101
106
  end
data/spec/sass_spec.rb CHANGED
@@ -14,27 +14,27 @@ describe 'Sass Helpers' do
14
14
  end
15
15
 
16
16
  it 'loads Rails Sass Images' do
17
- @assets['load'].to_s.should =~ /data:text\/plain/
17
+ expect(@assets['load'].to_s).to match(/data:text\/plain/)
18
18
  end
19
19
 
20
20
  it 'loads variables, functions and mixins' do
21
21
  load = @assets['load'].to_s
22
- load.should =~ /rgba\(0, 0, 0, 0.5\)/
23
- load.should =~ /cubic-bezier\(0.47, 0, 0.745, 0.715\)/
24
- load.should =~ /a:after/
22
+ expect(load).to match(/rgba\(0, 0, 0, 0.5\)/)
23
+ expect(load).to match(/cubic-bezier\(0.47, 0, 0.745, 0.715\)/)
24
+ expect(load).to match(/a:after/)
25
25
  end
26
26
 
27
27
  describe '+import-ruble' do
28
28
 
29
29
  it 'adds font-faces and .ruble' do
30
30
  ruble = @assets['ruble'].to_s
31
- ruble.should =~ /font-family: ALSRubl-Arial, PT Sans, sans-serif/
32
- ruble.should_not =~ /font-woff;base64/
31
+ expect(ruble).to match(/font-family: ALSRubl-Arial, PT Sans, sans-serif/)
32
+ expect(ruble).not_to match(/font-woff;base64/)
33
33
  end
34
34
 
35
35
  it 'inlines specified fonts' do
36
36
  ruble = @assets['inline-ruble'].to_s
37
- ruble.should =~ /font-style: italic;\s*src: url\('data/n
37
+ expect(ruble).to match(/font-style: italic;\s*src: url\('data/n)
38
38
  end
39
39
 
40
40
  end
@@ -45,11 +45,11 @@ describe 'Sass Helpers' do
45
45
  end
46
46
 
47
47
  it 'receives size without units' do
48
- @media.should =~ /max-width: 100px/
48
+ expect(@media).to match(/max-width: 100px/)
49
49
  end
50
50
 
51
51
  it 'receives size with units' do
52
- @media.should =~ /min-width: 200px/
52
+ expect(@media).to match(/min-width: 200px/)
53
53
  end
54
54
 
55
55
  end
@@ -60,15 +60,15 @@ describe 'Sass Helpers' do
60
60
  end
61
61
 
62
62
  it 'receives 2 sizes' do
63
- @size.should =~ /.all {\s*width: 10px;\s*height: 20px; }/
63
+ expect(@size).to match(/.all {\s*width: 10px;\s*height: 20px; }/)
64
64
  end
65
65
 
66
66
  it 'receives 1 sizes' do
67
- @size.should =~ /.one {\s*width: 30px;\s*height: 30px; }/
67
+ expect(@size).to match(/.one {\s*width: 30px;\s*height: 30px; }/)
68
68
  end
69
69
 
70
70
  it 'receives size without unit' do
71
- @size.should =~ /.no-unit {\s*width: 15px;\s*height: 15px; }/
71
+ expect(@size).to match(/.no-unit {\s*width: 15px;\s*height: 15px; }/)
72
72
  end
73
73
 
74
74
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evil-front
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Sitnik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-15 00:00:00.000000000 Z
11
+ date: 2014-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n