summaryrefslogtreecommitdiff
path: root/tex/context/base/lxml-ini.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/lxml-ini.mkiv')
-rw-r--r--tex/context/base/lxml-ini.mkiv22
1 files changed, 17 insertions, 5 deletions
diff --git a/tex/context/base/lxml-ini.mkiv b/tex/context/base/lxml-ini.mkiv
index 4c5b10327..81a611bf1 100644
--- a/tex/context/base/lxml-ini.mkiv
+++ b/tex/context/base/lxml-ini.mkiv
@@ -11,6 +11,8 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+%D Todo: push/pop for nested usage ... think this over
+
\writestatus{loading}{ConTeXt XML Support / Initialization}
\registerctxluafile{lxml-tab}{1.001}
@@ -41,7 +43,6 @@
\def\xmlfirst #1#2{\ctxlua{lxml.first("#1","#2")}}
\def\xmlflush #1{\ctxlua{lxml.flush("#1")}}
% \def\xmlcontent #1{\ctxlua{lxml.content("#1")}}
-% \def\xmlstrip #1{\ctxlua{lxml.strip("#1")}}
% \def\xmlflushstripped #1{\ctxlua{lxml.strip("#1",true)}}
\def\xmldirect #1{\ctxlua{lxml.direct("#1")}} % in loops, not dt but root
\def\xmlidx #1#2#3{\ctxlua{lxml.idx("#1","#2",\number#3)}}
@@ -150,17 +151,21 @@
% todo: test for duplicates !
\xmlflushdocumentsetups{#1}%
\xmldefaulttotext{#1}% after include
+\xmladdindex{#1}% check for dups
\xmlstoptiming}
\def\xmlstarttiming{\ctxlua{statistics.starttiming(lxml)}}
\def\xmlstoptiming {\ctxlua{statistics.stoptiming (lxml)}}
+\def\xmlpushdocument#1{\ctxlua{lxml.pushdocument("#1")}}
+\def\xmlpopdocument {\ctxlua{lxml.popdocument()}}
+
\def\doxmlprocess#1#2#3#4#5%
{\begingroup
\edef\xmldocument{#3}% #2 can be \xmldocument and set as such
- \ctxlua{lxml.pushdocument("#3")}%
+ \xmlpushdocument{#3}%
#2{#3}{#4}%
-\ctxlua{lxml.addindex("\xmldocument",\ifnum#1=\plusone true\else false\fi)}% todo: only checksum for file
+ \ctxlua{lxml.addindex("\xmldocument",\ifnum#1=\plusone true\else false\fi)}% todo: only checksum for file
\ifcase\xmlprocessingmode
\enableXML
\else
@@ -169,7 +174,7 @@
\doifelsenothing{#5}
{\directsetup{xml:process}}
{\directsetup{#5}}%
- \ctxlua{lxml.popdocument()}%
+ \xmlpopdocument
\endgroup}
\def\xmlprocessfile {\doxmlprocess\plusone \xmlload}
@@ -411,7 +416,7 @@
%D Experimental:
-%def\xmladdindex #1{\ctxlua{lxml.addindex("#1")}}
+\def\xmladdindex #1{\ctxlua{lxml.addindex("#1")}}
\def\xmlgetindex #1{\ctxlua{lxml.getindex("\xmldocument","#1")}}
\def\xmlrawindex #1{\ctxlua{lxml.rawindex("#1")}}
\def\xmlwithindex#1#2{\ctxlua{lxml.withindex("\xmldocument","#1","#2")}}
@@ -421,4 +426,11 @@
\xmlflush{#1}
\stopxmlsetups
+%D Under construction (see x-set-11)
+
+\def\xmlloadonly#1#2#3%
+ {\xmlload{#1}{#2}%
+ \xmlregistereddocumentsetups{#3}%
+ \xmladdindex{#1}}
+
\protect \endinput