summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/cont-new.tex2
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/font-otn.lua21
-rw-r--r--tex/context/base/lpdf-mis.lua42
-rw-r--r--tex/context/base/lxml-ini.lua8
-rw-r--r--tex/context/base/lxml-ini.mkiv22
-rw-r--r--tex/context/base/lxml-tab.lua2
-rw-r--r--tex/context/base/mult-ini.lua9
-rw-r--r--tex/context/base/mult-ini.mkiv10
-rw-r--r--tex/context/base/page-sid.mkiv95
-rw-r--r--tex/context/base/spac-ali.mkiv3
-rw-r--r--tex/context/base/spac-ver.lua18
-rw-r--r--tex/context/base/spac-ver.mkiv32
-rw-r--r--tex/context/base/strc-syn.lua16
-rw-r--r--tex/context/base/strc-syn.mkiv60
-rw-r--r--tex/context/base/supp-mps.mkii3
-rw-r--r--tex/context/base/x-mathml.mkiv6
-rw-r--r--tex/context/base/x-set-11.mkii556
-rw-r--r--tex/context/base/x-set-11.mkiv544
-rw-r--r--tex/context/base/x-set-11.tex891
-rw-r--r--tex/context/base/x-set-12.tex13
-rw-r--r--tex/context/base/x-set-99.tex283
-rw-r--r--tex/generic/context/luatex-fonts-merged.lua23
23 files changed, 1592 insertions, 1069 deletions
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index eb837a618..5f255585e 100644
--- a/tex/context/base/cont-new.tex
+++ b/tex/context/base/cont-new.tex
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2009.09.21 17:39}
+\newcontextversion{2009.09.23 10:07}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex
index 1eac2fe20..9ba4f8287 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2009.09.21 17:39}
+\edef\contextversion{2009.09.23 10:07}
%D For those who want to use this:
diff --git a/tex/context/base/font-otn.lua b/tex/context/base/font-otn.lua
index 51ecc3811..66e7f7a3f 100644
--- a/tex/context/base/font-otn.lua
+++ b/tex/context/base/font-otn.lua
@@ -385,16 +385,19 @@ local function alternative_glyph(start,alternatives,kind,chainname,chainlookupna
value, choice = format("first, choice %s",1), alternatives[1]
elseif value == "last" then
value, choice = format("last, choice %s",n), alternatives[n]
- elseif type(value) ~= "number" then
- value, choice = "default, choice 1", alternatives[1]
- elseif value > n then
- value, choice = format("no %s variants, taking %s",value,n), alternatives[n]
- elseif value == 0 then
- value, choice = format("choice %s (no change)",value), start.char
- elseif value < 1 then
- value, choice = format("no %s variants, taking %s",value,1), alternatives[1]
else
- value, choice = format("choice %s",value), alternatives[value]
+ value = tonumber(value)
+ if type(value) ~= "number" then
+ value, choice = "default, choice 1", alternatives[1]
+ elseif value > n then
+ value, choice = format("no %s variants, taking %s",value,n), alternatives[n]
+ elseif value == 0 then
+ value, choice = format("choice %s (no change)",value), start.char
+ elseif value < 1 then
+ value, choice = format("no %s variants, taking %s",value,1), alternatives[1]
+ else
+ value, choice = format("choice %s",value), alternatives[value]
+ end
end
if not choice then
logwarning("%s: no variant %s for %s",cref(kind,chainname,chainlookupname,lookupname),value,gref(start.char))
diff --git a/tex/context/base/lpdf-mis.lua b/tex/context/base/lpdf-mis.lua
index c852fb2d3..3a0422bad 100644
--- a/tex/context/base/lpdf-mis.lua
+++ b/tex/context/base/lpdf-mis.lua
@@ -227,26 +227,30 @@ end
local function documentspecification()
local spec = pagespecs[pagespec] or pagespecs[variables.default]
- local mode, layout, fit = spec[1], spec[2], spec[3]
- if layout == variables.auto then
- if doublesided then
- spec = pagespecs.doublesided
- mode, layout, fit = spec[1], spec[2], spec[3]
- else
- layout = false
+ if spec then
+ local mode, layout, fit = spec[1], spec[2], spec[3]
+ if layout == variables.auto then
+ if doublesided then
+ spec = pagespecs[variables.doublesided] -- to be checked voor interfaces
+ if spec then
+ mode, layout, fit = spec[1], spec[2], spec[3]
+ end
+ else
+ layout = false
+ end
+ end
+ mode = mode and pdfconstant(mode)
+ layout = layout and pdfconstant(layout)
+ fit = fit and pdfdictionary { FitWindow = true }
+ if layout then
+ lpdf.addtocatalog("PageLayout",layout)
+ end
+ if mode then
+ lpdf.addtocatalog("PageMode",mode)
+ end
+ if fit then
+ lpdf.addtocatalog("ViewerPreferences",fit)
end
- end
- mode = mode and pdfconstant(mode)
- layout = layout and pdfconstant(layout)
- fit = fit and pdfdictionary { FitWindow = true }
- if layout then
- lpdf.addtocatalog("PageLayout",layout)
- end
- if mode then
- lpdf.addtocatalog("PageMode",mode)
- end
- if fit then
- lpdf.addtocatalog("ViewerPreferences",fit)
end
end
diff --git a/tex/context/base/lxml-ini.lua b/tex/context/base/lxml-ini.lua
index 781478a54..8db90c960 100644
--- a/tex/context/base/lxml-ini.lua
+++ b/tex/context/base/lxml-ini.lua
@@ -608,7 +608,6 @@ function lxml.attribute(id,pattern,a,default) --todo: snelle xmlatt
local str = xmlattribute(get_id(id),pattern,a) or ""
texsprint((str == "" and default) or str)
end
-
function lxml.chainattribute(id,pattern,a,default) --todo: snelle xmlatt
local str = xmlchainattribute(get_id(id),pattern,a) or ""
texsprint((str == "" and default) or str)
@@ -695,7 +694,12 @@ function xml.command(root, command)
--~ local n = #myself + 1
--~ myself[n] = root
--~ texsprint(ctxcatcodes,format("\\xmlsetup{%i}{%s}",n,command))
- texsprint(ctxcatcodes,format("\\xmlsetup{%s}{%s}",root.ix,command))
+ local ix = root.ix
+--~ if not ix then
+--~ lxml.addindex(root)
+--~ ix = root.ix
+--~ end
+ texsprint(ctxcatcodes,format("\\xmlsetup{%s}{%s}",ix,command))
elseif tc == "function" then
-- function
command(root)
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
diff --git a/tex/context/base/lxml-tab.lua b/tex/context/base/lxml-tab.lua
index a93aa6149..407950086 100644
--- a/tex/context/base/lxml-tab.lua
+++ b/tex/context/base/lxml-tab.lua
@@ -7,6 +7,8 @@ if not modules then modules = { } end modules ['lxml-tab'] = {
}
-- this module needs a cleanup: check latest lpeg, passing args, (sub)grammar, etc etc
+-- stripping spaces from e.g. cont-en.xml saves .2 sec runtime so it's not worth the
+-- trouble
--[[ldx--
<p>The parser used here is inspired by the variant discussed in the lua book, but
diff --git a/tex/context/base/mult-ini.lua b/tex/context/base/mult-ini.lua
index 9f42fe3d0..1d3be3c87 100644
--- a/tex/context/base/mult-ini.lua
+++ b/tex/context/base/mult-ini.lua
@@ -36,9 +36,14 @@ function interfaces.setmessage(category,tag,message)
m[tag] = message:gsub("%-%-","%%s")
end
-function interfaces.getmessage(category,tag)
+function interfaces.getmessage(category,tag,default)
local m = messages[category]
- return (m and m[tag]) or "unknown message"
+ return (m and m[tag]) or default or "unknown message"
+end
+
+function interfaces.doifelsemessage(category,tag)
+ local m = messages[category]
+ return commands.testcase(m and m[tag])
end
local messagesplitter = lpeg.splitat(",")
diff --git a/tex/context/base/mult-ini.mkiv b/tex/context/base/mult-ini.mkiv
index 5033a5233..547bbb39a 100644
--- a/tex/context/base/mult-ini.mkiv
+++ b/tex/context/base/mult-ini.mkiv
@@ -370,10 +370,12 @@
{\ifcsname\m!prefix!#1\endcsname\else\setgvalue{\m!prefix!#1}{#1}\fi
\ctxlua{interfaces.setmessage("#1","#2",\!!bs#3\!!es)}}
-\unexpanded\def\setmessagetext #1#2{\edef\currentmessagetext{\ctxlua{tex.sprint(tex.ctxcatcodes,interfaces.getmessage("#1","#2"))}}}
-\unexpanded\def\getmessage #1#2{\ctxlua{tex.sprint(tex.ctxcatcodes,interfaces.getmessage("#1","#2"))}}
-\unexpanded\def\makemessage #1#2#3{\ctxlua{tex.sprint(tex.ctxcatcodes,interfaces.makemessage("#1","#2","#3"))}}
-\unexpanded\def\showmessage #1#2#3{\ctxlua{interfaces.showmessage("#1","#2","#3")}}
+\unexpanded\def\setmessagetext #1#2{\edef\currentmessagetext{\ctxlua{tex.sprint(tex.ctxcatcodes,interfaces.getmessage("#1","#2"))}}}
+\unexpanded\def\doifelsemessage #1#2{\ctxlua{interfaces.doifelsemessage("#1","#2")}}
+\unexpanded\def\getmessage #1#2{\ctxlua{tex.sprint(tex.ctxcatcodes,interfaces.getmessage("#1","#2"))}}
+\unexpanded\def\getmessagedefault#1#2#3{\ctxlua{tex.sprint(tex.ctxcatcodes,interfaces.getmessage("#1","#2","#3"))}}
+\unexpanded\def\makemessage #1#2#3{\ctxlua{tex.sprint(tex.ctxcatcodes,interfaces.makemessage("#1","#2","#3"))}}
+\unexpanded\def\showmessage #1#2#3{\ctxlua{interfaces.showmessage("#1","#2","#3")}}
%D \macros
%D {ifshowwarnings, ifshowmessages}
diff --git a/tex/context/base/page-sid.mkiv b/tex/context/base/page-sid.mkiv
index 26cc9c026..c30204a4e 100644
--- a/tex/context/base/page-sid.mkiv
+++ b/tex/context/base/page-sid.mkiv
@@ -150,39 +150,6 @@
\fi
\fi}
-% \def\setsidefloatskips
-% {\global\sidefloatrightskip\zeropoint
-% \global\sidefloatleftskip \zeropoint
-% \ifcase\sidefloattype
-% \or % backspace
-% \global \sidefloatleftskip \rightorleftpageaction \backspace \cutspace
-% \or % leftedge
-% \global \sidefloatleftskip \rightorleftpageaction \leftmargindistance\rightmargindistance
-% \global\advance\sidefloatleftskip \rightorleftpageaction \leftmarginwidth\rightmarginwidth
-% \global\advance\sidefloatleftskip \rightorleftpageaction \leftedgedistance\rightedgedistance
-% \or % leftmargin
-% \global \sidefloatleftskip \rightorleftpageaction \leftmargindistance\rightmargindistance
-% \or % leftside
-% \or % rightside
-% \or % rightmargin
-% \global \sidefloatrightskip\rightorleftpageaction \rightmargindistance\leftmargindistance
-% \or % rightedge
-% \global \sidefloatrightskip\rightorleftpageaction \rightmargindistance\leftmargindistance
-% \global\advance\sidefloatrightskip\rightorleftpageaction \rightmarginwidth\leftmarginwidth
-% \global\advance\sidefloatrightskip\rightorleftpageaction \rightedgedistance\leftedgedistance
-% \or % cutspace
-% \global \sidefloatrightskip\rightorleftpageaction \cutspace\backspace
-% \fi
-% \ifdim\sidefloatrightskip>\zeropoint
-% \doglobal\advance\sidefloatrightskip\rightskip
-% \fi
-% \ifdim\sidefloatleftskip>\zeropoint
-% \doglobal\advance\sidefloatleftskip\leftskip
-% \fi}
-
-
-% use \outermarginwidth etc here
-
\def\setsidefloatskips
{\global\sidefloatrightskip\zeropoint
\global\sidefloatleftskip \zeropoint
@@ -467,6 +434,30 @@
%
% keep this ^
+\def\repositionsidefloat#1%
+ {\global\setbox\floatbox\hbox % no \hskip, but \kern here
+ {\ifnum\sidefloattype=\plusfour
+ \hskip\sidefloatleftshift
+ \else\ifnum\sidefloattype=\plusone
+ \hskip\sidefloatleftshift
+ \fi\fi
+ \ifnum\sidefloattype>\plusfour
+ \hskip-\sidefloatextrashift
+ \else
+ \hskip\sidefloatshift
+ \fi
+ \vbox{#1\ifnum\sidefloatalign=\plusfour \removedepth\fi}%
+ \ifnum\sidefloattype>\plusfour
+ \kern\sidefloatshift
+ \else
+ \kern-\sidefloatextrashift
+ \fi
+ \ifnum\sidefloattype=8
+ \kern\sidefloatrightshift
+ \else\ifnum\sidefloattype=\plusfive
+ \kern\sidefloatrightshift
+ \fi\fi}}
+
\def\putsidefloat#1% grid (4) is rather experimental
{\par
\whitespace
@@ -490,28 +481,7 @@
\fi
\previoussidefloat
\stallsidefloat
- \global\setbox\floatbox\hbox % no \hskip, but \kern here
- {\ifnum\sidefloattype=\plusfour
- \hskip\sidefloatleftshift
- \else\ifnum\sidefloattype=\plusone
- \hskip\sidefloatleftshift
- \fi\fi
- \ifnum\sidefloattype>\plusfour
- \hskip-\sidefloatextrashift
- \else
- \hskip\sidefloatshift
- \fi
- \vbox{#1\ifnum\sidefloatalign=\plusfour \removedepth\fi}%
- \ifnum\sidefloattype>\plusfour
- \kern\sidefloatshift
- \else
- \kern-\sidefloatextrashift
- \fi
- \ifnum\sidefloattype=8
- \kern\sidefloatrightshift
- \else\ifnum\sidefloattype=\plusfive
- \kern\sidefloatrightshift
- \fi\fi}%
+ \repositionsidefloat{#1}%
\ifnum\sidefloatalign=\plusfour
\getnoflines{\ht\floatbox}%
\scratchdimen\noflines\lineheight
@@ -576,17 +546,6 @@
\fi
\setsidefloat}
-% \def\progresssidefloat
-% {\sidefloatprogress\sidefloatvsize
-% \iffloatflag
-% \advance\sidefloatprogress -\sidefloatpagetotal
-% \global\floatflagfalse
-% \else
-% \advance\sidefloatprogress -\pagetotal
-% \fi}
-%
-% more compact:
-
\def\progresssidefloat
{\sidefloatprogress\sidefloatvsize
\advance\sidefloatprogress-\iffloatflag\sidefloatpagetotal\global\floatflagfalse\else\pagetotal\fi}
@@ -676,6 +635,10 @@
\fi
\egroup
\par
+\ifgridsnapping
+ \getrawnoflines\sidefloatheight
+ \sidefloatheight=\noflines\lineheight
+\fi
\kern-\sidefloatheight
\penalty10001 % oeps, this will change
\normalbaselines
diff --git a/tex/context/base/spac-ali.mkiv b/tex/context/base/spac-ali.mkiv
index a684e21c3..62164f997 100644
--- a/tex/context/base/spac-ali.mkiv
+++ b/tex/context/base/spac-ali.mkiv
@@ -308,9 +308,6 @@
{\endgraf
\endgroup}
-% \defineXMLenvironment[showpardata] \startshowpardata \stopshowpardata
-% \defineXMLsingular [showpardata] \showpardata
-
% defaults
\def\raggedfillamount {1fil}
diff --git a/tex/context/base/spac-ver.lua b/tex/context/base/spac-ver.lua
index 408b310f4..712307626 100644
--- a/tex/context/base/spac-ver.lua
+++ b/tex/context/base/spac-ver.lua
@@ -133,12 +133,12 @@ function vspacing.define_snap_method(name,method)
end
function vspacing.freeze_snap_method(ht,dp)
- snapht, snapdp = ht or texdimen.strutht, dp or texdimen.strutdp
+ snapht, snapdp = ht or texdimen.bodyfontstrutheight, dp or texdimen.bodyfontstrutdepth
snaphtdp = snapht + snapdp
end
-local function snap_hlist(current,method) -- method.strut is default
- local h, d = current.height, current.depth
+local function snap_hlist(current,method,height,depth) -- method.strut is default
+ local h, d = height or current.height, depth or current.depth
local hr, dr, ch, cd = method.hfraction or 1, method.dfraction or 1, h, d
local done, plusht, plusdp = false, snapht, snapdp
if method.none then
@@ -201,7 +201,12 @@ local function snap_hlist(current,method) -- method.strut is default
else
cd = plusdp
end
- current.height, current.depth = ch, cd
+ if not height then
+ current.height = ch
+ end
+ if not depth then
+ current.depth = cd
+ end
return h, d, ch, cd, (ch+cd)/snaphtdp
end
@@ -513,8 +518,9 @@ function vspacing.snap_box(n,how)
local sv = snapmethods[how]
if sv then
local list = texbox[n].list
- if list and (list.id == hlist or list.id == vlist) then
- local h, d, ch, cd, lines = snap_hlist(list,sv)
+--~ if list and (list.id == hlist or list.id == vlist) then
+ if list then
+ local h, d, ch, cd, lines = snap_hlist(list,sv,texht[n],texdp[n])
texht[n], texdp[n] = ch, cd
if trace_vsnapping then
logs.report("snapper", "hlist snapped from (%s,%s) to (%s,%s) using method '%s' (%s) for '%s' (%s lines)",h,d,ch,cd,sv.name,sv.specification,"direct",lines)
diff --git a/tex/context/base/spac-ver.mkiv b/tex/context/base/spac-ver.mkiv
index a2d081141..8849d71c1 100644
--- a/tex/context/base/spac-ver.mkiv
+++ b/tex/context/base/spac-ver.mkiv
@@ -625,7 +625,9 @@
\fi
\normallineskip\minimumlinedistance\relax % \onepoint\relax
\normallineskiplimit\zeropoint\relax
- \normalbaselines}
+ \normalbaselines
+ \dosetupgridsnapping
+ }
\def\spacing#1%
{\ifgridsnapping
@@ -1155,12 +1157,9 @@
\newdimen \bodyfontstrutheight
\newdimen \bodyfontstrutdepth
-\appendtoks
- \bodyfontlineheight \normallineheight
- \bodyfontstrutheight \strutheight
- \bodyfontstrutdepth \strutdepth
- \dosetupgridsnapping
-\to \everysetupbodyfont
+% \appendtoks
+% \dosetupgridsnapping
+% \to \everysetupbodyfont
\def\installsnapvalues#1#2% todo: a proper define
{\edef\currentsnapper{#1:#2}%
@@ -1237,7 +1236,10 @@
\def\dosetupgridsnapping{\the\everysetupgridsnapping}
\appendtoks
- \ctxlua{vspacing.freeze_snap_method(\number\bodyfontstrutheight,\number\bodyfontstrutdepth)}%
+ \bodyfontlineheight \normallineheight
+ \bodyfontstrutheight \strutheight
+ \bodyfontstrutdepth \strutdepth
+ \ctxlua{vspacing.freeze_snap_method()}%
\to \everysetupgridsnapping
% \appendtoks
@@ -1564,16 +1566,28 @@
% \definevspacingamount[\v!height] [\strutheight] [\strutheight]
% \definevspacingamount[\v!depth] [\strutdepth] [\strutdepth]
+\definevspacingamount[\v!none] [\zeropoint] [\zeropoint]
\definevspacingamount[\v!big] [\bigskipamount] [\bodyfontlineheight]
\definevspacingamount[\v!medium] [\medskipamount] [0.50\bodyfontlineheight]
\definevspacingamount[\v!small] [\smallskipamount] [0.25\bodyfontlineheight]
\definevspacingamount[\v!line] [\openlineheight] [\bodyfontlineheight]
\definevspacingamount[\v!halfline][0.50\openlineheight][0.50\bodyfontlineheight]
\definevspacingamount[\v!formula] [\medskipamount] [0.50\bodyfontlineheight]
-\definevspacingamount[\v!white] [\parskip] [\bodyfontlineheight]
+\definevspacingamount[\v!white] [\parskip] [\bodyfontwhitespace]
\definevspacingamount[\v!height] [\strutheight] [\bodyfontstrutheight]
\definevspacingamount[\v!depth] [\strutdepth] [\bodyfontstrutdepth]
+\def\bodyfontwhitespace
+ {\dimexpr
+ \ifdim\parskip=\zeropoint
+ \zeropoint
+ \else\ifgridsnapping
+ \bodyfontlineheight
+ \else
+ \parskip
+ \fi\fi
+ \relax}
+
\definevspacing[\v!samepage][penalty:10000]
\definevspacing[\v!max] [category:1]
\definevspacing[\v!force] [category:2]
diff --git a/tex/context/base/strc-syn.lua b/tex/context/base/strc-syn.lua
index 7e2a346eb..b410b4243 100644
--- a/tex/context/base/strc-syn.lua
+++ b/tex/context/base/strc-syn.lua
@@ -58,8 +58,18 @@ end
function joblists.register(class,kind,spec)
local data = allocate(class)
data.metadata.kind = kind -- runtime, not saved in format (yet)
- data.entries[#data.entries+1] = spec
- data.hash[spec.definition.tag or ""] = spec
+ if not data.hash[spec.definition.tag or ""] then
+ data.entries[#data.entries+1] = spec
+ data.hash[spec.definition.tag or ""] = spec
+ end
+end
+
+function joblists.registerused(class,tag)
+ local data = allocate(class)
+ local dht = data.hash[tag]
+ if dht then
+ dht.definition.used = true
+ end
end
function joblists.synonym(class,tag)
@@ -147,7 +157,7 @@ function joblists.flush(data,options) -- maybe pass the settings differently
--~ texsprint(ctxcatcodes,format("\\start%ssection{%s}",kind,sublist.tag))
for d=1,#data do
local entry = data[d].definition
- texsprint(ctxcatcodes,format("\\%sentry{%s}{%s}{%s}",kind,d,entry.synonym,entry.meaning))
+ texsprint(ctxcatcodes,format("\\%sentry{%s}{%s}{%s}",kind,d,entry.tag,entry.synonym))
end
--~ texsprint(ctxcatcodes,format("\\stop%ssection",kind))
end
diff --git a/tex/context/base/strc-syn.mkiv b/tex/context/base/strc-syn.mkiv
index 97073b3e8..2a1ef8558 100644
--- a/tex/context/base/strc-syn.mkiv
+++ b/tex/context/base/strc-syn.mkiv
@@ -114,12 +114,12 @@
\fi
\unexpanded\setvalue{#1}{\definesynonym[\v!yes][#1]}% \name
\fi
- \getparameters[\??sm#1][\s!parent=\??sm]%
+ \getparameters[\??sm#1][\s!parent=\??sm,\s!multi={#2}]%
\presetheadtext[#2=\Word{#2}]% changes the \if...argument
%\ctxlua{joblists.define('#1')}%
\setvalue{\e!setup #2\e!endsetup}{\dodoubleargument\getparameters[\??sm#1]}% to be obsolete
- \setvalue{\e!place \e!listof#2}{\doplacelistofsynonyms{#1}{#2}}%
- \setvalue{\e!complete\e!listof#2}{\docompletelistofsynonyms{#1}{#2}}}
+ \setvalue{\e!place \e!listof#2}{\placelistofsynonyms[#1]}% accepts extra argument
+ \setvalue{\e!complete\e!listof#2}{\completelistofsynonyms[#1]}}
\def\definesynonym
{\dotripleempty\dodefinesynonym}
@@ -154,6 +154,12 @@
\fi
\endgroup}
+\def\registersynonym
+ {\dodoubleargument\doregistersynonym}
+
+\def\registersynonym[#1][#2]%
+ {\ctxlua{joblists.registerused("#1","#2")}}
+
\unexpanded\def\doinsertsynonymmeaning#1#2% name tag
{\begingroup
\def\currentsynonym{#1}%
@@ -168,7 +174,10 @@
\synonymparameter\c!synonymcommand{\ctxlua{joblists.synonym("#1","#2")}}%
\endgroup}
-\def\doplacelistofsynonyms#1#2%
+\def\placelistofsynonyms
+ {\dodoubleempty\doplacelistofsynonyms}
+
+\def\doplacelistofsynonyms[#1][#2]%
{\begingroup
\def\currentsynonym{#1}%
\definedescription % todo, per class
@@ -188,15 +197,19 @@
\c!headstyle=\synonymparameter\c!textstyle,
\c!headcolor=\synonymparameter\c!textcolor,
\c!style=,
- \c!color=]%
+ \c!color=.
+ #2]%
\startpacked
\ctxlua{joblists.process('#1',{ criterium = "\synonymparameter\c!criterium" })}%
\stoppacked
\endgroup}
-\def\docompletelistofsynonyms#1#2% expansion needed to avoid v! (due to french active !)
- {\normalexpanded{\systemsuppliedchapter[#1]{\noexpand\headtext{#2}}}%
- \doplacelistofsynonyms{#1}{#2}%
+\def\completelistofsynonyms
+ {\dodoubleempty\docompletelistofsynonyms}
+
+\def\docompletelistofsynonyms[#1][#2]% expansion needed to avoid v! (due to french active !)
+ {\normalexpanded{\systemsuppliedchapter[#1]{\noexpand\headtext{\synonymparameter\s!single}}}%
+ \doplacelistofsynonyms[#1][#2]%
\page[\v!yes]}
\let\startsynonymoutput \relax
@@ -266,12 +279,12 @@
\else
\unexpanded\setvalue{#1}{\definesort[\v!yes][#1]}%
\fi
- \getparameters[\??so#1][\s!parent=\??so]%
+ \getparameters[\??so#1][\s!parent=\??so,\s!multi={#2}]%
\presetheadtext[#2=\Word{#2}]% after \ifthirdargument -)
%\ctxlua{joblists.define('#1')}%
\setvalue{\e!setup #2\e!endsetup}{\dodoubleargument\getparameters[\??so#1]}% to be obsolete
- \setvalue{\e!place \e!listof#2}{\doplacelistofsorts{#1}{#2}}%
- \setvalue{\e!complete\e!listof#2}{\docompletelistofsorts{#1}{#2}}}
+ \setvalue{\e!place \e!listof#2}{\placelistofsorts[#1]}%
+ \setvalue{\e!complete\e!listof#2}{\completelistofsorts[#1]}}
\def\definesort
{\dotripleempty\dodefinesort}
@@ -311,21 +324,34 @@
\ctxlua{joblists.synonym("#1","#2")}%
\endgroup}
+\def\registersort
+ {\dodoubleargument\doregistersort}
+
+\def\registersort[#1][#2]%
+ {\ctxlua{joblists.registerused("#1","#2")}}
+
% before after
%
% maybe just 'commandset' and then combine
-\def\doplacelistofsorts#1% NOG EEN RUWE VERSIE MAKEN ZONDER WITRUIMTE ETC ETC
+\def\placelistofsorts
+ {\dodoubleempty\placelistofsorts}
+
+\def\placelistofsorts[#1][#2]% NOG EEN RUWE VERSIE MAKEN ZONDER WITRUIMTE ETC ETC
{\begingroup
\def\currentsorting{#1}%
+ \getparameters[\??so#1][#2]%
\startpacked
- \ctxlua{joblists.process('#1',{})}%
+ \ctxlua{joblists.process('#1',{ criterium = "\sortingparameter\c!criterium" })}%
\stoppacked
\endgroup}
-\def\docompletelistofsorts#1#2%
+\def\completelistofsorts
+ {\dodoubleemptydocompletelistofsorts}
+
+\def\docompletelistofsorts[#1][#2]%
{\normalexpanded{\systemsuppliedchapter[#1]{\noexpand\headtext{#2}}}%
- \doplacelistofsorts{#1}%
+ \doplacelistofsorts[#1][#2]%
\page[\v!yes]}
\let\startsortingoutput \relax
@@ -334,7 +360,9 @@
\let\stopsortingsection \relax
\def\sortingentry#1#2#3%
- {\begingroup\dosetsortingattributes\c!style\c!color#2\endgroup\par} % todo
+ {\doifelsenothing{\sortingparameter\c!command}
+ {\begingroup\dosetsortingattributes\c!style\c!color#3\endgroup\par} % todo
+ {\sortingparameter\c!command{#1}{#2}{#3}}}
%D Here we define a support macro that can sort simple comma
%D separated lists. It's a multi-list variant of a prototype
diff --git a/tex/context/base/supp-mps.mkii b/tex/context/base/supp-mps.mkii
index 3629ccf0b..b071ffe72 100644
--- a/tex/context/base/supp-mps.mkii
+++ b/tex/context/base/supp-mps.mkii
@@ -236,7 +236,8 @@
%D The next hack prevents too long lines:
\long\def\runtimeobeyMPlines
- {\ifx\rawcharacter\undefined
+ {\catcode35=11\relax % goodie
+ \ifx\rawcharacter\undefined
\let\obeyedline\space
\else
\obeylines
diff --git a/tex/context/base/x-mathml.mkiv b/tex/context/base/x-mathml.mkiv
index 82db51168..73958e129 100644
--- a/tex/context/base/x-mathml.mkiv
+++ b/tex/context/base/x-mathml.mkiv
@@ -1361,12 +1361,6 @@
}
\stopxmlsetups
-% option: to be discussed with taco/aditya: all math functions \mathentity
-%
-% \defineXMLentity [div] {\mathematics{\triangledown\times}}
-% \defineXMLentity [curl] {\mathematics{\triangledown .}}
-% \defineXMLentity [grad] {\mathematics{\triangledown }}
-
\startxmlsetups mml:divergence \mathopnolimits{div} \xmlall{#1}{/!mml:divergence} \stopxmlsetups
\startxmlsetups mml:grad \mathopnolimits{grad} \xmlall{#1}{/!mml:grad} \stopxmlsetups
\startxmlsetups mml:curl \mathopnolimits{curl} \xmlall{#1}{/!mml:curl} \stopxmlsetups
diff --git a/tex/context/base/x-set-11.mkii b/tex/context/base/x-set-11.mkii
index 434b18647..450382a95 100644
--- a/tex/context/base/x-set-11.mkii
+++ b/tex/context/base/x-set-11.mkii
@@ -1,14 +1,100 @@
+%D \module
+%D [ file=x-set-11,
+%D version=2004.10.31,
+%D remark=setupx.tex: 1998.07.20 and later,
+%D title=\CONTEXT\ Setup Definitions,
+%D subtitle=Macro Definitions,
+%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.
+
+% module x-set-02 loads the mapping, after that we can say:
+%
+% texmfstart texexec --int=nl --pdf --global --result=setup-nl x-set-12
+
+\usemodule[set-99] % interface messages
+
\unprotect
-\def\mkloadsetups#1%
- {\doifnotmode{no-setup-all}
- {\startXMLmapping[zero]
- \expanded{\processXMLfilegrouped{#1}}%
- \stopXMLmapping}}
+% general
+
+\def\setupnumfont {}
+\def\setuptxtfont {}
+\def\setupintfont#1{\uppercase{#1}}
+\def\setupvarfont {\sl}
+\def\setupoptfont {\sl}
+\def\setupalwcolor {}
+\def\setupoptcolor {darkgray}
+
+\defineXMLenvironmentsave [cd:content] [list=,state=]
+ {\simpleSETUPargument{content}\blank[\v!halfline]\ignorespaces}
+ {\ignorespaces}
+
+\def\c!setup!internal!#1%
+ {{\setmessagetext{setup}{#1}%
+ \expanded{\setupintfont{\currentmessagetext}}}}
+
+\def\c!setup!text!#1%
+ {{\setmessagetext{setup}{#1}%
+ \setupvarfont{\currentmessagetext}}}
+
+\def\c!setup!command!#1%
+ {{\setupvarfont{\texescape...#1}}}
+
+\def\??stp{@@stp}
+
+\defineregister
+ [texmacro]
+ [texmacros]
+
+\definesorting
+ [texcommand]
+ [texcommands]
+
+\setupsorting
+ [texcommand]
+ [\c!command=\@@stpcommand,
+ \c!criterium=\@@stpcriterium]
+
+\definesorting
+ [eachtexcommand]
+ [alltexcommands]
+
+\setupsorting
+ [eachtexcommand]
+ [\c!command=\@@stpcommand,
+ \c!criterium=\v!all]
+
+\pushmacro\setuptext
+
+\defineframedtext
+ [setuptext]
+ [\c!width=\hsize,
+ \c!height=\v!fit,
+ \c!align=\v!right,
+ \c!offset=0.75em]
+
+\popmacro\setuptext
+
+\newif\ifshortsetup
+
+\def\doshowsetup
+ {\dosingleempty\dodoshowsetup}
+
+\def\dodoshowsetup[#1]%
+ {\iffirstargument
+ \doshowsetup{#1}%
+ \else
+ \expandafter\doshowsetup
+ \fi}
\bgroup \catcode`\<=\active
-\gdef\mkshowsetup#1%
+\gdef\doshowsetup#1%
{\bgroup
\def<<##1>>{##1}%
\edef\ascii{#1}%
@@ -23,17 +109,465 @@
\egroup
-\def\mkshowusedsetups
- {\getvalue{\e!place\e!listof texcommands}}
+\def\setup {\shortsetupfalse\doshowsetup}
+\def\showsetup {\shortsetupfalse\doshowsetup}
+\def\shortsetup{\shortsetuptrue \doshowsetup}
+\def\setupsetup{\dodoubleargument\getparameters[\??stp]}
+
+\setupsetup
+ [\c!before=,
+ \c!after=,
+ \c!command=\setup,
+ \c!criterium=\v!used]
+
+% verwijzing: 0 geen verwijzingen plaatsen / wel genereren
+% 1 alleen bij zie plaatsen / wel genereren
+% 2 alle verwijzingen plaatsen / niet genereren
+% 3 bij zie commando klikken / wel genereren
+
+\setupsetup
+ [\c!reference=0]
+
+\def\placesetup
+ {\bgroup
+ \getvalue{\e!place\e!listof texcommands}%
+ \egroup}
+
+\def\placeallsetups
+ {\bgroup
+ \setupsetup[\c!reference=2]%
+ \setupreferencing[\c!state=\v!stop]%
+ \getvalue{\e!place\e!listof alltexcommands}%
+ \egroup}
+
+\let\placeeverysetup\placeallsetups
+
+\let\plaatssetup \placesetup
+\let\plaatselkesetup\placeallsetups
-\def\mkshowallsetups
- {\getvalue{\e!place\e!listof alltexcommands}}
+% we use :1 as fallback
+%
+% \setup{setupinterlinespace}
+% \setup{setupinterlinespace:1}
+% \setup{setupinterlinespace:2}
+
+% todo: make this proper mkiv xml
\defineXMLenvironmentsave [cd:define] [name=]
{}
{\setxvalue{cd:def:\XMLop{name}}{\XMLflush{cd:define}}}
\defineXMLsingular [cd:resolve] [name=]
- {\getvalue{cd:def:\XMLop{name}}}
+ {\ignorespaces\getvalue{cd:def:\XMLop{name}}\ignorespaces}
+
+\defineXMLenvironment [cd:command] [name=,type=,generated=,interactive=,variant=]
+ {}
+ {\showSETUPrecord}
+
+\def\showSETUPrecord
+ {\getvalue{\e!start setuptext}
+ \tttf
+ \nohyphens
+ \veryraggedright
+ \startXMLmapping [one]
+ \doglobal\newcounter\currentSETUPargument
+ \global\let\maximumSETUPargument\currentSETUPargument
+ \bgroup
+ \doif{\XMLpar{cd:command}{generated}{}}{yes}{\ttsl}%
+ \doifelseXMLop{type}{environment}
+ {\tex{\e!start}}{\tex{}}\ignorespaces
+ \XMLflush{cd:sequence}\ignorespaces
+ \egroup
+ \doifelseXMLempty{cd:arguments}
+ {}
+ {\bgroup
+ \setbox0=\hbox{\XMLflush{cd:arguments}}%
+ \global\let\maximumSETUPargument\currentSETUPargument
+ \doglobal\newcounter\currentSETUPargument
+ \ignorespaces\XMLflush{cd:arguments}%
+ \doif{\XMLpar{cd:command}{type}{}}{environment}
+ {\hskip.5em\unknown\hskip.5em
+ \doif{\XMLpar{cd:command}{generated}{}}{yes}{\ttsl}%
+ \tex{\e!stop}\ignorespaces\XMLflush{cd:sequence}}%
+ \endgraf
+ \egroup
+ %\bgroup
+ % \tx
+ % \doif{\XMLpar{cd:command}{interactive}{}}{yes} {\quad INTERACTIVE}%
+ % \doif{\XMLpar{cd:command}{interactive}{}}{exclusive}{\quad INTERACTIVE ONLY}%
+ %\egroup
+ \startXMLmapping [two]
+ \bgroup
+ \doglobal\newcounter\currentSETUPargument
+ \blank[\v!line]
+ \switchtobodyfont[small] % kan sneller
+ \ignorespaces\XMLflush{cd:arguments}\endgraf
+ \egroup
+ \stopXMLmapping}
+ \stopXMLmapping
+ \getvalue{\e!stop setuptext}}
+
+\defineXMLenvironmentsave [cd:sequence] \ignorespaces \ignorespaces
+\defineXMLenvironmentsave [cd:arguments] \ignorespaces \ignorespaces
+
+%D This is the first pass; here we generate the top line.
+
+\newcounter\currentSETUPargument
+\def\currentSETUPwidth{0pt}
+
+% environmentsave ?
+
+\startXMLmapping [one]
+
+\defineXMLenvironmentsave [cd:string] [value=]
+ {\XMLop{value}\ignorespaces}
+ {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:variable] [value=]
+ {{\expanded{\setupintfont{\XMLop{value}}}}\ignorespaces}
+ {\ignorespaces}
+
+% moet een standaard type worden
+
+\defineXMLenvironmentsave [cd:assignments] [list=,state=]
+ {\showSETUPassignment\ignorespaces} {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:keywords] [list=,state=]
+ {\showSETUPkeyword\ignorespaces} {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:content] [list=,state=]
+ {\showSETUPcontent\ignorespaces} {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:displaymath] [list=,state=]
+ {\showSETUPdisplaymath\ignorespaces} {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:index] [list=,state=]
+ {\showSETUPindex\ignorespaces} {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:math] [list=,state=]
+ {\showSETUPmath\ignorespaces} {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:nothing] [list=,state=]
+ {\showSETUPnothing\ignorespaces} {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:file] [list=,state=]
+ {\showSETUPfile\ignorespaces} {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:position] [list=,state=]
+ {\showSETUPposition\ignorespaces} {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:reference] [list=,state=]
+ {\showSETUPreference\ignorespaces} {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:csname] [list=,state=]
+ {\showSETUPcsname\ignorespaces} {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:destination] [list=,state=]
+ {\showSETUPdestination\ignorespaces} {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:triplet] [list=,state=]
+ {\showSETUPtriplet\ignorespaces} {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:word] [list=,state=]
+ {\showSETUPword\ignorespaces} {\ignorespaces}
+
+\stopXMLmapping
+
+%D This is the second pass; here we generate the table.
+
+\startXMLmapping [two]
+
+\def\startfirstSETUPcolumn#1%
+ {\bgroup
+ \advance\leftskip 2em
+ \noindent\llap{\hbox to 2em{#1\hss}}}
+
+\def\stopfirstSETUPcolumn
+ {\endgraf
+ \egroup}
+
+\def\startsecondSETUPcolumn#1#2%
+ {\bgroup
+ \advance\hangindent \currentSETUPwidth
+ \advance\hangindent 2.5em
+ \noindent \hbox to \hangindent{#1\hss\hbox to 2.5em{\hss#2\hss}}%
+ \ignorespaces}
+
+\def\stopsecondSETUPcolumn
+ {\endgraf
+ \egroup}
+
+\def\secondSETUPcolumn#1#2%
+ {\startsecondSETUPcolumn{#1}{#2}\stopsecondSETUPcolumn}
+
+\def\previousSETUPargument{\currentSETUPargument}
+
+\defineXMLenvironmentsave [cd:assignments]
+ {}
+ {\xdef\currentSETUPwidth{0pt}%
+ \bgroup
+ \defineXMLenvironment [cd:parameter] [name=]
+ {\setbox0=\hbox{\potentialXMLentity{\XMLop{name}}}%
+ \ifdim\wd0>\currentSETUPwidth\xdef\currentSETUPwidth{\the\wd0}\fi}%
+ {}%
+ \setbox0=\vbox{\XMLflush{cd:assignments}}%
+ \egroup
+ \startfirstSETUPcolumn{\showSETUPnumber}%
+ \doifelseXMLempty{cd:assignments}
+ {\secondSETUPcolumn{\c!setup!text!{see} \previousSETUPargument}{}}
+ {\ignorespaces
+ \XMLflush{cd:assignments}%
+ \let\previousSETUPargument\currentSETUPargument}%
+ \stopfirstSETUPcolumn
+ \blank[\v!halfline]
+ \ignorespaces}
+
+\defineXMLenvironmentsave [cd:keywords] [optional=no]
+ {}
+ {\startfirstSETUPcolumn{\showSETUPnumber}%
+ \doifelseXMLempty{cd:keywords}
+ {\secondSETUPcolumn{see \previousSETUPargument}{}}
+ {\ignorespaces
+ \XMLflush{cd:keywords}%
+ \let\previousSETUPargument\currentSETUPargument}%
+ \stopfirstSETUPcolumn
+ \blank[\v!halfline]
+ \ignorespaces}
+
+\defineXMLenvironment [cd:parameter] [name=]
+ {\startsecondSETUPcolumn{\potentialXMLentity{\XMLop{name}}}{=}%
+ \ignorespaces}
+ {\stopsecondSETUPcolumn
+ \ignorespaces}
+
+\defineXMLenvironmentsave [cd:constant] [type=,default=]
+ {\doifXMLop{default}{yes}{\underbar}%
+ {\potentialXMLentity{\XMLop{type}}}\space\ignorespaces}
+ {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:variable] [value=]
+ {\potentialXMLentity{\XMLop{value}}\space\ignorespaces}
+ {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:inherit] [name=]
+ {\secondSETUPcolumn{\c!setup!text!{inherits} \tex{}\XMLop{name}}{}\ignorespaces}
+ {\ignorespaces}
+
+\def\simpleSETUPargument#1%
+ {\startfirstSETUPcolumn{\showSETUPnumber}%
+ \c!setup!internal!{#1}%
+ \stopfirstSETUPcolumn}
+
+\defineXMLenvironmentsave [cd:content] [list=,state=]
+ {\simpleSETUPargument{content}\blank[\v!halfline]\ignorespaces}
+ {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:displaymath] [list=,state=]
+ {\simpleSETUPargument{display math}\blank[\v!halfline]\ignorespaces}
+ {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:index] [list=,state=]
+ {\simpleSETUPargument{index}\blank[\v!halfline]\ignorespaces}
+ {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:math] [list=,state=]
+ {\simpleSETUPargument{math}\blank[\v!halfline]\ignorespaces}
+ {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:nothing] [list=,state=]
+ {\simpleSETUPargument{nothing}\blank[\v!halfline]\ignorespaces}
+ {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:file] [list=,state=]
+ {\simpleSETUPargument{file name}\blank[\v!halfline]\ignorespaces}
+ {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:position] [list=,state=]
+ {\simpleSETUPargument{position}\blank[\v!halfline]\ignorespaces}
+ {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:reference] [list=,state=]
+ {\simpleSETUPargument{reference}\blank[\v!halfline]\ignorespaces}
+ {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:csname] [list=,state=]
+ {\simpleSETUPargument{csname}\blank[\v!halfline]\ignorespaces}
+ {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:destination] [list=,state=]
+ {\simpleSETUPargument{destination}\blank[\v!halfline]\ignorespaces}
+ {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:triplet] [list=,state=]
+ {\simpleSETUPargument{triplet}\blank[\v!halfline]\ignorespaces}
+ {\ignorespaces}
+
+\defineXMLenvironmentsave [cd:word] [list=,state=]
+ {\simpleSETUPargument{word}\blank[\v!halfline]\ignorespaces}
+ {\ignorespaces}
+
+\stopXMLmapping
+
+\defineXMLentity [cd:command] {\c!setup!internal!{command}}
+\defineXMLentity [cd:dimension] {\c!setup!internal!{dimension}}
+\defineXMLentity [cd:file] {\c!setup!internal!{file}}
+\defineXMLentity [cd:name] {\c!setup!internal!{identifier}}
+\defineXMLentity [cd:character] {\c!setup!internal!{character}}
+\defineXMLentity [cd:mark] {\c!setup!internal!{mark}}
+\defineXMLentity [cd:number] {\c!setup!internal!{number}}
+\defineXMLentity [cd:reference] {\c!setup!internal!{reference}}
+\defineXMLentity [cd:plural] {\c!setup!internal!{plural}}
+\defineXMLentity [cd:singular] {\c!setup!internal!{singular}}
+\defineXMLentity [cd:text] {\c!setup!internal!{text}}
+\defineXMLentity [cd:formula] {\c!setup!internal!{formula}}
+\defineXMLentity [cd:file] {\c!setup!internal!{file}}
+\defineXMLentity [cd:matrix] {\c!setup!internal!{matrix}}
+\defineXMLentity [cd:list] {\c!setup!internal!{list}}
+\defineXMLentity [cd:section] {\c!setup!internal!{section}}
+
+\defineXMLentity [cd:noargument] {\c!setup!command!{}}
+\defineXMLentity [cd:oneargument] {\c!setup!command!{\#1}}
+\defineXMLentity [cd:twoarguments] {\c!setup!command!{\#1\#2}}
+\defineXMLentity [cd:threearguments] {\c!setup!command!{\#1\#2\#3}}
+
+%D Todo:
+
+\defineXMLprocess [cd:choice]
+
+%D Auxiliary.
+
+\unexpanded\def\showSETUP#1#2%
+ {\bgroup
+ \doglobal\increment\currentSETUPargument
+ \setbox0=\hbox
+ {\doifelseXMLop{list}{yes}{#2}{#1}}%
+ \setbox2=\hbox to \wd0
+ {\hss
+ \raise1ex\hbox
+ {\tx\ifcase\maximumSETUPargument\relax
+ \or*\else\currentSETUPargument
+ \fi}%
+ \hss}%
+ \setbox4=\hbox to \wd0
+ {\hss
+ \lower2ex\hbox
+ \bgroup
+ \txx\doifXMLop{optional}{yes}{\c!setup!internal!{optional}}%
+ \egroup
+ \hss}%
+ \ht2\ht\strutbox
+ \dp4\dp\strutbox
+ \hskip.5em\hsmash{\box0}\hsmash{\box4}\box2%
+ \egroup}
+
+\def\showSETUPnumber
+ {\doglobal\increment\currentSETUPargument
+ \hbox to 2em
+ {\ifcase\maximumSETUPargument\relax
+ \or*\else\currentSETUPargument
+ \fi
+ \hss}}
+
+\def\showSETUPassignment {\showSETUP
+ {[.\lower.5ex\hbox{=}.]}
+ {[..,.\lower.5ex\hbox{=}.,..]}}
+
+\def\showSETUPkeyword {\showSETUP
+ {[...]}
+ {[...,...]}}
+
+\def\showSETUPargument {\showSETUP
+ {\leftargument..\rightargument}
+ {\leftargument..,...,..\rightargument}}
+
+\def\showSETUPdisplaymath {\showSETUP
+ {\$\$...\$\$}
+ {\$\$...\$\$}}
+
+\def\showSETUPindex {\showSETUP
+ {\leftargument...\rightargument}
+ {\leftargument..+...+..\rightargument}}
+
+\def\showSETUPmath {\showSETUP
+ {\$...\$}
+ {\$...\$}}
+
+\def\showSETUPnothing {\showSETUP
+ {...}
+ {}}
+
+\def\showSETUPfile {\showSETUP
+ {~...~}
+ {}}
+
+\def\showSETUPposition {\showSETUP
+ {(...)}
+ {(...,...)}}
+
+\def\showSETUPreference {\showSETUP
+ {[...]}
+ {[...,...]}}
+
+\def\showSETUPcsname {\showSETUP
+ {{\c!setup!command!{}}}
+ {}}
+
+\def\showSETUPdestination {\showSETUP
+ {[\leftargument..[ref]\rightargument]}
+ {[..,\leftargument..[ref,..]\rightargument,..]}}
+
+\def\showSETUPtriplet {\showSETUP
+ {[x:y:z=]}
+ {[x:y:z=,..]}}
+
+\def\showSETUPword {\showSETUP
+ {\leftargument...\rightargument}
+ {\leftargument.. ... ..\rightargument}}
+
+\def\showSETUPcontent {\showSETUP
+ {\leftargument...\rightargument}
+ {\leftargument.. ... ..\rightargument}}
+
+%\def\c!par!{\c!setup!internal!{endofpar}}
+%\def\c!repeat!{\c!opt!{{\setupvarfont n}*}}
+%\showSETUP\def\c!par!{\texescape par}
+%\showSETUP\def\c!sep!{\texescape\texescape}
+%\def\c!par!{\addtypespec{delimiter}{par}} % \par
+%\def\c!sep!{\addtypespec{separator}{backslash}} % \\
+%\def\c!repeat!{}
+%\def\c!tex!#1{\addtypespec{command}{#1}\doanother{tex}}
+
+\startXMLmapping[zero]
+
+\defineXMLenvironmentsave [cd:command] [name=,type=,generated=,interactive=,variant=]
+ {}
+ {\doifelseXMLop{type}{environment}
+ {\edef\currentSETUPname{start\XMLop{name}}}
+ {\edef\currentSETUPname{\XMLop{name}}}%
+ \doifsomething{\XMLop{variant}}
+ {\edef\currentSETUPname{\currentSETUPname:\XMLop{variant}}}% like setupinterlinespace:1
+ \doifXMLop{generated}{yes}
+ {\edef\currentSETUPname{\currentSETUPname*}}%
+ \doglobal\saveXMLdatainelement{stp:\currentSETUPname}{cd:command}{cd:command}%
+ \expanded{\eachtexcommand[stp:x:\currentSETUPname]{\currentSETUPname}}%
+ \expanded{\texcommand [stp:y:\currentSETUPname]{\currentSETUPname}}}
+
+\stopXMLmapping
+
+\def\loadsetups{\complexorsimple\loadsetups}
+
+\def\simpleloadsetups
+ {\doifnotmode{no-setup-main}
+ {\complexloadsetups[cont-en.xml]}}
+
+\def\complexloadsetups[#1]%
+ {\doifsomething{#1}
+ {\doifnotmode{no-setup-all}
+ {\startXMLmapping[zero]
+ \expanded{\processXMLfilegrouped{#1}}%
+ \stopXMLmapping}}}
+
+\defineXMLsingular [cd:include] [file=]
+ {\complexloadsetups[\XMLop{file}]}
\protect \endinput
diff --git a/tex/context/base/x-set-11.mkiv b/tex/context/base/x-set-11.mkiv
index 499d531e5..4e86f668e 100644
--- a/tex/context/base/x-set-11.mkiv
+++ b/tex/context/base/x-set-11.mkiv
@@ -1,98 +1,454 @@
-% engine=luatex
+%D \module
+%D [ file=x-set-11,
+%D version=2004.10.31,
+%D remark=setupx.tex: 1998.07.20 and later,
+%D title=\CONTEXT\ Setup Definitions,
+%D subtitle=Macro Definitions,
+%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.
-\startluacode
- do
- document = document or { }
+% todo: for fun: pure lua interface, but as this style evolved over 15 years
+% it's a waste of time
+%
+% todo:
+%
+% \setup{setupinterlinespace}
+% \setup{setupinterlinespace:1}
+% \setup{setupinterlinespace:2}
+%
+% cd:include -> @file
+% cd:choice
+%
+% register, interaction
- document.setups = {
- loaded = { },
- root = nil,
- used = { },
+\usemodule[set-99] % interface messages
+
+\unprotect
+
+% general
+
+\def\setupnumfont {}
+\def\setuptxtfont {}
+\def\setupintfont {\WORD}
+\def\setupvarfont {\sl}
+\def\setupoptfont {\sl}
+\def\setupalwcolor {}
+\def\setupoptcolor {darkgray}
+
+\def\c!setup!definereserved#1#2%
+ {\setvalue{c!setup!:r:#1}{#2}}
+
+\def\c!setup!reserved!#1%
+ {\executeifdefined{c!setup!:r:#1}{#1}}
+
+\def\c!setup!internal!#1%
+ {\dontleavehmode
+ \begingroup
+ \setupintfont{#1}%
+ \endgroup}
+
+\def\c!setup!text!#1%
+ {\dontleavehmode
+ \begingroup
+ \setupvarfont{#1}%
+ \endgroup}
+
+\def\c!setup!command!#1%
+ {{\setupvarfont{\texescape...#1}}}
+
+\def\??stp{@@stp}
+
+\defineregister
+ [texmacro]
+ [texmacros]
+
+\definesorting
+ [texcommand]
+ [texcommands]
+
+\setupsorting
+ [texcommand]
+ [\c!command=\showsetupinlist,
+ \c!criterium=\@@stpcriterium]
+
+\pushmacro\setuptext
+
+\defineframedtext
+ [setuptext]
+ [\c!width=\hsize,
+ \c!height=\v!fit,
+ \c!align=\v!right,
+ \c!offset=0.75em]
+
+\popmacro\setuptext
+
+%D Loading:
+
+\startxmlsetups xml:setups:register
+ \edef\currentSETUPname{\xmlatt{#1}{name}}
+ % \writestatus{setups}{registering \currentSETUPname}%
+ \expanded{\texcommand[stp:x:\currentSETUPname]{\currentSETUPname}}
+\stopxmlsetups
+
+\startxmlsetups xml:setups:basics
+ \xmlsetsetup {setups} {
+ sequence|string|variable|assignments|keywords|content|displaymath|index|math|
+ nothing|file|position|reference|csname|destination|triplet|word|
+ resolve|parameter|constant|inherit|parameter|define
+ } {xml:setups:*}
+\stopxmlsetups
+
+\xmlregisterdocumentsetup{setups}{xml:setups:basics}
+
+\def\loadsetups{\complexorsimple\loadsetups}
+
+\def\simpleloadsetups
+ {\doifnotmode{no-setup-main}{\complexloadsetups[cont-en.xml]}}
+
+\def\complexloadsetups[#1]%
+ {\doifsomething{#1}
+ {\doonlyonce{setups:#1}
+ {\xmlloadonly{setups}{#1}{setups}%
+ \xmlpushdocument{setups}% should be automatic
+ \xmlcommand{setups}{/interface/command}{xml:setups:register}}% qualified path saves > 50% runtime
+ \xmlpopdocument}}
+
+\newif\ifshortsetup
+
+\def\setup {\shortsetupfalse\doshowsetup}
+\def\showsetup {\shortsetupfalse\doshowsetup}
+\def\shortsetup{\shortsetuptrue \doshowsetup}
+\def\setupsetup{\dodoubleargument\getparameters[\??stp]}
+
+\unexpanded\def\showsetupinlist#1#2#3{\shortsetupfalse\showsetupindeed{#3}\par}
+
+% todo: only references in lists
+
+\def\doshowsetup
+ {\dosingleempty\dodoshowsetup}
+
+\def\dodoshowsetup[#1]%
+ {\iffirstargument
+ \dododoshowsetup{#1}%
+ \else
+ \expandafter\dododoshowsetup
+ \fi}
+
+\def\dododoshowsetup#1% this will trigger 'used'
+ {\registersort[texcommand][stp:x:#1]%
+ \showsetupindeed{#1}}
+
+\def\showsetupindeed#1%
+ {\xmlcommand{setups}{/interface/command[@name='#1']}{xml:setups:typeset}}
+
+\def\placesetup {\placelistofsorts[texcommand][\c!criterium=\v!used]}
+\def\placeallsetups{\placelistofsorts[texcommand][\c!criterium=\v!all ]}
+
+\let\placeeverysetup\placeallsetups
+
+%D Typesetting:
+
+\setupxml
+ [\c!method=mkiv, % mixed mode
+ \c!default=\v!hidden, % ignore elements that are not defined
+ \c!compress=\v!yes, % strip comment
+ \c!entities=\v!yes] % replace entities
+
+\newcounter\currentSETUPargument
+\newcounter\maximumSETUPargument
+
+\def\currentSETUPwidth{0pt}
+
+\startxmlsetups xml:setups:typeset
+ \xmlpushdocument{setups}
+ \edef\currentSETUPname{\xmlatt{#1}{name}}%
+ \getvalue{\e!start setuptext}
+ \tttf
+ \nohyphens
+ \veryraggedright
+ \doglobal\newcounter\currentSETUPargument
+ \xdef\maximumSETUPargument{\xmlcount{#1}{/arguments/*}}
+ \bgroup
+ \doif {\xmlatt{#1}{generated}} {yes} {
+ \ttsl
+ }
+ \doifelse {\xmlatt{#1}{type}} {environment} {
+ \tex{\e!start}
+ } {
+ \tex{}
+ }
+ \xmlfirst{#1}{/sequence}
+ \ignorespaces
+ \egroup
+ \xmldoif{#1}{/arguments} {
+ \bgroup
+ \enablemode[setups-pass-one]
+ \doglobal\newcounter\currentSETUPargument
+ \ignorespaces
+ \xmltext{#1}{/arguments}
+ \egroup
+ }
+ \doif {\xmlatt{#1}{type}} {environment} {
+ \bgroup
+ \hskip.5em\unknown\hskip.5em
+ \doif {\xmlatt{#1}{generated}} {yes} {
+ \ttsl
+ }
+ \tex{\e!stop}
+ \xmlfirst{#1}{/sequence/variable}
+ \ignorespaces
+ \egroup
+ }
+ \endgraf
+ \xmldoif{#1}{/arguments} {
+ \bgroup
+ \enablemode[setups-pass-two]
+ \doglobal\newcounter\currentSETUPargument
+ \blank[\v!line]
+ \switchtobodyfont[small]
+ \ignorespaces\xmltext{#1}{/arguments}\endgraf
+ \egroup
+ }
+ \getvalue{\e!stop setuptext}
+ \xmlpopdocument
+\stopxmlsetups
+
+\setupsetup
+ [\c!before=,
+ \c!after=,
+ \c!command=\setup,
+ \c!criterium=\v!used]
+
+\startxmlsetups xml:setups:resolve
+ \ignorespaces
+ \xmlfirst{setups}{define[@name='\xmlatt{#1}{name}']}
+\stopxmlsetups
+
+%D This is the first pass; here we generate the top line.
+
+\startxmlsetups xml:setups:define
+ \ignorespaces\xmlflush{#1}
+\stopxmlsetups
+
+\startxmlsetups xml:setups:sequence
+ \ignorespaces\xmlflush{#1}
+\stopxmlsetups
+
+\startxmlsetups xml:setups:string
+ \xmlatt{#1}{value}\ignorespaces
+\stopxmlsetups
+
+\startxmlsetups xml:setups:content \showSETUPcomponent{#1}{content} {content} \stopxmlsetups
+\startxmlsetups xml:setups:displaymath \showSETUPcomponent{#1}{displaymath}{display math}\stopxmlsetups
+\startxmlsetups xml:setups:index \showSETUPcomponent{#1}{index} {index} \stopxmlsetups
+\startxmlsetups xml:setups:math \showSETUPcomponent{#1}{math} {math} \stopxmlsetups
+\startxmlsetups xml:setups:nothing \showSETUPcomponent{#1}{nothing} {nothing} \stopxmlsetups
+\startxmlsetups xml:setups:file \showSETUPcomponent{#1}{file} {file name} \stopxmlsetups
+\startxmlsetups xml:setups:position \showSETUPcomponent{#1}{position} {position} \stopxmlsetups
+\startxmlsetups xml:setups:reference \showSETUPcomponent{#1}{reference} {reference} \stopxmlsetups
+\startxmlsetups xml:setups:csname \showSETUPcomponent{#1}{csname} {csname} \stopxmlsetups
+\startxmlsetups xml:setups:destination \showSETUPcomponent{#1}{destination}{destination} \stopxmlsetups
+\startxmlsetups xml:setups:triplet \showSETUPcomponent{#1}{triplet} {triplet} \stopxmlsetups
+\startxmlsetups xml:setups:word \showSETUPcomponent{#1}{word} {word} \stopxmlsetups
+
+\def\showSETUPcomponent#1#2#3%
+ {\doifmodeelse{setups-pass-one}
+ {\getvalue{showSETUP#2}{#1}}
+ {\simpleSETUPargument{#3}}}
+
+%D This is the second pass; here we generate the table.
+
+\def\startfirstSETUPcolumn#1%
+ {\bgroup
+ \advance\leftskip 2em
+ \noindent\llap{\hbox to 2em{#1\hss}}}
+
+\def\stopfirstSETUPcolumn
+ {\endgraf
+ \egroup}
+
+\def\startsecondSETUPcolumn#1#2%
+ {\bgroup
+ \advance\hangindent\dimexpr\currentSETUPwidth+2.5em\relax
+ \noindent \hbox to \hangindent{#1\hss\hbox to 2.5em{\hss#2\hss}}}
+
+\def\stopsecondSETUPcolumn
+ {\endgraf
+ \egroup}
+
+\def\secondSETUPcolumn#1#2%
+ {\startsecondSETUPcolumn{#1}{#2}\stopsecondSETUPcolumn}
+
+\def\previousSETUPargument{\currentSETUPargument}
+
+\startxmlsetups xml:setups:parameter:measure
+ \setbox0=\hbox{\c!setup!reserved!{\xmlatt{#1}{name}}}
+ \ifdim\wd0>\currentSETUPwidth\xdef\currentSETUPwidth{\the\wd0}\fi
+\stopxmlsetups
+
+\startxmlsetups xml:setups:assignments
+ \doifmodeelse{setups-pass-one} {
+ \showSETUPassignment{#1}
+ } {
+ \xdef\currentSETUPwidth{0pt}%
+ \bgroup
+ \xmlcommand{#1}{/parameter}{xml:setups:parameter:measure}
+ \egroup
+ \startfirstSETUPcolumn{\showSETUPnumber}%
+% \xmldoifelseempty {#1} {} {
+ \ignorespaces
+ \xmlflush{#1}
+ \let\previousSETUPargument\currentSETUPargument
+% } {
+% \secondSETUPcolumn{\c!setup!text!{see} \previousSETUPargument}{}
+% }
+ \stopfirstSETUPcolumn
+ \blank[\v!halfline]
+ \ignorespaces
+ }
+\stopxmlsetups
+
+\startxmlsetups xml:setups:keywords
+ \doifmodeelse{setups-pass-one} {
+ \showSETUPkeyword{#1}
+ } {
+ \startfirstSETUPcolumn{\showSETUPnumber}%
+% \xmldoifelseempty {#1} {} {
+ \ignorespaces
+ \xmlflush{#1}
+ \let\previousSETUPargument\currentSETUPargument
+% }{
+% \secondSETUPcolumn{see \previousSETUPargument}{}
+% }
+ \stopfirstSETUPcolumn
+ \blank[\v!halfline]
+ \ignorespaces
+ }
+\stopxmlsetups
+
+\startxmlsetups xml:setups:parameter
+ \startsecondSETUPcolumn{\c!setup!reserved!{\xmlatt{#1}{name}}}{=}
+ \ignorespaces
+ \xmlflush{#1}
+ \stopsecondSETUPcolumn
+ \ignorespaces
+\stopxmlsetups
+
+\startxmlsetups xml:setups:constant
+ \doifmodeelse {setups-pass-one} {
+ } {
+ \doif {\xmlatt{#1}{default}} {yes} {
+ \underbar % next needs to be {braced}
}
+ {\c!setup!reserved!{\xmlatt{#1}{type}}}
+ \space
+ \ignorespaces
+ }
+\stopxmlsetups
+
+\startxmlsetups xml:setups:variable
+ \doifmodeelse {setups-pass-one} {
+ \expanded{\setupintfont{\xmlatt{#1}{value}}}\ignorespaces
+ } {
+ \c!setup!reserved!{\xmlatt{#1}{value}}
+ \space
+ \ignorespaces
+ }
+\stopxmlsetups
+
+\startxmlsetups xml:setups:inherit
+ \secondSETUPcolumn {
+ \c!setup!text!{\getmessage{setup}{inherits}}
+ \enspace
+ \tex{}
+ \xmlatt{#1}{name}
+ } {}
+ \ignorespaces
+\stopxmlsetups
+
+\def\simpleSETUPargument#1%
+ {\startfirstSETUPcolumn{\showSETUPnumber}%
+ \c!setup!internal!{#1}%
+ \stopfirstSETUPcolumn
+ \blank[\v!halfline]
+ \ignorespaces}
+
+\c!setup!definereserved {cd:command} {\c!setup!internal!{\getmessage{setup}{command}}}
+\c!setup!definereserved {cd:dimension} {\c!setup!internal!{\getmessage{setup}{dimension}}}
+\c!setup!definereserved {cd:file} {\c!setup!internal!{\getmessage{setup}{file}}}
+\c!setup!definereserved {cd:name} {\c!setup!internal!{\getmessage{setup}{identifier}}}
+\c!setup!definereserved {cd:character} {\c!setup!internal!{\getmessage{setup}{character}}}
+\c!setup!definereserved {cd:mark} {\c!setup!internal!{\getmessage{setup}{mark}}}
+\c!setup!definereserved {cd:number} {\c!setup!internal!{\getmessage{setup}{number}}}
+\c!setup!definereserved {cd:reference} {\c!setup!internal!{\getmessage{setup}{reference}}}
+\c!setup!definereserved {cd:plural} {\c!setup!internal!{\getmessage{setup}{plural}}}
+\c!setup!definereserved {cd:singular} {\c!setup!internal!{\getmessage{setup}{singular}}}
+\c!setup!definereserved {cd:text} {\c!setup!internal!{\getmessage{setup}{text}}}
+\c!setup!definereserved {cd:formula} {\c!setup!internal!{\getmessage{setup}{formula}}}
+\c!setup!definereserved {cd:file} {\c!setup!internal!{\getmessage{setup}{file}}}
+\c!setup!definereserved {cd:matrix} {\c!setup!internal!{\getmessage{setup}{matrix}}}
+\c!setup!definereserved {cd:list} {\c!setup!internal!{\getmessage{setup}{list}}}
+\c!setup!definereserved {cd:section} {\c!setup!internal!{\getmessage{setup}{section}}}
+
+\c!setup!definereserved {cd:noargument} {\c!setup!command! {}}
+\c!setup!definereserved {cd:oneargument} {\c!setup!command! {\#1}}
+\c!setup!definereserved {cd:twoarguments} {\c!setup!command! {\#1\#2}}
+\c!setup!definereserved {cd:threearguments} {\c!setup!command! {\#1\#2\#3}}
+
+%D Auxiliary.
+
+\unexpanded\def\showSETUP#1#2#3%
+ {\bgroup
+ \doglobal\increment\currentSETUPargument
+ \setbox0=\hbox
+ {\doifelse{\xmlatt{#1}{list}}{yes}{#3}{#2}}%
+ \setbox2=\hbox to \wd0
+ {\hss
+ \raise1ex\hbox
+ {\tx\ifcase\maximumSETUPargument\relax
+ \or*\else\currentSETUPargument
+ \fi}%
+ \hss}%
+ \setbox4=\hbox to \wd0
+ {\hss
+ \lower2ex\hbox
+ \bgroup
+ \txx\doif{\xmlatt{#1}{optional}}{yes}{\c!setup!internal!{\getmessage{setup}{optional}}}%
+ \egroup
+ \hss}%
+ \ht2\ht\strutbox
+ \dp4\dp\strutbox
+ \hskip.5em\hsmash{\box0}\hsmash{\box4}\box2%
+ \egroup
+ \ignorespaces}
+
+\def\showSETUPnumber
+ {\doglobal\increment\currentSETUPargument
+ \hbox to 2em
+ {\ifcase\maximumSETUPargument\relax
+ \or*\else\currentSETUPargument
+ \fi
+ \hss}}
+
+\def\showSETUPassignment #1{\showSETUP{#1}{[.\lower.5ex\hbox{=}.]} {[..,.\lower.5ex\hbox{=}.,..]}}
+\def\showSETUPkeyword #1{\showSETUP{#1}{[...]} {[...,...]}}
+\def\showSETUPargument #1{\showSETUP{#1}{\leftargument..\rightargument} {\leftargument..,...,..\rightargument}}
+\def\showSETUPdisplaymath#1{\showSETUP{#1}{\$\$...\$\$} {\$\$...\$\$}}
+\def\showSETUPindex #1{\showSETUP{#1}{\leftargument...\rightargument} {\leftargument..+...+..\rightargument}}
+\def\showSETUPmath #1{\showSETUP{#1}{\$...\$} {\$...\$}}
+\def\showSETUPnothing #1{\showSETUP{#1}{...} {}}
+\def\showSETUPfile #1{\showSETUP{#1}{~...~} {}}
+\def\showSETUPposition #1{\showSETUP{#1}{(...)} {(...,...)}}
+\def\showSETUPreference #1{\showSETUP{#1}{[...]} {[...,...]}}
+\def\showSETUPcsname #1{\showSETUP{#1}{{\c!setup!command!{}}} {}}
+\def\showSETUPdestination#1{\showSETUP{#1}{[\leftargument..[ref]\rightargument]}{[..,\leftargument..[ref,..]\rightargument,..]}}
+\def\showSETUPtriplet #1{\showSETUP{#1}{[x:y:z=]} {[x:y:z=,..]}}
+\def\showSETUPword #1{\showSETUP{#1}{\leftargument...\rightargument} {\leftargument.. ... ..\rightargument}}
+\def\showSETUPcontent #1{\showSETUP{#1}{\leftargument...\rightargument} {\leftargument.. ... ..\rightargument}}
- function document.setups.load(filename)
- filename = resolvers.find_file(filename) or ""
- if filename ~= "" and not document.setups.loaded[filename] then
- local loaded = xml.load(filename)
- if loaded then
- if document.setups.root then
- xml.inject(document.setups.root,"/",loaded)
- else
- document.setups.root = loaded
- end
- document.setups.loaded[filename] = true
- end
- end
- end
- function document.setups.name(ek)
- local at = ek.at
- local name = at.name
- if at.type == 'environment' then
- name = "start" .. name
- end
- if at.variant then
- name = name .. ":" .. at.variant
- end
- if at.generated == "yes" then
- name = name .. "*"
- end
- return name:lower()
- end
- function document.setups.show(name)
- if document.setups.root then
- local name = name:gsub("[<>]","")
- local setup = xml.first(document.setups.root,"cd:command[@name='" .. name .. "']")
- document.setups.used[#document.setups.used+1] = setup
- xml.sprint(setup)
- end
- end
- function document.setups.showused()
- if document.setups.root and next(document.setups.used) then
- for k,v in ipairs(table.sortedkeys(document.setups.used)) do
- xml.sprint(document.setups.used[v])
- end
- end
- end
- function document.setups.showall()
- if document.setups.root then
- local list = { }
- xml.each_element(document.setups.root,"cd:command", function(r,d,t)
- local ek = d[t]
- list[document.setups.name(ek)] = ek
- end )
- for k,v in ipairs(table.sortedkeys(list)) do
- xml.sprint(list[v])
- end
- end
- end
- function document.setups.resolve(name)
- if document.setups.root then
- local e = xml.filter(document.setups.root,string.format("cd:define[@name='%s']/text()",name))
- if e then
- xml.sprint(e)
- end
- end
- end
- end
-\stopluacode
-
-\def\mkloadsetups #1{\ctxlua{document.setups.load("#1")}}
-\def\mkshowsetup #1{\ctxlua{document.setups.show("#1")}}
-\def\mkshowusedsetups {\bgroup\enableXML\ctxlua{document.setups.showused()}\egroup}
-\def\mkshowallsetups {\bgroup\enableXML\ctxlua{document.setups.showall ()}\egroup}
-
-\def\mkshowsetup #1{\bgroup\enableXML\ctxlua{document.setups.show("#1")}\egroup}
-
-\defineXMLenvironmentsave [cd:define] [name=]
- {}
-
-\defineXMLsingular [cd:resolve] [name=]
- {\enableXML\ignorespaces\ctxlua{document.setups.resolve("\XMLop{name}")}}
-
-\endinput
-
-% \starttext
-% \loadsetups[cont-en.xml]
-% \setup[goto]
-% \placeeverysetup
-% \stoptext
+\protect \endinput
diff --git a/tex/context/base/x-set-11.tex b/tex/context/base/x-set-11.tex
index 6d4cab5ca..920fd7426 100644
--- a/tex/context/base/x-set-11.tex
+++ b/tex/context/base/x-set-11.tex
@@ -12,808 +12,99 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-% module x-set-02 loads the mapping, after that we can say:
-%
-% texmfstart texexec --int=nl --pdf --global --result=setup-nl x-set-12
-%
-% \getinterfacecomponent{constant|variable|string}{tag}
-
-\usemodule[set-02]
-
\loadmarkfile{x-set-11}
-\ifx\mkloadsetups\undefined \let\mkloadsetups \gobbleoneargument \fi
-\ifx\mkshowsetup \undefined \let\mkshowsetup \gobbleoneargument \fi
-\ifx\mkusedsetups\undefined \let\mkusedsetups \gobbleoneargument \fi
-\ifx\mkallsetups \undefined \let\mkallsetups \gobbleoneargument \fi
-
-\unprotect
-
-% general
-
-\def\setupnumfont {}
-\def\setuptxtfont {}
-\def\setupintfont#1{\uppercase{#1}}
-\def\setupvarfont {\sl}
-\def\setupoptfont {\sl}
-\def\setupalwcolor {}
-\def\setupoptcolor {darkgray}
-
-\defineXMLenvironmentsave [cd:content] [list=,state=]
- {\simpleSETUPargument{content}\blank[\v!halfline]\ignorespaces}
- {\ignorespaces}
-
-\startmessages dutch library: setup
- title: setup
- formula: formule
- number: getal
- list: lijst
- dimension: maat
- mark: markering
- reference: verwijzing
- command: commando
- file: file
- name: naam
- identifier: naam
- text: tekst
- section: sectie
- singular: naam enkelvoud
- plural: naam meervoud
- matrix: n*m
- see: zie
- inherits: erft van
- 1: de karakters < en > zijn globaal actief!
- 2: -- wordt verwerkt
- 3: -- is niet gedefinieerd
- 4: -- wordt nogmaals verwerkt
- optional: optioneel
- displaymath: formule
- index: ingang
- math: formule
- nothing: leeg
- file: file
- position: positie
- reference: verwijzing
- csname: naam
- destination: bestemming
- triplet: triplet
- word: woord
- content: tekst
-\stopmessages
-
-\startmessages english library: setup
- title: setup
- formula: formula
- number: number
- list: list
- dimension: dimension
- mark: mark
- reference: reference
- command: command
- file: file
- name: name
- identifier: identifier
- text: text
- section: section
- singular: singular name
- plural: plural name
- matrix: n*m
- see: see
- inherits: inherits from
- 1: the characters < and > are globally active!
- 2: -- is processed
- 3: -- is undefined
- 4: -- is processed again
- optional: optional
- displaymath: formula
- index: entry
- math: formula
- nothing: empty
- file: file
- position: position
- reference: reference
- csname: name
- destination: destination
- triplet: triplet
- word: word
- content: text
-\stopmessages
-
-\startmessages german library: setup
- title: Setup
- formula: Formel
- number: Nummer
- list: Liste
- dimension: Dimension
- mark: Beschriftung
- reference: Referenz
- command: Befehl
- file: Datei
- name: Name
- identifier: Name
- text: Text
- section: Abschnitt
- singular: singular
- plural: plural
- matrix: n*m
- see: siehe
- inherits: inherits from
- 1: Die Zeichen < und > gelten global!
- 2: -- wird verarbeitet
- 3: -- ist undefiniert
- 4: -- ist mehrmals verarbeitet
- optional: optioneel
- displaymath: formula
- index: entry
- math: formula
- nothing: empty
- file: file
- position: position
- reference: reference
- csname: name
- destination: destination
- triplet: triplet
- word: word
- content: text
-\stopmessages
-
-\startmessages czech library: setup
- title: setup
- formula: rovnice
- number: cislo
- list: seznam
- dimension: dimenze
- mark: znacka
- reference: reference
- command: prikaz
- file: soubor
- name: jmeno
- identifier: jmeno
- text: text
- section: sekce
- singular: jmeno v singularu
- plural: jmeno v pluralu
- matrix: n*m
- see: viz
- inherits: inherits from
- 1: znaky < a > jsou globalne aktivni!
- 2: -- je zpracovano
- 3: -- je nedefinovano
- 4: -- je zpracovano znovu
- optional: optioneel
- displaymath: formula
- index: entry
- math: formula
- nothing: empty
- file: file
- position: position
- reference: reference
- csname: name
- destination: destination
- triplet: triplet
- word: word
- content: text
-\stopmessages
-
-\startmessages italian library: setup
- title: setup
- formula: formula
- number: number
- list: list
- dimension: dimension
- mark: mark
- reference: reference
- command: command
- file: file
- name: name
- identifier: name
- text: text
- section: section
- singular: singular name
- plural: plural name
- matrix: n*m
- see: see
- inherits: inherits from
- 1: the characters < and > are globally active!
- 2: -- is processed
- 3: -- is undefined
- 4: -- is processed again
- optional: optioneel
- displaymath: formula
- index: entry
- math: formula
- nothing: empty
- file: file
- position: position
- reference: reference
- csname: name
- destination: destination
- triplet: triplet
- word: word
- content: text
-\stopmessages
-
-\startmessages romanian library: setup
- title: setari
- formula: formula
- number: numar
- list: lista
- dimension: dimensiune
- mark: marcaj
- reference: referinta
- command: comanda
- file: fisier
- name: nume
- identifier: nume
- text: text
- section: sectiune
- singular: nume singular
- plural: nume pluram
- matrix: n*m
- see: vezi
- inherits: inherits from
- 1: caracterele < si > sunt active global!
- 2: este procesat --
- 3: -- este nedefinit
- 4: -- este procesat din nou
- optional: optioneel
- displaymath: formula
- index: entry
- math: formula
- nothing: empty
- file: file
- position: position
- reference: reference
- csname: name
- destination: destination
- triplet: triplet
- word: word
- content: text
-\stopmessages
-
-\startmessages french library: setup
- title: réglage
- formula: formule
- number: numéro
- list: liste
- dimension: dimension
- mark: marquage
- reference: reference
- command: commande
- file: fichier
- name: nom
- identifier: identificateur
- text: texte
- section: section
- singular: nom singulier
- plural: nom pluriel
- matrix: n*m
- see: vois
- inherits: herite de
- 1: les caractères < et > sont globalement actifs !
- 2: -- est traité
- 3: -- n'est pas défini
- 4: -- est traité de nouveau
- optional: optionel
- displaymath: formule
- index: entrée
- math: formule
- nothing: vide
- file: fichier
- position: position
- reference: réference
- csname: nom
- destination: destination
- triplet: triplet
- word: mot
- content: texte
-\stopmessages
-
-\def\c!setup!internal!#1%
- {{\setmessagetext{setup}{#1}%
- \expanded{\setupintfont{\currentmessagetext}}}}
-
-\def\c!setup!text!#1%
- {{\setmessagetext{setup}{#1}%
- \setupvarfont{\currentmessagetext}}}
-
-\def\c!setup!command!#1%
- {{\setupvarfont{\texescape...#1}}}
-
-\def\??stp{@@stp}
-
-\defineregister
- [texmacro]
- [texmacros]
-
-\definesorting
- [texcommand]
- [texcommands]
-
-\setupsorting
- [texcommand]
- [\c!command=\@@stpcommand,
- \c!criterium=\@@stpcriterium]
-
-\definesorting
- [eachtexcommand]
- [alltexcommands]
-
-\setupsorting
- [eachtexcommand]
- [\c!command=\@@stpcommand,
- \c!criterium=\v!all]
-
-\pushmacro\setuptext
-
-\defineframedtext
- [setuptext]
- [\c!width=\hsize,
- \c!height=\v!fit,
- \c!align=\v!right,
- \c!offset=0.75em]
-
-\popmacro\setuptext
-
-\newif\ifshortsetup
-
-\def\doshowsetup
- {\dosingleempty\dodoshowsetup}
-
-\def\dodoshowsetup[#1]%
- {\iffirstargument
- \mkshowsetup{#1}%
- \else
- \expandafter\mkshowsetup
- \fi}
-
-\def\setup {\shortsetupfalse\doshowsetup}
-\def\showsetup {\shortsetupfalse\doshowsetup}
-\def\shortsetup{\shortsetuptrue \doshowsetup}
-\def\setupsetup{\dodoubleargument\getparameters[\??stp]}
-
-\setupsetup
- [\c!before=,
- \c!after=,
- \c!command=\setup,
- \c!criterium=\v!used]
-
-% verwijzing: 0 geen verwijzingen plaatsen / wel genereren
-% 1 alleen bij zie plaatsen / wel genereren
-% 2 alle verwijzingen plaatsen / niet genereren
-% 3 bij zie commando klikken / wel genereren
-
-\setupsetup
- [\c!reference=0]
-
-\def\placesetup
- {\bgroup
- \mkshowusedsetups
- \egroup}
-
-\def\placeallsetups
- {\bgroup
- \setupsetup[\c!reference=2]%
- \setupreferencing[\c!state=\v!stop]%
- \mkshowallsetups
- \egroup}
-
-\let\placeeverysetup\placeallsetups
-
-\let\plaatssetup \placesetup
-\let\plaatselkesetup\placeallsetups
-
-% we use :1 as fallback
-%
-% \setup{setupinterlinespace}
-% \setup{setupinterlinespace:1}
-% \setup{setupinterlinespace:2}
-
-% todo: make this proper mkiv xml
-
-\defineXMLenvironment [cd:command] [name=,type=,generated=,interactive=,variant=]
- {}
- {\showSETUPrecord}
-
-\def\showSETUPrecord
- {\getvalue{\e!start setuptext}
- \tttf
- \nohyphens
- \veryraggedright
- \startXMLmapping [one]
- \doglobal\newcounter\currentSETUPargument
- \global\let\maximumSETUPargument\currentSETUPargument
- \bgroup
- \doif{\XMLpar{cd:command}{generated}{}}{yes}{\ttsl}%
- \doifelseXMLop{type}{environment}
- {\tex{\e!start}}{\tex{}}\ignorespaces
- \XMLflush{cd:sequence}\ignorespaces
- \egroup
- \doifelseXMLempty{cd:arguments}
- {}
- {\bgroup
- \setbox0=\hbox{\XMLflush{cd:arguments}}%
- \global\let\maximumSETUPargument\currentSETUPargument
- \doglobal\newcounter\currentSETUPargument
- \ignorespaces\XMLflush{cd:arguments}%
- \doif{\XMLpar{cd:command}{type}{}}{environment}
- {\hskip.5em\unknown\hskip.5em
- \doif{\XMLpar{cd:command}{generated}{}}{yes}{\ttsl}%
- \tex{\e!stop}\ignorespaces\XMLflush{cd:sequence}}%
- \endgraf
- \egroup
- %\bgroup
- % \tx
- % \doif{\XMLpar{cd:command}{interactive}{}}{yes} {\quad INTERACTIVE}%
- % \doif{\XMLpar{cd:command}{interactive}{}}{exclusive}{\quad INTERACTIVE ONLY}%
- %\egroup
- \startXMLmapping [two]
- \bgroup
- \doglobal\newcounter\currentSETUPargument
- \blank[\v!line]
- \switchtobodyfont[small] % kan sneller
- \ignorespaces\XMLflush{cd:arguments}\endgraf
- \egroup
- \stopXMLmapping}
- \stopXMLmapping
- \getvalue{\e!stop setuptext}}
-
-\defineXMLenvironmentsave [cd:sequence] \ignorespaces \ignorespaces
-\defineXMLenvironmentsave [cd:arguments] \ignorespaces \ignorespaces
-
-%D This is the first pass; here we generate the top line.
-
-\newcounter\currentSETUPargument
-\def\currentSETUPwidth{0pt}
-
-% environmentsave ?
-
-\startXMLmapping [one]
-
-\defineXMLenvironmentsave [cd:string] [value=]
- {\getinterfacecomponent{string}{\XMLop{value}}\ignorespaces}
- {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:variable] [value=]
- {{\expanded{\setupintfont{\getinterfacecomponent{variable}{\XMLop{value}}}}}\ignorespaces}
- {\ignorespaces}
-
-% moet een standaard type worden
-
-\defineXMLenvironmentsave [cd:assignments] [list=,state=]
- {\showSETUPassignment\ignorespaces} {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:keywords] [list=,state=]
- {\showSETUPkeyword\ignorespaces} {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:content] [list=,state=]
- {\showSETUPcontent\ignorespaces} {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:displaymath] [list=,state=]
- {\showSETUPdisplaymath\ignorespaces} {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:index] [list=,state=]
- {\showSETUPindex\ignorespaces} {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:math] [list=,state=]
- {\showSETUPmath\ignorespaces} {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:nothing] [list=,state=]
- {\showSETUPnothing\ignorespaces} {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:file] [list=,state=]
- {\showSETUPfile\ignorespaces} {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:position] [list=,state=]
- {\showSETUPposition\ignorespaces} {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:reference] [list=,state=]
- {\showSETUPreference\ignorespaces} {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:csname] [list=,state=]
- {\showSETUPcsname\ignorespaces} {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:destination] [list=,state=]
- {\showSETUPdestination\ignorespaces} {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:triplet] [list=,state=]
- {\showSETUPtriplet\ignorespaces} {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:word] [list=,state=]
- {\showSETUPword\ignorespaces} {\ignorespaces}
-
-\stopXMLmapping
-
-%D This is the second pass; here we generate the table.
-
-\startXMLmapping [two]
-
-\def\startfirstSETUPcolumn#1%
- {\bgroup
- \advance\leftskip 2em
- \noindent\llap{\hbox to 2em{#1\hss}}}
-
-\def\stopfirstSETUPcolumn
- {\endgraf
- \egroup}
-
-\def\startsecondSETUPcolumn#1#2%
- {\bgroup
- \advance\hangindent \currentSETUPwidth
- \advance\hangindent 2.5em
- \noindent \hbox to \hangindent{#1\hss\hbox to 2.5em{\hss#2\hss}}}
-
-\def\stopsecondSETUPcolumn
- {\endgraf
- \egroup}
-
-\def\secondSETUPcolumn#1#2%
- {\startsecondSETUPcolumn{#1}{#2}\stopsecondSETUPcolumn}
-
-\def\previousSETUPargument{\currentSETUPargument}
-
-\defineXMLenvironmentsave [cd:assignments]
- {}
- {\xdef\currentSETUPwidth{0pt}%
- \bgroup
- \defineXMLenvironment [cd:parameter] [name=]
- {\setbox0=\hbox{\potentialXMLentity{\getinterfacecomponent{constant}{\XMLop{name}}}}%
- \ifdim\wd0>\currentSETUPwidth\xdef\currentSETUPwidth{\the\wd0}\fi}%
- {}
- \setbox0=\vbox{\XMLflush{cd:assignments}}%
- \egroup
- \startfirstSETUPcolumn{\showSETUPnumber}%
- \doifelseXMLempty{cd:assignments}
- {\secondSETUPcolumn{\c!setup!text!{see} \previousSETUPargument}{}}
- {\ignorespaces
- \XMLflush{cd:assignments}%
- \let\previousSETUPargument\currentSETUPargument}%
- \stopfirstSETUPcolumn
- \blank[\v!halfline]
- \ignorespaces}
-
-\defineXMLenvironmentsave [cd:keywords] [optional=no]
+\endinput
+
+% Old code, a mixture of loading in mkiv and processing in mkii.
+
+\startluacode
+ do
+ document = document or { }
+
+ document.setups = {
+ loaded = { },
+ root = nil,
+ used = { },
+ }
+
+ function document.setups.load(filename)
+ filename = resolvers.find_file(filename) or ""
+ if filename ~= "" and not document.setups.loaded[filename] then
+ local loaded = xml.load(filename)
+ if loaded then
+ if document.setups.root then
+ xml.inject(document.setups.root,"/",loaded)
+ else
+ document.setups.root = loaded
+ end
+ document.setups.loaded[filename] = true
+ end
+ end
+ end
+ function document.setups.name(ek)
+ local at = ek.at
+ local name = at.name
+ if at.type == 'environment' then
+ name = "start" .. name
+ end
+ if at.variant then
+ name = name .. ":" .. at.variant
+ end
+ if at.generated == "yes" then
+ name = name .. "*"
+ end
+ return name:lower()
+ end
+ function document.setups.show(name)
+ if document.setups.root then
+ local name = name:gsub("[<>]","")
+ local setup = xml.first(document.setups.root,"cd:command[@name='" .. name .. "']")
+ document.setups.used[#document.setups.used+1] = setup
+ xml.sprint(setup)
+ end
+ end
+ function document.setups.showused()
+ if document.setups.root and next(document.setups.used) then
+ for k,v in ipairs(table.sortedkeys(document.setups.used)) do
+ xml.sprint(document.setups.used[v])
+ end
+ end
+ end
+ function document.setups.showall()
+ if document.setups.root then
+ local list = { }
+ xml.each_element(document.setups.root,"cd:command", function(r,d,t)
+ local ek = d[t]
+ list[document.setups.name(ek)] = ek
+ end )
+ for k,v in ipairs(table.sortedkeys(list)) do
+ xml.sprint(list[v])
+ end
+ end
+ end
+ function document.setups.resolve(name)
+ if document.setups.root then
+ local e = xml.filter(document.setups.root,string.format("cd:define[@name='%s']/text()",name))
+ if e then
+ xml.sprint(e)
+ end
+ end
+ end
+ end
+\stopluacode
+
+\def\mkloadsetups #1{\ctxlua{document.setups.load("#1")}}
+\def\mkshowsetup #1{\ctxlua{document.setups.show("#1")}}
+\def\mkshowusedsetups {\bgroup\enableXML\ctxlua{document.setups.showused()}\egroup}
+\def\mkshowallsetups {\bgroup\enableXML\ctxlua{document.setups.showall ()}\egroup}
+
+\def\mkshowsetup #1{\bgroup\enableXML\ctxlua{document.setups.show("#1")}\egroup}
+
+\defineXMLenvironmentsave [cd:define] [name=]
{}
- {\startfirstSETUPcolumn{\showSETUPnumber}%
- \doifelseXMLempty{cd:keywords}
- {\secondSETUPcolumn{see \previousSETUPargument}{}}
- {\ignorespaces
- \XMLflush{cd:keywords}%
- \let\previousSETUPargument\currentSETUPargument}%
- \stopfirstSETUPcolumn
- \blank[\v!halfline]
- \ignorespaces}
-
-\defineXMLenvironment [cd:parameter] [name=]
- {\startsecondSETUPcolumn{\potentialXMLentity{\getinterfacecomponent{constant}{\XMLop{name}}}}{=}%
- \ignorespaces}
- {\stopsecondSETUPcolumn
- \ignorespaces}
-
-\defineXMLenvironmentsave [cd:constant] [type=,default=]
- {\doifXMLop{default}{yes}{\underbar}%
- {\potentialXMLentity{\getinterfacecomponent{variable}{\XMLop{type}}}}\quad\ignorespaces}
- {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:variable] [type=]
- {\potentialXMLentity{\getinterfacecomponent{variable}{\XMLop{type}}}\quad\ignorespaces}
- {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:inherit] [name=]
- {\secondSETUPcolumn{\c!setup!text!{inherits} \tex{}\getinterfacecomponent{string}{\XMLop{name}}}{}\ignorespaces}
- {\ignorespaces}
-
-\def\simpleSETUPargument#1%
- {\startfirstSETUPcolumn{\showSETUPnumber}%
- \c!setup!internal!{#1}%
- \stopfirstSETUPcolumn}
-
-\defineXMLenvironmentsave [cd:content] [list=,state=]
- {\simpleSETUPargument{content}\blank[\v!halfline]\ignorespaces}
- {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:displaymath] [list=,state=]
- {\simpleSETUPargument{display math}\blank[\v!halfline]\ignorespaces}
- {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:index] [list=,state=]
- {\simpleSETUPargument{index}\blank[\v!halfline]\ignorespaces}
- {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:math] [list=,state=]
- {\simpleSETUPargument{math}\blank[\v!halfline]\ignorespaces}
- {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:nothing] [list=,state=]
- {\simpleSETUPargument{nothing}\blank[\v!halfline]\ignorespaces}
- {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:file] [list=,state=]
- {\simpleSETUPargument{file name}\blank[\v!halfline]\ignorespaces}
- {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:position] [list=,state=]
- {\simpleSETUPargument{position}\blank[\v!halfline]\ignorespaces}
- {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:reference] [list=,state=]
- {\simpleSETUPargument{reference}\blank[\v!halfline]\ignorespaces}
- {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:csname] [list=,state=]
- {\simpleSETUPargument{csname}\blank[\v!halfline]\ignorespaces}
- {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:destination] [list=,state=]
- {\simpleSETUPargument{destination}\blank[\v!halfline]\ignorespaces}
- {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:triplet] [list=,state=]
- {\simpleSETUPargument{triplet}\blank[\v!halfline]\ignorespaces}
- {\ignorespaces}
-
-\defineXMLenvironmentsave [cd:word] [list=,state=]
- {\simpleSETUPargument{word}\blank[\v!halfline]\ignorespaces}
- {\ignorespaces}
-
-\stopXMLmapping
-
-\defineXMLentity [cd:command] {\c!setup!internal!{command}}
-\defineXMLentity [cd:dimension] {\c!setup!internal!{dimension}}
-\defineXMLentity [cd:file] {\c!setup!internal!{file}}
-\defineXMLentity [cd:name] {\c!setup!internal!{identifier}}
-\defineXMLentity [cd:character] {\c!setup!internal!{character}}
-\defineXMLentity [cd:mark] {\c!setup!internal!{mark}}
-\defineXMLentity [cd:number] {\c!setup!internal!{number}}
-\defineXMLentity [cd:reference] {\c!setup!internal!{reference}}
-\defineXMLentity [cd:plural] {\c!setup!internal!{plural}}
-\defineXMLentity [cd:singular] {\c!setup!internal!{singular}}
-\defineXMLentity [cd:text] {\c!setup!internal!{text}}
-\defineXMLentity [cd:formula] {\c!setup!internal!{formula}}
-\defineXMLentity [cd:file] {\c!setup!internal!{file}}
-\defineXMLentity [cd:matrix] {\c!setup!internal!{matrix}}
-\defineXMLentity [cd:list] {\c!setup!internal!{list}}
-\defineXMLentity [cd:section] {\c!setup!internal!{section}}
-
-\defineXMLentity [cd:noargument] {\c!setup!command!{}}
-\defineXMLentity [cd:oneargument] {\c!setup!command!{\#1}}
-\defineXMLentity [cd:twoarguments] {\c!setup!command!{\#1\#2}}
-\defineXMLentity [cd:threearguments] {\c!setup!command!{\#1\#2\#3}}
-
-%D Todo:
-
-\defineXMLprocess [cd:choice]
-
-%D Auxiliary.
-
-\unexpanded\def\showSETUP#1#2%
- {\bgroup
- \doglobal\increment\currentSETUPargument
- \setbox0=\hbox
- {\doifelseXMLop{list}{yes}{#2}{#1}}%
- \setbox2=\hbox to \wd0
- {\hss
- \raise1ex\hbox
- {\tx\ifcase\maximumSETUPargument\relax
- \or*\else\currentSETUPargument
- \fi}%
- \hss}%
- \setbox4=\hbox to \wd0
- {\hss
- \lower2ex\hbox
- \bgroup
- \txx\doifXMLop{optional}{yes}{\c!setup!internal!{optional}}%
- \egroup
- \hss}%
- \ht2\ht\strutbox
- \dp4\dp\strutbox
- \hskip.5em\hsmash{\box0}\hsmash{\box4}\box2%
- \egroup}
-
-\def\showSETUPnumber
- {\doglobal\increment\currentSETUPargument
- \hbox to 2em
- {\ifcase\maximumSETUPargument\relax
- \or*\else\currentSETUPargument
- \fi
- \hss}}
-
-\def\showSETUPassignment {\showSETUP
- {[.\lower.5ex\hbox{=}.]}
- {[..,.\lower.5ex\hbox{=}.,..]}}
-
-\def\showSETUPkeyword {\showSETUP
- {[...]}
- {[...,...]}}
-
-\def\showSETUPargument {\showSETUP
- {\leftargument..\rightargument}
- {\leftargument..,...,..\rightargument}}
-
-\def\showSETUPdisplaymath {\showSETUP
- {\$\$...\$\$}
- {\$\$...\$\$}}
-
-\def\showSETUPindex {\showSETUP
- {\leftargument...\rightargument}
- {\leftargument..+...+..\rightargument}}
-
-\def\showSETUPmath {\showSETUP
- {\$...\$}
- {\$...\$}}
-
-\def\showSETUPnothing {\showSETUP
- {...}
- {}}
-
-\def\showSETUPfile {\showSETUP
- {~...~}
- {}}
-
-\def\showSETUPposition {\showSETUP
- {(...)}
- {(...,...)}}
-
-\def\showSETUPreference {\showSETUP
- {[...]}
- {[...,...]}}
-
-\def\showSETUPcsname {\showSETUP
- {{\c!setup!command!{}}}
- {}}
-
-\def\showSETUPdestination {\showSETUP
- {[\leftargument..[ref]\rightargument]}
- {[..,\leftargument..[ref,..]\rightargument,..]}}
-
-\def\showSETUPtriplet {\showSETUP
- {[x:y:z=]}
- {[x:y:z=,..]}}
-
-\def\showSETUPword {\showSETUP
- {\leftargument...\rightargument}
- {\leftargument.. ... ..\rightargument}}
-
-\def\showSETUPcontent {\showSETUP
- {\leftargument...\rightargument}
- {\leftargument.. ... ..\rightargument}}
-
-%\def\c!par!{\c!setup!internal!{endofpar}}
-%\def\c!repeat!{\c!opt!{{\setupvarfont n}*}}
-%\showSETUP\def\c!par!{\texescape par}
-%\showSETUP\def\c!sep!{\texescape\texescape}
-%\def\c!par!{\addtypespec{delimiter}{par}} % \par
-%\def\c!sep!{\addtypespec{separator}{backslash}} % \\
-%\def\c!repeat!{}
-%\def\c!tex!#1{\addtypespec{command}{#1}\doanother{tex}}
-
-\startXMLmapping[zero]
-
-\defineXMLenvironmentsave [cd:command] [name=,type=,generated=,interactive=,variant=]
- {}
- {\doifelseXMLop{type}{environment}
- {\edef\currentSETUPname{start\getinterfacecomponent{string}{\XMLop{name}}}}
- {\edef\currentSETUPname{\getinterfacecomponent{string}{\XMLop{name}}}}%
- \doifsomething{\XMLop{variant}}
- {\edef\currentSETUPname{\currentSETUPname:\XMLop{variant}}}% like setupinterlinespace:1
- \doifXMLop{generated}{yes}
- {\edef\currentSETUPname{\currentSETUPname*}}%
- \doglobal\saveXMLdatainelement{stp:\currentSETUPname}{cd:command}{cd:command}%
- \expanded{\eachtexcommand[stp:x:\currentSETUPname]{\currentSETUPname}}%
- \expanded{\texcommand [stp:y:\currentSETUPname]{\currentSETUPname}}}
-
-\stopXMLmapping
-
-\def\loadsetups{\complexorsimple\loadsetups}
-
-\def\simpleloadsetups
- {\doifnotmode{no-setup-main}
- {\complexloadsetups[cont-en.xml]}}
-
-\def\complexloadsetups[#1]%
- {\doifsomething{#1}{\mkloadsetups{#1}}}
-\defineXMLsingular [cd:include] [file=]
- {\complexloadsetups[\XMLop{file}]}
+\defineXMLsingular [cd:resolve] [name=]
+ {\enableXML\ignorespaces\ctxlua{document.setups.resolve("\XMLop{name}")}}
-\protect \endinput
+\endinput
diff --git a/tex/context/base/x-set-12.tex b/tex/context/base/x-set-12.tex
index 2659df0d8..6d3667771 100644
--- a/tex/context/base/x-set-12.tex
+++ b/tex/context/base/x-set-12.tex
@@ -16,7 +16,10 @@
\unprotect
-\loadsetups
+% \starttext
+% \setup{installlanguage}
+% \placesetup
+% \stoptext
\definecolor[TitleColor][r=.375,g=.125,b=.125]
\definecolor[TitleColor][r=.125,g=.375,b=.125]
@@ -32,6 +35,14 @@
\definecolor[TitleColor][r=.15,g=.20,b=.25]
\definecolor[TitleColor][r=.15,g=.25,b=.20]
+\startinterface english \loadsetups[cont-en.xml] \stopinterface
+\startinterface dutch \loadsetups[cont-nl.xml] \stopinterface
+\startinterface german \loadsetups[cont-de.xml] \stopinterface
+\startinterface french \loadsetups[cont-fr.xml] \stopinterface
+\startinterface italian \loadsetups[cont-it.xml] \stopinterface
+\startinterface czech \loadsetups[cont-cs.xml] \stopinterface
+\startinterface romanian \loadsetups[cont-ro.xml] \stopinterface
+
\startinterface dutch \definecolor[LocalColor][r=.75,g=.25,b=.25] \stopinterface
\startinterface english \definecolor[LocalColor][r=.25,g=.75,b=.25] \stopinterface
\startinterface german \definecolor[LocalColor][r=.25,g=.25,b=.75] \stopinterface
diff --git a/tex/context/base/x-set-99.tex b/tex/context/base/x-set-99.tex
new file mode 100644
index 000000000..64d2b1db3
--- /dev/null
+++ b/tex/context/base/x-set-99.tex
@@ -0,0 +1,283 @@
+%D \module
+%D [ file=x-set-99,
+%D version=2004.10.31,
+%D remark=setupx.tex: 1998.07.20 and later,
+%D title=\CONTEXT\ Setup Definitions,
+%D subtitle=Macro Definitions,
+%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.
+
+% shared list
+
+\startmessages dutch library: setup
+ title: setup
+ formula: formule
+ number: getal
+ list: lijst
+ dimension: maat
+ mark: markering
+ reference: verwijzing
+ command: commando
+ file: file
+ name: naam
+ identifier: naam
+ text: tekst
+ section: sectie
+ singular: naam enkelvoud
+ plural: naam meervoud
+ matrix: n*m
+ see: zie
+ inherits: erft van
+ 1: de karakters < en > zijn globaal actief!
+ 2: -- wordt verwerkt
+ 3: -- is niet gedefinieerd
+ 4: -- wordt nogmaals verwerkt
+ optional: optioneel
+ displaymath: formule
+ index: ingang
+ math: formule
+ nothing: leeg
+ file: file
+ position: positie
+ reference: verwijzing
+ csname: naam
+ destination: bestemming
+ triplet: triplet
+ word: woord
+ content: tekst
+\stopmessages
+
+\startmessages english library: setup
+ title: setup
+ formula: formula
+ number: number
+ list: list
+ dimension: dimension
+ mark: mark
+ reference: reference
+ command: command
+ file: file
+ name: name
+ identifier: identifier
+ text: text
+ section: section
+ singular: singular name
+ plural: plural name
+ matrix: n*m
+ see: see
+ inherits: inherits from
+ 1: the characters < and > are globally active!
+ 2: -- is processed
+ 3: -- is undefined
+ 4: -- is processed again
+ optional: optional
+ displaymath: formula
+ index: entry
+ math: formula
+ nothing: empty
+ file: file
+ position: position
+ reference: reference
+ csname: name
+ destination: destination
+ triplet: triplet
+ word: word
+ content: text
+\stopmessages
+
+\startmessages german library: setup
+ title: Setup
+ formula: Formel
+ number: Nummer
+ list: Liste
+ dimension: Dimension
+ mark: Beschriftung
+ reference: Referenz
+ command: Befehl
+ file: Datei
+ name: Name
+ identifier: Name
+ text: Text
+ section: Abschnitt
+ singular: singular
+ plural: plural
+ matrix: n*m
+ see: siehe
+ inherits: inherits from
+ 1: Die Zeichen < und > gelten global!
+ 2: -- wird verarbeitet
+ 3: -- ist undefiniert
+ 4: -- ist mehrmals verarbeitet
+ optional: optioneel
+ displaymath: formula
+ index: entry
+ math: formula
+ nothing: empty
+ file: file
+ position: position
+ reference: reference
+ csname: name
+ destination: destination
+ triplet: triplet
+ word: word
+ content: text
+\stopmessages
+
+\startmessages czech library: setup
+ title: setup
+ formula: rovnice
+ number: cislo
+ list: seznam
+ dimension: dimenze
+ mark: znacka
+ reference: reference
+ command: prikaz
+ file: soubor
+ name: jmeno
+ identifier: jmeno
+ text: text
+ section: sekce
+ singular: jmeno v singularu
+ plural: jmeno v pluralu
+ matrix: n*m
+ see: viz
+ inherits: inherits from
+ 1: znaky < a > jsou globalne aktivni!
+ 2: -- je zpracovano
+ 3: -- je nedefinovano
+ 4: -- je zpracovano znovu
+ optional: optioneel
+ displaymath: formula
+ index: entry
+ math: formula
+ nothing: empty
+ file: file
+ position: position
+ reference: reference
+ csname: name
+ destination: destination
+ triplet: triplet
+ word: word
+ content: text
+\stopmessages
+
+\startmessages italian library: setup
+ title: setup
+ formula: formula
+ number: number
+ list: list
+ dimension: dimension
+ mark: mark
+ reference: reference
+ command: command
+ file: file
+ name: name
+ identifier: name
+ text: text
+ section: section
+ singular: singular name
+ plural: plural name
+ matrix: n*m
+ see: see
+ inherits: inherits from
+ 1: the characters < and > are globally active!
+ 2: -- is processed
+ 3: -- is undefined
+ 4: -- is processed again
+ optional: optioneel
+ displaymath: formula
+ index: entry
+ math: formula
+ nothing: empty
+ file: file
+ position: position
+ reference: reference
+ csname: name
+ destination: destination
+ triplet: triplet
+ word: word
+ content: text
+\stopmessages
+
+\startmessages romanian library: setup
+ title: setari
+ formula: formula
+ number: numar
+ list: lista
+ dimension: dimensiune
+ mark: marcaj
+ reference: referinta
+ command: comanda
+ file: fisier
+ name: nume
+ identifier: nume
+ text: text
+ section: sectiune
+ singular: nume singular
+ plural: nume pluram
+ matrix: n*m
+ see: vezi
+ inherits: inherits from
+ 1: caracterele < si > sunt active global!
+ 2: este procesat --
+ 3: -- este nedefinit
+ 4: -- este procesat din nou
+ optional: optioneel
+ displaymath: formula
+ index: entry
+ math: formula
+ nothing: empty
+ file: file
+ position: position
+ reference: reference
+ csname: name
+ destination: destination
+ triplet: triplet
+ word: word
+ content: text
+\stopmessages
+
+\startmessages french library: setup
+ title: réglage
+ formula: formule
+ number: numéro
+ list: liste
+ dimension: dimension
+ mark: marquage
+ reference: reference
+ command: commande
+ file: fichier
+ name: nom
+ identifier: identificateur
+ text: texte
+ section: section
+ singular: nom singulier
+ plural: nom pluriel
+ matrix: n*m
+ see: vois
+ inherits: herite de
+ 1: les caractères < et > sont globalement actifs !
+ 2: -- est traité
+ 3: -- n'est pas défini
+ 4: -- est traité de nouveau
+ optional: optionel
+ displaymath: formule
+ index: entrée
+ math: formule
+ nothing: vide
+ file: fichier
+ position: position
+ reference: réference
+ csname: nom
+ destination: destination
+ triplet: triplet
+ word: mot
+ content: texte
+\stopmessages
+
+\endinput
diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua
index 3ca17ac6d..a07ca9466 100644
--- a/tex/generic/context/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts.lua
--- merge date : 09/21/09 17:40:59
+-- merge date : 09/23/09 10:11:52
do -- begin closure to overcome local limits and interference
@@ -7613,16 +7613,19 @@ local function alternative_glyph(start,alternatives,kind,chainname,chainlookupna
value, choice = format("first, choice %s",1), alternatives[1]
elseif value == "last" then
value, choice = format("last, choice %s",n), alternatives[n]
- elseif type(value) ~= "number" then
- value, choice = "default, choice 1", alternatives[1]
- elseif value > n then
- value, choice = format("no %s variants, taking %s",value,n), alternatives[n]
- elseif value == 0 then
- value, choice = format("choice %s (no change)",value), start.char
- elseif value < 1 then
- value, choice = format("no %s variants, taking %s",value,1), alternatives[1]
else
- value, choice = format("choice %s",value), alternatives[value]
+ value = tonumber(value)
+ if type(value) ~= "number" then
+ value, choice = "default, choice 1", alternatives[1]
+ elseif value > n then
+ value, choice = format("no %s variants, taking %s",value,n), alternatives[n]
+ elseif value == 0 then
+ value, choice = format("choice %s (no change)",value), start.char
+ elseif value < 1 then
+ value, choice = format("no %s variants, taking %s",value,1), alternatives[1]
+ else
+ value, choice = format("choice %s",value), alternatives[value]
+ end
end
if not choice then
logwarning("%s: no variant %s for %s",cref(kind,chainname,chainlookupname,lookupname),value,gref(start.char))