typohero 0.0.4 → 0.0.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13d3687a6f31edadcea2ff02592d22225f5b0b19
4
- data.tar.gz: 78d20a873b169e808800dbf6158ad93889f750d7
3
+ metadata.gz: b46c2b740e356ca0fede60d8031058c353e44de0
4
+ data.tar.gz: 0e8ac74b6c5b3698ebbc0eca2a7b4c057695f99e
5
5
  SHA512:
6
- metadata.gz: 2404afeb00889cbbe73d21e5b64fc18cbcd74d7cf568baaa1eb9188f491876bfb9e618a46d701698b12f949d28ba0fb560e48460b574b638d83784ed63078b16
7
- data.tar.gz: eb7d1528137c7a91a4f67b8a96e1295e8b72735bdf11faa0e7eb33ede2ae892b88ff09440fd41e9849982331a15b15d37b11ab4b06e91c29d3834296038dc772
6
+ metadata.gz: 8bbf72951c41850e2153eef8cc08dde5b39e756dd56391299021c9a9e80bd665d102b75b3101ebeee2fb2b7c4d6ef2adb012b3071164ae3dfb3adbce7fb14a49
7
+ data.tar.gz: 23aab7e111d88797365075809aacccde8566683925dc869b19eb44030621d554af2a8c2564fba24914607f02425aae7a70ae5fe8e6ee2d2e0ea0e0a1b339be41
@@ -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)
@@ -513,7 +513,6 @@ module TypoHero
513
513
  '\varphi' => "\u03c6",
514
514
  '\rho' => "\u03c1",
515
515
  '\varrho' => "\u03c1",
516
- '\sigma' => "\u03c2",
517
516
  '\varsigma' => "\u03c2",
518
517
  '\theta' => "\u03b8",
519
518
  '\vartheta' => "\u03b8",
@@ -1,3 +1,3 @@
1
1
  module TypoHero
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -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>&nbsp;tags'
167
171
  assert_enhance 'Replace text <i>IN</i> tags', 'Replace text <i><span class="caps">IN</span></i>&nbsp;tags'
168
172
  assert_enhance 'AB, CD, EF', '<span class="caps">AB</span>, <span class="caps">CD</span>,&nbsp;<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 '&#8220;WHEEE&#8221;', '<span class="dquo">&#8220;</span><span class="caps">WHEEE</span>&#8221;'
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
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: 2014-11-09 00:00:00.000000000 Z
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).