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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 58814b4ae083a7ad0c1347e8726480573c987d4e
4
- data.tar.gz: 37b177ddacad1c32a4a3ba3f31ade38f56bf328d
3
+ metadata.gz: da19ab76a8cf4a14d847a7a7aa60ecce3cec196d
4
+ data.tar.gz: cc8b80624af026ed7cff5b4c3627ec3e8deed6f2
5
5
  SHA512:
6
- metadata.gz: 9e127eeff35b15ee6d48d14a1b9f38a22ba16fb32570aaef47930d40a4293abe08d462f115495a2543553afa13c052a7ddfe535c2a7424f0b174355946d4388b
7
- data.tar.gz: 3257122f1f0ee80f70bf8c1a25fe9a8a641784ea425491c102dd893128f13e9a148c9a85048fd4bd947675e37020af4e6c4c85ca29f107aa4a2ff1aa89e077d7
6
+ metadata.gz: c44b8842370ea8c280db66b8c16cc23639e08b1d8daf30387dda0377e5c2b4d5fa1d2dfc7c350b6835cfc354162bb4580328127ddcc83250760e164f09c20e95
7
+ data.tar.gz: c3fe4fccdf6610464f85aea2939704d11205624da18d2ad2dd0a71a69e2fe5336aeb246aff29639a90c05802651e3fd9d108f6c95649d38e34449f5f9073ceb4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- typogruby (1.0.16)
4
+ typogruby (1.0.17)
5
5
  rubypants
6
6
 
7
7
  GEM
data/HISTORY.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.17
4
+
5
+ * Allow ampersands in capitalised words (thanks Paul Robert Lloyd)
6
+
3
7
  ## 1.0.16
4
8
 
5
9
  * Added textarea to list of ignored elements (thanks Juan Antonio Navarro Pérez)
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&amp;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
- (<[^/][^>]*?>)| # Ignore any opening tag, so we don't mess up attribute values
160
- (\s|&nbsp;|^|'|"|>|) # Make sure our capture is preceded by whitespace or quotes
161
- ([A-Z\d](?:[\.']?[A-Z\d][\.']?){1,}) # Capture capital words, with optional dots or numbers in between
162
- (?!\w) # ...which must not be followed by a word character.
163
+ (<[^/][^>]*?>)| # Ignore any opening tag, so we don't mess up attribute values
164
+ (\s|&nbsp;|^|'|"|>|) # Make sure our capture is preceded by whitespace or quotes
165
+ ([A-Z\d](?:(\.|'|&|&amp;|&\#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
@@ -1,3 +1,3 @@
1
1
  module Typogruby
2
- VERSION = '1.0.16'
2
+ VERSION = '1.0.17'
3
3
  end
@@ -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&amp;T</span>', caps("AT&amp;T")
49
+ assert_equal '<span class="caps">AT&#38;T</span>', caps("AT&#38;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.16
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: 2013-08-26 00:00:00.000000000 Z
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.0.7
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