diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/lxml-ini.tex')
-rw-r--r-- | Master/texmf-dist/tex/context/base/lxml-ini.tex | 304 |
1 files changed, 0 insertions, 304 deletions
diff --git a/Master/texmf-dist/tex/context/base/lxml-ini.tex b/Master/texmf-dist/tex/context/base/lxml-ini.tex deleted file mode 100644 index c6cd60b8929..00000000000 --- a/Master/texmf-dist/tex/context/base/lxml-ini.tex +++ /dev/null @@ -1,304 +0,0 @@ -%D \module -%D [ file=lxml-ini, -%D version=2007.08.17, -%D title=\CONTEXT\ \LUA\ based \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. - -\writestatus{loading}{Context L-XML Macros (initialization)} - -\registerctxluafile{lxml-ini}{1.001} - -\unprotect - -\def\xmlall #1#2{\ctxlua{lxml.all("#1","#2")}} -\def\xmlatt #1#2{\ctxlua{lxml.attribute("#1","/","#2")}} -\def\xmlattdef #1#2#3{\ctxlua{lxml.attribute("#1","/","#2","#3")}} -\def\xmlattribute #1#2#3{\ctxlua{lxml.attribute("#1","#2","#3")}} -\def\xmlattributedef #1#2#3#4{\ctxlua{lxml.attribute("#1","#2","#3","#4")}} -\def\xmlchecknamespace #1#2#3{\ctxlua{xml.check_namespace(lxml.id("#1"),"#2","#3")}} % element -\def\xmlcommand #1#2#3{\ctxlua{lxml.command("#1","#2","#3")}} -\def\xmlconcat #1#2#3{\ctxlua{lxml.concat("#1","#2",[[\detokenize{#3}]])}} -\def\xmlconcatrange#1#2#3#4#5{\ctxlua{lxml.concatrange("#1","#2","#3","#4",[[\detokenize{#5}]])}} -\def\xmlcontent #1#2{\ctxlua{lxml.content("#1","#2")}} -\def\xmlcount #1#2{\ctxlua{lxml.count("#1","#2")}} -\def\xmldelete #1#2{\ctxlua{xml.delete(lxml.id("#1"),"#2")}} -\def\xmldirectives #1{\ctxlua{lxml.directives.setups("#1")}} -\def\xmlfilter #1#2{\ctxlua{lxml.filter("#1","#2")}} -\def\xmlfirst #1#2{\ctxlua{lxml.first("#1","#2")}} -\def\xmlflush #1{\ctxlua{lxml.flush("#1")}} -\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)}} -\def\xmlinclude #1#2#3{\ctxlua{lxml.include("#1","#2","#3",true)}} -\def\xmlindex #1#2#3{\ctxlua{lxml.index("#1","#2",\number#3)}} -\def\xmlinfo #1{\hbox{\ttxx[\ctxlua{lxml.info("#1")}]}} -\def\xmlshow #1{\startpacked\ttx\xmlverbatim{#1}\stoppacked} -\def\xmllast #1#2{\ctxlua{lxml.last("#1","#2")}} -\def\xmlload #1#2{\ctxlua{lxml.load("#1","#2")}} -\def\xmlloadbuffer #1#2{\ctxlua{lxml.loadbuffer("#1","#2")}} -\def\xmlloaddata #1#2{\ctxlua{lxml.loaddata("#1",\!!bs#2\!!es)}} -\def\xmlloaddirectives #1{\ctxlua{lxml.directives.load("#1")}} -\def\xmlname #1{\ctxlua{lxml.name("#1")}} -\def\xmlnamespace #1{\ctxlua{lxml.namespace("#1")}} -\def\xmlnonspace #1#2{\ctxlua{lxml.nonspace("#1","#2")}} -\def\xmlraw #1#2{\ctxlua{lxml.raw("#1","#2")}} -\def\xmlsnippet #1#2{\ctxlua{lxml.snippet("#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.rename_space(lxml.id("#1"),"#2","#3")}} % document -\def\xmlsetfunction #1#2#3{\ctxlua{lxml.setaction("#1","#2",#3)}} -\def\xmlsetsetup #1#2#3{\ctxlua{lxml.setsetup("#1","#2","#3")}} -\def\xmlstrip #1#2{\ctxlua{lxml.strip("#1","#2")}} -\def\xmlstripped #1#2{\ctxlua{lxml.stripped("#1","#2")}} -\def\xmltag #1{\ctxlua{lxml.tag("#1")}} -\def\xmltext #1#2{\ctxlua{lxml.text("#1","#2")}} -\def\xmltags #1#2{\ctxlua{lxml.tags("#1","#2")}} -\def\xmlutfize #1{\ctxlua{lxml.utfize("#1")}} -\def\xmlverbatim #1{\ctxlua{lxml.verbatim("#1")}} - -%def\xmldoifelse #1#2{\ctxlua{cs.testcase(xml.found(lxml.id("#1"),"#2",false))}} -%def\xmldoifelsetext #1#2{\ctxlua{cs.testcase(xml.found(lxml.id("#1"),"#2",true ))}} - -% todo: \xmldoifelseattribute - -\def\xmldoifelse #1#2{\ctxlua{commands.doifelse(xml.found(lxml.id("#1"),"#2",false))}} -\def\xmldoifelsetext #1#2{\ctxlua{commands.doifelse(xml.found(lxml.id("#1"),"#2",true ))}} -\def\xmldoif #1#2{\ctxlua{commands.doif (xml.found(lxml.id("#1"),"#2",false))}} -\def\xmldoiftext #1#2{\ctxlua{commands.doif (xml.found(lxml.id("#1"),"#2",true ))}} -\def\xmldoifnot #1#2{\ctxlua{commands.doifnot (xml.found(lxml.id("#1"),"#2",false))}} -\def\xmldoifnottext #1#2{\ctxlua{commands.doifnot (xml.found(lxml.id("#1"),"#2",true ))}} - -\def\xmldefaulttotext #1{\ifcase\xmlprocessingmode\or\or \ctxlua{lxml.set_command_to_text("#1")}\fi} -\def\xmldefaulttonone #1{\ifcase\xmlprocessingmode\or\or\or\ctxlua{lxml.set_command_to_none("#1")}\fi} - -% \startxmlsetups xml:include -% \xmlinclude{main}{include}{filename|href} -% \stopxmlsetups -% -% \xmlprependsetup{xml:include} - -\let\xmlgrab\xmlsetsetup - -\def\xmlsetup#1#2% % we pass the reference so that we have access to the frozen number - {\def\xmlself{#1}% % by using #1 inside a setup - \setupwithargument{#2}{#1}} - -\newtoks \registeredxmlsetups - -\def\xmlappendsetup #1{\appendtoksonce \directsetup{#1}\to\registeredxmlsetups} % to be done, made faster -\def\xmlprependsetup#1{\prependtoksonce\directsetup{#1}\to\registeredxmlsetups} % to be done, made faster - -\let\xmlregistersetup\xmlappendsetup - -\def\xmlregisteredsetups - {\xmlstarttiming - \the\registeredxmlsetups\registeredxmlsetups\emptytoks - \xmldefaulttotext\xmldocument % after include - \xmlstoptiming} - -\chardef\xmlprocessingmode=0 % 0=mixed, 1=mkivonly, 2=mkivonly-default-text, 3=mkivonly-default-none - -\def\xmlstarttiming{\ctxlua{input.starttiming(lxml)}} -\def\xmlstoptiming {\ctxlua{input.stoptiming (lxml)}} - -\def\doxmlprocess#1#2#3#4% - {\begingroup - \def\xmldocument{#2}% - #1{#2}{#3}% - \ifcase\xmlprocessingmode - \enableXML - \else - \setcatcodetable\notcatcodes - \fi - \doifelsenothing{#4} - {\directsetup{xml:process}} - {\directsetup{#4}}% - \endgroup} - -\def\xmlprocessfile {\doxmlprocess\xmlload} -\def\xmlprocessdata {\doxmlprocess\xmlloaddata} -\def\xmlprocessbuffer{\doxmlprocess\xmlloadbuffer} -\let\xmlprocess \xmlprocessfile - -\startsetups xml:process - \xmlregisteredsetups - \xmlall\xmldocument{/} -\stopsetups - -\long\def\xmlloop#1#2#3% - {\def\xmli##1##2{\xmlidx{#1}{#2/##1}{##2}}% - \dorecurse{\xmlcount{#1}{#2}}{#3}} - -\long\def\xmlconnect#1#2#3% inefficient - {\scratchcounter\xmlcount{#1}{#2}\relax - \ifcase\scratchcounter \or - \xmlall{#1}{#2}% - \else - \dorecurse \scratchcounter { - \ifnum\recurselevel>\plusone#3\fi - \xmlidx{#1}{#2}{\recurselevel} - } - \fi} - -\def\xmlcdataobeyedline {\obeyedline} -\def\xmlcdataobeyedspace{\strut\obeyedspace} -\def\xmlcdatabefore {\bgroup\tt} -\def\xmlcdataafter {\egroup} - -% verbatim (dodo:pre/post whitespace, maybe splot verbatim and -% cdata commands), experimental: -% -% \xmlsetfunction{main}{verbatim}{lxml.displayverbatim} -% \xmlsetfunction{main}{verb} {lxml.inlineverbatim} - -% \def\startxmldisplayverbatim[#1]{} -% \def\stopxmldisplayverbatim {} -% \def\startxmlinlineverbatim [#1]{} -% \def\stopxmlinlineverbatim {} - -% we use an xml: namespace so one has to define a suitable verbatim, say -% -% \definetyping[xml:verbatim][typing] -% -% this is experimental! - -\def\startxmldisplayverbatim[#1]% - {\startpacked % \begingroup - \let\currenttypingclass\??tp - \edef\currenttyping{xml:#1}% - \def\stopxmldisplayverbatim - {\endofverbatimlines - \stoppacked} % \endgroup - \mkinitializeverbatim - \beginofverbatimlines} - -\def\startxmlinlineverbatim[#1]% - {\begingroup - \let\currenttypingclass\??ty - \edef\currenttyping{xml:#1}% - \let\stopxmldisplayverbatim\endgroup - \mkinitializeverbatim} - -% will move but is developed for xml - -\newtoks \collectingtoks - -\def\startcollect#1\stopcollect - {\collectingtoks\@EA{\the\collectingtoks#1}} - -\def\startexpandedcollect#1\stopexpandedcollect - {\expanded{\collectingtoks{\the\collectingtoks#1}}} - -\def\startcollecting{\collectingtoks\emptytoks} -\def\stopcollecting {\the\collectingtoks} - -\def\inlinemessage #1{\dontleavehmode{\tttf#1}} -\def\displaymessage#1{\blank\inlinemessage{#1}\blank} - -% entities - -\def\xmlresolveentities - {\ctxlua{xml.set_text_cleanup(xml.resolve_text_entities)}} - -\def\xmltraceentities - {\ctxlua{xml.set_text_cleanup(lxml.trace_text_entities)}% - \appendtoks\ctxlua{lxml.show_text_entities()}\to\everygoodbye} - -% processing instructions - -\def\xmlcontextdirective#1% kind class key value - {\executeifdefined{xml#1directive}\gobblethreearguments} - -% brrrr, give this at the top of a style that needs to stub mkiv loading -% -% this will change - -\def\processXMLfileMKIV - {\dosingleempty\doprocessXMLfileMKIV} - -\let\normalprocessXMLfilegrouped\processXMLfilegrouped - -\def\doprocessXMLfileMKIV[#1]% - {\def\processXMLfilegrouped##1% - {\let\processXMLfilegrouped\normalprocessXMLfilegrouped - \doifelsenothing{#1}{\xmlprocess{main}{##1}{}}{\xmlprocess{#1}{##1}{}}}} - -\protect \endinput - -% \xmlload{main}{normreader.xml} - -% \xmlattribute{main}{/subject/information/materialoverview/attribute}{pocketbook} -% \xmltext{main}{/subject/information/materialoverview/@pocketbook} - -% \dorecurse{\xmlflush{main}{/subject/blabla/count()}} -% {\ifnum\recurselevel=\xmlflush{main}{/subject/blabla/count()}\relax -% \removeunwantedspaces and\space\ignorespaces -% \else\ifnum\recurselevel>1 -% \removeunwantedspaces,\space\ignorespaces -% \fi -% \xmlflush{main}{/subject/blabla/index(\recurselevel})} - -% \def\xmljoin{main}{/subject/information/authors/author}{,}{and} -% table.join(t,1,#t-1,", ") .. " and " .. t[#t] - -% % An example by Wolfgang Schuster: -% -% \startxmlsetups xml:mysetups -% \xmlsetsetup{\xmldocument}{section}{xml:*} -% \xmlsetsetup{\xmldocument}{title|p}{xml:*} -% \stopxmlsetups -% -% \xmlregistersetup{xml:mysetups} -% -% \newcounter\sectionlevel -% -% \startxmlsetups xml:section -% \increment\sectionlevel -% \xmlflush{#1} -% \decrement\sectionlevel -% \stopxmlsetups -% -% \startxmlsetups xml:title -% \ifcase\sectionlevel -% \or\chapter {\xmlflush{#1}} -% \or\section {\xmlflush{#1}} -% \or\subsection {\xmlflush{#1}} -% \or\subsubsection{\xmlflush{#1}} -% \fi -% \stopxmlsetups -% -% \startxmlsetups xml:p -% \xmlflush{#1}\endgraf -% \stopxmlsetups -% -% \startbuffer[section] -% <!-- An example by Wolfgang Schuster: --> -% <section> -% <title>Section 1</title> -% <p>text text text text text text text text</p> -% <section> -% <title>Subsection 1</title> -% <p>text text text text text text text text</p> -% </section> -% <section> -% <title>Subsection 2</title> -% <p>text text text text text text text text</p> -% </section> -% <section> -% <title>Subsection 3</title> -% <p>text text text text text text text text</p> -% </section> -% <title>Section 2</title> -% <p>text text text text text text text text</p> -% </section> -% \stopbuffer -% -% \starttext -% \xmlprocessbuffer{main}{section}{} -% \stoptext |