1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus{loading}{ConTeXt XML Macros MathML to SVG Converter}
15
16\usemodule[x][mathml]
17
18\registerctxluafile{xmathsvg}{}
19
20\starttexdefinition MakeSVGMath #index#page#mode
21 \setbox\scratchbox\hbox\bgroup
22 \xmlprocessbuffer{main}{math#page}{}
23 \egroup
24 \ctxlua {
25 moduledata.svgmath.register(#index, #page, {
26 mode = "#mode",
27 width = \number\wd\scratchbox,
28 height = \number\ht\scratchbox,
29 depth = \number\dp\scratchbox,
30 } )
31 }
32 \startTEXpage
33 \box\scratchbox
34 \stopTEXpage
35\stoptexdefinition
36
37\starttexdefinition ReuseSVGMath #index#page
38 \ctxlua {
39 moduledata.svgmath.register(#index,#page)
40 }
41\stoptexdefinition
42
43
44
45\startluacode
46
47 local svgstyle = document.arguments.svgstyle or ""
48
49 if type(svgstyle) == "string" and svgstyle ~= "" then
50 context.environment { svgstyle }
51 else
52 context.setupbodyfont { "pagella" }
53 end
54
55\stopluacode
56
57
58
59\starttext
60
61 \startluacode
62 moduledata.svgmath.process(environment.arguments.inputfile)
63 \stopluacode
64
65\stoptext
66 |