summaryrefslogtreecommitdiff
path: root/tex/context/base/x-mml.mkiv
blob: 8cbf07f089206a814c99b695598f5460be68cc97 (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
50
51
52
53
54
55
56
57
58
59
60
61
%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.

% \xmlstrip  {\xmldocument} {mml:math|mml:imath|mml:dmath}

% \startxmlsetups xml:mml:process
%     \xmlutfize {\xmldocument}
%     \xmlgrab   {\xmldocument} {mml:math|mml:imath|mml:dmath} {*}
%     \xmlgrab   {\xmldocument} {mml:annotation}               {ignore}
% \stopxmlsetups

% \xmlregistersetup{xml:mml:process}


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

\xmlregistersetup{xml:mml:process}

\xmlregisterns{mml}{mathml}

\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)

\usemodule[newmme] % temporary, we will have a new one, using lua tables

%loadmarkfile{x-mme}
\loadmarkfile{x-mmp}
%loadmarkfile{x-mmc}

\endinput