typogruby 1.0.12 → 1.0.13

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- typogruby (1.0.12)
4
+ typogruby (1.0.13)
5
5
  rubypants
6
6
 
7
7
  GEM
data/HISTORY.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.13
4
+
5
+ * Be smart about periods in abbreviations. Capitalise LA, L.A. and L.A, but not L. or L. A. (by Brad Weslake)
6
+
3
7
  ## 1.0.12
4
8
 
5
9
  * Fixed aruba deprecation warnings
@@ -0,0 +1,27 @@
1
+ Feature: processing caps
2
+
3
+ In order to be smart about caps
4
+ As a web developer using typogruby
5
+ I want to be fine-grained about what is and is not included within my caps tag
6
+
7
+ Scenario:
8
+ Given a file named "input.html" with:
9
+ """
10
+ L. A. Paul is a name
11
+ L.A.P.D. is an acronym
12
+ LA is the normal case
13
+ LA. is a twist on the normal case that does no harm
14
+ LA..PD and LA...PD are fringe cases, but also do no harm
15
+
16
+ """
17
+ When I run `typogruby -c input.html`
18
+ Then the output should contain exactly:
19
+ """
20
+ L. A. Paul is a name
21
+ <span class="caps">L.A.P.D.</span> is an acronym
22
+ <span class="caps">LA</span> is the normal case
23
+ <span class="caps">LA.</span> is a twist on the normal case that does no harm
24
+ <span class="caps">LA..PD</span> and <span class="caps">LA.</span>..PD are fringe cases, but also do no harm
25
+
26
+ """
27
+ And the exit status should be 0
data/lib/typogruby.rb CHANGED
@@ -1,6 +1,8 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  require 'rubypants'
2
4
  require 'digest/md5'
3
- $KCODE = 'U'
5
+ $KCODE = 'U' if RUBY_VERSION < '1.9.0'
4
6
 
5
7
  # A collection of simple helpers for improving web
6
8
  # typograhy. Based on TypographyHelper by Luke Hartman and Typogrify.
@@ -141,16 +143,22 @@ module Typogruby
141
143
  # caps("<i>D.O.T.</i>HE34T<b>RFID</b>")
142
144
  # # => '<i><span class="caps">D.O.T.</span></i><span class="caps">HE34T</span><b><span class="caps">RFID</span></b>'
143
145
  #
146
+ # @example Sequences of capitalised letters with spaces are not eligible, since they may be names.
147
+ # caps("L.A.P.D")
148
+ # # => '<span class="caps">L.A.P.D.</span>'
149
+ # caps("L. A. Paul")
150
+ # # => 'L. A. Paul'
151
+ #
144
152
  # @param [String] text input text
145
153
  # @return [String] input text with caps wrapped
146
154
  def caps(text)
147
155
  exclude_sensitive_tags(text) do |t|
148
156
  # $1 and $2 are excluded HTML tags, $3 is the part before the caps and $4 is the caps match
