typogruby 1.0.16 → 1.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/HISTORY.md +4 -0
- data/lib/typogruby.rb +8 -4
- data/lib/version.rb +1 -1
- data/test/test_typogruby.rb +6 -0
- metadata +21 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da19ab76a8cf4a14d847a7a7aa60ecce3cec196d
|
4
|
+
data.tar.gz: cc8b80624af026ed7cff5b4c3627ec3e8deed6f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c44b8842370ea8c280db66b8c16cc23639e08b1d8daf30387dda0377e5c2b4d5fa1d2dfc7c350b6835cfc354162bb4580328127ddcc83250760e164f09c20e95
|
7
|
+
data.tar.gz: c3fe4fccdf6610464f85aea2939704d11205624da18d2ad2dd0a71a69e2fe5336aeb246aff29639a90c05802651e3fd9d108f6c95649d38e34449f5f9073ceb4
|
data/Gemfile.lock
CHANGED
data/HISTORY.md
CHANGED
data/lib/typogruby.rb
CHANGED
@@ -134,6 +134,10 @@ module Typogruby
|
|
134
134
|
# caps("A message from 2KU2 with digits")
|
135
135
|
# # => 'A message from <span class="caps">2KU2</span> with digits'
|
136
136
|
#
|
137
|
+
# @example Allows ampersands
|
138
|
+
# caps("A phone bill from AT&T")
|
139
|
+
# # => 'A phone bill from <span class="caps">AT&T</span>'
|
140
|
+
#
|
137
141
|
# @example Ignores HTML attributes
|
138
142
|
# caps('Download <a href="file.doc" title="PDF document">this file</a>')
|
139
143
|
# # => 'Download <a href="file.doc" title="PDF document">this file</a>'
|
@@ -156,10 +160,10 @@ module Typogruby
|
|
156
160
|
exclude_sensitive_tags(text) do |t|
|
157
161
|
# $1 and $2 are excluded HTML tags, $3 is the part before the caps and $4 is the caps match
|
158
162
|
t.gsub(%r{
|
159
|
-
(<[^/][^>]*?>)|
|
160
|
-
(\s| |^|'|"|>|)
|
161
|
-
([A-Z\d](?:
|
162
|
-
(?!\w)
|
163
|
+
(<[^/][^>]*?>)| # Ignore any opening tag, so we don't mess up attribute values
|
164
|
+
(\s| |^|'|"|>|) # Make sure our capture is preceded by whitespace or quotes
|
165
|
+
([A-Z\d](?:(\.|'|&|&|&\#38;)?[A-Z\d][\.']?){1,}) # Capture capital words, with optional dots, numbers or ampersands in between
|
166
|
+
(?!\w) # ...which must not be followed by a word character.
|
163
167
|
}x) do |str|
|
164
168
|
tag, before, caps = $1, $2, $3
|
165
169
|
|
data/lib/version.rb
CHANGED
data/test/test_typogruby.rb
CHANGED
@@ -43,6 +43,12 @@ class TestTypogruby < Test::Unit::TestCase
|
|
43
43
|
assert_equal '<i><span class="caps">D.O.T.</span></i><span class="caps">HE34T</span><b><span class="caps">RFID</span></b>', caps("<i>D.O.T.</i>HE34T<b>RFID</b>")
|
44
44
|
end
|
45
45
|
|
46
|
+
def test_should_not_break_caps_with_ampersands
|
47
|
+
assert_equal '<span class="caps">AT&T</span>', caps("AT&T")
|
48
|
+
assert_equal '<span class="caps">AT&T</span>', caps("AT&T")
|
49
|
+
assert_equal '<span class="caps">AT&T</span>', caps("AT&T")
|
50
|
+
end
|
51
|
+
|
46
52
|
def test_should_replace_quotes
|
47
53
|
assert_equal '<span class="dquo">"</span>With primes"', initial_quotes('"With primes"')
|
48
54
|
assert_equal '<span class="quo">\'</span>With single primes\'', initial_quotes("'With single primes'")
|
metadata
CHANGED
@@ -1,97 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typogruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arjan van der Gaag
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubypants
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: aruba
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: cucumber
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: bluecloth
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
description: Improve web typography using various text filters. This gem prevents
|
@@ -105,9 +105,9 @@ extra_rdoc_files:
|
|
105
105
|
- README.md
|
106
106
|
- HISTORY.md
|
107
107
|
files:
|
108
|
-
- .document
|
109
|
-
- .gitignore
|
110
|
-
- .travis.yml
|
108
|
+
- ".document"
|
109
|
+
- ".gitignore"
|
110
|
+
- ".travis.yml"
|
111
111
|
- Gemfile
|
112
112
|
- Gemfile.lock
|
113
113
|
- HISTORY.md
|
@@ -132,22 +132,22 @@ licenses: []
|
|
132
132
|
metadata: {}
|
133
133
|
post_install_message:
|
134
134
|
rdoc_options:
|
135
|
-
- --charset=UTF-8
|
135
|
+
- "--charset=UTF-8"
|
136
136
|
require_paths:
|
137
137
|
- lib
|
138
138
|
required_ruby_version: !ruby/object:Gem::Requirement
|
139
139
|
requirements:
|
140
|
-
- -
|
140
|
+
- - ">="
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0'
|
143
143
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
144
|
requirements:
|
145
|
-
- -
|
145
|
+
- - ">="
|
146
146
|
- !ruby/object:Gem::Version
|
147
147
|
version: '0'
|
148
148
|
requirements: []
|
149
149
|
rubyforge_project:
|
150
|
-
rubygems_version: 2.
|
150
|
+
rubygems_version: 2.4.1
|
151
151
|
signing_key:
|
152
152
|
specification_version: 4
|
153
153
|
summary: Improves web typography like Django's Typogrify
|