Remove leading asterisks from link URLs.
[lw2-viewer.git] / text-clean-regexps.js
blob5a181d12291dcc0e129cdc3f133c937cd8dc8474
2   // convert nbsp to regular space
3   [/\xa0/, ' '],
4   // line-breaks after slashes (for long URLs etc.)
5   [/\/+/, '\\&\u200b'],
7   // triple prime
8   [/'''/g, '\u2034'],
9   // beginning "
10   [/([\s([]|^)"([^\s?!.,;\/)])/g, '$1\u201c$2'],
11   // ending "
12   [/(\u201c[^"]*)"([^"]*$|[^\u201c"]*\u201c)/g, '$1\u201d$2'],
13   // remaining " at end of word
14   [/([^0-9])"/g, '$1\u201d'],
15   // double quotes
16   [/"(.+?)"/g, '\u201c$1\u201d'],
17   // double prime as two single quotes
18   [/''/g, '\u2033'],
19   // beginning '
20   [/(\W|^)'(\S)/g, '$1\u2018$2'],
21   // conjunction's possession
22   [/([a-z])'([a-z])/ig, '$1\u2019$2'],
23   // abbrev. years like '93
24   [/(\u2018)([0-9]{2}[^\u2019]*)(\u2018([^0-9]|$)|$|\u2019[a-z])/ig, '\u2019$2$3'],
25   // ending '
26   [/((\u2018[^']*)|[a-z])'([^0-9]|$)/ig, '$1\u2019$3'],
27   // backwards apostrophe
28   [/(\B|^)\u2018(?=([^\u2018\u2019]*\u2019\b)*([^\u2018\u2019]*\B\W[\u2018\u2019]\b|[^\u2018\u2019]*$))/ig, '$1\u2019'],
29   // double prime
30   [/"/g, '\u2033'],
31   // prime
32   [/'/g, '\u2032'],
33   
34   // turn a hyphen surrounded by spaces, between words, into an em-dash
35   [/([a-z\u201d]) - ([a-z\u201c])/ig, '$1\u2014$2'],
36   // turn a hyphen between a space and a quote, into an em-dash
37   [/([a-z]) -(\u201d)/ig, '$1\u2014$2'],
38   [/(\u201c)- ([a-z])/ig, '$1\u2014$2'],
39   // turn a double or triple hyphen, optionally surrounded by spaces, between words, or at the start of a line, into an em-dash
40   [/([a-z"'“”‘’]|\n) ?---? ?([a-z"'“”‘’])/ig, '$1\u2014$2'],
41   
42   // Two spaces after a period is INCORRECT.
43   [ /(\w[\.\?\!])[ \u00a0]{2}(\w)/g, '$1 $2'],
44   
45   // ellipsis rectification
46   [/(\s)\.\.\./g, '$1…'],
47   [/\.\.\.(\s)/g, '…$1'],
48   
49   // Hyphen followed by a numeral (with an optional space first), becomes an actual minus sign
50   [/(\s)-( ?)([0-9])/g, '$1\u2212$2$3'],
51   
52   // Arrows
53   [/(\s)->(\s)/g, '$1\u2192$2'],
54   [/(\s)<-(\s)/g, '$1\u2190$2'],
55   [/(\s)=>(\s)/g, '$1\u21d2$2'],
56   [/(\s)<=(\s)/g, '$1\u21d0$2'],
57   [/(\s)<=>(\s)/g, '$1\u21d4$2']