6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/hacks/sterile.rb', line 6
def self.smart_format_rules
[
["'tain't", "’tain’t"],
["'twere", "’twere"],
["'twas", "’twas"],
["'tis", "’tis"],
["'twill", "’twill"],
["'til", "’til"],
["'bout", "’bout"],
["'nuff", "’nuff"],
["'round", "’round"],
["'cause", "’cause"],
["'cos", "’cos"],
["i'm", "i’m"],
['--"', "—“"],
["--'", "—‘"],
["--", "—"],
["...", "…"],
["(tm)", "™"],
["(TM)", "™"],
["(c)", "©"],
["(r)", "®"],
["(R)", "®"],
[/\'(\d\d)(?!’|\')([\p{P}\p{Z}])/, "’\\1\\2"],
[/s\'([^a-zA-Z0-9])/, "s’\\1"],
[/"([:;])/, "”\\1"],
[/\'s$/, "’s"],
[/\'(\d\d(?:’|\')?s)/, "’\\1"],
[/(\s|\A|"|\(|\[)\'/, "\\1‘"],
[/(\S)\'([^\'\s])/, "\\1’\\2"],
[/(\s|\A|\(|\[)"(?!\s)/, "\\1“\\2"],
[/"(\s|\S|\Z)/, "”\\1"],
[/\'([\s.]|\Z)/, "’\\1"],
[/(\d+)x(\d+)/, "\\1×\\2"],
[/([a-z])'(t|d|s|ll|re|ve)(\b)/i, "\\1’\\2\\3"],
]
end
|