typohero 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -2
- data/bench/bench.rb +23 -0
- data/bench/bench.txt +16413 -0
- data/bench/profile.rb +8 -0
- data/hero.jpg +0 -0
- data/latex.pl +16 -0
- data/lib/typohero.rb +96 -80
- data/lib/typohero/latex.rb +537 -0
- data/lib/typohero/version.rb +3 -0
- data/test/typohero_test.rb +24 -9
- data/typohero.gemspec +1 -1
- metadata +8 -1
data/test/typohero_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'minitest/autorun'
|
2
2
|
require 'typohero'
|
3
3
|
|
4
|
-
class
|
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(' ', "\u00a0")
|
13
|
+
orig.gsub!('–', "\u2013")
|
14
|
+
orig.gsub!('…', "\u2026")
|
15
|
+
orig.gsub!('“', "\u201C")
|
16
|
+
orig.gsub!('”', "\u201D")
|
17
|
+
orig.gsub!('‘', "\u2018")
|
18
|
+
orig.gsub!('’', "\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 – bar'
|
73
|
-
typo "foo---bar",
|
80
|
+
typo "foo---bar", "foo\u2009\u2014 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\'\'',
|
226
|
-
typo '
|
227
|
-
typo '>>', '»'
|
228
|
-
typo '->', '→'
|
229
|
-
typo '<-', '←'
|
230
|
-
typo '(tm)', '™'
|
232
|
+
typo ',,hello\'\'', "<span class=\"bdquo\">\u201E</span>hello”"
|
233
|
+
typo '(tm)', "\u2122"
|
231
234
|
end
|
232
235
|
|
233
236
|
def test_primes
|
234
|
-
typo "She's 6'2''",
|
237
|
+
typo "She's 6'2''", "She’s 6\u20322\u2033"
|
235
238
|
end
|
236
239
|
|
237
240
|
def test_ordinals
|
238
241
|
typo 'I am the 1st', 'I am the 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 \u2248"
|
250
|
+
typo '\\(\\approx\\) outside \\approx', "\\(\\approx\\) outside \u2248"
|
251
|
+
typo '\\[\\approx\\] outside \\approx', "\\[\\approx\\] outside \u2248"
|
252
|
+
typo '<span>$</span>', '<span>$</span>'
|
253
|
+
typo '<span>\\</span>', '<span>\\</span>'
|
254
|
+
end
|
240
255
|
end
|
data/typohero.gemspec
CHANGED
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.
|
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/
|