diff options
Diffstat (limited to 'tex')
40 files changed, 660 insertions, 313 deletions
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 5e771da8b..b4a3d19b2 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -26,6 +26,30 @@ \def\@@itemcounter {\s!itemcount\currentitemgroup} +% very experimental + +\def\redoanalyzefigurefiles#1% + {\ifcase\figurestatus + \def\@@efcurrenttype{#1}% + \dododoanalyzefigurefiles\empty + \fi} + +\def\analyzefigurefiles + {\let\externalfigurelog\empty + \let\@@efcurrenttype\empty + \let\@@efcurrentpath\empty + \let\@@efcurrentfile\empty + \doanalyzefigurefiles\doanalyzefigurefilesA + \doanalyzefigurefiles\doanalyzefigurefilesB + \doanalyzefigurefiles\doanalyzefigurefilesC + % new, permits rather raw names like e:/.... + \let\dodoanalyzefigurefiles\redoanalyzefigurefiles + \doanalyzefigurefiles\doanalyzefigurefilesA + \doanalyzefigurefiles\doanalyzefigurefilesB + \doanalyzefigurefiles\doanalyzefigurefilesC} + + + \def\OTRSETgotocell#1#2% not that robust {\endgraf \gdef\gotocellcounter{0}% @@ -339,7 +363,7 @@ {\box\nextbox}}% \hbox\framed[\c!plaats=\v!normaal,#2]} -\beginETEX +\beginETEX \dimexpr \definepapersize [oversized] @@ -488,8 +512,6 @@ \else \writestatus{\m!fields}{pass parent field and copies}% \fi} - - \newtoks\everyfirstparagraphintro \newtoks\everynextparagraphintro diff --git a/tex/context/base/cont-sys.tex b/tex/context/base/cont-sys.tex deleted file mode 100644 index c39daf8b6..000000000 --- a/tex/context/base/cont-sys.tex +++ /dev/null @@ -1,123 +0,0 @@ -%D \module -%D [ file=cont-sys, -%D version=1995.10.10, -%D title=\CONTEXT\ Miscellaneous Macros, -%D subtitle=System Specific Setups, -%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. - -\unprotect - -% Here you can take care of overloading some (style) -% defaults. What goes here, depends on your local system. -% -% The following commands sets the default font encoding: -% -% \setupencoding [\s!default=ec] -% -% You can let \CONTEXT\ load the map files for \PDFTEX. -% -% \autoloadmapfilestrue -% -% If you use the more verbose naming scheme, uncomment this: -% -% \usetypescript [map] [default,\defaultencoding] -% -% or : -% -% \usetypescript [map] [all] -% -% In case you have set psfonts.map already, you can comment -% the following lines. Beware: pdftex uses the fontname -% (second entry on map file lines) for (not so) clever -% remapping, so in case of troubles, remove the names (is -% safe)! -% -% \preloadmapfile [original-ams-cmr] -% \preloadmapfile [original-ams-euler] -% \preloadmapfile [il2-ams-cmr] -% \preloadmapfile [pl0-ams-cmr] -% -% If you want the default berry names (ec and 8r only): -% -% \usetypescript [berry] [\defaultencoding] -% -% Overload Lucida by Times cum suis: -% -% \definetypescriptsynonym [lbr] [pos] -% -% Compensate for missing files: -% -% \definefontsynonym [gbhei] [gbsong] -% \definefontsynonym [gbheisl] [gbsong] -% \definefontsynonym [gbheisl] [gbsong] -% -% The already loaded map file list can be reset with: -% -% \forgetmapfiles -% -% Setting up a global figure path: -% -% \setupexternalfigures [\c!gebied={e:/fig/eps,t:/mine/figs}] -% -% Loading a specific special driver: -% -% \setupoutput [dviwindo] -% -% Enabling \CONTEXT\ navigation symbols as well as \euro's. - -\usesymbols [nav,mvs] - -\setupsymbolset [navigation 1] % not that clever - -\setupinteraction [\c!symboolset=navigation 1] - -% Changing language defaults: -% -% \setuplanguage -% [nl] -% [\c!leftquote=\upperleftsinglesixquote, -% \c!leftquotation=\upperleftdoublesixquote] - -% Loading local preferences, for example -% -% \input prag-gen % company styles -% \input prag-log % more company styles -% -% Enabling run time \METAPOST\ (also enable \write18 in -% texmf.cnf): - -\runMPgraphicstrue -\runMPTEXgraphicstrue - -\recycleMPslotstrue - -% This saves some runtime, but needs a format, which you can -% make with 'texexec --make --alone metafun'. Make sure that -% the mem files are moved to the used web2c path (locate with -% 'kpsewhich plain.mem'). - -\useMETAFUNformattrue - -% Enabling nested pretty printing: - -\newprettytrue - -% This can be a way to get things working on system with -% name clashes. (Some \TeX's tend do search system wide.) - -\protectbufferstrue - -% You can enable a rigurous figure searching, but normally -% this is not really needed and even annoying. -% -% \runutilityfiletrue - -% So far. - -\protect \endinput diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index c8bba2123..5fd0bda0f 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -15,7 +15,7 @@ \catcode`\{=1 \catcode`\}=2 -\def\contextversion{2002.3.4} +\def\contextversion{2002.3.12} %D Welcome to the main module. When this module is ran through %D \type{initex} or \type{tex -i} or \type{whatevertex} using @@ -205,6 +205,7 @@ \input page-lin.tex \input page-mar.tex \input page-bck.tex +\input page-app.tex \input core-job.tex diff --git a/tex/context/base/core-fig.tex b/tex/context/base/core-fig.tex index 2316691cd..8435757b9 100644 --- a/tex/context/base/core-fig.tex +++ b/tex/context/base/core-fig.tex @@ -218,7 +218,7 @@ \let\@@efcurrentpath\empty \let\@@efcurrentfile\empty -\def\analyzefigurefiles% +\def\analyzefigurefiles {\let\externalfigurelog\empty \let\@@efcurrenttype\empty \let\@@efcurrentpath\empty @@ -657,9 +657,9 @@ {\scratchcounter=3 } {\scratchcounter=0 \ExpandBothAfter\doifinset{\v!lokaal}{\@@explaats} - {\advance\scratchcounter by 1 }% + {\advance\scratchcounter 1 }% \ExpandBothAfter\doifinset{\v!globaal}{\@@explaats} - {\advance\scratchcounter by 2 }}}% + {\advance\scratchcounter 2 }}}% \chardef\figurefilemode=\scratchcounter \ifcase\figurefilemode \let\@@ex@@gebied\f!currentpath @@ -1003,7 +1003,8 @@ {\let\@@efkader=\v!aan}% \fi \ifcase\figurestatus - \def\@@efkader{\v!aan}% + \let\@@efkader\v!aan + \let\@@efobject\v!nee \showmessage{\m!figures}{1}{\@@effilename}% \or \showmessage{\m!figures}{2}{\@@effullname}% @@ -1220,28 +1221,28 @@ \else \settrue\externalfigurelevel \ifskipexternalfigures - \externalfigurereplacement{name: #2 \\ file: #3 \\ skipped}% + \externalfigurereplacement{#2}{#3}{skipped}% {name: #2 \\ file: #3 \\ skipped}% \else\ifcase\figurestatus - \externalfigurereplacement{name: #2 \\ file: #3 \\ unknown}% + \externalfigurereplacement{#2}{#3}{unknown}% {name: #2 \\ file: #3 \\ unknown}% \else -\doifelse{\@@efreset}{\v!ja} - {\ht\foundexternalfigure\figureheight - \dp\foundexternalfigure\zeropoint - \wd\foundexternalfigure\figurewidth - \box\foundexternalfigure} - {\localframed - [\??ef] - [\c!breedte=\figurewidth, - \c!hoogte=\figureheight, - \c!offset=\v!overlay] - {\vfilll\box\foundexternalfigure}}% + \doifelse\@@efreset\v!ja + {\ht\foundexternalfigure\figureheight + \dp\foundexternalfigure\zeropoint + \wd\foundexternalfigure\figurewidth + \box\foundexternalfigure} + {\localframed + [\??ef] + [\c!breedte=\figurewidth, + \c!hoogte=\figureheight, + \c!offset=\v!overlay] + {\vfilll\box\foundexternalfigure}}% \fi\fi \fi \popmacro\figureheight \popmacro\figurewidth \egroup} -\def\externalfigurereplacement#1% +\def\externalfigurereplacement#1#2#3% {\expanded{\localframed [\??ef] [\c!breedte=\figurewidth, @@ -1250,7 +1251,9 @@ \c!achtergrondraster=.5, %\c!kader=\ifincolor\v!uit\else\v!aan\fi] \c!kader=\ifincolor\@@efkader\else\v!aan\fi]}% - {\ttx#1}} + {\ttx name: \expanded{\verbatimstring{#1}}\\% + file: \expanded{\verbatimstring{#2}}\\% + state: \expanded{\verbatimstring{#3}}}} \def\getexternalfigure#1% {\getvalue{\??ef\??ef#1}} diff --git a/tex/context/base/core-fld.tex b/tex/context/base/core-fld.tex index 93fa01d61..4967eada5 100644 --- a/tex/context/base/core-fld.tex +++ b/tex/context/base/core-fld.tex @@ -165,6 +165,8 @@ \newevery\everysetfield\relax +\def\doiffieldelse#1{\doifdefinedelse{fielddata#1}} + \def\setfield#1#2#3#4#5#6#7#8#9% {\bgroup \doglobal\increment\numberoffields @@ -172,7 +174,7 @@ \doglobal\addtocommalist{#1}\collectedfields \fi \the\everysetfield - \setxvalue{fielddata#1}% + \setxvalue{fielddata#1}% kortere tag {\noexpand\dosetfield{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}}% \egroup} diff --git a/tex/context/base/core-hlp.tex b/tex/context/base/core-hlp.tex index 7347f40ab..8e6005059 100644 --- a/tex/context/base/core-hlp.tex +++ b/tex/context/base/core-hlp.tex @@ -39,6 +39,8 @@ % will be proper state variable +\let\pagehelpdata\empty + \def\dontresetpagedata% {\let\synchronizepagehelpdata\relax} @@ -151,7 +153,7 @@ \def\donohelpbutton[#1][#2]% {\dodohelpbutton[#1][]{}[#2]} -\def\dohelpbutton[#1][#2]% +\def\dohelpbutton {\ifsecondargument \expandafter\donohelpbutton \else @@ -159,11 +161,9 @@ \fi} \def\helpbutton% also gobble spaces between [][] - {\dodoublempty\dohelpbutton} + {\dodoubleempty\dohelpbutton} \def\doifhelpinfo#1#2% {\iflocation\doifsymboldefinedelse{helpinfo:#1}{#2}{}\fi} -\protect - -\endinput +\protect \endinput diff --git a/tex/context/base/core-itm.tex b/tex/context/base/core-itm.tex index 059ef7d33..f6d9961d9 100644 --- a/tex/context/base/core-itm.tex +++ b/tex/context/base/core-itm.tex @@ -21,7 +21,7 @@ \stopmessages \startmessages english library: layouts - 9: currently no more than -- levels in itimezations + 9: currently no more than -- levels in itemizations \stopmessages \startmessages german library: layouts diff --git a/tex/context/base/core-job.tex b/tex/context/base/core-job.tex index 443cdf12b..a9a7b03c5 100644 --- a/tex/context/base/core-job.tex +++ b/tex/context/base/core-job.tex @@ -303,23 +303,18 @@ \def\stopomgeving% {\doprevlevel} -\long\def\skipdeelomgeving#1\stopdeelomgeving% - {} - \def\startdeelomgeving[#1]% - {\def\partialenvironments{}% + {\let\loadedlocalenvironments\empty \def\docommando##1% {\beforesplitstring##1\at.\to\someevironment - \fullexpandoneargafter\addtocommalist{\someevironment}\partialenvironments}% + \fullexpandoneargafter\addtocommalist{\someevironment}\loadedlocalenvironments}% \processcommalist[#1]\docommando \fullexpandtwoargsafter\doifcommonelse % no longer next needed {\currentproject,\currentproduct, \currentcomponent,\currentenvironment} - {\partialenvironments} - {\let\stopdeelomgeving\relax - \let\next\relax} - {\let\next\skipdeelomgeving}% - \next} + {\loadedlocalenvironments} + {\letvalue{\e!stop\e!deelomgeving}\relax} + {\grabuntil{\e!stop\e!deelomgeving}\relax}} \def\startproduct{\startprodukt} \def\stopproduct {\stopprodukt} diff --git a/tex/context/base/core-obj.tex b/tex/context/base/core-obj.tex index c8d978a34..8898fe410 100644 --- a/tex/context/base/core-obj.tex +++ b/tex/context/base/core-obj.tex @@ -90,6 +90,7 @@ \def\presetobject#1#2% {\ifundefined{\r!object#1::#2}% +\global % added \@EA\let\csname\r!object#1::#2\endcsname\objectplaceholder \fi} diff --git a/tex/context/base/core-pos.tex b/tex/context/base/core-pos.tex index f833a09ed..3edbd1b15 100644 --- a/tex/context/base/core-pos.tex +++ b/tex/context/base/core-pos.tex @@ -611,7 +611,7 @@ %D {action when not on this page} %D \stoptypen -\def\doifpositionsonsamepageelse#1#2#3#4% +\def\dodoifpositionsonsamepageelse#1#2#3#4% {\bgroup \scratchcounter=#1\donefalse \def\docommando##1% @@ -624,10 +624,10 @@ \ifdone\egroup#3\else\egroup#4\fi} \def\doifpositionsonsamepageelse% - {\doifpositionsonsamepageelse{0}} + {\dodoifpositionsonsamepageelse{0}} \def\doifpositionsonthispageelse#1#2#3% - {\doifpositionsonsamepageelse\realfolio} + {\dodoifpositionsonsamepageelse\realfolio} %D Before we come to graphics support, we have to make sure of %D the reference point on the page. The next macro does so and diff --git a/tex/context/base/core-spa.tex b/tex/context/base/core-spa.tex index 88079adf1..891fed3f2 100644 --- a/tex/context/base/core-spa.tex +++ b/tex/context/base/core-spa.tex @@ -430,6 +430,8 @@ % ETEX ! ! ! +\beginETEX \ifcsname + \def\doblanko#1% {\edef\ascii{#1}\convertcommand\ascii\to\ascii \ifx\ascii\empty\else @@ -454,6 +456,40 @@ \fi\fi \fi} +\endETEX + +\beginTEX + +\def\doblanko#1% + {\edef\ascii{#1}\convertcommand\ascii\to\ascii + \ifx\ascii\empty\else + \@EA\ifx\csname\??bo\??bo\ascii\endcsname\relax + \@EA\ifx\csname\??bo\ascii\endcsname\relax + \dorepeatwithcommand[#1]\redoblanko + \else + \@EA\rawprocesscommalist\@EA[\csname\??bo\ascii\endcsname]\doblanko\relax + \fi + \else + \csname\??bo\??bo\ascii\endcsname + \fi + \fi} + +\def\redoblanko#1% + {\edef\ascii{#1}\convertcommand\ascii\to\ascii + \ifx\ascii\empty\else + \@EA\ifx\csname\??bo\??bo\ascii\endcsname\relax + \@EA\ifx\csname\??bo\ascii\endcsname\relax + \global\advance\blankoskip#1\relax + \else + \@EA\rawprocesscommalist\@EA[\csname\??bo\ascii\endcsname]\doblanko\relax + \fi + \else + \csname\??bo\??bo\ascii\endcsname + \fi + \fi} + +\endTEX + \unexpanded\def\blanko % the \relax is definitely needed due to the many \if's {\relax\complexorsimple\doblanko} @@ -771,6 +807,15 @@ \def\nospace {\removelastspace\ignorespaces} \def\removeunwantedspaces{\ifhmode\unskip\unskip\unskip\unskip\fi} +% better, but not done: +% +% \def\removelastspace +% {\ifhmode \ifdim\lastskip=\spaceamount\relax +% \unskip +% \fi \fi} +% +% due to backward compability + \let\spatie \space \let\hardespatie\fixedspace \let\geenspatie \nospace diff --git a/tex/context/base/core-ver.tex b/tex/context/base/core-ver.tex index c9d5a4093..3061ea280 100644 --- a/tex/context/base/core-ver.tex +++ b/tex/context/base/core-ver.tex @@ -1063,7 +1063,8 @@ \def\complextypefile[#1]#2% {\getvalue{\??tp#1\c!voor}% - \doiflocfileelse{\pathplusfile\f!currentpath{#2}} +% \doiflocfileelse{\pathplusfile\f!currentpath{#2}} + \doiflocfileelse{#2} {\startopelkaar % includes \bgroup \doifinset{\getvalue{\??tp#1\c!optie}}{\v!commandos,\v!schuin,\v!normaal} {\setuptyping[#1][\c!optie=\v!geen]}% diff --git a/tex/context/base/enco-ans.tex b/tex/context/base/enco-ans.tex index 2e3b55cb5..758126593 100644 --- a/tex/context/base/enco-ans.tex +++ b/tex/context/base/enco-ans.tex @@ -62,6 +62,8 @@ \definecharacter textmacron 175 \definecharacter textcedilla 184 +\definecharacter textunderscore 95 + \definecharacter dotlessi 16 % 105 \definecharacter Lstroke 128 diff --git a/tex/context/base/enco-def.tex b/tex/context/base/enco-def.tex index cf132bd40..0a0e5095c 100644 --- a/tex/context/base/enco-def.tex +++ b/tex/context/base/enco-def.tex @@ -37,6 +37,8 @@ \definecharacter texttilde 126 \definecharacter textdiaeresis 127 +\definecharacter textunderscore {\fakeunderscore} + \definecharacter Acircumflex {\buildtextaccent\textcircumflex A} \definecharacter acircumflex {\buildtextaccent\textcircumflex a} \definecharacter Ccircumflex {\buildtextaccent\textcircumflex C} diff --git a/tex/context/base/enco-ec.tex b/tex/context/base/enco-ec.tex index 065cbfe11..5e2cb46ad 100644 --- a/tex/context/base/enco-ec.tex +++ b/tex/context/base/enco-ec.tex @@ -59,6 +59,11 @@ \definecharacter textcedilla 11 \definecharacter textogonek 12 +\definecharacter textunderscore 95 + +\definecharacter leftguillemot 19 +\definecharacter rightguillemot 20 + \definecharacter dotlessi 25 \definecharacter dotlessj 26 diff --git a/tex/context/base/enco-tbo.tex b/tex/context/base/enco-tbo.tex index 37df4d458..6f0d04482 100644 --- a/tex/context/base/enco-tbo.tex +++ b/tex/context/base/enco-tbo.tex @@ -78,6 +78,9 @@ \definecharacter Ydiaeresis 159 +\definecharacter leftguillemot 171 +\definecharacter rightguillemot 187 + \definecharacter Agrave 192 \definecharacter Aacute 193 \definecharacter Acircumflex 194 @@ -143,9 +146,6 @@ \definecharacter thorn 254 \definecharacter ydiaeresis 255 -\definecharacter leftguillemot 171 -\definecharacter rightguillemot 183 - \stopencoding \endinput diff --git a/tex/context/base/java-ini.tex b/tex/context/base/java-ini.tex index d89b14a89..c8239e4a5 100644 --- a/tex/context/base/java-ini.tex +++ b/tex/context/base/java-ini.tex @@ -203,7 +203,7 @@ \long\gdef\startJScode#1 #2 {\doifelse{#2}{uses} {\def\next{\dostartJScodeA{#1}}} - {\def\next{\dostartJScodeB{#1} #2}}% + {\def\next{\dostartJScodeB{#1} #2 }}% \next} \long\gdef\dostartJScodeA#1#2 #3\stopJScode% @@ -212,6 +212,8 @@ \long\gdef\dostartJScodeB#1#2\stopJScode% {\long\setgvalue{\r!java#1}{\do{}{#2}}} +\let\stopJScode\relax + %D \macros %D {presetJScode} %D diff --git a/tex/context/base/lang-ini.tex b/tex/context/base/lang-ini.tex index 0f7442576..c2ef0840a 100644 --- a/tex/context/base/lang-ini.tex +++ b/tex/context/base/lang-ini.tex @@ -841,6 +841,15 @@ \def\rightsubfakeguillemot {\hbox{\raise.25ex\hbox{$\scriptscriptstyle>$}}} +%D Pretty Plain: + +\def\fakeunderscore{\leavevmode\kern.06em\vbox{\hrule\!!width.3em}} + +\ifx\mathunderscore\undefined \let\mathunderscore\fakeunderscore \fi +\ifx\textunderscore\undefined \let\textunderscore\fakeunderscore \fi + +\def\_{\ifmmode\mathunderscore\else\textunderscore\fi} + %D Just like with subsentence boundary symbols, quotes %D placement depends on the current language, therefore we show %D the defaults here. diff --git a/tex/context/base/m-pstric.tex b/tex/context/base/m-pstric.tex index 39f45525a..4fb3ae7a5 100644 --- a/tex/context/base/m-pstric.tex +++ b/tex/context/base/m-pstric.tex @@ -8,39 +8,101 @@ %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. +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. -\edef\oldbarcode{\the\catcode`\|} % \chardef -\catcode`\|=12 - -\def\definieerkleur#1[#2]#3[#4]% - {%\writestatus{pstricks}{definieer kleur #2}% - \getparameters[pstricks][#4]% - \newrgbcolor{#2}{{\pstricksr} {\pstricksg} {\pstricksb}}} - -\def\definieerpalet#1[#2]#3[#4]% - {} %{\writestatus{pstricks}{overslaan definieer palet #2}} - -\def\definieerkleurgroep#1[#2]#3[#4]% - {} %{\writestatus{pstricks}{overslaan definieer kleurgroep #2}} +\chardef\oldbarcode\the\catcode`\| \catcode`\|=12 \def\loadpstrickscolors#1% - {\let\olddefinekleur =\definecolor - \let\olddefinepalet =\definepalet - \let\olddefinecolorgroup=\definecolorgroup + {\pushmacro\dodefinecolor + \pushmacro\dodefinepalet + \pushmacro\dodefinecolorgroup + \def\dodefinecolor[##1][##2]% + {\doifassignmentelse{##2} + {\getparameters[pstricks][r=0,g=0,b=0,##2]% + \expanded{\newrgbcolor{##1}{{\pstricksr} {\pstricksg} {\pstricksb}}}}% + {}}% + \def\dodefinepalet [##1][##2]{}% + \def\dodefinecolorgroup[##1][##2][##3]{}% \writestatus{pstricks}{loading colors from #1}% \input #1 \relax - \let\definecolor =\olddefinecolor - \let\definepalet =\olddefinepalet - \let\definecolorgroup=\olddefinecolorgroup} + \popmacro\dodefinecolorgroup + \popmacro\dodefinepalet + \popmacro\dodefinecolor} -\input multido \relax -\input pstricks \relax -\input pst-plot \relax - -\loadpstrickscolors{colo-rgb} % nog koppelen \redef\ +\doifelse{\jobsuffix}{dvi} + {\input multido \relax + \input pstricks \relax + \input pst-plot \relax + \loadpstrickscolors{colo-rgb}} + {\writestatus{pstricks}{using indirect method; enable write18}} \catcode`\|=\oldbarcode -\endinput +%D The next piece of code is for John Culleton who suggested to +%D handle \PSTRICKS\ in a similar fashion as \METAPOST, i.e.\ +%D using a child process. For the moment there is no support +%D for passing environments, so these should be called +%D explicitly inside this environment. + +\unprotect + +%D \startPSTRICKS[offset=2pt] ... \stopPSTRICKS +%D +%D works in both dvi and pdf mode +%D +%D % \usemodule[pstric] +%D +%D \startPSTRICKS +%D \pspicture(0,0)(10,10) +%D \dorecurse{10}{\psline(0,0)(\recurselevel,10)} +%D \dorecurse{10}{\psline(0,0)(10,\recurselevel)} +%D \endpspicture +%D \stopPSTRICKS + +\def\startPSTRICKS + {\dosingleempty\dostartPSTRICKS} + +\ifx\startTEXapplication\undefined + +\long\def\dostartPSTRICKS[#1]#2\stopPSTRICKS + {\doifelse{\jobsuffix}{dvi} + {#2} + {\bgroup + \setbuffer[pstricks]% + \usemodule[pstric]% + \setbox\scratchbox=\hbox{#2}% + % There is probably a nicer way to handle this + \immediate\openout\scratchwrite=\bufferprefix dim.tmp + \immediate\write\scratchwrite{\dimen0=\the\ht\scratchbox}% + \immediate\write\scratchwrite{\dimen2=\the\wd\scratchbox}% + \immediate\closeout\scratchwrite + % Quick and dirty + \startTEXpage[#1]\box\scratchbox\stopTEXpage + \endbuffer + % Here we go! + \immediate\write18{texexec \bufferprefix pstricks.tmp --once --batch}% + \immediate\write18{dvips \bufferprefix pstricks}% + \immediate\write18{ps2pdf \bufferprefix pstricks.ps \bufferprefix pstricks.pdf}% + % We pick up the dimensions from the scratch file. + \readlocfile{\bufferprefix pstricks-dim.tmp}{}{}% + % Since the graphic is put on a page (sigh) by dvips/gs + % we need to shift it around a bit. + \setbox\scratchbox=\hbox + {\externalfigure[\bufferprefix pstricks.pdf][\c!object=\v!nee]}% + \setbox\scratchbox=\hbox + {\lower\ht\scratchbox\hbox{\raise\dimen2\box\scratchbox}}% + \wd\scratchbox\dimen0 + \ht\scratchbox\dimen2 + \dp\scratchbox\zeropoint + \box\scratchbox + \egroup}} + +\fi + +\long\def\dostartPSTRICKS[#1]#2\stopPSTRICKS + {\doifelse{\jobsuffix}{dvi} % will some day move to app as switch + {\hbox{#2}} + {\startTEXapplication[#1]{\usemodule[pstric]}#2\stopTEXapplication}} + +\protect \endinput diff --git a/tex/context/base/m-units.tex b/tex/context/base/m-units.tex index 423ca5e70..f66204f90 100644 --- a/tex/context/base/m-units.tex +++ b/tex/context/base/m-units.tex @@ -354,7 +354,7 @@ \def\Femto {\dimensionprefix{f}} \def\Pico {\dimensionprefix{p}} \def\Nano {\dimensionprefix{n}} -\def\Micro {\dimensionprefix{\iftextunits u\else\mu\fi}} +\def\Micro {\dimensionprefix{\iftextdimensions u\else\mu\fi}} \def\Milli {\dimensionprefix{m}} \def\Centi {\dimensionprefix{c}} \def\Deci {\dimensionprefix{d}} @@ -368,7 +368,7 @@ %D and operators: -\def\Times {\dimensionnopfix{\iftextunits.\else\cdot\fi}} +\def\Times {\dimensionnopfix{\iftextdimensions.\else\cdot\fi}} \def\Solidus {\dimensionmidfix{/}} \def\Per {\dimensionmidfix{/}} \def\OutOf {\dimensionnopfix{:}} diff --git a/tex/context/base/meta-fig.tex b/tex/context/base/meta-fig.tex index 8a0e41ce6..e0e3a57c3 100644 --- a/tex/context/base/meta-fig.tex +++ b/tex/context/base/meta-fig.tex @@ -41,40 +41,6 @@ %D definitions with the text flow, since all settings are %D kept local. The page is clipped to the image size. -% generalized, so this belongs in another module - -\def\dostartfittingpage[#1][#2]% - {\pagina - \bgroup - \setbox\scratchbox=\hbox - \bgroup - \getparameters[#1][#2]% - \schaal[\c!schaal=\getvalue{#1\c!schaal}]\bgroup\localframed[#1]\bgroup} - -\def\dostopfittingpage% - {\egroup\egroup\egroup - \edef\fittingwd{\the\wd\scratchbox}% - \edef\fittinght{\the\ht\scratchbox}% - \definepapersize - [\s!dummy] - [\c!breedte=\fittingwd, - \c!hoogte=\fittinght]% - \startlocal % keep settings as local as can be - \setuppapersize - [\s!dummy][\s!dummy]% - \stellayoutin - [\c!breedte=\fittingwd,\c!hoogte=\fittinght,\c!plaats=\v!midden, - \c!kopwit=\!!zeropoint,\c!rugwit=\!!zeropoint, - \c!snijwit=\!!zeropoint,\c!bodemwit=\!!zeropoint, - \c!hoofd=\!!zeropoint,\c!voet=\!!zeropoint]% - \stoplocal % which saves us the trouble of push/pop - \startmakeup[\v!standaard][\c!tekststatus=\v!leeg,\c!dubbelzijdig=\v!nee,\c!pagina=]% - \centerbox{\box\scratchbox}% - \stopmakeup - \egroup} - -% MP pages - \presetlocalframed[\??mg] \def\setupMPpage% @@ -97,28 +63,6 @@ \c!hoogte=\v!passend, \c!kader=\v!uit] -% tex pages - -\presetlocalframed[\??tg] - -\def\setupTEXpage% - {\dodoubleargument\getparameters[\??tg]} - -\def\startTEXpage% - {\dodoubleempty\dostartfittingpage[\??tg]} - -\def\stopTEXpage% - {\dostopfittingpage} - -\setupTEXpage - [\c!schaal=1000, - \c!strut=\v!nee, - \c!uitlijnen=\v!normaal, % needed, else problems ! - \c!offset=\v!overlay, - \c!breedte=\v!passend, - \c!hoogte=\v!passend, - \c!kader=\v!uit] - %D \macros %D {MPfigure} %D diff --git a/tex/context/base/mult-com.tex b/tex/context/base/mult-com.tex index 98a2e0441..91e9e5aee 100644 --- a/tex/context/base/mult-com.tex +++ b/tex/context/base/mult-com.tex @@ -1400,6 +1400,9 @@ startdeelomgeving: startdeelomgeving startlocalenvironment startlokaleumgebung startlokalnihoprostredi iniziaambientelocale startmediulocal + deelomgeving: deelomgeving localenvironment + lokaleumgebung lokalnihoprostredi + ambientelocale mediulocal startonderdeel: startonderdeel startcomponent startkomponente startkomponenta iniziacomponente startcomponenta diff --git a/tex/context/base/mult-con.tex b/tex/context/base/mult-con.tex index 791438739..b9f361243 100644 --- a/tex/context/base/mult-con.tex +++ b/tex/context/base/mult-con.tex @@ -2373,7 +2373,10 @@ sectieblokomgeving: sectieblokomgeving sectionblockenvironment sectionblockenvironment sectionblockenvironment ambientebloccosezione blocsectiuneambient % TB TH - + deelomgeving: deelomgeving localenvironment + lokaleumgebung lokalnihoprostredi + ambientelocale mediulocal + \stopelements %D \stopcompressdefinitions diff --git a/tex/context/base/page-app.tex b/tex/context/base/page-app.tex new file mode 100644 index 000000000..5ba74fdef --- /dev/null +++ b/tex/context/base/page-app.tex @@ -0,0 +1,128 @@ +%D \module +%D [ file=page-app, % from meta-fig +%D version=1998.01.15, +%D title=\CONTEXT\ Core Macros, +%D subtitle=Independent page building, +%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 The fitting page code is moved from \type {meta-fig} to +%D here. + +\unprotect + +\def\dostartfittingpage[#1][#2]% + {\pagina + \bgroup + \setbox\scratchbox=\hbox + \bgroup + \getparameters[#1][#2]% + \schaal[\c!schaal=\getvalue{#1\c!schaal}]\bgroup\localframed[#1]\bgroup} + +\def\dostopfittingpage% + {\egroup\egroup\egroup + \edef\fittingwd{\the\wd\scratchbox}% + \edef\fittinght{\the\ht\scratchbox}% + \definepapersize + [\s!dummy] + [\c!breedte=\fittingwd, + \c!hoogte=\fittinght]% + \startlocal % keep settings as local as can be + \setuppapersize + [\s!dummy][\s!dummy]% + \stellayoutin + [\c!breedte=\fittingwd,\c!hoogte=\fittinght,\c!plaats=\v!midden, + \c!kopwit=\!!zeropoint,\c!rugwit=\!!zeropoint, + \c!snijwit=\!!zeropoint,\c!bodemwit=\!!zeropoint, + \c!hoofd=\!!zeropoint,\c!voet=\!!zeropoint]% + \stoplocal % which saves us the trouble of push/pop + \startmakeup[\v!standaard][\c!tekststatus=\v!leeg,\c!dubbelzijdig=\v!nee,\c!pagina=]% + \centerbox{\box\scratchbox}% + \stopmakeup + \egroup} + +%D \TEX\ pages (for \METAPOST\ pages, see \type {meta-fig}): + +\presetlocalframed[\??tg] + +\def\setupTEXpage% + {\dodoubleargument\getparameters[\??tg]} + +\def\startTEXpage% + {\dosingleempty\dostartTEXpage} + +\def\dostartTEXpage[#1]% + {\dostartfittingpage[\??tg][#1]\gobblespacetokens} + +\def\stopTEXpage% + {\removelastspace + \dostopfittingpage} + +\setupTEXpage + [\c!schaal=1000, + \c!strut=\v!nee, + \c!uitlijnen=\v!normaal, % needed, else problems ! + \c!offset=\v!overlay, + \c!breedte=\v!passend, + \c!hoogte=\v!passend, + \c!kader=\v!uit] + +%D Application pages (for an example, see \type {m-pstric}): + +\def\@@texapp{texapp} +\def\@@texdim{texdim} + +\def\saveTEXapplication#1#2% + {\immediate\openout\scratchwrite=\bufferprefix\@@texdim.tmp + \immediate\write\scratchwrite{\dimen#1=\the\ht\scratchbox}% + \immediate\write\scratchwrite{\dimen#2=\the\wd\scratchbox}% + \immediate\closeout\scratchwrite} + +\def\restoreTEXapplication + {\readlocfile{\bufferprefix\@@texdim.tmp}\donothing\donothing} + +\def\startTEXapplication + {\dosingleempty\dostartTEXapplication} + +\long\def\dostartTEXapplication[#1]#2#3\stopTEXapplication + {\bgroup + \bgroup + \let\f!temporaryextension\c!tex + \setbuffer[\@@texapp]% + \starttext + #2% preamble + \startTEXpage[#1]% + \setbox\scratchbox=\hbox{#3}% + \saveTEXapplication02% dimensions + \box\scratchbox + \stopTEXpage + \stoptext + \endbuffer + \egroup + \doifelse\jobsuffix{dvi}\donetrue\donefalse + \executesystemcommand{texexec \bufferprefix\@@texapp.tex --once --batch}% + \ifdone % eps + \executesystemcommand{dvips -E* -o \@@texapp.eps \@@texapp}% + \else % pdf + \executesystemcommand{dvips \bufferprefix\@@texapp}% + \executesystemcommand{ps2pdf \bufferprefix\@@texapp.ps \bufferprefix\@@texapp.pdf}% + \fi + \restoreTEXapplication % dimensions + \setbox\scratchbox=\hbox + {\expanded{\externalfigure + [\bufferprefix\@@texapp.\ifdone eps\else pdf\fi] + [\c!object=\v!nee]}}% + \setbox\scratchbox=\hbox + {\lower\ht\scratchbox\hbox{\raise\dimen2\box\scratchbox}}% + \wd\scratchbox\dimen0 + \ht\scratchbox\dimen2 + \dp\scratchbox\zeropoint + \box\scratchbox + \egroup} + +\protect \endinput diff --git a/tex/context/base/page-imp.tex b/tex/context/base/page-imp.tex index 6cc0c2bd8..c8e4f405c 100644 --- a/tex/context/base/page-imp.tex +++ b/tex/context/base/page-imp.tex @@ -1,5 +1,5 @@ %D \module -%D [ file=core-pag, +%D [ file=page-imp, % was: core-pag, %D version=1998.01.15, %D title=\CONTEXT\ Core Macros, %D subtitle=Pagebody Building (Imposition), diff --git a/tex/context/base/page-lin.tex b/tex/context/base/page-lin.tex index 91b2d0863..4b6b9cdac 100644 --- a/tex/context/base/page-lin.tex +++ b/tex/context/base/page-lin.tex @@ -115,7 +115,7 @@ \ifregelnummersinmarge \llap{\hbox{\box0\hskip\linkermargeafstand}}% \else - \llap{\hbox to \@@rnbreedte{\box0\hss}}% + \rlap{\hbox to \@@rnbreedte{\box0\hss}}% was \llap, nog testen !! \fi} \def\complexstartregelnummeren[#1]% diff --git a/tex/context/base/page-lyr.tex b/tex/context/base/page-lyr.tex index 2796ba228..119702399 100644 --- a/tex/context/base/page-lyr.tex +++ b/tex/context/base/page-lyr.tex @@ -383,7 +383,7 @@ %D efficient in \ETEX\ since there testing for an undefined %D macro does not takes hash space. -\def\flushlayer[#1]% +\unexpanded\def\flushlayer[#1]% {\doifnotvalue{\??ll#1\c!status}{\v!stop} {\startoverlay {\doflushlayer1{#1}{#1}} diff --git a/tex/context/base/page-mar.tex b/tex/context/base/page-mar.tex index d1f7bf7ab..637a34baa 100644 --- a/tex/context/base/page-mar.tex +++ b/tex/context/base/page-mar.tex @@ -19,34 +19,39 @@ \newif\iflowinmargin -\def\stelinmargein% +\def\stelinmargein {\dodoubleempty\dostelinmargein} \def\dostelinmargein[#1][#2]% {\ifsecondargument - \doifundefinedelse{\??im#1\c!offset} - {\presetlocalframed - [\??im#1]% - \getparameters - [\??im#1] - [\c!kader=\v!uit, - \c!offset=\v!overlay, - \c!regel=1, - \c!scheider=, - \c!breedte=\v!ruim, - \c!afstand=\!!zeropoint, - \c!letter=\@@imletter, - \c!kleur=\@@imkleur, - \c!plaats=\@@implaats, - \c!uitlijnen=\@@imuitlijnen, - \c!voor=\@@imvoor, - \c!na=\@@imna, - #2]} - {\getparameters[\??im#1][#2]}% + \processcommalist[#1]{\dodostelinmargein[#2]}% becomes [#2]{##1} \else \getparameters[\??im][#1]% \fi} +\def\dodostelinmargein[#1]#2% [settings]{class} + {\ifundefined{\??im#2\c!offset}% + \presetlocalframed + [\??im#2]% + \getparameters + [\??im#2] + [\c!kader=\v!uit, + \c!offset=\v!overlay, + \c!regel=1, + \c!scheider=, + \c!breedte=\v!ruim, + \c!afstand=\!!zeropoint, + \c!letter=\@@imletter, + \c!kleur=\@@imkleur, + \c!plaats=\@@implaats, + \c!uitlijnen=\@@imuitlijnen, + \c!voor=\@@imvoor, + \c!na=\@@imna, + #1]% + \else + \getparameters[\??im#2][#1]% + \fi} + \let\margetekstafstand = \!!zeropoint \def\margetekstregels {1} \def\margetekstnummer {0} diff --git a/tex/context/base/setupe.tex b/tex/context/base/setupe.tex index 2d3e4b60e..d44416a54 100644 --- a/tex/context/base/setupe.tex +++ b/tex/context/base/setupe.tex @@ -303,7 +303,7 @@ \def\convertsetupdata#1#2% only accept #1=\v!whatever {\doifsystemconstantelse{#1}{\edef#2{#1}}{\let#2\empty}} -\input setupb +{\catcode`\<=\active \input setupb } \protect diff --git a/tex/context/base/spec-fdf.tex b/tex/context/base/spec-fdf.tex index 3b688f097..584ac71bb 100644 --- a/tex/context/base/spec-fdf.tex +++ b/tex/context/base/spec-fdf.tex @@ -1842,7 +1842,7 @@ {\let\PDFcomment\empty} {\def\PDFcomment{/Name \getvalue{PDFcomment#6} }}% \sanitizePDFdocencoding#7\to\PDFdata - \setbox\scratchbox=\vbox to #3sp + \setbox\scratchbox=\vbox to #3 {\vfill \doPDFannotation width #2 height #3 data {/Subtype /Text diff --git a/tex/context/base/supp-box.tex b/tex/context/base/supp-box.tex index 0b6320502..9d7b19de3 100644 --- a/tex/context/base/supp-box.tex +++ b/tex/context/base/supp-box.tex @@ -1757,7 +1757,7 @@ \hskip-\scratchdimen \normalhbox to \scratchdimen{\hss\box\nextbox\hss}}} -\def\startoverlay% +\def\startoverlay {\bgroup \let\stopoverlay\egroup \processboxes\dooverlaybox} diff --git a/tex/context/base/supp-num.tex b/tex/context/base/supp-num.tex index a39733ceb..1220b53be 100644 --- a/tex/context/base/supp-num.tex +++ b/tex/context/base/supp-num.tex @@ -188,7 +188,7 @@ \def\dohandledigits% {\mathcode`\,="013B \mathcode`\.="013A % pretty hard coded \expandafter\handletokens\collecteddigits\with\scandigits - \ifcase\powerdigits\else\digitpowerseperator^{\savedpowerdigits}\fi} + \ifcase\powerdigits\else\digitpowerseparator^{\savedpowerdigits}\fi} \def\doscandigit#1% {\ifcase\skipdigit\else\hphantom{\fi diff --git a/tex/context/base/syst-ext.tex b/tex/context/base/syst-ext.tex index f46a0b017..2276f894a 100644 --- a/tex/context/base/syst-ext.tex +++ b/tex/context/base/syst-ext.tex @@ -4045,6 +4045,21 @@ \def\stopstrictinspectnextcharacter {\let\inspectnextcharacter\normalinspectnextcharacter} -\protect +%D \macros +%D {gobblespacetokens} +%D +%D This macro needs a speed-up! + +\def\gobblespacetokens % will go to syst-ext.tex + speed up + {\doifnextcharelse\empty\donothing\donothing} % no {}\do\do ! + +%D \macros +%D {verbatimargument} +%D +%D As the name says, this macro converts its argument to a +%D (rather safe) string. + +\def\verbatimstring#1% + {\convertargument#1\to\ascii\ascii} -\endinput +\protect \endinput diff --git a/tex/context/base/syst-gen.tex b/tex/context/base/syst-gen.tex index a2e80674a..fb6788018 100644 --- a/tex/context/base/syst-gen.tex +++ b/tex/context/base/syst-gen.tex @@ -428,20 +428,6 @@ \def\!!stringb{#3}% \futurelet\nexttoken\inspectnextcharacter} -% \def\inspectnextcharacter% -% {\ifx\nexttoken\blankspace -% \let\localnext\reinspectnextcharacter -% %\else\ifx\nexttoken\endoflinetoken -% % \let\localnext\reinspectaftercharacter -% \else\ifx\nexttoken\charactertoken -% \let\localnext\!!stringa -% \else -% \let\localnext\!!stringb -% \fi\fi%\fi -% \localnext} -% -% faster ? - \def\inspectnextcharacter% {\ifx\nexttoken\blankspace \@EA\reinspectnextcharacter diff --git a/tex/context/base/syst-pln.tex b/tex/context/base/syst-pln.tex index d6e1a481b..bf2cc1e60 100644 --- a/tex/context/base/syst-pln.tex +++ b/tex/context/base/syst-pln.tex @@ -615,7 +615,7 @@ \chardef\#=`\# \chardef\$=`\$ -\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em}} +\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em}} %D Used at all? diff --git a/tex/context/base/x-fdf-00.tex b/tex/context/base/x-fdf-00.tex index 921757f56..2f9a3b2be 100644 --- a/tex/context/base/x-fdf-00.tex +++ b/tex/context/base/x-fdf-00.tex @@ -28,8 +28,9 @@ \defineXMLsingular [fdf:field] [name=,value=] {\doglobal\saveasXMLdata{fdf:\XMLop{name}}{\XMLop{value}}} -\def\flushFDFfield #1{\flushXMLelement {fdf:#1}} -\def\processFDFfield#1{\processXMLelement{fdf:#1}} +\def\doifelseFDFfield#1{\doifelseXMLelement{fdf:#1}} +\def\flushFDFfield #1{\flushXMLelement {fdf:#1}} +\def\processFDFfield #1{\processXMLelement {fdf:#1}} \def\loadFDFfile#1% {\bgroup diff --git a/tex/context/base/xtag-ini.tex b/tex/context/base/xtag-ini.tex index 8f018bfd2..e3db7939e 100644 --- a/tex/context/base/xtag-ini.tex +++ b/tex/context/base/xtag-ini.tex @@ -26,9 +26,6 @@ %D This module is highly optimized for speed, which sometimes %D reads to rather unreadable code. Sorry for this. -\def\gobblespacetokens % will go to syst-ext.tex + speed up - {\doifnextcharelse\empty\donothing\donothing} % no {}\do\do ! - \beginETEX XML \bgroup \obeylines @@ -382,6 +379,17 @@ %D constructs. Unfortunately, we need to catch \type {<--text} %D too, so we need another handler: +% \long\def\xparseXMLescape !#1#2% +% {\if#1-% +% \if#2-% +% \expandafter\expandafter\expandafter\xxparseXMLescape +% \else +% \expandafter\expandafter\expandafter\xyparseXMLescape +% \fi +% \else +% \expandafter\xyparseXMLescape +% \fi#1#2} + \long\def\xparseXMLescape !#1#2% {\if#1-% \if#2-% @@ -390,11 +398,17 @@ \expandafter\expandafter\expandafter\xyparseXMLescape \fi \else - \expandafter\xyparseXMLescape + \if#1[% + \expandafter\expandafter\expandafter\xzparseXMLescape + \else + \expandafter\expandafter\expandafter\xyparseXMLescape + \fi \fi#1#2} -\long\def\xxparseXMLescape --#1{\parseXMLescape{--}#1} -\long\def\xyparseXMLescape #1 {\parseXMLescape{#1}} + +\long\def\xxparseXMLescape--#1{\parseXMLescape{--}#1} +\long\def\xyparseXMLescape#1 {\parseXMLescape{#1}} +\long\def\xzparseXMLescape[#1[{\parseXMLescape{#1}} %D Now the real work can begin. diff --git a/tex/context/base/xtag-pre.tex b/tex/context/base/xtag-pre.tex index 6ce33ab84..f9d0afa09 100644 --- a/tex/context/base/xtag-pre.tex +++ b/tex/context/base/xtag-pre.tex @@ -111,15 +111,19 @@ %D strange syntax. %D %D \starttypen -%D <!CDATA[ +%D <!CDATA[it starts here %D whatever you like to be shown verbatim -%D ]]> +%D and ends here]]> %D \stoptypen %D %D Watch this rather obscure definition (we need to pass an %D \type {[} to the macro. -\defineXMLescape [{CDATA[}] +% \defineXMLescape [{CDATA[}] +% {\skipfirstverbatimlinefalse +% \processtaggeddisplayverbatim{]]>}} + +\defineXMLescape [CDATA] {\skipfirstverbatimlinefalse \processtaggeddisplayverbatim{]]>}} diff --git a/tex/context/base/xtag-run.tex b/tex/context/base/xtag-run.tex index ebfee9e80..ffdf913c9 100644 --- a/tex/context/base/xtag-run.tex +++ b/tex/context/base/xtag-run.tex @@ -86,6 +86,7 @@ \ifx\XMLprettycycle\undefined \gdef\XMLprettycycle{3} \fi \doglobal\newcounter\@XMLnofelements +\doglobal\newif\ifXMLunspacepretty \gdef\@XMLelement#1% {\ifnum\XMLlevel<\@@xfniveau\relax @@ -102,6 +103,7 @@ \DoMod\XMLlevel by\XMLprettycycle to\scratchcounter \advance\scratchcounter 1 \startcolor[xtag:\ifnum\scratchcounter<0 0\else\number\scratchcounter\fi]% +\ifXMLunspacepretty\unskip\fi \string<% \ifnum\kindofXMLelement=2\string/\fi \currentXMLelement @@ -121,7 +123,7 @@ \ifcase\@XMLnofelements\else\@@xftussen\fi \fi \fi - \ignorespaces} + \ifXMLunspacepretty\ignorespaces\fi} \gdef\nextXMLtext{\blank\@XMLlevel+\@XMLelement1\par} \gdef\prevXMLtext{\par\@XMLelement0\par\@XMLlevel-\blank} diff --git a/tex/context/base/xtag-xsl.tex b/tex/context/base/xtag-xsl.tex new file mode 100644 index 000000000..ac88845b9 --- /dev/null +++ b/tex/context/base/xtag-xsl.tex @@ -0,0 +1,213 @@ +%D \module +%D [ file=xtag-xsl, +%D version=2002.03.07, +%D title=\CONTEXT\ XML Support, +%D subtitle=XSLT processing, +%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 This module is rather experimental so users may expect +%D changes in the interface. + +\unprotect + +\definesystemvariable {xl} + +\newif\iftraceXSLTprocessing % \traceXSLTprocessingtrue + +\def\XSLTscriptfile{\bufferprefix xlscript} + +\def\presetXSLTcharacters + {\let\par\empty + \def\{{\rawcharacter{`\{}}% + \def\}{\rawcharacter{`\}}}% + \def\\{\rawcharacter{`\\}}} + +\def\obeyXSLTcharacters + {\setnaturalcatcodes + \catcode`\\=\@@escape} + +\long\def\startXSLTscript #1 #2 % + {\bgroup + \obeyXSLTcharacters + \doifelse{#2}{capsule}\dostartXSLTscript\nostartXSLTscript#1 #2 } + +\long\def\dostartXSLTscript#1 #2 #3 #4\stopXSLTscript + {\egroup + \long\setvalue{\??xl#1}{\doXSLTscript{#3}{#4}}} + +\long\def\nostartXSLTscript#1 #2\stopXSLTscript + {\egroup + \long\setvalue{\??xl#1}{\doXSLTscript\empty{#2}}} + +\long\def\donormalXSLTscript#1#2% + {\includeXSLTscript{b-capsule-#1}% + #2% + \includeXSLTscript{e-capsule-#1}} + +\def\includeXSLTscript#1% + {\csname\ifcsname\??xl#1\endcsname\??xl#1\else empty\fi\endcsname} + +\startXSLTscript b-capsule-1.0 +<?xml version="1.0"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> +\stopXSLTscript + +\startXSLTscript e-capsule-1.0 +</xsl:stylesheet> +\stopXSLTscript + +\def\applyXSLTscript + {\dotripleempty\doapplyXSLTscript} + +\long\def\doapplyXSLTscript[#1][#2][#3]% + {\ifthirdargument + \bgroup + \let\doXSLTscript\donormalXSLTscript + \presetXSLTcharacters + \donefalse + \def\docommando##1% + {\dodoapplyXSLTscript{##1}{\ifdone#3\else#2\fi}{#3}\donetrue}% + \processcommalist[#1]\docommando + \egroup + \else + \applyXSLTscript[#1][#2][#2]% + \fi} + +% Since a \XML\ file is loaded into memory as a tree, we +% can safely use the same input and output filename, thereby +% avoiding temporary files. + +\def\dodoapplyXSLTscript#1#2#3% + {\bgroup + \doifundefined{\??xl#1}% + {\writestatus{XSLT}{unknown script #1}} + {\writestatus{XSLT}{convert #2 into #3 using #1}% + \edef\!!stringc{\getvalue{\??xl#1}}% + \immediate\openout\scratchwrite=\XSLTscriptfile.xsl + \immediate\write\scratchwrite{\!!stringc}% + \immediate\closeout\scratchwrite + \iftraceXSLTprocessing\wait\fi + \executeXSLT{\XSLTscriptfile.xsl}{#2}{#3}% + \iftraceXSLTprocessing\wait\fi}% + \egroup} + +\def\executeXSLT#1#2#3% script input output + {\executesystemcommand{xsltproc -o #3 #1 #2}} + +\long\def\applyXSLTtobuffer + {\dodoubleempty\doapplyXSLTtobuffer} + +\long\def\doapplyXSLTtobuffer[#1][#2]% + {\expanded{\applyXSLTscript + [#1][\TEXbufferfile{\ifsecondargument#2\else\jobname\fi}]}} + +%D \startMPdrawing +%D \stopMPdrawing +%D \pushMPdrawing +%D \popMPdrawing +%D \resetMPdrawing +%D \ifMPdrawingdone +%D \getMPdrawing + +\def\resetXSLTscripting#1% + {\setgvalue{\??xl\s!dummy}{\doXSLTscript{#1}{}}} + +\resetXSLTscripting{1.0} + +\def\startXSLTscripting + {\bgroup + \obeyXSLTcharacters + \dostartXSLTscripting} + +\long\def\dostartXSLTscripting#1\stopXSLTscripting + {\egroup + \let\doXSLTscript\doextendXSLTscript + \getvalue{\??xl\s!dummy}{#1}} + +\long\def\doextendXSLTscript#1#2#3% + {\setgvalue{\??xl\s!dummy}{\doXSLTscript{#1}{#2#3}}} + +\def\applyXSLTscripting + {\applyXSLTscript[\s!dummy]} + +\protect + +\doifnotmode{mytest}{\endinput} + +\starttext + +% \def\Whow{Whow It Works} +% +% \startXSLTscript test capsule 1.0 +% <xsl:output method="text"/> +% +% <xsl:template match="/figurelibrary/figure"> +% \Whow \\ #<xsl:apply-templates/> +% </xsl:template> +% +% <xsl:template match="/"> +% <xsl:apply-templates/> +% </xsl:template> +% \stopXSLTscript +% +% \applyXSLTscript [test] [figtest.xml] [crap.tmp] \typefile{crap.tmp} +% +% \startbuffer +% <hello>world</hello> +% \stopbuffer +% +% \applyXSLTtobuffer[test] \typebuffer +% +% \startXSLTscripting +% <xsl:output method="text"/> +% \stopXSLTscripting +% +% \startXSLTscripting +% <xsl:template match="/figurelibrary/figure"> +% <xsl:apply-templates/> +% </xsl:template> +% \stopXSLTscripting +% +% \startXSLTscripting +% <xsl:template match="/"> +% <xsl:apply-templates/> +% </xsl:template> +% \stopXSLTscripting +% +% \applyXSLTscripting [figtest.xml] [crap.tmp] \typefile{crap.tmp} + +\startXSLTscript another +<?xml version="1.0"?> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:cd="http://www.pragma-ade.com/commands" + version="1.0"> + +<xsl:output method="text"/> + +<xsl:template match="/"> + <xsl:apply-templates/> +</xsl:template> + +<xsl:template match="cd:interface"> + <xsl:apply-templates><xsl:sort order="descending" select="@name"/></xsl:apply-templates> +</xsl:template> + +<xsl:template match="cd:command"> + name: <xsl:value-of select="@name"/>\\par +</xsl:template> + +</xsl:stylesheet> +\stopXSLTscript + +\applyXSLTscript [another] [cont-en.xml] [whatever.tmp] + +\readfile{whatever.tmp}{}{} + +\stoptext |