-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathreplace.js
More file actions
114 lines (100 loc) · 1.57 KB
/
Copy pathreplace.js
File metadata and controls
114 lines (100 loc) · 1.57 KB
1
2
3
4
5
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
const lookup = {
// Greek
alpha: "α",
beta: "β",
gamma: "γ",
delta: "δ",
epsilon: "ε",
zeta: "ζ",
eta: "η",
theta: "θ",
iota: "ι",
kappa: "κ",
lambda: "λ",
mu: "μ",
nu: "ν",
xi: "ξ",
omicron: "ο",
pi: "π",
rho: "ρ",
sigma: "σ",
ssigma: "ς",
tau: "τ",
upsilon: "υ",
phi: "φ",
chi: "χ",
psi: "ψ",
omega: "ω",
bigtheta: "Θ",
// Math
// "+-": "±",
// "*": "×",
// "/": "÷",
sqrt: "√",
integral: "∫",
inf: "∞",
"/=": "≠",
approx: "≈",
equiv: "≡",
prop: "∝",
">=": "≥",
"<=": "≤",
// Set theory
elem: "∈",
nelem: "∉",
natN: "ℕ",
intZ: "ℤ",
ratio: "ℚ",
realR: "ℝ",
aleph: "ℵ",
concat: "◦",
// ⊆ ⊇
// Logic
not: "¬",
"∝": "prop",
forall: "∀",
// Arrows
"<=>": "⇔",
"=>": "⇒",
// Subscripts
_0: "₀",
_1: "₁",
_2: "₂",
_3: "₃",
_4: "₄",
_5: "₅",
_6: "₆",
_7: "₇",
_8: "₈",
_9: "₉",
// Superscripts
"^0": "⁰",
"^1": "¹",
"^2": "²",
"^3": "³",
"^4": "⁴",
"^5": "⁵",
"^6": "⁶",
"^7": "⁷",
"^8": "⁸",
"^9": "⁹",
// Geometry
// Arabic, Hebrew
// Cultural
man: "♂",
woman: "♀"
// Music
};
function replace(file) {
const fs = require('fs');
var data = fs.readFileSync(file, "utf8");
var res = data;
for (var key in lookup) {
res = res.replace(new RegExp('//'+key, 'g'), lookup[key]);
}
console.log(res);
fs.writeFile('test.md', res, 'utf8', (err) => {
if (err) throw err;
});
}
replace(process.argv[2]);