typohero 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ module TypoHero
2
+ VERSION = '0.0.2'
3
+ end
@@ -1,7 +1,7 @@
1
1
  require 'minitest/autorun'
2
2
  require 'typohero'
3
3
 
4
- class TypoheroTest < Minitest::Test
4
+ class TypoHeroTest < Minitest::Test
5
5
  def typo(str, orig)
6
6
  # todo test recursive
7
7
  a = TypoHero.enhance(str)
@@ -9,6 +9,13 @@ class TypoheroTest < Minitest::Test
9
9
  #assert_equal a, b
10
10
  #c = Typogruby.improve(str)
11
11
  #puts "\nInput: #{str}\nTypogruby: #{c}\nTypoHero: #{a}\n" if a != c
12
+ orig = orig.gsub('&nbsp;', "\u00a0")
13
+ orig.gsub!('&#8211;', "\u2013")
14
+ orig.gsub!('&#8230;', "\u2026")
15
+ orig.gsub!('&#8220;', "\u201C")
16
+ orig.gsub!('&#8221;', "\u201D")
17
+ orig.gsub!('&#8216;', "\u2018")
18
+ orig.gsub!('&#8217;', "\u2019")
12
19
  assert_equal orig, a
13
20
  end
14
21
 
@@ -70,7 +77,7 @@ multiline
70
77
 
71
78
  def test_dashes
72
79
  typo "foo--bar", 'foo &#8211;&nbsp;bar'
73
- typo "foo---bar", 'foo&#8201;&#8212;&#8201;bar'
80
+ typo "foo---bar", "foo\u2009\u2014&nbsp;bar"
74
81
  end
75
82
 
76
83
  def test_ellipses
@@ -222,19 +229,27 @@ multiline
222
229
  end
223
230
 
224
231
  def test_other_special
225
- typo ',,hello\'\'', '&#8222;hello&#8221;'
226
- typo '&lt;&lt;', '&laquo;'
227
- typo '&gt;&gt;', '&raquo;'
228
- typo '-&gt;', '&rarr;'
229
- typo '&lt;-', '&larr;'
230
- typo '(tm)', '&trade;'
232
+ typo ',,hello\'\'', "<span class=\"bdquo\">\u201E</span>hello&#8221;"
233
+ typo '(tm)', "\u2122"
231
234
  end
232
235
 
233
236
  def test_primes
234
- typo "She's 6'2''", 'She&#8217;s&nbsp;6&prime;2&Prime;'
237
+ typo "She's 6'2''", "She&#8217;s&nbsp;6\u20322\u2033"
235
238
  end
236
239
 
237
240
  def test_ordinals
238
241
  typo 'I am the 1st', 'I am the&nbsp;1<sup>st</sup>'
239
242
  end
243
+
244
+ def test_latex
245
+ typo '\\textbackslash', '\\'
246
+ end
247
+
248
+ def test_ignore_mathjax
249
+ typo '$$\\approx$$ outside \\approx', "$$\\approx$$ outside&nbsp;\u2248"
250
+ typo '\\(\\approx\\) outside \\approx', "\\(\\approx\\) outside&nbsp;\u2248"
251
+ typo '\\[\\approx\\] outside \\approx', "\\[\\approx\\] outside&nbsp;\u2248"
252
+ typo '<span>$</span>', '<span>$</span>'
253
+ typo '<span>\\</span>', '<span>\\</span>'
254
+ end
240
255
  end
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require File.dirname(__FILE__) + '/lib/typohero'
2
+ require File.dirname(__FILE__) + '/lib/typohero/version'
3
3
  require 'date'
4
4
 
5
5
  Gem::Specification.new do |s|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typohero
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Mendler
@@ -23,7 +23,14 @@ files:
23
23
  - Gemfile
24
24
  - README.md
25
25
  - Rakefile
26
+ - bench/bench.rb
27
+ - bench/bench.txt
28
+ - bench/profile.rb
29
+ - hero.jpg
30
+ - latex.pl
26
31
  - lib/typohero.rb
32
+ - lib/typohero/latex.rb
33
+ - lib/typohero/version.rb
27
34
  - test/typohero_test.rb
28
35
  - typohero.gemspec
29
36
  homepage: https://github.com/minad/typohero/