149
157
  t.gsub(%r{
150
- (<[^/][^>]+?>)| # Ignore any opening tag, so we don't mess up attribute values
151
- (\s|&nbsp;|^|'|"|>) # Make sure our capture is preceded by whitespace or quotes
152
- ([A-Z\d][A-Z\d\.']{1,}) # Capture captial words, with optional dots or numbers in between
153
- (?!\w) # ...which must not be followed by a word character.
158
+ (<[^/][^>]+?>)| # Ignore any opening tag, so we don't mess up attribute values
159
+ (\s|&nbsp;|^|'|"|>) # Make sure our capture is preceded by whitespace or quotes
160
+ ([A-Z\d]([\.']?[A-Z\d][\.']?){1,}) # Capture capital words, with optional dots or numbers in between
161
+ (?!\w) # ...which must not be followed by a word character.
154
162
  }x) do |str|
155
163
  tag, before, caps = $1, $2, $3
156
164
 
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Typogruby
2
- VERSION = '1.0.12'
2
+ VERSION = '1.0.13'
3
3
  end
data/typogruby.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
- require 'lib/version'
3
+ require './lib/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  # Metadata
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typogruby
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 12
10
- version: 1.0.12
9
+ - 13
10
+ version: 1.0.13
11
11
  platform: ruby
12
12
  authors:
13
13
  - Arjan van der Gaag
@@ -15,10 +15,12 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-12 00:00:00 Z
18
+ date: 2011-09-23 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- version_requirements: &id001 !ruby/object:Gem::Requirement
21
+ type: :runtime
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
22
24
  none: false
23
25
  requirements:
24
26
  - - ">="
@@ -27,12 +29,12 @@ dependencies:
27
29
  segments:
28
30
  - 0
29
31
  version: "0"
30
- requirement: *id001
32
+ version_requirements: *id001
31
33
  name: rubypants
32
- prerelease: false
33
- type: :runtime
34
34
  - !ruby/object:Gem::Dependency
35
- version_requirements: &id002 !ruby/object:Gem::Requirement
35
+ type: :development
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
36
38
  none: false
37
39
  requirements:
38
40
  - - ">="
@@ -41,12 +43,12 @@ dependencies:
41
43
  segments:
42
44
  - 0
43
45
  version: "0"
44
- requirement: *id002
46
+ version_requirements: *id002
45
47
  name: yard
46
- prerelease: false
47
- type: :development
48
48
  - !ruby/object:Gem::Dependency
49
- version_requirements: &id003 !ruby/object:Gem::Requirement
49
+ type: :development
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
50
52
  none: false
51
53
  requirements:
52
54
  - - ">="
@@ -55,12 +57,12 @@ dependencies:
55
57
  segments:
56
58
  - 0
57
59
  version: "0"
58
- requirement: *id003
60
+ version_requirements: *id003
59
61
  name: rake
60
- prerelease: false
61
- type: :development
62
62
  - !ruby/object:Gem::Dependency
63
- version_requirements: &id004 !ruby/object:Gem::Requirement
63
+ type: :development
64
+ prerelease: false
65
+ requirement: &id004 !ruby/object:Gem::Requirement
64
66
  none: false
65
67
  requirements:
66
68
  - - ">="
@@ -69,12 +71,12 @@ dependencies:
69
71
  segments:
70
72
  - 0
71
73
  version: "0"
72
- requirement: *id004
74
+ version_requirements: *id004
73
75
  name: aruba
74
- prerelease: false
75
- type: :development
76
76
  - !ruby/object:Gem::Dependency
77
- version_requirements: &id005 !ruby/object:Gem::Requirement
77
+ type: :development
78
+ prerelease: false
79
+ requirement: &id005 !ruby/object:Gem::Requirement
78
80
  none: false
79
81
  requirements:
80
82
  - - ">="
@@ -83,12 +85,12 @@ dependencies:
83
85
  segments:
84
86
  - 0
85
87
  version: "0"
86
- requirement: *id005
88
+ version_requirements: *id005
87
89
  name: cucumber
88
- prerelease: false
89
- type: :development
90
90
  - !ruby/object:Gem::Dependency
91
- version_requirements: &id006 !ruby/object:Gem::Requirement
91
+ type: :development
92
+ prerelease: false
93
+ requirement: &id006 !ruby/object:Gem::Requirement
92
94
  none: false
93
95
  requirements:
94
96
  - - ">="
@@ -97,12 +99,12 @@ dependencies:
97
99
  segments:
98
100
  - 0
99
101
  version: "0"
100
- requirement: *id006
102
+ version_requirements: *id006
101
103
  name: rcov
102
- prerelease: false
103
- type: :development
104
104
  - !ruby/object:Gem::Dependency
105
- version_requirements: &id007 !ruby/object:Gem::Requirement
105
+ type: :development
106
+ prerelease: false
107
+ requirement: &id007 !ruby/object:Gem::Requirement
106
108
  none: false
107
109
  requirements:
108
110
  - - ">="
@@ -111,12 +113,12 @@ dependencies:
111
113
  segments:
112
114
  - 0
113
115
  version: "0"
114
- requirement: *id007
116
+ version_requirements: *id007
115
117
  name: rspec
116
- prerelease: false
117
- type: :development
118
118
  - !ruby/object:Gem::Dependency
119
- version_requirements: &id008 !ruby/object:Gem::Requirement
119
+ type: :development
120
+ prerelease: false
121
+ requirement: &id008 !ruby/object:Gem::Requirement
120
122
  none: false
121
123
  requirements:
122
124
  - - ">="
@@ -125,10 +127,8 @@ dependencies:
125
127
  segments:
126
128
  - 0
127
129
  version: "0"
128
- requirement: *id008
130
+ version_requirements: *id008
129
131
  name: bluecloth
130
- prerelease: false
131
- type: :development
132
132
  description: Improve web typography using various text filters. This gem prevents widows and applies markup to ampersans, consecutive capitals and initial quotes.
133
133
  email: arjan@arjanvandergaag.nl
134
134
  executables:
@@ -149,6 +149,7 @@ files:
149
149
  - README.md
150
150
  - Rakefile
151
151
  - bin/typogruby
152
+ - features/caps.feature
152
153
  - features/ignoring.feature
153
154
  - features/inputs.feature
154
155
  - features/selective_filtering.feature
@@ -188,11 +189,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
189
  requirements: []
189
190
 
190
191
  rubyforge_project:
191
- rubygems_version: 1.8.1
192
+ rubygems_version: 1.8.10
192
193
  signing_key:
193
194
  specification_version: 3
194
195
  summary: Improves web typography like Django's Typogrify
195
196
  test_files:
197
+ - features/caps.feature
196
198
  - features/ignoring.feature
197
199
  - features/inputs.feature
198
200
  - features/selective_filtering.feature