summaryrefslogtreecommitdiff
path: root/tex/context/base/lxml-ctx.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/lxml-ctx.mkiv')
-rw-r--r--tex/context/base/lxml-ctx.mkiv64
1 files changed, 64 insertions, 0 deletions
diff --git a/tex/context/base/lxml-ctx.mkiv b/tex/context/base/lxml-ctx.mkiv
new file mode 100644
index 000000000..73d082d0d
--- /dev/null
+++ b/tex/context/base/lxml-ctx.mkiv
@@ -0,0 +1,64 @@
+%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 / Hans Hagen \& Ton Otten}]
+%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 letterbar is a messy hack and is needed for the tabulate
+
+\settrue \xmllshowbuffer
+\setfalse\xmllshowtitle
+\settrue \xmllshowwarning
+
+\definehead[lshowtitle][subsubsubsubsubject]
+\setuphead[lshowtitle][style=\tta]
+
+% \unexpanded\def\setuplxmlshow[#1]%
+% {\dodoubleargument\getparameters[\??xl]}
+
+\def\xmllshow#1%
+ {\begingroup
+ \let|=\letterbar
+ \ctxlua{xml.ctx.tshow {
+ pattern = \!!bs#1\!!es,
+ \ifconditional\xmllshowtitle
+ title = "lshowtitle",
+ \fi
+ \ifconditional\xmllshowwarning
+ warning = true,
+ \fi
+ } }%
+ \endgroup}
+
+\def\xmllshowbuffer#1#2#3%
+ {\begingroup
+ \let|=\letterbar
+ \ctxlua{xml.ctx.tshow {
+ pattern = \!!bs#2\!!es,
+ \ifconditional\xmllshowbuffer
+ xmlroot = "#1",
+ attribute = "#3",
+ \fi
+ \ifconditional\xmllshowwarning
+ warning = true,
+ \fi
+ } }%
+ \endgroup}
+
+\protect