typogruby 1.0.11 → 1.0.12

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,45 +1,45 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- typogruby (1.0.11)
4
+ typogruby (1.0.12)
5
5
  rubypants
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
- aruba (0.3.2)
11
- childprocess (~> 0.1.6)
12
- cucumber (~> 0.10.0)
13
- rspec (~> 2.3.0)
14
- bluecloth (2.0.11)
10
+ aruba (0.3.6)
11
+ childprocess (>= 0.1.7)
12
+ cucumber (>= 0.10.0)
13
+ rspec (>= 2.5.0)
14
+ bluecloth (2.1.0)
15
15
  builder (3.0.0)
16
- childprocess (0.1.7)
17
- ffi (~> 0.6.3)
18
- cucumber (0.10.0)
16
+ childprocess (0.1.8)
17
+ ffi (~> 1.0.6)
18
+ cucumber (0.10.2)
19
19
  builder (>= 2.1.2)
20
- diff-lcs (~> 1.1.2)
21
- gherkin (~> 2.3.2)
22
- json (~> 1.4.6)
23
- term-ansicolor (~> 1.0.5)
20
+ diff-lcs (>= 1.1.2)
21
+ gherkin (>= 2.3.5)
22
+ json (>= 1.4.6)
23
+ term-ansicolor (>= 1.0.5)
24
24
  diff-lcs (1.1.2)
25
- ffi (0.6.3)
25
+ ffi (1.0.7)
26
26
  rake (>= 0.8.7)
27
- gherkin (2.3.3)
28
- json (~> 1.4.6)
29
- json (1.4.6)
27
+ gherkin (2.3.7)
28
+ json (>= 1.4.6)
29
+ json (1.5.1)
30
30
  rake (0.8.7)
31
31
  rcov (0.9.9)
32
- rspec (2.3.0)
33
- rspec-core (~> 2.3.0)
34
- rspec-expectations (~> 2.3.0)
35
- rspec-mocks (~> 2.3.0)
36
- rspec-core (2.3.1)
37
- rspec-expectations (2.3.0)
32
+ rspec (2.5.0)
33
+ rspec-core (~> 2.5.0)
34
+ rspec-expectations (~> 2.5.0)
35
+ rspec-mocks (~> 2.5.0)
36
+ rspec-core (2.5.2)
37
+ rspec-expectations (2.5.0)
38
38
  diff-lcs (~> 1.1.2)
39
- rspec-mocks (2.3.0)
39
+ rspec-mocks (2.5.0)
40
40
  rubypants (0.2.0)
41
41
  term-ansicolor (1.0.5)
42
- yard (0.6.4)
42
+ yard (0.6.8)
43
43
 
44
44
  PLATFORMS
45
45
  ruby
data/HISTORY.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.12
4
+
5
+ * Fixed aruba deprecation warnings
6
+ * Ensure duplicate sensitive tags are properly rendered (thanks Justin Hileman)
7
+ * Removed obsolete tag-ignoring clauses from regexes
8
+
3
9
  ## 1.0.11
4
10
 
5
11
  * Excluded more typography-sensitive tags from filtering (thanks Justin Hileman)
@@ -12,7 +12,7 @@ Feature: ignoring parts of a file
12
12
  </script>
13
13
  <p>"This IS a simple file!</p>
14
14
  """
15
- When I run "typogruby input.html"
15
+ When I run `typogruby input.html`
16
16
  Then the output should contain exactly:
17
17
  """
18
18
  <script>
@@ -16,7 +16,7 @@ Feature: various inputs
16
16
 
17
17
  @wip
18
18
  Scenario: take input from STDIN
19
- When I run "typogruby < input.html"
19
+ When I run `typogruby < input.html`
20
20
  Then the output should contain exactly:
21
21
  """
22
22
  <p><span class="dquo">&#8220;</span>This <span class="caps">IS</span> a simple&nbsp;file!</p>
@@ -24,7 +24,7 @@ Feature: various inputs
24
24
  And the exit status should be 0
25
25
 
26
26
  Scenario: multiple input files
27
- When I run "typogruby input.html input2.html"
27
+ When I run `typogruby input.html input2.html`
28
28
  Then the output should contain exactly:
29
29
  """
