forked from fex-team/kf-parser
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchar.html
104 lines (83 loc) · 3.11 KB
/
char.html
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
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<style type="text/css">
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
.main {
width: 1000px;
height: 100%;
margin: 0 auto;
}
#container {
padding: 50px;
}
#container div {
display: inline-block;
width: 100px;
height: 100px;
}
</style>
<script src="dev-lib/kitygraph.all.js"></script>
<script src="dev-lib/kity-formula.all.js"></script>
<script src="dev-lib/dev-define.js"></script>
<script>
inc.config({
base: './src'
});
</script>
<script src="dev-lib/exports.js"></script>
<script src="dev-lib/dev-start.js"></script>
<script>
window.onload = function () {
var Parser = kf.Parser,
Assembly = kf.Assembly,
container = document.getElementById( "container" ),
assembly = null;
var latexParser = Parser.use( "latex" ),
list = [
"gets", "to", "uparrow", "downarrow", "leftrightarrow", "updownarrow",
"Leftarrow", "Rightarrow", "Uparrow", "Downarrow", "Leftrightarrow",
"Updownarrow", "longleftarrow", "longrightarrow", "longleftrightarrow",
"Longleftarrow", "Longrightarrow", "Longleftrightarrow", "nearrow",
"nwarrow", "searrow", "swarrow", "nleftarrow", "nrightarrow",
"nLeftarrow", "nRightarrow", "nLeftrightarrow", "leftharpoonup",
"leftharpoondown", "rightharpoonup",
"rightharpoondown", "upharpoonleft", "upharpoonright", "downharpoonleft",
"downharpoonright", "leftrightharpoons", "rightleftharpoons", "leftleftarrows",
"rightrightarrows", "upuparrows", "downdownarrows", "leftrightarrows",
"rightleftarrows", "looparrowleft", "looparrowright", "leftarrowtail",
"rightarrowtail", "Lsh", "Rsh", "Lleftarrow", "Rrightarrow", "curvearrowleft",
"curvearrowright", "circlearrowleft", "circlearrowright", "multimap",
"leftrightsquigarrow", "twoheadleftarrow", "twoheadrightarrow", "rightsquigarrow"
];
kity.Utils.each( list, function ( str ) {
createFormula( "\\" + str );
} );
function parse ( ass, str ) {
var parseResult = latexParser.parse( str );
ass.regenerateBy( parseResult );
}
function createFormula ( str ) {
var node = document.createElement( "div" );
container.appendChild( node );
assembly = Assembly.use( node, {
fontsize: 20
} );
parse( assembly, str );
}
};
</script>
</head>
<body>
<div class="main">
<div id="container"></div>
</div>
</body>
</html>