typogruby 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/typogruby.rb +1 -1
- data/test/test_typogruby.rb +1 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.2
|
data/lib/typogruby.rb
CHANGED
@@ -167,7 +167,7 @@ module Typogruby
|
|
167
167
|
# @return [String] input text with initial quotes wrapped
|
168
168
|
def initial_quotes(text)
|
169
169
|
# $1 is the initial part of the string, $2 is the quote or entitity, and $3 is the double quote
|
170
|
-
text.gsub(/((?:<(?:h[1-6]|p|li|dt|dd)[^>]*>|^)\s*(?:<(?:a|em|strong|span)[^>]*>)?)('|‘|("|“))/) {$1 + "<span class=\"#{'d' if $3}quo\">#{$2}</span>"}
|
170
|
+
text.gsub(/((?:<(?:h[1-6]|p|li|dt|dd)[^>]*>|^)\s*(?:<(?:a|em|strong|span)[^>]*>)?)('|‘|‘|("|“|“))/) {$1 + "<span class=\"#{'d' if $3}quo\">#{$2}</span>"}
|
171
171
|
end
|
172
172
|
|
173
173
|
# main function to do all the functions from the method
|
data/test/test_typogruby.rb
CHANGED
@@ -39,6 +39,7 @@ class TestTypogruby < Test::Unit::TestCase
|
|
39
39
|
assert_equal '<span class="quo">\'</span>With single primes\'', initial_quotes("'With single primes'")
|
40
40
|
assert_equal '<a href="#"><span class="dquo">"</span>With primes and a link"</a>', initial_quotes('<a href="#">"With primes and a link"</a>')
|
41
41
|
assert_equal '<span class="dquo">“</span>With smartypanted quotes”', initial_quotes('“With smartypanted quotes”')
|
42
|
+
assert_equal '<span class="quo">‘</span>With manual quotes’', initial_quotes('‘With manual quotes’')
|
42
43
|
end
|
43
44
|
|
44
45
|
def test_should_apply_smartypants
|
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:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 2
|
10
|
+
version: 1.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Arjan van der Gaag
|