typography 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/typography/core.rb +3 -1
- data/lib/typography/version.rb +1 -1
- data/spec/typography_spec.rb +4 -0
- metadata +9 -9
data/lib/typography/core.rb
CHANGED
@@ -10,7 +10,8 @@ module TypographyHelper
|
|
10
10
|
def typography
|
11
11
|
#apostrophe
|
12
12
|
@out.gsub!(/(\w)'(\w)/, '\1’\2')
|
13
|
-
|
13
|
+
@out.gsub!(/\“/,'„')
|
14
|
+
@out.gsub!(/\”/,'“')
|
14
15
|
#russian quotes
|
15
16
|
@out = replace_quotes '«', '»', '„', '“', 'а-яА-Я'
|
16
17
|
|
@@ -43,6 +44,7 @@ module TypographyHelper
|
|
43
44
|
|
44
45
|
def replace_quotes(left1 = '“', right1 = '”', left2 = '‘', right2 = '’', letters = 'a-zA-Z')
|
45
46
|
str = @out.dup
|
47
|
+
|
46
48
|
replace_quotes = lambda do
|
47
49
|
old_str = str.dup
|
48
50
|
str.gsub!(Regexp.new("(\"|\')([#{letters}].*?[^\\s])\\1", Regexp::MULTILINE | Regexp::IGNORECASE)) do |match|
|
data/lib/typography/version.rb
CHANGED
data/spec/typography_spec.rb
CHANGED
@@ -73,6 +73,10 @@ describe TypographyHelper, 'with typography' do
|
|
73
73
|
ty('"Quotes "second level"" и "Кавычки "второго уровня""').should == '“Quotes ‘second level’” и «Кавычки „второго уровня“»'
|
74
74
|
end
|
75
75
|
|
76
|
+
it "should make (“”) quotes in the same string" do
|
77
|
+
ty('“Кавычки” and “Quotes”').should == '„Кавычки“ and „Quotes“'
|
78
|
+
end
|
79
|
+
|
76
80
|
it "should replace -- to —" do
|
77
81
|
ty('Replace -- to mdash please').should == 'Replace — to mdash please'
|
78
82
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typography
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dmitry Shaposhnik
|
@@ -63,12 +63,12 @@ extensions: []
|
|
63
63
|
extra_rdoc_files:
|
64
64
|
- README.rdoc
|
65
65
|
files:
|
66
|
-
- lib/typography.rb
|
67
|
-
- lib/typography/version.rb
|
68
|
-
- lib/typography/helper.rb
|
69
66
|
- lib/typography/core.rb
|
70
|
-
-
|
67
|
+
- lib/typography/helper.rb
|
68
|
+
- lib/typography/version.rb
|
69
|
+
- lib/typography.rb
|
71
70
|
- spec/debug.log
|
71
|
+
- spec/spec_helper.rb
|
72
72
|
- spec/typography_spec.rb
|
73
73
|
- README.rdoc
|
74
74
|
- Rakefile
|
@@ -109,8 +109,8 @@ rubyforge_project: ""
|
|
109
109
|
rubygems_version: 1.3.7
|
110
110
|
signing_key:
|
111
111
|
specification_version: 3
|
112
|
-
summary: typography-0.2.
|
112
|
+
summary: typography-0.2.1
|
113
113
|
test_files:
|
114
|
-
- spec/spec_helper.rb
|
115
114
|
- spec/debug.log
|
115
|
+
- spec/spec_helper.rb
|
116
116
|
- spec/typography_spec.rb
|