typohero 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/typohero.rb +4 -3
- data/lib/typohero/latex.rb +0 -1
- data/lib/typohero/version.rb +1 -1
- data/test/typohero_test.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b46c2b740e356ca0fede60d8031058c353e44de0
|
4
|
+
data.tar.gz: 0e8ac74b6c5b3698ebbc0eca2a7b4c057695f99e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bbf72951c41850e2153eef8cc08dde5b39e756dd56391299021c9a9e80bd665d102b75b3101ebeee2fb2b7c4d6ef2adb012b3071164ae3dfb3adbce7fb14a49
|
7
|
+
data.tar.gz: 23aab7e111d88797365075809aacccde8566683925dc869b19eb44030621d554af2a8c2564fba24914607f02425aae7a70ae5fe8e6ee2d2e0ea0e0a1b339be41
|
data/lib/typohero.rb
CHANGED
@@ -74,6 +74,7 @@ module TypoHero
|
|
74
74
|
DASH_RE = "[#{MDASH}#{NDASH}]"
|
75
75
|
AMP_RE = '&(?:amp;)?'
|
76
76
|
LEFT_QUOTE_RE = "[#{LDQUO}#{LSQUO}#{BDQUO}]"
|
77
|
+
LEFT_PAREN_RE = '[\(\[\{]'
|
77
78
|
|
78
79
|
PRIME_RE = /(?<=\d)(''?)(?=[\p{Space}\dNEWS]|$)/m
|
79
80
|
PRIMES = {
|
@@ -102,8 +103,8 @@ module TypoHero
|
|
102
103
|
'(?=(\d\d(?:s|\p{Space}|$))) # Decade abbreviations (the '80s)
|
103
104
|
}xm
|
104
105
|
|
105
|
-
CAPS_INNER_RE = "(?:#{AMP_RE}|[A-Z\\d\\.\-]|#{RSQUO})*" # right quote for posession (e.g. JIMMY'S)
|
106
|
-
CAPS_RE = /(?<=^|\p{Space}|#{LEFT_QUOTE_RE})([A-Z\d]#{CAPS_INNER_RE}[A-Z]#{CAPS_INNER_RE}|[A-Z]#{CAPS_INNER_RE}[A-Z\d]#{CAPS_INNER_RE})(?=$|\p{Space}|#{RIGHT_QUOTE_RE}|\p{Punct})/m
|
106
|
+
CAPS_INNER_RE = "(?:#{AMP_RE}|[A-Z\\d/_\\.\-]|#{RSQUO})*" # right quote for posession (e.g. JIMMY'S)
|
107
|
+
CAPS_RE = /(?<=^|\p{Space}|#{LEFT_QUOTE_RE}|#{LEFT_PAREN_RE})([A-Z\d]#{CAPS_INNER_RE}[A-Z]#{CAPS_INNER_RE}|[A-Z]#{CAPS_INNER_RE}[A-Z\d]#{CAPS_INNER_RE})(?=$|\p{Space}|#{RIGHT_QUOTE_RE}|\p{Punct})/m
|
107
108
|
|
108
109
|
LEFT_QUOTES = {
|
109
110
|
"'" => LSQUO,
|
@@ -269,9 +270,9 @@ module TypoHero
|
|
269
270
|
end
|
270
271
|
widont(tokens)
|
271
272
|
text.each do |s|
|
273
|
+
caps(s)
|
272
274
|
initial_quotes(s)
|
273
275
|
amp(s)
|
274
|
-
caps(s)
|
275
276
|
ordinals(s)
|
276
277
|
nobr(s)
|
277
278
|
unescape(s)
|
data/lib/typohero/latex.rb
CHANGED
data/lib/typohero/version.rb
CHANGED
data/test/typohero_test.rb
CHANGED
@@ -44,6 +44,10 @@ multiline
|
|
44
44
|
assert_enhance "<script>'hello'</script>", "<script>'hello'</script>"
|
45
45
|
assert_enhance "<!-- <a>'hello'</a> -->", "<!-- <a>'hello'</a> -->"
|
46
46
|
assert_enhance "<![CDATA[<a>'hello'</a>]]>", "<![CDATA[<a>'hello'</a>]]>"
|
47
|
+
assert_enhance "<pre> PRE doesn't\nget changed</pre>", "<pre> PRE doesn't\nget changed</pre>"
|
48
|
+
assert_enhance "<kbd> KBD doesn't\nget changed</kbd>", "<kbd> KBD doesn't\nget changed</kbd>"
|
49
|
+
assert_enhance "<code> CODE doesn't\nget changed</code>", "<code> CODE doesn't\nget changed</code>"
|
50
|
+
assert_enhance "<math> MATH doesn't\nget changed</math>", "<math> MATH doesn't\nget changed</math>"
|
47
51
|
end
|
48
52
|
|
49
53
|
def test_quotes
|
@@ -166,6 +170,10 @@ multiline
|
|
166
170
|
assert_enhance 'Replace text <a href=".">IN</a> tags', 'Replace text <a href="."><span class="caps">IN</span></a> tags'
|
167
171
|
assert_enhance 'Replace text <i>IN</i> tags', 'Replace text <i><span class="caps">IN</span></i> tags'
|
168
172
|
assert_enhance 'AB, CD, EF', '<span class="caps">AB</span>, <span class="caps">CD</span>, <span class="caps">EF</span>'
|
173
|
+
assert_enhance 'HTML/XHTML', '<span class="caps">HTML/XHTML</span>'
|
174
|
+
assert_enhance 'UNDERSCORE_DELIMITED_CAPS', '<span class="caps">UNDERSCORE_DELIMITED_CAPS</span>'
|
175
|
+
assert_enhance '(WHEEE)', '(<span class="caps">WHEEE</span>)'
|
176
|
+
assert_enhance '“WHEEE”', '<span class="dquo">“</span><span class="caps">WHEEE</span>”'
|
169
177
|
end
|
170
178
|
|
171
179
|
def test_should_ignore_special_case_caps
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typohero
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Mendler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: TypoHero improves web typography by applying various filters (similar
|
14
14
|
to rubypants, typogruby, typogrify).
|