summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/x-mml.mkiv
blob: d2dd91a0900ef2f4ac5f0bc9d3785522216356ee (plain)
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
%D \module
%D   [       file=x-mml,
%D        version=2007.09.04,
%D          title=\CONTEXT\ XML Modules,
%D       subtitle=MathML Renderer,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D This is a first version of the \MKIV\ \MATHML\ processor using
%D the \type {lxml} helper functions. The implementation is yet
%D incomplete but I needed a quick hack for a project where I wanted
%D to use the new \MKIV\ \XML\ handler. It's also a nice testcase.

\startxmlsetups xml:mml:process
    \xmlgrab {\xmldocument} {mml:*} {*}
\stopxmlsetups

\xmlregistersetup{xml:mml:process}

\xmlregisterns{mml}{mathml}

\def\setupMMLappearance[#1]{\dodoubleargument\getparameters[@@MML#1]}

\def\MMLhack{\let\MMLpar\par \let\par\relax \everyvbox{\let\par\MMLpar}}

\startxmlsetups mml:math
    \automathematics  {\MMLhack\xmlflush{#1}}
\stopxmlsetups

\startxmlsetups mml:imath
    \inlinemathematics{\MMLhack\xmlflush{#1}}
\stopxmlsetups

\startxmlsetups mml:dmath
    \displaymathematics{\MMLhack\xmlflush{#1}}
\stopxmlsetups

% -- we need a new entity mapper (also covering unicode)

\loadmarkfile{x-mmb} % common code
\loadmarkfile{x-mmp} % presentation mathml
\loadmarkfile{x-mmc} % content mathml

\endinput