summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/lxml-ctx.mkiv
blob: 530c29aa7783b28aeee575002bb2271e67207b9d (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=lxml-ini,
%D        version=2007.08.17,
%D          title=\CONTEXT\ \XML\ Support,
%D       subtitle=Initialization,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%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 Experimental. This might change! Also, it might become a module
%D instead if core code.

\writestatus{loading}{ConTeXt XML Support / Goodies}

\registerctxluafile{lxml-ctx}{1.001}

\unprotect

% The \let|=letterbar is a messy hack and is needed for the tabulate. We now use
% \detokenize.

\settrue \xmllshowbuffer
\setfalse\xmllshowtitle
\settrue \xmllshowwarning

\definehead
  [lshowtitle]
  [subsubsubsubsubject]

\setuphead
  [lshowtitle]
  [\c!style=\tta]

\unexpanded\def\xmllshow#1%
  {\ctxlua{xml.ctx.tshow {
        pattern = \!!bs\detokenize{#1}\!!es,
    \ifconditional\xmllshowtitle
        title = "lshowtitle",
    \fi
    \ifconditional\xmllshowwarning
        warning = true,
    \fi
    } }}

\unexpanded\def\xmllshowbuffer#1#2#3%
  {\ctxlua{xml.ctx.tshow {
        pattern = \!!bs\detokenize{#2}\!!es,
    \ifconditional\xmllshowbuffer
        xmlroot   = "#1",
        attribute = "#3",
    \fi
    \ifconditional\xmllshowwarning
        warning = true,
    \fi
     } }}

\protect