30
30
  <p><span class="dquo">&#8220;</span>This <span class="caps">IS</span> a simple&nbsp;file!</p><p>This is another&nbsp;file</p>
@@ -11,7 +11,7 @@ Feature: selective filtering
11
11
  """
12
12
 
13
13
  Scenario: using just one filter
14
- When I run "typogruby -w input.html"
14
+ When I run `typogruby -w input.html`
15
15
  Then the output should contain exactly:
16
16
  """
17
17
  <p>"This IS a simple&nbsp;file!</p>
@@ -19,7 +19,7 @@ Feature: selective filtering
19
19
  And the exit status should be 0
20
20
 
21
21
  Scenario: using just several filters
22
- When I run "typogruby -cw input.html"
22
+ When I run `typogruby -cw input.html`
23
23
  Then the output should contain exactly:
24
24
  """
25
25
  <p>"This <span class="caps">IS</span> a simple&nbsp;file!</p>
@@ -27,7 +27,7 @@ Feature: selective filtering
27
27
  And the exit status should be 0
28
28
 
29
29
  Scenario: excluding a single filter
30
- When I run "typogruby --no-widows input.html"
30
+ When I run `typogruby --no-widows input.html`
31
31
  Then the output should contain exactly:
32
32
  """
33
33
  <p><span class="dquo">&#8220;</span>This <span class="caps">IS</span> a simple file!</p>
@@ -35,7 +35,7 @@ Feature: selective filtering
35
35
  And the exit status should be 0
36
36
 
37
37
  Scenario: excluding multiple filters
38
- When I run "typogruby --no-widows --no-caps input.html"
38
+ When I run `typogruby --no-widows --no-caps input.html`
39
39
  Then the output should contain exactly:
40
40
  """
41
41
  <p><span class="dquo">&#8220;</span>This IS a simple file!</p>
@@ -5,12 +5,12 @@ Feature: Simple usage
5
5
  I want to apply typogruby to a file
6
6
 
7
7
  Scenario: getting help
8
- When I run "typogruby -h"
8
+ When I run `typogruby -h`
9
9
  Then the output should contain "Usage: typogruby [options] filename [filename, ...]"
10
10
  And the exit status should be 0
11
11
 
12
12
  Scenario: getting the version number
13
- When I run "typogruby -v"
13
+ When I run `typogruby -v`
14
14
  Then the output should contain "Typogruby "
15
15
 
16
16
  Scenario: filtering a file
@@ -18,7 +18,7 @@ Feature: Simple usage
18
18
  """
19
19
  <p>"This IS a simple file!</p>
20
20
  """
21
- When I run "typogruby input.html"
21
+ When I run `typogruby input.html`
22
22
  Then the output should contain exactly:
23
23
  """
24
24
  <p><span class="dquo">&#8220;</span>This <span class="caps">IS</span> a simple&nbsp;file!</p>
@@ -30,7 +30,7 @@ Feature: Simple usage
30
30
  """
31
31
  <p>"This IS a simple file!</p>
32
32
  """
33
- When I run "typogruby -o output.html input.html"
33
+ When I run `typogruby -o output.html input.html`
34
34
  Then the file "output.html" should contain exactly:
