diff options
author | Karl Berry <karl@freefriends.org> | 2015-04-18 22:52:45 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-04-18 22:52:45 +0000 |
commit | 16aa5a7c87f18a2483d0d61795899f886781b51c (patch) | |
tree | 1d72f00b2a4185425393598402fe055c61d1de58 /Master/texmf-dist/tex/context/base/lxml-ini.mkiv | |
parent | e68dc4d5506d46bf72823234f902bc76d1f70352 (diff) |
context, from www.pragma-ade.com/context/beta/cont-tmf.zip (18apr15)
git-svn-id: svn://tug.org/texlive/trunk@36923 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/lxml-ini.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/base/lxml-ini.mkiv | 337 |
1 files changed, 218 insertions, 119 deletions
diff --git a/Master/texmf-dist/tex/context/base/lxml-ini.mkiv b/Master/texmf-dist/tex/context/base/lxml-ini.mkiv index 752e315da5e..1141288992e 100644 --- a/Master/texmf-dist/tex/context/base/lxml-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/lxml-ini.mkiv @@ -12,6 +12,7 @@ %C details. %D Todo: auto apply setups (manage at lua end) +%D Todo: manuak: \xmlinclusion \xmlinclusions \writestatus{loading}{ConTeXt XML Support / Initialization} @@ -20,102 +21,195 @@ %registerctxluafile{lxml-xml}{1.001} % xml finalizers %registerctxluafile{lxml-aux}{1.001} % extras using parser %registerctxluafile{lxml-mis}{1.001} % extras independent of parser -\registerctxluafile{char-ent}{1.001} \registerctxluafile{lxml-ent}{1.001} % entity hacks \registerctxluafile{lxml-tex}{1.001} % tex finalizers \registerctxluafile{lxml-dir}{1.001} % ctx hacks +\registerctxluafile{lxml-ini}{1.001} % interface \unprotect % todo \!!bs \!!es where handy (slower) +% todo: { } mandate +% avoid # + \def\ctxlxml #1{\ctxlua{lxml.#1}} -\def\xmlmain #1{\ctxlxml{main("#1")}} -\def\xmlmatch #1{\ctxlxml{match("#1")}} -\def\xmlall #1#2{\ctxlxml{all("#1","#2")}} -\def\xmlatt #1#2{\ctxlxml{att("#1","#2")}} -\def\xmlattdef #1#2#3{\ctxlxml{att("#1","#2","#3")}} -\def\xmlchainatt #1#2{\ctxlxml{chainattribute("#1","/","#2")}} -\def\xmlchainattdef #1#2#3{\ctxlxml{chainattribute("#1","/","#2","#3")}} -\def\xmlattribute #1#2#3{\ctxlxml{attribute("#1","#2","#3")}} -\def\xmlattributedef #1#2#3#4{\ctxlxml{attribute("#1","#2","#3","#4")}} -\def\xmlcommand #1#2#3{\ctxlxml{command("#1","#2","#3")}} -\def\xmlconcat #1#2#3{\ctxlxml{concat("#1","#2",[[\detokenize{#3}]])}} -\def\xmlconcatrange #1#2#3#4#5{\ctxlxml{concatrange("#1","#2","#3","#4",[[\detokenize{#5}]])}} -\def\xmlcount #1#2{\ctxlxml{count("#1","#2")}} -\def\xmldelete #1#2{\ctxlxml{delete("#1","#2")}} -\def\xmldirectives #1{\ctxlxml{directives.setup("#1")}} -\def\xmldirectivesbefore #1{\ctxlxml{directives.before("#1")}} -\def\xmldirectivesafter #1{\ctxlxml{directives.after("#1")}} -\def\xmlfilter #1#2{\ctxlxml{filter("#1",\!!bs#2\!!es)}} -\def\xmlfilterlist #1#2{\ctxlxml{filterlist("#1",\!!bs#2\!!es)}} -\def\xmlfunction #1#2{\ctxlxml{applyfunction("#1",\!!bs#2\!!es)}} -\def\xmlfirst #1#2{\ctxlxml{first("#1","#2")}} -\def\xmlflush #1{\ctxlxml{flush("#1")}} -\def\xmlflushlinewise #1{\ctxlxml{flushlinewise("#1")}} -\def\xmlflushspacewise #1{\ctxlxml{flushspacewise("#1")}} -%def\xmlcontent #1{\ctxlxml{content("#1")}} -%def\xmlflushstripped #1{\ctxlxml{strip("#1",true)}} -\def\xmldirect #1{\ctxlxml{direct("#1")}} % in loops, not dt but root -\def\xmlidx #1#2#3{\ctxlxml{idx("#1","#2",\number#3)}} -\def\xmlinclude #1#2#3{\ctxlxml{include("#1","#2","#3",true)}} -\def\xmlincludeoptions#1#2#3#4{\ctxlxml{include("#1","#2","#3","#4")}} -\def\xmlsave #1#2{\ctxlxml{save("#1","#2")}} -\def\xmlindex #1#2#3{\ctxlxml{index("#1","#2",\number#3)}} -\def\xmlinfo #1{\hbox{\ttxx[\ctxlxml{info("#1")}]}} +%def\xmlall #1#2{\clf_xmlall {#1}{#2}} +%def\xmlatt #1#2{\clf_xmlatt {#1}{#2}} +%def\xmlattdef #1#2#3{\clf_xmlattdef {#1}{#2}{#3}} +%def\xmlattribute #1#2#3{\clf_xmlattribute {#1}{#2}{#3}} +%def\xmlattributedef #1#2#3#4{\clf_xmlattributedef {#1}{#2}{#3}{#4}} +%def\xmlchainatt #1#2{\clf_xmlchainatt {#1}{#2}} +%def\xmlchainattdef #1#2#3{\clf_xmlchainattdef {#1}{#2}{#3}} +%def\xmlchecknamespace #1#2#3{\clf_xmlchecknamespace {#1}{#2}{#3}} % element +%def\xmlcommand #1#2#3{\clf_xmlcommand {#1}{#2}{#3}} +\def\xmlconcat #1#2#3{\clf_xmlconcat {#1}{#2}{\detokenize{#3}}} +\def\xmlconcatrange #1#2#3#4#5{\clf_xmlconcatrange {#1}{#2}{#3}{#4}{\detokenize{#5}}} +%def\xmlcontext #1#2{\clf_xmlcontext {#1}{#2}} +%def\xmlcount #1#2{\clf_xmlcount {#1}{#2}} +%def\xmldelete #1#2{\clf_xmldelete {#1}{#2}} +%def\xmldirect #1{\clf_xmldirect {#1}} % in loops, not dt but root +%def\xmldirectives #1{\clf_xmldirectives {#1}} +%def\xmldirectivesafter #1{\clf_xmldirectivesafter {#1}} +%def\xmldirectivesbefore #1{\clf_xmldirectivesbefore {#1}} +%def\xmldisplayverbatim #1{\clf_xmldisplayverbatim {#1}} +%def\xmlelement #1#2{\clf_xmlelement {#1}{#2}} +%def\xmlfilter #1#2{\clf_xmlfilter {#1}{#2}} +%def\xmlfilterlist #1#2{\clf_xmlfilterlist {#1}{#2}} +%def\xmlfirst #1#2{\clf_xmlfirst {#1}{#2}} +%def\xmlflush #1{\clf_xmlflush {#1}} +%def\xmlflushcontext #1{\clf_xmlflushcontext {#1}} +%def\xmlflushlinewise #1{\clf_xmlflushlinewise {#1}} +%def\xmlflushspacewise #1{\clf_xmlflushspacewise {#1}} +%def\xmlfunction #1#2{\clf_xmlfunction {#1}{#2}} +%def\xmlinclude #1#2#3{\clf_xmlinclude {#1}{#2}{#3}} +%def\xmlincludeoptions#1#2#3#4{\clf_xmlincludeoptions {#1}{#2}{#3}{#4}} +%def\xmlinclusion #1{\clf_xmlinclusion {#1}} +%def\xmlinclusions #1{\clf_xmlinclusions {#1}} +%def\xmlindex #1#2#3{\clf_xmlindex {#1}{#2}{#3}} +%let\xmlposition \xmlindex +%def\xmlinlineverbatim #1{\clf_xmlinlineverbatim {#1}} +%def\xmllast #1#2{\clf_xmllast {#1}{#2}} +\def\xmlload #1#2{\clf_xmlload {#1}{#2}{\directxmlparameter\c!entities}{\directxmlparameter\c!compress}} +\def\xmlloadbuffer #1#2{\clf_xmlloadbuffer {#1}{#2}{\directxmlparameter\c!entities}{\directxmlparameter\c!compress}} +\def\xmlloaddata #1#2{\clf_xmlloaddata {#1}{#2}{\directxmlparameter\c!entities}{\directxmlparameter\c!compress}} +%def\xmlloaddirectives #1{\clf_xmlloaddirectives {#1}} +\def\xmlloadregistered #1#2{\clf_xmlloadregistered {#1}{\directxmlparameter\c!entities}{\directxmlparameter\c!compress}} +%def\xmlmain #1{\clf_xmlmain {#1}} +%def\xmlmatch #1{\clf_xmlmatch {#1}} +%def\xmlname #1{\clf_xmlname {#1}} +%def\xmlnamespace #1{\clf_xmlnamespace {#1}} +%def\xmlnonspace #1#2{\clf_xmlnonspace {#1}{#2}} +%def\xmlpos #1{\clf_xmlpos {#1}} +%def\xmlraw #1#2{\clf_xmlraw {#1}{#2}} +%def\xmlregisterns #1#2{\clf_xmlregisterns {#1}{#2}} % document +%def\xmlremapname #1#2#3#4{\clf_xmlremapname {#1}{#2}{#3}{#4}} % element +%def\xmlremapnamespace #1#2#3{\clf_xmlremapnamespace {#1}{#2}{#3}} % document +%def\xmlsave #1#2{\clf_xmlsave {#1}{#2}} +%def\xmlsetfunction #1#2#3{\clf_xmlsetfunction {#1}{#2}{#3}} +%def\xmlsetsetup #1#2#3{\clf_xmlsetsetup {#1}{#2}{#3}} +%def\xmlsnippet #1#2{\clf_xmlsnippet {#1}{#2}} +%def\xmlstrip #1#2{\clf_xmlstrip {#1}{#2}} +%def\xmlstripanywhere #1#2{\clf_xmlstripanywhere {#1}{#2}} +%def\xmlstripnolines #1#2{\clf_xmlstripnolines {#1}{#2}} +%def\xmlstripped #1#2{\clf_xmlstripped {#1}{#2}} +%def\xmlstrippednolines #1#2{\clf_xmlstrippednolines {#1}{#2}} +%def\xmltag #1{\clf_xmltag {#1}} +%def\xmltext #1#2{\clf_xmltext {#1}{#2}} +%def\xmltobuffer #1#2#3{\clf_xmltobuffer {#1}{#2}{#3}} % id pattern name +%def\xmltobufferverbose #1#2#3{\clf_xmltobufferverbose {#1}{#2}{#3}} % id pattern name +%def\xmltofile #1#2#3{\clf_xmltofile {#1}{#2}{#3}} % id pattern filename +%def\xmltoparameters #1{\clf_xmltoparameters {#1}} +%def\xmlverbatim #1{\clf_xmlverbatim {#1}} + +% experiment: +\let\xmlall \clf_xmlall +\let\xmlatt \clf_xmlatt +\let\xmlattdef \clf_xmlattdef +\let\xmlattribute \clf_xmlattribute +\let\xmlattributedef \clf_xmlattributedef +\let\xmlchainatt \clf_xmlchainatt +\let\xmlchainattdef \clf_xmlchainattdef +\let\xmlchecknamespace \clf_xmlchecknamespace +\let\xmlcommand \clf_xmlcommand +% \xmlconcat +% \xmlconcatrange +\let\xmlcontext \clf_xmlcontext +\let\xmlcount \clf_xmlcount +\let\xmldelete \clf_xmldelete +\let\xmldirect \clf_xmldirect % in loops, not dt but root +\let\xmldirectives \clf_xmldirectives +\let\xmldirectivesafter \clf_xmldirectivesafter +\let\xmldirectivesbefore \clf_xmldirectivesbefore +\let\xmldisplayverbatim \clf_xmldisplayverbatim +\let\xmlelement \clf_xmlelement +\let\xmlfilter \clf_xmlfilter +\let\xmlfilterlist \clf_xmlfilterlist +\let\xmlfirst \clf_xmlfirst +\let\xmlflush \clf_xmlflush +\let\xmlflushcontext \clf_xmlflushcontext +\let\xmlflushlinewise \clf_xmlflushlinewise +\let\xmlflushspacewise \clf_xmlflushspacewise +\let\xmlfunction \clf_xmlfunction +\let\xmlinclude \clf_xmlinclude +\let\xmlincludeoptions \clf_xmlincludeoptions +\let\xmlinclusion \clf_xmlinclusion +\let\xmlinclusions \clf_xmlinclusions +\let\xmlindex \clf_xmlindex +\let\xmlposition \clf_xmlindex +\let\xmlinlineverbatim \clf_xmlinlineverbatim +\let\xmllast \clf_xmllast +% \xmlload +% \xmlloadbuffer +% \xmlloaddata +\let\xmlloaddirectives \clf_xmlloaddirectives +% \xmlloadregistered +\let\xmlmain \clf_xmlmain +\let\xmlmatch \clf_xmlmatch +\let\xmlname \clf_xmlname +\let\xmlnamespace \clf_xmlnamespace +\let\xmlnonspace \clf_xmlnonspace +\let\xmlpos \clf_xmlpos +\let\xmlraw \clf_xmlraw +\let\xmlregisterns \clf_xmlregisterns % document +\let\xmlremapname \clf_xmlremapname % element +\let\xmlremapnamespace \clf_xmlremapnamespace % document +\let\xmlsave \clf_xmlsave +\let\xmlsetfunction \clf_xmlsetfunction +\let\xmlsetsetup \clf_xmlsetsetup +\let\xmlsnippet \clf_xmlsnippet +\let\xmlstrip \clf_xmlstrip +\let\xmlstripanywhere \clf_xmlstripanywhere +\let\xmlstripnolines \clf_xmlstripnolines +\let\xmlstripped \clf_xmlstripped +\let\xmlstrippednolines \clf_xmlstrippednolines +\let\xmltag \clf_xmltag +\let\xmltext \clf_xmltext +\let\xmltobuffer \clf_xmltobuffer % id pattern name +\let\xmltobufferverbose \clf_xmltobufferverbose % id pattern name +\let\xmltofile \clf_xmltofile % id pattern filename +\let\xmltoparameters \clf_xmltoparameters +\let\xmlverbatim \clf_xmlverbatim + +\def\xmlinfo #1{\hbox{\ttxx[\clf_xmlinfo{#1}]}} \def\xmlshow #1{\startpacked\ttx\xmlverbatim{#1}\stoppacked} -\def\xmllast #1#2{\ctxlxml{last("#1","#2")}} -\def\xmlname #1{\ctxlxml{name("#1")}} -\def\xmlnamespace #1{\ctxlxml{namespace("#1")}} -\def\xmlnonspace #1#2{\ctxlxml{nonspace("#1","#2")}} -\def\xmlraw #1#2{\ctxlxml{raw("#1","#2")}} -\def\xmlcontext #1#2{\ctxlxml{context("#1","#2")}} -\def\xmlflushcontext #1{\ctxlxml{context("#1")}} -\def\xmlsnippet #1#2{\ctxlxml{snippet("#1",#2)}} -\def\xmlelement #1#2{\ctxlxml{element("#1",#2)}} -\def\xmlregisterns #1#2{\ctxlua{xml.registerns("#1","#2")}} % document -\def\xmlremapname #1#2#3#4{\ctxlua{xml.remapname(lxml.id("#1"),"#2","#3","#4")}} % element -\def\xmlremapnamespace #1#2#3{\ctxlua{xml.renamespace(lxml.id("#1"),"#2","#3")}} % document -\def\xmlchecknamespace #1#2#3{\ctxlua{xml.checknamespace(lxml.id("#1"),"#2","#3")}} % element -\def\xmlsetfunction #1#2#3{\ctxlxml{setaction("#1",\!!bs#2\!!es,#3)}} -\def\xmlsetsetup #1#2#3{\ctxlxml{setsetup("#1",\!!bs#2\!!es,"#3")}} -\def\xmlstrip #1#2{\ctxlxml{strip("#1","#2")}} -\def\xmlstripnolines #1#2{\ctxlxml{strip("#1","#2",true)}} -\def\xmlstripanywhere #1#2{\ctxlxml{strip("#1","#2",true,true)}} -\def\xmlstripped #1#2{\ctxlxml{stripped("#1","#2")}} -\def\xmlstrippednolines #1#2{\ctxlxml{stripped("#1","#2",true)}} -\def\xmltag #1{\ctxlxml{tag("#1")}} -\def\xmltext #1#2{\ctxlxml{text("#1","#2")}} -\def\xmlverbatim #1{\ctxlxml{verbatim("#1")}} -\def\xmldisplayverbatim #1{\ctxlxml{displayverbatim("#1")}} -\def\xmlinlineverbatim #1{\ctxlxml{inlineverbatim("#1")}} - -\def\xmlload #1#2{\ctxlxml{load("#1","#2","\directxmlparameter\c!entities","\directxmlparameter\c!compress")}} -\def\xmlloadbuffer #1#2{\ctxlxml{loadbuffer("#1","#2","\directxmlparameter\c!entities","\directxmlparameter\c!compress")}} -\def\xmlloaddata #1#2{\ctxlxml{loaddata("#1",\!!bs#2\!!es,"\directxmlparameter\c!entities","\directxmlparameter\c!compress")}} -\def\xmlloadregistered #1#2{\ctxlxml{loadregistered("#1","\directxmlparameter\c!entities","\directxmlparameter\c!compress")}} -\def\xmlloaddirectives #1{\ctxlxml{directives.load("any:///#1")}} -\def\xmlpos #1{\ctxlxml{pos("#1")}} - -\def\xmltoparameters #1{\ctxlxml{toparameters("#1")}} - -\def\xmltofile #1#2#3{\ctxlxml{tofile("#1","#2","#3")}} % id pattern filename + +% goodie: + +\unexpanded\def\xmlprettyprint#1#2% + {\xmltobufferverbose{#1}{.}{xml-temp}% + \ifdefined\scitebuffer + \scitebuffer[#2][xml-temp]% + \else + \typebuffer[xml-temp][\c!option=#2]% + \fi} % kind of special: -\def\xmlstartraw{\ctxlxml{startraw()}} -\def\xmlstopraw {\ctxlxml{stopraw()}} +%def\xmlstartraw{\clf_xmlstartraw} +%def\xmlstopraw {\clf_xmlstopraw} + +\let\xmlstartraw\clf_xmlstartraw +\let\xmlstopraw \clf_xmlstopraw -% todo: \xmldoifelseattribute +% these are expandable! todo: \xmldoifelseattribute -\def\xmldoif #1#2{\ctxlxml{doif (\!!bs#1\!!es,\!!bs#2\!!es)}} % expandable -\def\xmldoifnot #1#2{\ctxlxml{doifnot (\!!bs#1\!!es,\!!bs#2\!!es)}} % expandable -\def\xmldoifelse #1#2{\ctxlxml{doifelse (\!!bs#1\!!es,\!!bs#2\!!es)}} % expandable -\def\xmldoiftext #1#2{\ctxlxml{doiftext (\!!bs#1\!!es,\!!bs#2\!!es)}} % expandable -\def\xmldoifnottext #1#2{\ctxlxml{doifnottext (\!!bs#1\!!es,\!!bs#2\!!es)}} % expandable -\def\xmldoifelsetext #1#2{\ctxlxml{doifelsetext(\!!bs#1\!!es,\!!bs#2\!!es)}} % expandable +\let\xmldoif \clf_xmldoif +\let\xmldoifnot \clf_xmldoifnot +\let\xmldoifelse \clf_xmldoifelse +\let\xmldoiftext \clf_xmldoiftext +\let\xmldoifnottext \clf_xmldoifnottext +\let\xmldoifelsetext \clf_xmldoifelsetext -%def\xmldoifelseempty #1#2{\ctxlxml{doifelseempty("#1","#2")}} % #2, "*" or "" == self not yet implemented -%def\xmldoifelseselfempty #1{\ctxlxml{doifelseempty("#1")}} +\let\xmldoifempty \clf_xmldoifempty +\let\xmldoifnotempty \clf_xmldoifnotempty +\let\xmldoifelseempty \clf_xmldoifelseempty +\let\xmldoifselfempty \clf_xmldoifselfempty +\let\xmldoifnotselfempty \clf_xmldoifnotselfempty +\let\xmldoifelseselfempty \clf_xmldoifelseselfempty + +\let\xmldoiftextelse \xmldoifelsetext +\let\xmldoifemptyelse \xmldoifelseempty +\let\xmldoifselfemptyelse \xmldoifelseselfempty % \startxmlsetups xml:include % \xmlinclude{main}{include}{filename|href} @@ -129,28 +223,28 @@ %\ef\xmlsetup#1#2{\setupwithargument{#2}{#1}} \let\xmlsetup\setupwithargumentswapped -\let\xmls\setupwithargumentswapped -\let\xmlw\setupwithargument +\let\xmls\setupwithargumentswapped % hardly any faster +\let\xmlw\setupwithargument % hardly any faster \newtoks \registeredxmlsetups % todo: 1:xml:whatever always before 3:xml:something -\unexpanded\def\xmlprependsetup #1{\ctxlxml{installsetup(1,"*","#1")}} -\unexpanded\def\xmlappendsetup #1{\ctxlxml{installsetup(2,"*","#1")}} -\unexpanded\def\xmlbeforesetup #1#2{\ctxlxml{installsetup(3,"*","#1","#2")}} -\unexpanded\def\xmlaftersetup #1#2{\ctxlxml{installsetup(4,"*","#1","#2")}} +\unexpanded\def\xmlprependsetup #1{\clf_xmlprependsetup {*}{#1}} +\unexpanded\def\xmlappendsetup #1{\clf_xmlappendsetup {*}{#1}} +\unexpanded\def\xmlbeforesetup #1#2{\clf_xmlbeforesetup {*}{#1}{#2}} +\unexpanded\def\xmlaftersetup #1#2{\clf_xmlaftersetup {*}{#1}{#2}} -\unexpanded\def\xmlprependdocumentsetup #1#2{\ctxlxml{installsetup(1,"#1","#2")}} -\unexpanded\def\xmlappenddocumentsetup #1#2{\ctxlxml{installsetup(2,"#1","#2")}} -\unexpanded\def\xmlbeforedocumentsetup#1#2#3{\ctxlxml{installsetup(3,"#1","#2","#3")}} -\unexpanded\def\xmlafterdocumentsetup #1#2#3{\ctxlxml{installsetup(4,"#1","#2","#3")}} +\unexpanded\def\xmlprependdocumentsetup #1#2{\clf_xmlprependdocumentsetup{#1}{#2}} +\unexpanded\def\xmlappenddocumentsetup #1#2{\clf_xmlappenddocumentsetup {#1}{#2}} +\unexpanded\def\xmlbeforedocumentsetup #1#2#3{\clf_xmlbeforedocumentsetup {#1}{#2}{#3}} +\unexpanded\def\xmlafterdocumentsetup #1#2#3{\clf_xmlafterdocumentsetup {#1}{#2}{#3}} -\unexpanded\def\xmlremovesetup #1{\ctxlxml{removesetup("*","#1")}} -\unexpanded\def\xmlremovedocumentsetup #1#2{\ctxlxml{removesetup("#1","#2")}} +\unexpanded\def\xmlremovesetup #1{\clf_xmlremovesetup {*}{#1}} +\unexpanded\def\xmlremovedocumentsetup #1#2{\clf_xmlremovedocumentsetup {#1}{#2}} -\unexpanded\def\xmlflushdocumentsetups #1#2{\ctxlxml{flushsetups("#1","*","#2")}} % #1 == id where to apply * and #2 -\unexpanded\def\xmlresetdocumentsetups #1{\ctxlxml{resetsetups("#1")}} +\unexpanded\def\xmlflushdocumentsetups #1#2{\clf_xmlflushdocumentsetups {#1}{*}{#2}} % #1 == id where to apply * and #2 +\unexpanded\def\xmlresetdocumentsetups #1{\clf_xmlresetdocumentsetups {#1}} \let\xmlregistersetup \xmlappendsetup \let\xmlregisterdocumentsetup\xmlappenddocumentsetup @@ -170,8 +264,8 @@ \xmldefaulttotext{#1}% after include \xmlstoptiming} -\unexpanded\def\xmlstarttiming{\ctxlua{statistics.starttiming(lxml)}} -\unexpanded\def\xmlstoptiming {\ctxlua{statistics.stoptiming (lxml)}} +\unexpanded\def\xmlstarttiming{\clf_xmlstarttiming} +\unexpanded\def\xmlstoptiming {\clf_xmlstoptiming} \def\lxml_process#1#2#3#4#5% flag \loader id name what initializersetup {\begingroup @@ -229,11 +323,6 @@ % \xmlsetfunction{main}{verbatim}{lxml.displayverbatim} % \xmlsetfunction{main}{verb} {lxml.inlineverbatim} -% \unexpanded\def\startxmldisplayverbatim[#1]{} -% \unexpanded\def\stopxmldisplayverbatim {} -% \unexpanded\def\startxmlinlineverbatim [#1]{} -% \unexpanded\def\stopxmlinlineverbatim {} - % we use an xml: namespace so one has to define a suitable verbatim, say % % \definetyping[xml:verbatim][typing] @@ -252,7 +341,7 @@ \unexpanded\def\startxmlinlineverbatim[#1]% {\begingroup \edef\currenttype{xml:#1}% - \let\stopxmldisplayverbatim\endgroup + \let\stopxmlinlineverbatim\endgroup \doinitializeverbatim} % will move but is developed for xml @@ -271,14 +360,13 @@ \def\inlinemessage #1{\dontleavehmode{\tttf#1}} \def\displaymessage#1{\blank\inlinemessage{#1}\blank} -% \def\xmltraceentities % settextcleanup is not defined -% {\ctxlua{xml.settextcleanup(lxml.trace_text_entities)}% -% \appendtoks\ctxlxml{showtextentities()}\to\everygoodbye} - % processing instructions -\def\xmlcontextdirective#1% kind class key value - {\executeifdefined{xml#1directive}\gobblethreearguments} +\unexpanded\def\xmlinstalldirective#1#2% + {\clf_xmlinstalldirective{#1}{\checkedstrippedcsname#2}} + +% \def\xmlcontextdirective#1% kind class key value +% {\executeifdefined{xml#1directive}\gobblethreearguments} % setting up xml: % @@ -301,15 +389,15 @@ \letvalue{\??xmldefaults\v!text }\plusone \letvalue{\??xmldefaults\v!hidden}\plustwo -\unexpanded\def\xmldefaulttotext#1% +\unexpanded\def\xmldefaulttotext {\ifcase\xmlprocessingmode - % unset + \expandafter\gobbleoneargument % unset \or - \ctxlxml{setcommandtotext("#1")}% 1 + \expandafter\clf_xmlsetcommandtotext % 1 \or - \ctxlxml{setcommandtonone("#1")}% 2 + \expandafter\clf_xmlsetcommandtonone % 2 \else - % unset + \expandafter\gobbleoneargument % unset \fi} \appendtoks @@ -326,22 +414,23 @@ %def\xmlvalue #1#2{\ifcsname\??xmlmapvalue#1:#2\endcsname\csname\??xmlmapvalue#1:#2\expandafter\expandafter\gobbleoneargument\expandafter\endcsname\else\expandafter\firstofoneargument\fi} \def\xmldoifelsevalue #1#2{\ifcsname\??xmlmapvalue#1:#2\endcsname\expandafter\firstoftwoarguments\else\expandafter\secondoftwoarguments\fi} +\let\xmldoifvalueelse\xmldoifelsevalue + \let\xmlmapval\xmlmapvalue \let\xmlval \xmlvalue %D Experimental: -\def\xmlgetindex #1{\ctxlxml{getindex("\xmldocument","#1")}} -\def\xmlrawindex #1{\ctxlxml{rawindex("#1")}} -\def\xmlwithindex #1#2{\ctxlxml{withindex("\xmldocument","#1","#2")}} +\def\xmlgetindex #1{\clf_xmlgetindex {\xmldocument}{#1}} +\def\xmlwithindex #1#2{\clf_xmlwithindex{\xmldocument}{#1}{#2}} \def\xmlreference #1#2{\string\xmlwithindex{#1}{#2}} %D Entities (might change): \setnewconstant\xmlautoentities\plusone % 0=off, 1=upper, 2=upper,lower -\def\xmlsetentity#1#2{\ctxlua{xml.registerentity('#1',\!!bs\detokenize{#2}\!!es)}} -\def\xmltexentity#1#2{\ctxlua{lxml.registerentity('#1',\!!bs\detokenize{#2}\!!es)}} +\unexpanded\def\xmlsetentity#1#2{\clf_xmlsetentity{#1}{\detokenize{#2}}} +\unexpanded\def\xmltexentity#1#2{\clf_xmltexentity{#1}{\detokenize{#2}}} % \xmlsetentity{tex}{\TEX{}} % {} needed @@ -393,6 +482,16 @@ \let\processxmlfile \processXMLfile \let\xmldata \XMLdata +\unexpanded\def\xmlsetinjectors[#1]% + {\clf_xmlsetinjectors{#1}} + +\unexpanded\def\xmlresetinjectors + {\clf_xmlresetinjectors{}} + +\def\xmlinjector#1{\executeifdefined{#1}\donothing} + +\let\xmlapplyselectors\clf_xmlapplyselectors + \protect \endinput % \newcount\charactersactiveoffset \charactersactiveoffset="10000 |