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 +4 -4
- data/ChangeLog.md +4 -0
- data/lib/evil-front/russian.rb +2 -1
- data/lib/evil-front/version.rb +1 -1
- data/spec/english_spec.rb +7 -4
- data/spec/helpers_spec.rb +2 -2
- data/spec/russian_spec.rb +12 -9
- 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: cbe12fe2c6e73339048942e618cd2d71af5a0a48
|
4
|
+
data.tar.gz: 6d44c469fed3bf9e79e105d717707011e21ff359
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d053af5722b38cb46ae0daeb7c0947bb78cbadb5adf8078d1c48b95b63386f557dcfd352b6e71966228f1b39731a01ba97339966df4ee13cebf56b388347f06
|
7
|
+
data.tar.gz: 1135cbdff9e14a8c864d4dcfb221561cff3362bb32f28cd6f5bc94d125ee7a8638bb7a57f6bcdc1b8c92dfc61f2bd467f6c6011afc7fc364b29b3371720564f5
|
data/ChangeLog.md
CHANGED
data/lib/evil-front/russian.rb
CHANGED
@@ -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
|
data/lib/evil-front/version.rb
CHANGED
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
|
-
|
13
|
+
nbsp_mark_typograph('"a".').should == '“a”.'
|
11
14
|
end
|
12
15
|
|
13
16
|
it 'changes dashes' do
|
14
|
-
|
17
|
+
nbsp_mark_typograph('a - b').should == 'a - b'
|
15
18
|
end
|
16
19
|
|
17
20
|
it 'changes ellipsis' do
|
18
|
-
|
21
|
+
nbsp_mark_typograph('a...').should == 'a…'
|
19
22
|
end
|
20
23
|
|
21
24
|
it 'inserts non-break spaces' do
|
22
|
-
|
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="
|
68
|
-
russian_typograph(tag).should == '<a title="
|
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
|
-
|
62
|
+
nbsp_mark_typograph('сказал "смотри "зорко"".').should ==
|
60
63
|
'сказал «смотри „зорко“».'
|
61
64
|
end
|
62
65
|
|
63
66
|
it 'changes dashes' do
|
64
|
-
|
67
|
+
nbsp_mark_typograph('а - это б').should == 'а_— это_б'
|
65
68
|
end
|
66
69
|
|
67
70
|
it 'changes ellipsis' do
|
68
|
-
|
71
|
+
nbsp_mark_typograph('а...').should == 'а…'
|
69
72
|
end
|
70
73
|
|
71
74
|
it 'inserts non-break spaces' do
|
72
|
-
|
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('
|
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="
|
85
|
-
'<a title="
|
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
|
90
|
-
'<code
|
92
|
+
EvilFront::Russian.typograph_html('<code>а...</code>').should ==
|
93
|
+
'<code>а...</code>'
|
91
94
|
end
|
92
95
|
|
93
96
|
it 'keeps escaping' do
|