Class: Sterile::Data

Inherits:
Object
  • Object
show all
Defined in:
lib/hacks/sterile.rb

Class Method Summary collapse

Class Method Details

.smart_format_rulesObject



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"],
    # [/<p>"/, "<p>\\1″"],
    [/s\'([^a-zA-Z0-9])/, "s’\\1"],
    [/"([:;])/, "”\\1"],
    [/\'s$/, "’s"],
    [/\'(\d\d(?:’|\')?s)/, "’\\1"],
    [/(\s|\A|"|\(|\[)\'/, "\\1‘"],
    # [/(\d+)"/, "\\1″"],
    # [/(\d+)\'/, "\\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