35
35
  """
36
36
  <p><span class="dquo">&#8220;</span>This <span class="caps">IS</span> a simple&nbsp;file!</p>
data/lib/typogruby.rb CHANGED
@@ -56,10 +56,10 @@ module Typogruby
56
56
  # @param [String] text input text
57
57
  # @return [String] input text with ampersands wrapped
58
58
  def amp(text)
59
- # $1 is an excluded HTML tag, $2 is the part before the caps and $3 is the amp match
59
+ # $1 is the part before the caps and $2 is the amp match
60
60
  exclude_sensitive_tags(text) do |t|
61
- t.gsub(/<(code|pre).+?<\/\1>|(\s|&nbsp;)&(?:amp;|#38;)?(\s|&nbsp;)/) { |str|
62
- $1 ? str : $2 + '<span class="amp">&amp;</span>' + $3
61
+ t.gsub(/(\s|&nbsp;)&(?:amp;|#38;)?(\s|&nbsp;)/) { |str|
62
+ $1 + '<span class="amp">&amp;</span>' + $2
63
63
  }.gsub(/(\w+)="(.*?)<span class="amp">&amp;<\/span>(.*?)"/, '\1="\2&amp;\3"')
64
64
  end
65
65
  end
@@ -147,17 +147,16 @@ module Typogruby
147
147
  exclude_sensitive_tags(text) do |t|
148
148
  # $1 and $2 are excluded HTML tags, $3 is the part before the caps and $4 is the caps match
149
149
  t.gsub(%r{
150
- (?i:<(code|pre).+?</\1>)| # Ignore the contents of code and pre elements
151
150
  (<[^/][^>]+?>)| # Ignore any opening tag, so we don't mess up attribute values
152
151
  (\s|&nbsp;|^|'|"|>) # Make sure our capture is preceded by whitespace or quotes
153
152
  ([A-Z\d][A-Z\d\.']{1,}) # Capture captial words, with optional dots or numbers in between
154
153
  (?!\w) # ...which must not be followed by a word character.
155
154
  }x) do |str|
156
- excluded, tag, before, caps = $1, $2, $3, $4
155
+ tag, before, caps = $1, $2, $3
157
156
 
158
157
  # Do nothing with the contents if ignored tags, the inside of an opening HTML element
159
158
  # so we don't mess up attribute values, or if our capture is only digits.
160
- if excluded || tag || caps =~ /^\d+\.?$/
159
+ if tag || caps =~ /^\d+\.?$/
161
160
  str
162
161
  elsif $3 =~ /^[\d\.]+$/
163
162
  before + caps
@@ -254,7 +253,7 @@ private
254
253
  end
255
254
  end
256
255
 
257
- # Hackish text filter that will make sure our text filters leave
256
+ # Hackish text filter that will make sure our text filters leave
258
257
  # sensitive tags alone without resorting to a full-blown HTML parser.
259
258
  #
260
259
  # Sensitive tags are tags with literal contents, which we do not
@@ -278,7 +277,7 @@ private
278
277
  hash
279
278
  end
280
279
  yield(modified_text).gsub(/#{@exluded_sensitive_tags.keys.join('|')}/) do |h|
281
- @exluded_sensitive_tags.delete(h)
280
+ @exluded_sensitive_tags[h]
282
281
  end
283
282
  end
284
283
 
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Typogruby
2
- VERSION = '1.0.11'
2
+ VERSION = '1.0.12'
3
3
  end
@@ -104,4 +104,11 @@ class TestTypogruby < Test::Unit::TestCase
104
104
  assert_equal test_string, improve(test_string)
105
105
  end
106
106
  end
107
+
108
+ def test_should_not_forget_about_duplicate_sensitive_tags
109
+ %w{script pre code kbd math}.each do |tag_name|
110
+ test_string = "<#{tag_name}>this</#{tag_name}>==<#{tag_name}>this</#{tag_name}>"
111
+ assert_equal test_string, improve(test_string)
112
+ end
113
+ end
107
114
  end
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: 1
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 11
10
- version: 1.0.11
9
+ - 12
10
+ version: 1.0.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - Arjan van der Gaag
@@ -15,13 +15,9 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-24 00:00:00 +01:00
19
- default_executable:
18
+ date: 2011-05-12 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
- prerelease: false
23
- type: :runtime
24
- name: rubypants
25
21
  version_requirements: &id001 !ruby/object:Gem::Requirement
26
22
  none: false
27
23
  requirements:
@@ -32,10 +28,10 @@ dependencies:
32
28
  - 0
33
29
  version: "0"
34
30
  requirement: *id001
35
- - !ruby/object:Gem::Dependency
31
+ name: rubypants
36
32
  prerelease: false
37
- type: :development
38
- name: yard
33
+ type: :runtime
34
+ - !ruby/object:Gem::Dependency
39
35
  version_requirements: &id002 !ruby/object:Gem::Requirement
40
36
  none: false
41
37
  requirements:
@@ -46,10 +42,10 @@ dependencies:
46
42
  - 0
47
43
  version: "0"
48
44
  requirement: *id002
49
- - !ruby/object:Gem::Dependency
45
+ name: yard
50
46
  prerelease: false
51
47
  type: :development
52
- name: rake
48
+ - !ruby/object:Gem::Dependency
53
49
  version_requirements: &id003 !ruby/object:Gem::Requirement
54
50
  none: false
55
51
  requirements:
@@ -60,10 +56,10 @@ dependencies:
60
56
  - 0
61
57
  version: "0"
62
58
  requirement: *id003
63
- - !ruby/object:Gem::Dependency
59
+ name: rake
64
60
  prerelease: false
65
61
  type: :development
66
- name: aruba
62
+ - !ruby/object:Gem::Dependency
67
63
  version_requirements: &id004 !ruby/object:Gem::Requirement
68
64
  none: false
69
65
  requirements:
@@ -74,10 +70,10 @@ dependencies:
74
70
  - 0
75
71
  version: "0"
76
72
  requirement: *id004
77
- - !ruby/object:Gem::Dependency
73
+ name: aruba
78
74
  prerelease: false
79
75
  type: :development
80
- name: cucumber
76
+ - !ruby/object:Gem::Dependency
81
77
  version_requirements: &id005 !ruby/object:Gem::Requirement
82
78
  none: false
83
79
  requirements:
@@ -88,10 +84,10 @@ dependencies:
88
84
  - 0
89
85
  version: "0"
90
86
  requirement: *id005
91
- - !ruby/object:Gem::Dependency
87
+ name: cucumber
92
88
  prerelease: false
93
89
  type: :development
94
- name: rcov
90
+ - !ruby/object:Gem::Dependency
95
91
  version_requirements: &id006 !ruby/object:Gem::Requirement
96
92
  none: false
97
93
  requirements:
@@ -102,10 +98,10 @@ dependencies:
102
98
  - 0
103
99
  version: "0"
104
100
  requirement: *id006
105
- - !ruby/object:Gem::Dependency
101
+ name: rcov
106
102
  prerelease: false
107
103
  type: :development
108
- name: rspec
104
+ - !ruby/object:Gem::Dependency
109
105
  version_requirements: &id007 !ruby/object:Gem::Requirement
110
106
  none: false
111
107
  requirements:
@@ -116,10 +112,10 @@ dependencies:
116
112
  - 0
117
113
  version: "0"
118
114
  requirement: *id007
119
- - !ruby/object:Gem::Dependency
115
+ name: rspec
120
116
  prerelease: false
121
117
  type: :development
122
- name: bluecloth
118
+ - !ruby/object:Gem::Dependency
123
119
  version_requirements: &id008 !ruby/object:Gem::Requirement
124
120
  none: false
125
121
  requirements:
@@ -130,6 +126,9 @@ dependencies:
130
126
  - 0
131
127
  version: "0"
132
128
  requirement: *id008
129
+ name: bluecloth
130
+ prerelease: false
131
+ type: :development
133
132
  description: Improve web typography using various text filters. This gem prevents widows and applies markup to ampersans, consecutive capitals and initial quotes.
134
133
  email: arjan@arjanvandergaag.nl
135
134
  executables:
@@ -160,7 +159,6 @@ files:
160
159
  - lib/version.rb
161
160
  - test/test_typogruby.rb
162
161
  - typogruby.gemspec
163
- has_rdoc: true
164
162
  homepage: http://avdgaag.github.com/typogruby
165
163
  licenses: []
166
164
 
@@ -190,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
188
  requirements: []
191
189
 
192
190
  rubyforge_project:
193
- rubygems_version: 1.5.0
191
+ rubygems_version: 1.8.1
194
192
  signing_key:
195
193
  specification_version: 3
196
194
  summary: Improves web typography like Django's Typogrify