summaryrefslogtreecommitdiff
path: root/tex/context/base
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkiv/back-exp.lua29
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/core-dat.lua53
-rw-r--r--tex/context/base/mkiv/core-dat.mkiv33
-rw-r--r--tex/context/base/mkiv/data-tre.lua5
-rw-r--r--tex/context/base/mkiv/font-fil.mkvi4
-rw-r--r--tex/context/base/mkiv/lang-def.mkiv6
-rw-r--r--tex/context/base/mkiv/lang-ini.mkiv245
-rw-r--r--tex/context/base/mkiv/lang-txt.lua1
-rw-r--r--tex/context/base/mkiv/luat-env.lua16
-rw-r--r--tex/context/base/mkiv/math-noa.lua22
-rw-r--r--tex/context/base/mkiv/math-tag.lua31
-rw-r--r--tex/context/base/mkiv/meta-imp-txt.mkiv3
-rw-r--r--tex/context/base/mkiv/mult-low.lua1
-rw-r--r--tex/context/base/mkiv/mult-sys.mkiv1
-rw-r--r--tex/context/base/mkiv/node-ser.lua5
-rw-r--r--tex/context/base/mkiv/node-tra.lua20
-rw-r--r--tex/context/base/mkiv/spac-pag.mkiv1
-rw-r--r--tex/context/base/mkiv/spac-par.mkiv6
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin26331 -> 26335 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin267701 -> 267753 bytes
-rw-r--r--tex/context/base/mkiv/strc-lst.mkvi2
-rw-r--r--tex/context/base/mkiv/strc-mat.mkiv2
-rw-r--r--tex/context/base/mkiv/strc-reg.lua51
-rw-r--r--tex/context/base/mkiv/strc-reg.mkiv177
-rw-r--r--tex/context/base/mkiv/strc-tag.lua79
-rw-r--r--tex/context/base/mkiv/syst-aux.lua14
-rw-r--r--tex/context/base/mkiv/syst-aux.mkiv3
-rw-r--r--tex/context/base/mkiv/syst-lua.lua3
-rw-r--r--tex/context/base/mkiv/tabl-tbl.mkiv4
-rw-r--r--tex/context/base/mkiv/tabl-xtb.mkvi117
-rw-r--r--tex/context/base/mkiv/util-soc-imp-smtp.lua4
-rw-r--r--tex/context/base/mkiv/util-soc-imp-tp.lua2
36 files changed, 584 insertions, 364 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 89d228b63..0bbf208dd 100644
--- a/tex/context/base/mkii/cont-new.mkii
+++ b/tex/context/base/mkii/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2018.09.01 23:10}
+\newcontextversion{2018.09.12 00:38}
%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/mkii/context.mkii b/tex/context/base/mkii/context.mkii
index b146654e7..cf46d6007 100644
--- a/tex/context/base/mkii/context.mkii
+++ b/tex/context/base/mkii/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2018.09.01 23:10}
+\edef\contextversion{2018.09.12 00:38}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/back-exp.lua b/tex/context/base/mkiv/back-exp.lua
index 39f6e5155..9e62314d4 100644
--- a/tex/context/base/mkiv/back-exp.lua
+++ b/tex/context/base/mkiv/back-exp.lua
@@ -46,6 +46,7 @@ local replacetemplate = utilities.templates.replace
local trace_export = false trackers.register ("export.trace", function(v) trace_export = v end)
local trace_spacing = false trackers.register ("export.trace.spacing", function(v) trace_spacing = v end)
+local trace_detail = false trackers.register ("export.trace.detail", function(v) trace_detail = v end)
local less_state = false directives.register("export.lessstate", function(v) less_state = v end)
local show_comment = true directives.register("export.comment", function(v) show_comment = v end)
@@ -2552,8 +2553,8 @@ do
local cd = currentdata[j]
if not cd or cd == "" then
-- skip
-elseif cd.skip == "ignore" then
- -- skip
+ elseif cd.skip == "ignore" then
+ -- skip
elseif cd.content then
if not currentpar then
-- add space ?
@@ -2860,6 +2861,8 @@ local collectresults do -- too many locals otherwise
local listcodes = nodes.listcodes
local whatsitcodes = nodes.whatsitcodes
+ local subtypes = nodes.subtypes
+
local hlist_code = nodecodes.hlist
local vlist_code = nodecodes.vlist
local glyph_code = nodecodes.glyph
@@ -2913,7 +2916,7 @@ local collectresults do -- too many locals otherwise
local function addtomaybe(maybewrong,c,case)
if trace_export then
- report_export("%w<!-- possible paragraph mixup at %C case %i -->",currentdepth,c,at,case)
+ report_export("%w<!-- possible paragraph mixup at %C case %i -->",currentdepth,c,case)
else
local s = formatters["%C"](c)
if maybewrong then
@@ -2931,15 +2934,26 @@ local collectresults do -- too many locals otherwise
end
end
+ local function showdetail(n,id,subtype)
+ local a = getattr(n,a_tagged)
+ local t = taglist[a]
+ local c = nodecodes[id]
+ local s = subtypes[id][subtype]
+ if a and t then
+ report_export("node %a, subtype %a, tag %a, element %a, tree '% t'",c,s,a,t.tagname,t.taglist)
+ else
+ report_export("node %a, subtype %a, untagged",c,s)
+ end
+ end
+
local function collectresults(head,list,pat,pap) -- is last used (we also have currentattribute)
local p
local localparagraph
local maybewrong
for n, id, subtype in nextnode, head do
--- can go :
-if not subtype then
- subtype = getsubtype(n)
-end
+ if trace_detail then
+ showdetail(n,id,subtype)
+ end
if id == glyph_code then
local c = getchar(n)
local at = getattr(n,a_tagged) or pat
@@ -3214,6 +3228,7 @@ end
-- we need to determine an end-of-line
local list = getlist(n)
if list then
+ -- todo: no par checking needed in math
local at = getattr(n,a_tagged) or pat
collectresults(list,n,at)
end
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 6f8f6c2a7..7c2da5a84 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2018.09.01 23:10}
+\newcontextversion{2018.09.12 00:38}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index 24f2cb13d..8a5000b4e 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -42,7 +42,7 @@
%D has to match \type {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2018.09.01 23:10}
+\edef\contextversion{2018.09.12 00:38}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/core-dat.lua b/tex/context/base/mkiv/core-dat.lua
index fa4d089d0..5f9bc9d08 100644
--- a/tex/context/base/mkiv/core-dat.lua
+++ b/tex/context/base/mkiv/core-dat.lua
@@ -15,6 +15,7 @@ local tonumber, tostring, type = tonumber, tostring, type
local context = context
local commands = commands
+local ctx_latelua = context.latelua
local trace_datasets = false trackers.register("job.datasets" , function(v) trace_datasets = v end)
local trace_pagestates = false trackers.register("job.pagestates", function(v) trace_pagestates = v end)
@@ -244,7 +245,7 @@ end
pagestates.setstate = setstate
-function pagestates.extend(name,tag)
+local function extend(name,tag)
local realpage = texgetcount("realpageno")
if trace_pagestates then
report_pagestate("action %a, name %a, tag %a, preset %a","synchronize",name,tag,realpage)
@@ -252,6 +253,8 @@ function pagestates.extend(name,tag)
tobesaved[name][tag] = realpage
end
+pagestates.extend = extend
+
function pagestates.realpage(name,tag,default)
local t = collected[name]
if t then
@@ -267,21 +270,47 @@ function pagestates.realpage(name,tag,default)
return default
end
+-- local function setpagestate(settings)
+-- local name, tag = setstate(settings)
+-- if type(tag) == "number" then
+-- context(new_latelua(formatters["job.pagestates.extend(%q,%i)"](name,tag)))
+-- else
+-- context(new_latelua(formatters["job.pagestates.extend(%q,%q)"](name,tag)))
+-- end
+-- end
+
local function setpagestate(settings)
- local name, tag, data = setstate(settings)
- if type(tag) == "number" then
- context(new_latelua(formatters["job.pagestates.extend(%q,%i)"](name,tag)))
- else
- context(new_latelua(formatters["job.pagestates.extend(%q,%q)"](name,tag)))
- end
+ local name, tag = setstate(settings)
+ -- context(new_latelua(function() extend(name,tag) end))
+ ctx_latelua(function() extend(name,tag) end)
end
local function pagestaterealpage(name,tag)
local t = collected[name]
- t = t and (t[tag] or t[tonumber(tag)])
if t then
- context(t)
+ t = t[tag] or t[tonumber(tag)]
+ if t then
+ context(t)
+ end
+ end
+end
+
+local function pagestaterealpageorder(name,tag)
+ local t = collected[name]
+ if t then
+ local p = t[tag]
+ if p then
+ local n = 1
+ for i=tag-1,1,-1 do
+ if t[i] == p then
+ n = n +1
+ end
+ end
+ context(n)
+ return
+ end
end
+ context(0)
end
local function setpagestaterealpageno(name,tag)
@@ -313,3 +342,9 @@ implement {
actions = setpagestaterealpageno,
arguments = "2 strings",
}
+
+implement {
+ name = "pagestaterealpageorder",
+ actions = pagestaterealpageorder,
+ arguments = { "string", "integer" }
+}
diff --git a/tex/context/base/mkiv/core-dat.mkiv b/tex/context/base/mkiv/core-dat.mkiv
index 3bb923af4..b159fccf8 100644
--- a/tex/context/base/mkiv/core-dat.mkiv
+++ b/tex/context/base/mkiv/core-dat.mkiv
@@ -73,9 +73,18 @@
{\clf_datasetvariable{#1}{#2}{#3}}
\installcorenamespace{pagestate}
+\installcorenamespace{pagestatecounter}
\installcommandhandler \??pagestate {pagestate} \??pagestate
+\def\syst_pagestates_allocate
+ {\expandafter\newcount\csname\??pagestatecounter\currentpagestate\endcsname
+ \expandafter\let\expandafter\c_syst_pagestate\csname\??pagestatecounter\currentpagestate\endcsname}
+
+\appendtoks
+ \syst_pagestates_allocate
+\to \everydefinepagestate
+
\setuppagestate
[\c!delay=\v!yes]
@@ -85,17 +94,31 @@
\def\syst_pagestates_set[#1][#2]%
{\begingroup
\edef\currentpagestate{#1}%
+ \ifcsname\??pagestatecounter\currentpagestate\endcsname
+ \let\c_syst_pagestate\lastnamedcs
+ \else
+ \syst_pagestates_allocate
+ \fi
+ \global\advance\c_syst_pagestate\plusone
+ \scratchcounter\lastnamedcs
\clf_setpagestate
name {\currentpagestate}%
- tag {#2}%
+ tag {\ifsecondargument#2\else\number\c_syst_pagestate\fi}%
delay {\pagestateparameter\c!delay}%
\relax
\endgroup}
-\def\pagestaterealpage#1#2%
- {\clf_pagestaterealpage{#1}{#2}}
+\unexpanded\def\autosetpagestate#1%
+ {\secondargumentfalse\syst_pagestates_set[#1]}
+
+\def\autopagestatenumber#1{\begincsname\??pagestatecounter#1\endcsname}
+
+\def\pagestaterealpage #1#2{\clf_pagestaterealpage {#1}{#2}}
+\def\setpagestaterealpageno#1#2{\clf_setpagestaterealpageno{#1}{#2}}
+\def\pagestaterealpageorder#1#2{\clf_pagestaterealpageorder{#1}#2\relax}
-\def\setpagestaterealpageno#1#2%
- {\clf_setpagestaterealpageno{#1}{#2}}
+\def\autopagestaterealpage #1{\clf_pagestaterealpage {#1}{\number\autopagestatenumber{#1}}}
+\def\setautopagestaterealpageno#1{\clf_setpagestaterealpageno{#1}{\number\autopagestatenumber{#1}}}
+\def\autopagestaterealpageorder#1{\clf_pagestaterealpageorder{#1}\autopagestatenumber{#1}\relax}
\protect
diff --git a/tex/context/base/mkiv/data-tre.lua b/tex/context/base/mkiv/data-tre.lua
index 4388731f9..c4d43e3eb 100644
--- a/tex/context/base/mkiv/data-tre.lua
+++ b/tex/context/base/mkiv/data-tre.lua
@@ -100,11 +100,10 @@ end
function resolvers.hashers.tree(specification)
local name = specification.filename
- -- if trace_locating then
+ if trace_locating then
report_trees("analyzing %a",name)
- -- end
+ end
resolvers.methodhandler("hashers",name)
-
resolvers.generators.file(specification)
end
diff --git a/tex/context/base/mkiv/font-fil.mkvi b/tex/context/base/mkiv/font-fil.mkvi
index 177b1fea1..ff6a46d73 100644
--- a/tex/context/base/mkiv/font-fil.mkvi
+++ b/tex/context/base/mkiv/font-fil.mkvi
@@ -111,7 +111,7 @@
{\if]#key%
\font_basics_get_font_parameter_nop_finish
\else
- \expandafter\normaldef\csname p_#key\endcsname{#value}%
+ \expandafter\normaledef\csname p_#key\endcsname{#value}%
\expandafter\font_basics_get_font_parameter_nop
\fi}
@@ -119,7 +119,7 @@
{\if]#key%
\font_basics_get_font_parameter_yes_finish
\else
- \expandafter\normaldef\csname p_#key\endcsname{#value}%
+ \expandafter\normaledef\csname p_#key\endcsname{#value}%
\expandafter\font_basics_get_font_parameter_yes
\fi}
diff --git a/tex/context/base/mkiv/lang-def.mkiv b/tex/context/base/mkiv/lang-def.mkiv
index 28245e591..b2bd09aa4 100644
--- a/tex/context/base/mkiv/lang-def.mkiv
+++ b/tex/context/base/mkiv/lang-def.mkiv
@@ -328,6 +328,11 @@
\c!date={\v!year,\space,\v!month,\space,\v!day}]
\installlanguage
+ [\s!et]
+ [\s!patterns=\s!et,
+ \c!default=\s!fi]
+
+\installlanguage
[\s!hu]
[\c!spacing=\v!packed,
\c!leftsentence=\emdash,
@@ -341,6 +346,7 @@
\c!date={\v!year,.,\space,\v!month,\space,\v!day,.}]
\installlanguage [\s!finnish] [\s!fi]
+\installlanguage [\s!estonian] [\s!et]
\installlanguage [\s!hungarian] [\s!hu]
% Altaic Languages: Uigur, Uzbek, Azeri/Azerbaijani, Chuvash,
diff --git a/tex/context/base/mkiv/lang-ini.mkiv b/tex/context/base/mkiv/lang-ini.mkiv
index cc8a8ef16..13606c676 100644
--- a/tex/context/base/mkiv/lang-ini.mkiv
+++ b/tex/context/base/mkiv/lang-ini.mkiv
@@ -15,10 +15,10 @@
% \cldcontext{languages.numbers[tex.count.mainlanguagenumber]}
-%D This module implements the (for the moment still simple)
-%D multi||language support of \CONTEXT, which should not be
-%D confused with the multi||lingual interface. This support
-%D will be extended when needed.
+%D This module implements multi||language support of \CONTEXT, which should not be
+%D confused with the multi||lingual interface. This support will be extended when
+%D needed. Properties of languages are defined in \TEX\ files as well as \LUA\
+%D files.
\writestatus{loading}{ConTeXt Language Macros / Initialization}
@@ -28,41 +28,27 @@
\unprotect
-% \def\testlanguage[#1]%
-% {\start
-% \language[#1]
-% \number\normallanguage/\the\lefthyphenmin/\the\righthyphenmin:
-% \input tufte
-% \hyphenatedword{effetestenofditwerkt}
-% \par
-% \stop}
-%
-% \testlanguage[de] \testlanguage[de-de] \testlanguage[de-at] \testlanguage[de-ch] \page
-% \testlanguage[en] \testlanguage[us] \testlanguage[en-us] \testlanguage[uk] \testlanguage[en-gb] \page
-
\ifdefined\nonfrenchspacing\else \let\nonfrenchspacing\relax \fi
\ifdefined\frenchspacing \else \let\frenchspacing \relax \fi
-%D When loading hyphenation patterns, \TEX\ assign a number to
-%D each loaded table, starting with~0. Switching to a specific
-%D table is done by assigning the relevant number to the
-%D predefined \COUNTER\ \type{\language}.
+%D When loading hyphenation patterns, \TEX\ assign a number to each loaded table,
+%D starting with~0. Switching to a specific table is done by assigning the relevant
+%D number to the predefined \COUNTER\ \type {\language}. However, in \MKIV\ a lot
+%D of management is delegated to \LUA.
-%D We keep track of the last loaded patterns by means of a
-%D pseudo \COUNTER. This just one of those situations in which
-%D we don't want to spent a real one. Language zero has no
-%D patterns, first of all because I like to start numbering
-%D at one. It may come in handy for special purposes as well.
+%D We keep track of the last loaded patterns by means of a pseudo \COUNTER. This
+%D just one of those situations in which we don't want to spent a real one. Language
+%D zero has no patterns, first of all because I like to start numbering at one. It
+%D may come in handy for special purposes as well.
\normallanguage\zerocount \def\loadedlanguage{1}
%D \macros
%D {currentlanguage, setupcurrentlanguage}
%D
-%D Instead of numbers,we are going to use symbolic names for
-%D the languages. The current langage is saved in the macro
-%D \type {\currentlanguage}. The setup macro is mainly used
-%D for cosmetic purposes.
+%D Instead of numbers,we are going to use symbolic names for the languages. The
+%D current langage is saved in the macro \type {\currentlanguage}. The setup macro
+%D is mainly used for cosmetic purposes.
%D
%D \starttyping
%D \dorecurse{3}
@@ -79,10 +65,9 @@
%D \macros
%D {defaultlanguage,languageparameter,specificlanguageparameter}
-
-%D We don't use the commandhandler here (yet) because we have
-%D a rather special fallback mechanism so quite some compatibility
-%D testing is needed.
+%D
+%D We don't use the commandhandler here (yet) because we have a rather special
+%D fallback mechanism so quite some compatibility testing is needed.
\installcorenamespace{language}
\installcorenamespace{languagelinked}
@@ -96,33 +81,6 @@
#1%
\fi}
-% \def\languageparameter#1%
-% {\ifcsname\??language\currentlanguage#1\endcsname
-% \csname\??language\currentlanguage#1\endcsname
-% \else\ifcsname\??language\currentlanguage\s!default\endcsname
-% \expandafter\specificlanguageparameter\csname\??language\currentlanguage\s!default\endcsname{#1}%
-% \else\ifcsname\??language\s!default#1\endcsname
-% \csname\??language\s!default#1\endcsname
-% \fi\fi\fi}
-%
-% \def\specificlanguageparameter#1#2%
-% {\ifcsname\??language#1#2\endcsname
-% \csname\??language#1#2\endcsname
-% \else\ifcsname\??language#1\s!default\endcsname
-% \expandafter\specificlanguageparameter\csname\??language#1\s!default\endcsname{#2}%
-% \else\ifcsname\??language\s!default#2\endcsname
-% \csname\??language\s!default#2\endcsname
-% \fi\fi\fi}
-%
-% \def\mainlanguageparameter#1%
-% {\ifcsname\??language\currentmainlanguage#1\endcsname
-% \csname\??language\currentmainlanguage#1\endcsname
-% \else\ifcsname\??language\currentmainlanguage\s!default\endcsname
-% \expandafter\specificlanguageparameter\csname\??language\currentmainlanguage\s!default\endcsname{#1}%
-% \else\ifcsname\??language\s!default#1\endcsname
-% \csname\??language\s!default#1\endcsname
-% \fi\fi\fi}
-
\def\languageparameter#1%
{\ifcsname\??language\currentlanguage#1\endcsname
\lastnamedcs
@@ -152,15 +110,6 @@
\let\usedlanguageparameter\languageparameter
-% \def\askedlanguageparameter#1% assumes \currentusedlanguage being set
-% {\ifcsname\??language\currentusedlanguage#1\endcsname
-% \csname\??language\currentusedlanguage#1\endcsname
-% \else\ifcsname\??language\currentusedlanguage\s!default\endcsname
-% \expandafter\specificlanguageparameter\csname\??language\currentusedlanguage\s!default\endcsname{#1}%
-% \else\ifcsname\??language\s!default#1\endcsname
-% \csname\??language\s!default#1\endcsname
-% \fi\fi\fi}
-
\def\askedlanguageparameter#1% assumes \currentusedlanguage being set
{\ifcsname\??language\currentusedlanguage#1\endcsname
\lastnamedcs
@@ -171,7 +120,6 @@
\fi\fi\fi}
\unexpanded\def\setusedlanguage#1%
-% {\edef\currentusedlanguage{\reallanguagetag{#1\c!language}}%
{\edef\currentusedlanguage{\reallanguagetag{#1}}%
\ifx\currentusedlanguage\empty
\let\currentusedlanguage \currentlanguage
@@ -208,43 +156,23 @@
%D \macros
%D {installlanguage}
%D
-%D Hyphenation patterns can only be loaded when the format file
-%D is prepared. The next macro takes care of this loading. A
-%D language is specified with
+%D Hyphenation patterns can only be loaded when the format file is prepared. The
+%D next macro takes care of this loading. A language is specified with
%D
%D \showsetup{installlanguage}
%D
-%D When \type {state} equals \type {start}, both patterns
-%D and additional hyphenation specifications are loaded. These
-%D files are seached for on the system path and are to be
-%D named:
-%D
-%D \starttyping
-%D lang-identifier.\f!patternsextension
-%D lang-identifier.\f!hyhensextension
-%D \stoptyping
-%D
-%D The \type{spacing} variable specifies how the spaces after
-%D punctuation has to be handled. English is by tradition more
-%D tolerant to inter||sentence spacing than other languages.
+%D When \type {state} equals \type {start}, both patterns and additional hyphenation
+%D specifications are loaded. These files are seached for in the patterns path
+%D have names like \type {lang-nl.lua}.
%D
-%D This macro also defines \type {\identifier} as a shortcut
-%D switch to the language. Furthermore the command defined as
-%D being language specific, are executed. With
-%D \type {default} we can default to another language
-%D (patterns) at format generation time. This default language
-%D is overruled when the appropriate patterns are loaded (some
-%D implementations support run time addition of patterns to a
-%D preloaded format).
-
-%D \macros
-%D {preloadlanguages}
+%D The \type {spacing} variable specifies how the spaces after punctuation has to be
+%D handled. English is by tradition more tolerant to inter||sentence spacing than
+%D other languages.
%D
-%D We first try to load the files defined as file synonym
-%D for \type {lang-*.pat} and \type {lang-*.hyp}. After that we
-%D fall back on those files. The macro \type {\preloadpatterns}
-%D reports which patterns are loaded and what hyphenmin
-%D values are set.
+%D This macro also defines \type {\identifier} as a shortcut switch to the language.
+%D Furthermore the command defined as being language specific, are executed. With
+%D \type {default} we can default to another language (patterns) at format
+%D generation time. Patterns are loaded at runtime.
\newtoks \everysetuplanguage
@@ -260,7 +188,6 @@
\let\doiflanguageelse\doifelselanguage
\def\reallanguagetag#1%
- %{\ifcsname\??languagelinked#1\endcsname\csname\??languagelinked#1\endcsname\else#1\fi}
{\ifcsname\??languagelinked#1\endcsname\lastnamedcs\else#1\fi}
% \language[#1] gave unwanted side effect of loading language specifics
@@ -285,10 +212,9 @@
\def\lang_basics_install_indeed#1#2%
{\ifcsname#1\endcsname\else\setuvalue{#1}{\lang_basics_set_current[#2]}\fi}
-%D When the second argument is a language identifier, a
-%D synonym is created. This feature is present because we
-%D used dutch mnemonics in the dutch version, but nowadays
-%D conform a standard.
+%D When the second argument is a language identifier, a synonym is created. This
+%D feature is present because we used dutch mnemonics in the dutch version, but
+%D nowadays conform a standard.
\unexpanded\def\doifelsepatterns#1%
{\begingroup % will change
@@ -376,26 +302,20 @@
% [\s!default]
% [\c!righthyphenchar="AD]
-%D The values \type {leftsentence} and \type
-%D {rightsentence} can be (and are) used to implement
-%D automatic subsentence boundary glyphs, like in {\fr
-%D |<|french guillemots|>|} or {\de |<|german guillemots|>|} or
-%D {\nl |<|dutch dashes|>|} like situations. Furthermore \type
-%D {leftquotation} and \type {leftquote} come into view
-%D \quotation {when we quote} or \quote {quote} something.
+%D The values \type {leftsentence} and \type {rightsentence} can be (and are) used
+%D to implement automatic subsentence boundary glyphs, like in {\fr |<|french
+%D guillemots|>|} or {\de |<|german guillemots|>|} or {\nl |<|dutch dashes|>|} like
+%D situations. Furthermore \type {leftquotation} and \type {leftquote} come into
+%D view \quotation {when we quote} or \quote {quote} something.
%D \macros
%D {currentdatespecification}
%D
-%D Just to make things easy we can ask for the current date
-%D specification by saying:
+%D Just to make things easy we can ask for the current date specification by saying:
\def\currentdatespecification{\languageparameter\c!date}
-%D This command is not meant for users.
-
-%D Carefull reading of these macros shows that it's legal to
-%D say
+%D Carefull reading of these macros shows that it's legal to say
%D
%D \starttyping
%D \installlanguage [du] [de]
@@ -404,48 +324,33 @@
%D \macros
%D {language,mainlanguage}
%D
-%D Switching to another language (actually another hyphenation
-%D pattern) is done with:
+%D Switching to another language (actually another hyphenation pattern) is done
+%D with:
%D
%D \starttyping
%D \language[identifier]
%D \stoptyping
%D
-%D or with \type{\identifier}. Just to be compatible with
-%D \PLAIN\ \TEX, we still support the original meaning, so
+%D or with \type {\identifier}. Just to be compatible with \PLAIN\ \TEX, we still
+%D support the original meaning, so
%D
%D \starttyping
%D \language=1
%D \stoptyping
%D
-%D is a valid operation, where the relation between number
-%D and language depends on the order in installing languages.
+%D is a valid operation, where the relation between number and language depends on
+%D the order in installing languages.
%D
%D \showsetup{language}
%D \showsetup{mainlanguage}
%D
-%D Both commands take a predefined language identifier as
-%D argument. We can use \type{\mainlanguage[identifier]} for
-%D setting the (indeed) main language. This is the language
-%D used for translating labels like {\em figure} and {\em
-%D table}. The main language defaults to the current language.
-%D
-%D We take care of local as well as standardized language
-%D switching (fr and fa, de and du, but nl and nl).
+%D Both commands take a predefined language identifier as argument. We can use \type
+%D {\mainlanguage[identifier]} for setting the (indeed) main language. This is the
+%D language used for translating labels like {\em figure} and {\em table}. The main
+%D language defaults to the current language.
\newtoks \everylanguage
-% \def\lang_basics_synchronize% assumes that \currentlanguage is set % % % use different name as complex
-% {\normallanguage\ctxcommand{languagenumber(%
-% "\currentlanguage",%
-% "\defaultlanguage\currentlanguage",%
-% "\languageparameter\s!patterns"%
-% )}\relax
-% \the\everylanguage\relax}
-
-% (some 20%) faster but code jungle (the publication code can have excessive
-% switching
-
\installcorenamespace{languagenumbers}
\appendtoks
@@ -473,7 +378,7 @@
\letvalue{\??languagenumbers}\lang_basics_synchronize_yes % runtime
\to \everydump
-\def\lang_basics_synchronize% assumes that \currentlanguage is set % % % use different name as complex
+\def\lang_basics_synchronize
{\normallanguage\csname\??languagenumbers
\ifcsname\??languagenumbers\currentlanguage\endcsname
\currentlanguage
@@ -483,12 +388,7 @@
\the\everylanguage
\relax}
-% experimental
-
\newcount\hyphenstate
-
-% so far
-
\newcount\hyphenminoffset
\unexpanded\def\lesshyphens
@@ -532,7 +432,7 @@
% \setups[\languageparameter\c!setups]%
% \to \everylanguage
-%D You can setup the 'default' language to reset settings.
+%D You can setup the default language to reset settings.
\appendtoks
\edef\currentlanguagesetups{\languageparameter\c!setups}%
@@ -583,11 +483,6 @@
\fi
\to \everylanguage
-% The following may be a solution for the fact that one cannot
-% change catcodes of characters like : and ; inside an environment.
-
-% we will also permit access by the other names
-
%D Fast switcher
\def\lang_basics_switch_asked
@@ -628,24 +523,6 @@
\let\stoplanguage\endgroup
-% \unexpanded\def\mainlanguage[#1]%
-% {\edef\askedlanguage{#1}%
-% \ifx\askedlanguage\empty \else
-% \ifcsname\??languagelinked\askedlanguage\endcsname
-% \edef\askedlanguage{\csname\??languagelinked\askedlanguage\endcsname}%
-% \ifx\currentlanguage\askedlanguage
-% \ifx\currentmainlanguage\askedlanguage \else
-% \setcurrentlanguage\askedlanguage\askedlanguage
-% \lang_basics_synchronize
-% \fi
-% \else
-% \setcurrentlanguage\askedlanguage\askedlanguage
-% \lang_basics_synchronize
-% \fi
-% \fi
-% \fi
-% \mainlanguagenumber\normallanguage}
-
\unexpanded\def\mainlanguage[#1]%
{\edef\askedlanguage{#1}%
\ifx\askedlanguage\empty \else
@@ -677,9 +554,8 @@
\def\splitsymbol#1%
{\splitsequence{#1}{\languageparameter\c!limittext}}
-%D Just like with subsentence boundary symbols, quotes
-%D placement depends on the current language, therefore we show
-%D the defaults here.
+%D Just like with subsentence boundary symbols, quotes placement depends on the
+%D current language, therefore we show the defaults here.
%D
%D \def\ShowLanguageValues [#1] [#2] #3 #4
%D {\blank
@@ -701,6 +577,7 @@
%D \ShowLanguageValues [da] [danish] deense ...
%D \ShowLanguageValues [de] [german] duitse degelijkheid
%D \ShowLanguageValues [en] [english] engelse humor
+%D \ShowLanguageValues [et] [estonian] ...
%D \ShowLanguageValues [fi] [finnish] finse ...
%D \ShowLanguageValues [fr] [french] franse slag
%D \ShowLanguageValues [it] [italian] italiaanse ...
@@ -714,10 +591,9 @@
%D \ShowLanguageValues [sv] [swedish] zweedse ...
%D \ShowLanguageValues [tr] [turkish] turks fruit
-%D We support a lot of languages. These are specified and
-%D loaded in separate files, according to their roots. Here
-%D we only take care of (postponed) setting of the current
-%D language.
+%D We support a lot of languages. These are specified and loaded in separate files,
+%D according to their roots. Here we only take care of (postponed) setting of the
+%D current language.
%D
%D \unprotect
%D \placetable{The germanic languages (\type{lang-ger})}
@@ -788,9 +664,8 @@
\unexpanded\def\nopatterns{\normallanguage\minusone}
-%D We default to the language belonging to the interface. This
-%D is one of the few places outside the interface modules where
-%D \type{\startinterface} is used.
+%D We default to the language belonging to the interface. This is one of the few
+%D places outside the interface modules where \type {\startinterface} is used.
\setupcurrentlanguage[\s!en]
diff --git a/tex/context/base/mkiv/lang-txt.lua b/tex/context/base/mkiv/lang-txt.lua
index 780d28d0d..1ee1aa9ba 100644
--- a/tex/context/base/mkiv/lang-txt.lua
+++ b/tex/context/base/mkiv/lang-txt.lua
@@ -25,6 +25,7 @@ if not modules then modules = { } end modules ['lang-txt'] = {
-- de German Tobias Burnus, ...
-- en English Hans Hagen, ...
-- es Spanish Andrés Montoya, ...
+-- et Estonian Clyde Johnston
-- fi Finish ...
-- fr French Daniel Flipo, Arthur Reutenauer
-- gr Greek Apostolos Syropoulos, Thomas Schmitz
diff --git a/tex/context/base/mkiv/luat-env.lua b/tex/context/base/mkiv/luat-env.lua
index a01a8cf84..e0c69d207 100644
--- a/tex/context/base/mkiv/luat-env.lua
+++ b/tex/context/base/mkiv/luat-env.lua
@@ -12,6 +12,7 @@
-- code has disappeared already.
local rawset, rawget, loadfile = rawset, rawget, loadfile
+local gsub = string.gsub
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
@@ -174,3 +175,18 @@ function environment.loadluafile(filename, version)
end
return false
end
+
+environment.filenames = setmetatable( { }, {
+ __index = function(t,k)
+ local v = environment.files[k]
+ if v then
+ return (gsub(v,"%.+$",""))
+ end
+ end,
+ __newindex = function(t,k)
+ -- nothing
+ end,
+ __len = function(t)
+ return #environment.files
+ end,
+} )
diff --git a/tex/context/base/mkiv/math-noa.lua b/tex/context/base/mkiv/math-noa.lua
index 15d9bd0f1..0ff189e06 100644
--- a/tex/context/base/mkiv/math-noa.lua
+++ b/tex/context/base/mkiv/math-noa.lua
@@ -823,8 +823,8 @@ do
local dummyfencechar = 0x2E
local function makefence(what,char)
- local d = new_delimiter()
- local f = new_fence()
+ local d = new_delimiter() -- todo: attr
+ local f = new_fence() -- todo: attr
if char then
local sym = getnucleus(char)
local chr = getchar(sym)
@@ -847,8 +847,8 @@ do
-- will become
-- local function makefence(what,char)
- -- local d = new_delimiter()
- -- local f = new_fence()
+ -- local d = new_delimiter() -- todo: attr
+ -- local f = new_fence() -- todo: attr
-- if char then
-- local sym = getnucleus(char)
-- local chr = getchar(sym)
@@ -1407,8 +1407,8 @@ do
local c_negative_d = "trace:dr"
local function insert_kern(current,kern)
- local sub = new_submlist()
- local noad = new_noad()
+ local sub = new_submlist() -- todo: attr
+ local noad = new_noad() -- todo: attr
setlist(sub,kern)
setnext(kern,noad)
setnucleus(noad,current)
@@ -1418,7 +1418,7 @@ do
registertracker("math.italics.visualize", function(v)
if v then
italic_kern = function(k)
- local n = new_kern(k)
+ local n = new_kern(k) -- todo: attr
set_visual(n,"italic")
return n
end
@@ -1627,7 +1627,7 @@ do
if trace_kernpairs then
report_kernpairs("adding %p kerning between %C and %C",kern,first,second)
end
- setlink(parent,new_kern(kern),getnext(parent))
+ setlink(parent,new_kern(kern),getnext(parent)) -- todo: attr
end
end
end
@@ -2212,6 +2212,12 @@ do
return mlist_to_hlist(head,style,force_penalties or penalties)
end
+ -- function builders.kernel.mlist_to_hlist(head,style,penalties)
+ -- local h = mlist_to_hlist(head,style,force_penalties or penalties)
+ -- inspect(nodes.totree(h,true,true,true))
+ -- return h
+ -- end
+
implement {
name = "setmathpenalties",
arguments = "integer",
diff --git a/tex/context/base/mkiv/math-tag.lua b/tex/context/base/mkiv/math-tag.lua
index 868c2b661..1cd8e4a7a 100644
--- a/tex/context/base/mkiv/math-tag.lua
+++ b/tex/context/base/mkiv/math-tag.lua
@@ -29,6 +29,7 @@ local getfield = nuts.getfield
local getdisc = nuts.getdisc
local getsubtype = nuts.getsubtype
local getattr = nuts.getattr
+local getattrlist = nuts.getattrlist
local setattr = nuts.setattr
local getcomponents = nuts.getcomponents
local getwidth = nuts.getwidth
@@ -178,18 +179,25 @@ end
--------------------
-local function showtag(n,id)
- local attr = getattr(n,a_tagged)
- report_tags("%s = %s",nodecodes[id or getid(n)],attr and taglist[attr].tagname or "?")
-end
+-- todo: use properties
+
+-- local function showtag(n,id,old)
+-- local attr = getattr(n,a_tagged)
+-- local curr = tags.current()
+-- report_tags("%s, node %s, attr %s:%s (%s), top %s (%s)",
+-- old and "before" or "after ",
+-- nodecodes[id],
+-- getattrlist(n),
+-- attr or "?",attr and taglist[attr].tagname or "?",
+-- curr or "?",curr and taglist[curr].tagname or "?"
+-- )
+-- end
process = function(start) -- we cannot use the processor as we have no finalizers (yet)
local mtexttag = nil
while start do
local id = getid(start)
-
--- showtag(start,id)
-
+-- showtag(start,id,true)
if id == glyph_code or id == disc_code then
if not mtexttag then
mtexttag = start_tagged("mtext")
@@ -226,6 +234,7 @@ process = function(start) -- we cannot use the processor as we have no finalizer
setattr(start,a_tagged,start_tagged(tag)) -- todo: a_mathcategory
end
stop_tagged()
+-- showtag(start,id,false)
break -- okay?
elseif id == math_textchar_code then -- or id == glyph_code
-- check for code
@@ -236,15 +245,18 @@ process = function(start) -- we cannot use the processor as we have no finalizer
setattr(start,a_tagged,start_tagged("ms")) -- mtext
end
stop_tagged()
+-- showtag(start,id,false)
break
elseif id == math_delim_code then
-- check for code
setattr(start,a_tagged,start_tagged("mo"))
stop_tagged()
+-- showtag(start,id,false)
break
elseif id == math_style_code then
-- has a next
elseif id == math_noad_code then
+-- setattr(start,a_tagged,tags.current())
processsubsup(start)
elseif id == math_box_code or id == hlist_code or id == vlist_code then
-- keep an eye on math_box_code and see what ends up in there
@@ -544,6 +556,7 @@ process = function(start) -- we cannot use the processor as we have no finalizer
stop_tagged()
end
end
+-- showtag(start,id,false)
start = getnext(start)
end
if mtexttag then
@@ -552,8 +565,8 @@ process = function(start) -- we cannot use the processor as we have no finalizer
end
function noads.handlers.tags(head,style,penalties)
- local v_mode = getattr(head,a_mathmode)
- local v_math = start_tagged("math", { mode = v_mode == 1 and "display" or "inline" })
+ start_tagged("math", { mode = (getattr(head,a_mathmode) == 1) and "display" or "inline" })
+-- start_tagged("mrow")
setattr(head,a_tagged,start_tagged("mrow"))
process(head)
stop_tagged()
diff --git a/tex/context/base/mkiv/meta-imp-txt.mkiv b/tex/context/base/mkiv/meta-imp-txt.mkiv
index 2e950d5c8..d4329cd6f 100644
--- a/tex/context/base/mkiv/meta-imp-txt.mkiv
+++ b/tex/context/base/mkiv/meta-imp-txt.mkiv
@@ -370,9 +370,8 @@
[medium]
\startuniqueMPgraphic{EnglishRule}{height,width,color}
- height = \MPvar{height} ;
x1 = 0 ; x3 = \MPvar{width} ; x2 = x4 = .5x3 ;
- y1 = y3 = 0 ; y2 = -y4 = height/2 ;
+ y1 = y3 = 0 ; y2 = -y4 = \MPvar{height}/2 ;
fill z1..z2..z3 & z3..z4..z1 & cycle withcolor \MPvar{color} ;
\stopuniqueMPgraphic
diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua
index b2a4cec69..1dd9b149a 100644
--- a/tex/context/base/mkiv/mult-low.lua
+++ b/tex/context/base/mkiv/mult-low.lua
@@ -254,6 +254,7 @@ return {
"scratchleftskip", "scratchrightskip", "scratchtopskip", "scratchbottomskip",
--
"doif", "doifnot", "doifelse",
+ "firstinset",
"doifinset", "doifnotinset",
"doifelseinset", "doifinsetelse",
"doifelsenextchar", "doifnextcharelse",
diff --git a/tex/context/base/mkiv/mult-sys.mkiv b/tex/context/base/mkiv/mult-sys.mkiv
index 22c14ff9c..fdb2ea732 100644
--- a/tex/context/base/mkiv/mult-sys.mkiv
+++ b/tex/context/base/mkiv/mult-sys.mkiv
@@ -55,6 +55,7 @@
\definesystemconstant {danish} \definesystemconstant {da}
\definesystemconstant {dutch} \definesystemconstant {nl}
\definesystemconstant {english} \definesystemconstant {en}
+\definesystemconstant {estonian} \definesystemconstant {et}
\definesystemconstant {farsi} \definesystemconstant {fa} % just persian
\definesystemconstant {finnish} \definesystemconstant {fi}
\definesystemconstant {french} \definesystemconstant {fr}
diff --git a/tex/context/base/mkiv/node-ser.lua b/tex/context/base/mkiv/node-ser.lua
index 056b52e8d..4f201ca5e 100644
--- a/tex/context/base/mkiv/node-ser.lua
+++ b/tex/context/base/mkiv/node-ser.lua
@@ -9,7 +9,7 @@ if not modules then modules = { } end modules ['node-ser'] = {
-- beware, some field names will change in a next releases
-- of luatex; this is pretty old code that needs an overhaul
-local type = type
+local type, tostring = type, tostring
local concat, tohash, sortedkeys, printtable, serialize = table.concat, table.tohash, table.sortedkeys, table.print, table.serialize
local formatters, format, rep = string.formatters, string.format, string.rep
@@ -28,12 +28,14 @@ local noadcodes = nodes.noadcodes
local getfields = nodes.fields
local tonode = nodes.tonode
+local tonut = nodes.tonut
local hlist_code = nodecodes.hlist
local vlist_code = nodecodes.vlist
----- utfchar = utf.char
local f_char = formatters["%U"]
+local f_attr = formatters["<%i>"]
----- fontchars = { } table.setmetatableindex(fontchars,function(t,k) fontchars = fonts.hashes.characters return fontchars[k] end)
----- f_char = utilities.strings.chkuni -- formatters["%!chkuni!"]
@@ -145,6 +147,7 @@ local function totable(n,flat,verbose,noattributes) -- nicest: n,true,true,true
if ignore[v] then
-- skip
elseif noattributes and v == "attr" then
+ tt[v] = f_attr(tonut(nv))
-- skip
elseif v == "prev" then
tt[v] = "<node>"
diff --git a/tex/context/base/mkiv/node-tra.lua b/tex/context/base/mkiv/node-tra.lua
index 6d6f1a554..bb08e1030 100644
--- a/tex/context/base/mkiv/node-tra.lua
+++ b/tex/context/base/mkiv/node-tra.lua
@@ -99,18 +99,20 @@ function nodes.showlist(head, message)
end
function nodes.handlers.checkglyphs(head,message)
- local h = tonut(head)
+ local h = tonut(head) -- tonut needed?
local t = { }
+ local n = 0
local f = formatters["%U:%s"]
- for g in nextglyph, h do
- t[#t+1] = f(getchar(g),getsubtype(g))
+ for g, font, char in nextglyph, h do
+ n = n + 1
+ t[n] = f(char,getsubtype(g))
end
- if #t > 0 then
- if message and message ~= "" then
- report_nodes("%s, %s glyphs: % t",message,#t,t)
- else
- report_nodes("%s glyphs: % t",#t,t)
- end
+ if n == 0 then
+ -- nothing to report
+ elseif message and message ~= "" then
+ report_nodes("%s, %s glyphs: % t",message,n,t)
+ else
+ report_nodes("%s glyphs: % t",n,t)
end
return false
end
diff --git a/tex/context/base/mkiv/spac-pag.mkiv b/tex/context/base/mkiv/spac-pag.mkiv
index c7d22f0e0..89a5ce36d 100644
--- a/tex/context/base/mkiv/spac-pag.mkiv
+++ b/tex/context/base/mkiv/spac-pag.mkiv
@@ -151,6 +151,7 @@
\unexpanded\def\signalrightpage {\dotrackpagestate \s!paragraph\nofraggedparagraphs} % use \dontleavehmode if needed
\unexpanded\def\doifelserightpage{\doifelserightpagestate\s!paragraph\nofraggedparagraphs}
+\unexpanded\def\rightpageorder {\pagestaterealpageorder\s!paragraph\nofraggedparagraphs}
\let\doifrightpageelse\doifelserightpage
diff --git a/tex/context/base/mkiv/spac-par.mkiv b/tex/context/base/mkiv/spac-par.mkiv
index 3d25fa3ad..0932b7359 100644
--- a/tex/context/base/mkiv/spac-par.mkiv
+++ b/tex/context/base/mkiv/spac-par.mkiv
@@ -221,19 +221,19 @@
\dowithnextboxcs\spac_postponed_data_finish\hbox}
\def\spac_postponed_data_finish
- {\global\setbox\b_spac_postponed_data\hbox % to\zeropoint
+ {\global\setbox\b_spac_postponed_data\hpack % to\zeropoint
{\box\b_spac_postponed_data\box\nextbox}%
\endgroup}
\def\spac_postponed_data_flush
{%\iftrialtypesetting \else
\ifvoid\b_spac_postponed_data\else
- \hbox{\smashedbox\b_spac_postponed_data}% \box\b_spac_postponed_data
+ \hpack{\smashedbox\b_spac_postponed_data}% \box\b_spac_postponed_data
\fi
\glet\flushpostponednodedata\relax
}%\fi}
-\unexpanded\def\doflushatpar
+\unexpanded\def\doflushatpar % might be renamed
{\ifvmode
\expandafter\flushatnextpar
\else
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 980f5d987..f70738a87 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index 7434187b1..efd137fe3 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/strc-lst.mkvi b/tex/context/base/mkiv/strc-lst.mkvi
index 6febd5040..dd4c40ea4 100644
--- a/tex/context/base/mkiv/strc-lst.mkvi
+++ b/tex/context/base/mkiv/strc-lst.mkvi
@@ -468,7 +468,7 @@
\relax}
\def\firststructureelementinlist#list% expandable
- {\clf_firstinset{#list}}
+ {\firstinset{#list}}
\def\structurelistsize
{\clf_listsize}
diff --git a/tex/context/base/mkiv/strc-mat.mkiv b/tex/context/base/mkiv/strc-mat.mkiv
index e04a0cb64..89912d904 100644
--- a/tex/context/base/mkiv/strc-mat.mkiv
+++ b/tex/context/base/mkiv/strc-mat.mkiv
@@ -899,7 +899,7 @@
{\edef\p_option{\formulaparameter\c!option}%
\edef\p_option{\ifx\p_option\empty\else\p_option,\fi#2}}%
\else
- \edef\p_option{\formulaparameter\c!option}
+ \edef\p_option{\formulaparameter\c!option}%
\fi
\ifx\p_option\empty \else
\rawprocesscommacommand[\p_option]\strc_formulas_option
diff --git a/tex/context/base/mkiv/strc-reg.lua b/tex/context/base/mkiv/strc-reg.lua
index d01037a10..28f8cddcd 100644
--- a/tex/context/base/mkiv/strc-reg.lua
+++ b/tex/context/base/mkiv/strc-reg.lua
@@ -82,10 +82,12 @@ local ctx_startregisterpages = context.startregisterpages
local ctx_stopregisterpages = context.stopregisterpages
local ctx_startregisterseewords = context.startregisterseewords
local ctx_stopregisterseewords = context.stopregisterseewords
+
local ctx_registerentry = context.registerentry
local ctx_registerseeword = context.registerseeword
local ctx_registerpagerange = context.registerpagerange
local ctx_registeronepage = context.registeronepage
+
local ctx_registerpacked = context.registerpacked
-- possible export, but ugly code (overloads)
@@ -517,6 +519,7 @@ local function storeregister(rawdata) -- metadata, references, entries
metadata.kind = "entry"
end
--
+ --
if not metadata.catcodes then
metadata.catcodes = tex.catcodetable -- get
end
@@ -915,8 +918,46 @@ function registers.finalize(data,options) -- maps character to index (order)
data.result = split
end
+-- local function analyzeregister(class,options)
+-- local data = collected[class]
+-- if data and data.entries then
+-- options = options or { }
+-- sorters.setlanguage(options.language,options.method,options.numberorder)
+-- registers.filter(data,options) -- filter entries into results (criteria)
+-- registers.prepare(data,options) -- adds split table parallel to list table
+-- registers.sort(data,options) -- sorts results
+-- registers.unique(data,options) -- get rid of duplicates
+-- registers.finalize(data,options) -- split result in ranges
+-- data.metadata.sorted = true
+-- return data.metadata.nofsorted or 0
+-- else
+-- return 0
+-- end
+-- end
+
local function analyzeregister(class,options)
- local data = collected[class]
+ local data = rawget(collected,class)
+ if not data then
+ local list = utilities.parsers.settings_to_array(class)
+ local entries = { }
+ local metadata = false
+ for i=1,#list do
+ local l = list[i]
+ local d = collected[l]
+ local e = d.entries
+ for i=1,#e do
+ entries[#entries+1] = e[i]
+ end
+ if not metadata then
+ metadata = d.metadata
+ end
+ end
+ data = {
+ metadata = metadata or { },
+ entries = entries,
+ }
+ collected[class] = data
+ end
if data and data.entries then
options = options or { }
sorters.setlanguage(options.language,options.method,options.numberorder)
@@ -968,6 +1009,7 @@ implement {
local function pagerange(f_entry,t_entry,is_last,prefixspec,pagespec)
local fer, ter = f_entry.references, t_entry.references
ctx_registerpagerange(
+ f_entry.metadata.name or "",
f_entry.processors and f_entry.processors[2] or "",
fer.internal or 0,
fer.realpage or 0,
@@ -989,6 +1031,7 @@ end
local function pagenumber(entry,prefixspec,pagespec)
local er = entry.references
ctx_registeronepage(
+ entry.metadata.name or "",
entry.processors and entry.processors[2] or "",
er.internal or 0,
er.realpage or 0,
@@ -1180,10 +1223,10 @@ function registers.flush(data,options,prefixspec,pagespec)
ctx_startregisterentry(0) -- will become a counter
started = true
if metadata then
- ctx_registerentry(processor,internal,seeparent,function() h_title(e[i],metadata) end)
+ ctx_registerentry(metadata.name or "",processor,internal,seeparent,function() h_title(e[i],metadata) end)
else
-- can this happen?
- ctx_registerentry(processor,internal,seeindex,e[i])
+ ctx_registerentry("",processor,internal,seeindex,e[i])
end
end
end
@@ -1323,7 +1366,7 @@ function registers.flush(data,options,prefixspec,pagespec)
local seetext = seeword.text or ""
local processor = seeword.processor or (entry.processors and entry.processors[1]) or ""
local seeindex = entry.references.seeindex or ""
- ctx_registerseeword(i,nt,processor,0,seeindex,function() h_title(seetext,metadata) end)
+ ctx_registerseeword(metadata.name or "",i,nt,processor,0,seeindex,function() h_title(seetext,metadata) end)
end
end
diff --git a/tex/context/base/mkiv/strc-reg.mkiv b/tex/context/base/mkiv/strc-reg.mkiv
index f00021170..21779f479 100644
--- a/tex/context/base/mkiv/strc-reg.mkiv
+++ b/tex/context/base/mkiv/strc-reg.mkiv
@@ -353,16 +353,46 @@
\unexpanded\def\strc_registers_insert_entry[#1][#2]%
{\def\currentregister{#1}%
- \doifelse{\registerparameter\c!ownnumber}\v!yes
- \strc_registers_insert_entry_yes
- \strc_registers_insert_entry_nop
- {#2}}
+ \edef\p_ownnumber{\registerparameter\c!ownnumber}%
+ \ifx\p_ownnumber\v!yes
+ \expandafter\strc_registers_insert_entry_yes
+ \else
+ \expandafter\strc_registers_insert_entry_nop
+ \fi{#2}}
+
+% \def\strc_registers_insert_entry_nop#1#2%
+% {\doflushatpar{\strc_registers_register_page_entry\currentregister{\c!keys={#1},\c!entries={#2}}{}}}
+%
+% \def\strc_registers_insert_entry_yes#1#2#3%
+% {\doflushatpar{\strc_registers_register_page_entry\currentregister{\c!keys={#1},\c!alternative=#2,\c!entries={#3}}{}}}
+%
+% less tokens passed (nicer for tracing) .. could become installable
+
+\def\strc_registers_insert_entry_nop
+ {\ifvmode
+ \expandafter\strc_registers_insert_entry_nop_par
+ \else
+ \expandafter\strc_registers_insert_entry_nop_txt
+ \fi}
+
+\def\strc_registers_insert_entry_yes
+ {\ifvmode
+ \expandafter\strc_registers_insert_entry_yes_par
+ \else
+ \expandafter\strc_registers_insert_entry_yes_txt
+ \fi}
-\def\strc_registers_insert_entry_nop#1#2%
- {\doflushatpar{\strc_registers_register_page_entry\currentregister{\c!keys={#1},\c!entries={#2}}{}}}
+\def\strc_registers_insert_entry_nop_par#1#2%
+ {\flushatnextpar{\strc_registers_register_page_entry\currentregister{\c!keys={#1},\c!entries={#2}}{}}}
-\def\strc_registers_insert_entry_yes#1#2#3%
- {\doflushatpar{\strc_registers_register_page_entry\currentregister{\c!keys={#1},\c!alternative=#2,\c!entries={#3}}{}}}
+\def\strc_registers_insert_entry_yes_par#1#2#3%
+ {\flushatnextpar{\strc_registers_register_page_entry\currentregister{\c!keys={#1},\c!alternative=#2,\c!entries={#3}}{}}}
+
+\def\strc_registers_insert_entry_nop_txt#1#2%
+ {\strc_registers_register_page_entry\currentregister{\c!keys={#1},\c!entries={#2}}{}}
+
+\def\strc_registers_insert_entry_yes_txt#1#2#3%
+ {\strc_registers_register_page_entry\currentregister{\c!keys={#1},\c!alternative=#2,\c!entries={#3}}{}}
\unexpanded\def\startregister{\doquadrupleempty\strc_registers_start_entry}
\unexpanded\def\stopregister {\dodoubleargument\strc_registers_stop_entry}
@@ -545,8 +575,8 @@
\def\strc_registers_determine_characteristics[#1][#2]%
{\begingroup
- \edef\currentregister{#1}%
- \setupregister[\currentregister][#2]%
+ \setupregister[#1][#2]%
+ \edef\currentregister{\firstinset{#1}}%
\normalexpanded{\endgroup\noexpand\xdef\noexpand\utilityregisterlength{\clf_analyzeregister
{\currentregister}%
{%
@@ -570,6 +600,8 @@
\dontcomplain
\to \everyplaceregister
+\newconditional\c_strc_registers_text_interaction
+
\unexpanded\def\placeregister
{\dodoubleempty\strc_registers_place}
@@ -577,26 +609,24 @@
{\iffirstargument
\begingroup
%\forgetall
- \edef\currentregister{#1}%
- \setupregister[\currentregister][#2]%
+ \setupregister[#1][#2]% can be a list
+ \edef\currentregister{\firstinset{#1}}%
\the\everyplaceregister
\ifnum\namedmixedcolumnsparameter\currentregister\c!n>\plusone
\startmixedcolumns[\currentregister]
- \strc_registers_place_indeed
+ \strc_registers_place_indeed{#1}%
\stopmixedcolumns
\else
- \strc_registers_place_indeed
+ \strc_registers_place_indeed{#1}%
\fi
\endgroup
\fi}
-\newconditional\c_strc_registers_text_interaction
-
-\def\strc_registers_place_indeed
+\def\strc_registers_place_indeed#1%
{\doifelse{\registerparameter\c!interaction}\v!text
\settrue\setfalse\c_strc_registers_text_interaction
\clf_processregister
- {\currentregister}%
+ {#1}%
{%
language {\registerparameter\s!language}%
method {\registerparameter\c!method}%
@@ -641,9 +671,9 @@
\def\strc_registers_complete[#1][#2]%
{\iffirstargument
\begingroup
- \edef\currentregister{#1}%
+ \edef\currentregister{\firstinset{#1}}%
\normalexpanded{\startnamedsection[\v!chapter][\c!title={\headtext{\currentregister}},reference=\currentregister]}%
- \placeregister[\currentregister][#2]%
+ \placeregister[#1][#2]%
\page[\v!yes]%
\stopnamedsection
\endgroup
@@ -890,39 +920,58 @@
\fi
\fi}
-\unexpanded\def\registeronepage#1#2#3#4% #1:processor content
- {\registerpageseparator
- \global\setconstant\c_strc_registers_page_state\plusone
- \dostarttagged\t!registerpage\empty
- \withregisterpagecommand{#1}{#2}{#3}{#4}%
- \dostoptagged}
+\unexpanded\def\pushcurrentregister#1%
+ {\let\m_current_register\currentregister
+ \edef\currentregister{#1}}
-\unexpanded\def\registerpagerange#1#2#3#4#5#6#7% #1:processor content, content todo: -- configurable
- {\registerpageseparator
- \global\setconstant\c_strc_registers_page_state\plusone
- \dostarttagged\t!registerpagerange\empty
- \dostarttagged\t!registerfrompage\empty
- \withregisterpagecommand{#1}{#2}{#3}{#4}%
- \dostoptagged
- \registeronepagerangeseparator
- \dostarttagged\t!registertopage\empty
- \withregisterpagecommand{#1}{#5}{#6}{#7}%
- \dostoptagged
- \dostoptagged}
+\unexpanded\def\popcurrentregister
+ {\let\currentregister\m_current_register}
+
+\unexpanded\def\registeronepage#1#2#3#4#5% #1:class #2:processor content
+ {\pushcurrentregister{#1}%
+ \edef\p_pagenumber{\registerparameter\c!pagenumber}%
+ \ifx\p_pagenumber\v!no\else
+ \registerpageseparator
+ \global\setconstant\c_strc_registers_page_state\plusone
+ \dostarttagged\t!registerpage\empty
+ \withregisterpagecommand{#2}{#3}{#4}{#5}%
+ \dostoptagged
+ \fi
+ \popcurrentregister}
+
+\unexpanded\def\registerpagerange#1#2#3#4#5#6#7#8% #1:class #2:processor content, content todo: -- configurable
+ {\pushcurrentregister{#1}%
+ \edef\p_pagenumber{\registerparameter\c!pagenumber}%
+ \ifx\p_pagenumber\v!no\else
+ \registerpageseparator
+ \global\setconstant\c_strc_registers_page_state\plusone
+ \dostarttagged\t!registerpagerange\empty
+ \dostarttagged\t!registerfrompage\empty
+ \withregisterpagecommand{#2}{#3}{#4}{#5}%
+ \dostoptagged
+ \registeronepagerangeseparator
+ \dostarttagged\t!registertopage\empty
+ \withregisterpagecommand{#2}{#6}{#7}{#8}%
+ \dostoptagged
+ \dostoptagged
+ \fi
+ \popcurrentregister}
-\unexpanded\def\defaultregisterentry#1#2#3#4% #1:processor #2:internal #3:seeindex #4:word
- {\def\currentregisterpageindex{#2}%
+\unexpanded\def\defaultregisterentry#1#2#3#4#5% #1:class #2:processor #3:internal #4:seeindex #5:word
+ {\pushcurrentregister{#1}%
+ \def\currentregisterpageindex{#3}%
\iflocation
- \def\currentregisterseeindex{#3}%
+ \def\currentregisterseeindex{#4}%
\ifconditional\c_strc_registers_text_interaction
- \strc_references_goto_internal{\setlocationcolor\doapplyregisterentrycommand{#1}{#4}}[internal(#2)]%
+ \strc_references_goto_internal{\setlocationcolor\doapplyregisterentrycommand{#2}{#5}}[internal(#3)]%
\else
- \doapplyregisterentrycommand{#1}{#4}%
+ \doapplyregisterentrycommand{#2}{#5}%
\fi
\else
\let\currentregisterseeindex\empty
- \doapplyregisterentrycommand{#1}{#4}%
- \fi}
+ \doapplyregisterentrycommand{#2}{#5}%
+ \fi
+ \popcurrentregister}
\unexpanded\def\doapplyregisterentrycommand#1#2% processor text
{\dostarttagged\t!registercontent\empty
@@ -942,27 +991,29 @@
\applyprocessor{#1}{#2}%
\fi\fi}
-\unexpanded\def\defaultregisterseeword#1#2#3#4#5#6% i n #3:processor #4:internal #5:seeindex #6:word
- {\ifnum#1=\plusone
+\unexpanded\def\defaultregisterseeword#1#2#3#4#5#6#7% class i n #3:processor #4:internal #5:seeindex #6:word
+ {\pushcurrentregister{#1}%
+ \ifnum#2=\plusone
\registerpageseparator
\fi
\global\setconstant\c_strc_registers_page_state\plustwo
- \def\currentregisterpageindex{#4}%
+ \def\currentregisterpageindex{#5}%
\dostarttagged\t!registersee\empty
\settrue\c_strc_registers_page_done
\iflocation
- \def\currentregisterseeindex{#5}%
+ \def\currentregisterseeindex{#6}%
\else
\let\currentregisterseeindex\empty
\fi
- \ifnum#1=\plusone
- \labeltexts\v!see{\doapplyregisterseecommand{#3}{#6}}%
- \else\ifnum#1=#2\relax
- \labeltexts\v!and{\doapplyregisterseecommand{#3}{#6}}%
+ \ifnum#2=\plusone
+ \labeltexts\v!see{\doapplyregisterseecommand{#4}{#7}}%
+ \else\ifnum#2=#3\relax
+ \labeltexts\v!and{\doapplyregisterseecommand{#4}{#7}}%
\else
- ,\space\doapplyregisterseecommand{#3}{#6}%
+ ,\space\doapplyregisterseecommand{#4}{#7}%
\fi\fi
- \dostoptagged}
+ \dostoptagged
+ \popcurrentregister}
\let\registerseeword \defaultregisterseeword
\let\registerentry \defaultregisterentry
@@ -1002,18 +1053,18 @@
\setvalue{\??registersymbol\v!none}%
{\let\registerpageseparatorsymbol\empty
- \let\registeronepage \gobblefourarguments
- \let\registerpagerange \gobblesevenarguments}
+ \let\registeronepage \gobblefivearguments
+ \let\registerpagerange\gobbleeightarguments}
\setvalue{\??registersymbol 1}%
{\let\registerpageseparatorsymbol\space
- \def\registeronepage {\symbol[1]\gobblefourarguments}%
- \def\registerpagerange{\symbol[1]\gobblesevenarguments}}
+ \def\registeronepage {\symbol[1]\gobblefivearguments}%
+ \def\registerpagerange{\symbol[1]\gobbleeightarguments}}
\setvalue{\??registersymbol 2}%
{\let\registerpageseparatorsymbol\space
- \def\registeronepage {\registerpagebuttonsymbol\gobblefourarguments}%
- \def\registerpagerange{\registerpagebuttonsymbol\gobblesevenarguments}}
+ \def\registeronepage {\registerpagebuttonsymbol\gobblefivearguments}%
+ \def\registerpagerange{\registerpagebuttonsymbol\gobbleeightarguments}}
\unexpanded\def\setregisterpagerendering
{\doifelse{\registerparameter\c!pagenumber}\v!no
@@ -1025,8 +1076,8 @@
\csname\??registersymbol\currentregisterpagesymbol\endcsname
\else
\let\registerpageseparatorsymbol\space
- \def\registeronepage{\registerparameter\c!symbol\gobblefourarguments}%
- \def\registerpagerange{\registerparameter\c!symbol\gobblesevenarguments}%
+ \def\registeronepage {\registerparameter\c!symbol\gobblefivearguments}%
+ \def\registerpagerange{\registerparameter\c!symbol\gobbleeightarguments}%
\fi\fi}
\appendtoks
diff --git a/tex/context/base/mkiv/strc-tag.lua b/tex/context/base/mkiv/strc-tag.lua
index bcd7f49ca..6ee7a9cff 100644
--- a/tex/context/base/mkiv/strc-tag.lua
+++ b/tex/context/base/mkiv/strc-tag.lua
@@ -15,7 +15,6 @@ local type, next = type, next
local insert, remove, unpack, concat, merge = table.insert, table.remove, table.unpack, table.concat, table.merge
local find, topattern, format = string.find, string.topattern, string.format
local lpegmatch, P, S, C, Cc = lpeg.match, lpeg.P, lpeg.S, lpeg.C, lpeg.Cc
-local texattribute = tex.attribute
local allocate = utilities.storage.allocate
local settings_to_hash = utilities.parsers.settings_to_hash
local setmetatableindex = table.setmetatableindex
@@ -24,35 +23,45 @@ local trace_tags = false trackers.register("structures.tags", function(v) trace
local report_tags = logs.reporter("structure","tags")
-local attributes = attributes
-local structures = structures
-local implement = interfaces.implement
-
-local a_tagged = attributes.private('tagged')
-
-local unsetvalue = attributes.unsetvalue
-local codeinjections = backends.codeinjections
-
-local taglist = allocate() -- access by attribute
-local specifications = allocate() -- access by fulltag
-local labels = allocate()
-local stack = { }
-local chain = { }
-local ids = { }
-local enabled = false
-local tagcontext = { }
-local tagpatterns = { }
-local lasttags = { }
-local stacksize = 0
-local metadata = nil -- applied to the next element
-local documentdata = { }
-local extradata = false
-
-local tags = structures.tags
-tags.taglist = taglist -- can best be hidden
-tags.labels = labels
-tags.patterns = tagpatterns
-tags.specifications = specifications
+local attributes = attributes
+local structures = structures
+local implement = interfaces.implement
+
+local a_tagged = attributes.private('tagged')
+
+local unsetvalue = attributes.unsetvalue
+local codeinjections = backends.codeinjections
+
+local texgetattribute = tex.getattribute
+local texsetattribute = tex.setattribute
+
+local taglist = allocate() -- access by attribute
+local specifications = allocate() -- access by fulltag
+local labels = allocate()
+local stack = { }
+local chain = { }
+local ids = { }
+local enabled = false
+local tagcontext = { }
+local tagpatterns = { }
+local lasttags = { }
+local stacksize = 0
+local metadata = nil -- applied to the next element
+local documentdata = { }
+local extradata = false
+
+local tags = structures.tags
+tags.taglist = taglist -- can best be hidden
+tags.labels = labels
+tags.patterns = tagpatterns
+tags.specifications = specifications
+
+
+function tags.current()
+ if stacksize > 0 then
+ return stack[stacksize] -- maybe copy or proxy
+ end
+end
-- Tags are internally stored as:
--
@@ -227,7 +236,7 @@ local patterns = setmetatableindex(function(t,tag)
end)
function tags.locatedtag(tag)
- local attribute = texattribute[a_tagged]
+ local attribute = texgetattribute(a_tagged)
if attribute >= 0 then
local specification = taglist[attribute]
if specification then
@@ -247,7 +256,7 @@ function tags.locatedtag(tag)
end
function structures.atlocation(str)
- local specification = taglist[texattribute[a_tagged]]
+ local specification = taglist[texgetattribute(a_tagged)]
if specification then
if list then
local taglist = specification.taglist
@@ -375,7 +384,7 @@ function tags.start(tag,specification)
specification.metadata = documentdata
end
--
- texattribute[a_tagged] = attribute
+ texsetattribute(a_tagged,attribute)
return attribute
end
@@ -390,7 +399,7 @@ function tags.restart(attribute)
taglist[attribute] = { taglist = { unpack(chain,1,stacksize) } }
end
stack[stacksize] = attribute
- texattribute[a_tagged] = attribute
+ texsetattribute(a_tagged,attribute)
return attribute
end
@@ -405,7 +414,7 @@ function tags.stop()
-- end
t = unsetvalue
end
- texattribute[a_tagged] = t
+ texsetattribute(a_tagged,t)
return t
end
diff --git a/tex/context/base/mkiv/syst-aux.lua b/tex/context/base/mkiv/syst-aux.lua
index 27f194b0a..5072879fa 100644
--- a/tex/context/base/mkiv/syst-aux.lua
+++ b/tex/context/base/mkiv/syst-aux.lua
@@ -621,6 +621,20 @@ implement {
arguments = "2 strings",
}
+-- done elsewhere:
+--
+-- local function firstinset(a)
+-- local aa = hash[a]
+-- context(aa and aa[1] or a)
+-- end
+--
+-- implement {
+-- name = "firstinset",
+-- actions = firstinset,
+-- arguments = "string",
+-- private = false,
+-- }
+
-- implement {
-- name = "stringcompare",
-- arguments = "2 strings",
diff --git a/tex/context/base/mkiv/syst-aux.mkiv b/tex/context/base/mkiv/syst-aux.mkiv
index faed87f2b..6ba3e0e66 100644
--- a/tex/context/base/mkiv/syst-aux.mkiv
+++ b/tex/context/base/mkiv/syst-aux.mkiv
@@ -965,6 +965,7 @@
\unexpanded\def\doifelseinset#1#2{\clf_doifelseinset{#1}{#2}}
\unexpanded\def\doifinset #1#2{\clf_doifinset {#1}{#2}}
\unexpanded\def\doifnotinset #1#2{\clf_doifnotinset {#1}{#2}}
+ % \let\firstinset \clf_firstinset
\let\doifinsetelse\doifelseinset
@@ -1401,7 +1402,7 @@
%D
%D Sometimes the action to be undertaken depends on the
%D next character. This macro get this character and puts it in
-%D \type{\firstcharacter}.
+%D \type {\firstcharacter}.
%D
%D \starttyping
%D \getfirstcharacter {string}
diff --git a/tex/context/base/mkiv/syst-lua.lua b/tex/context/base/mkiv/syst-lua.lua
index a8e9e1b01..a63c49e8f 100644
--- a/tex/context/base/mkiv/syst-lua.lua
+++ b/tex/context/base/mkiv/syst-lua.lua
@@ -105,7 +105,8 @@ local p_first = C((1-P(",")-P(-1))^0)
implement {
name = "firstinset",
arguments = "string",
- actions = function(str) context(lpegmatch(p_first,str or "")) end
+ actions = function(str) context(lpegmatch(p_first,str or "")) end,
+ public = true,
}
implement {
diff --git a/tex/context/base/mkiv/tabl-tbl.mkiv b/tex/context/base/mkiv/tabl-tbl.mkiv
index e274b7185..97a4f63c0 100644
--- a/tex/context/base/mkiv/tabl-tbl.mkiv
+++ b/tex/context/base/mkiv/tabl-tbl.mkiv
@@ -1744,8 +1744,8 @@
{\begingroup
\scratchcounter\numexpr\c_tabl_tabulate_column-\plusone\relax % ugly !
\ifcsname\??tabulatecolor\the\scratchcounter\endcsname
- %\hbox \thealignbackgroundcolorattr{\csname\??tabulatecolor\the\scratchcounter\endcsname}{}% pack ?
- \hpack \thealignbackgroundcolorattr{\lastnamedcs}{}% pack ?
+ % \hbox \thealignbackgroundcolorattr{\csname\??tabulatecolor\the\scratchcounter\endcsname}{}% pack ?
+ \hpack \expandafter\thealignbackgroundcolorattr\expandafter{\lastnamedcs}{}% pack ?
\fi
\endgroup}
diff --git a/tex/context/base/mkiv/tabl-xtb.mkvi b/tex/context/base/mkiv/tabl-xtb.mkvi
index dc4a30e2b..0f8c4f214 100644
--- a/tex/context/base/mkiv/tabl-xtb.mkvi
+++ b/tex/context/base/mkiv/tabl-xtb.mkvi
@@ -102,6 +102,10 @@
\newcount\c_tabl_x_nesting
\newcount\c_tabl_x_skip_mode % 1 = skip
\newdimen\d_tabl_x_textwidth
+\newcount\c_tabl_x_swapped
+\newcount\c_tabl_x_swapped_max
+
+\let\m_tabl_x_swapped_settings\empty
\let\currentxtablerow \clf_x_table_r
\let\currentxtablecolumn\clf_x_table_c
@@ -112,6 +116,7 @@
\installcorenamespace{xtable}
\installcorenamespace{xtablecheck}
+\installcorenamespace{xtableswap}
\installframedautocommandhandler \??xtable {xtable} \??xtable
@@ -296,6 +301,7 @@
% not so nice but needed as we use this in the setup
\linewidth\xtableparameter\c!rulethickness\relax
% so we freeze it
+ \c_tabl_x_swapped_max\zerocount
\begingroup
\let\tabl_x_start_row_yes \tabl_x_start_row_reflow_width_yes
\let\tabl_x_start_row_nop \tabl_x_start_row_reflow_width_nop
@@ -305,6 +311,10 @@
\let\tabl_x_stop_cell \tabl_x_stop_cell_reflow_width
\settrialtypesetting
\tabl_x_get_buffer
+ \ifcase\c_tabl_x_swapped_max
+ \else
+ \tabl_x_flush_swapped
+ \fi
\clf_x_table_reflow_width
\endgroup
\begingroup
@@ -315,7 +325,11 @@
\let\tabl_x_start_cell_nop\tabl_x_start_cell_reflow_height_nop
\let\tabl_x_stop_cell \tabl_x_stop_cell_reflow_height
\settrialtypesetting
- \tabl_x_get_buffer
+ \ifcase\c_tabl_x_swapped_max
+ \tabl_x_get_buffer
+ \else
+ \tabl_x_flush_swapped
+ \fi
\clf_x_table_reflow_height
\endgroup
\begingroup
@@ -325,7 +339,11 @@
\let\tabl_x_start_cell_yes\tabl_x_start_cell_construct_yes
\let\tabl_x_start_cell_nop\tabl_x_start_cell_construct_nop
\let\tabl_x_stop_cell \tabl_x_stop_cell_construct
- \tabl_x_get_buffer
+ \ifcase\c_tabl_x_swapped_max
+ \tabl_x_get_buffer
+ \else
+ \tabl_x_flush_swapped
+ \fi
\clf_x_table_construct
\endgroup
\endgroup % *
@@ -477,10 +495,6 @@
\unexpanded\def\stopxcell
{\tabl_x_stop_cell}
-\unexpanded\def\dummyxcell#1%
- {\tabl_x_start_cell_nop
- \tabl_x_stop_cell}
-
\unexpanded\def\dummyxcell
{\tabl_x_start_cell_nop
\tabl_x_stop_cell}
@@ -879,4 +893,95 @@
\let\NR\tabl_x_nr
\to \everypreparextable
+%D Another bonus, suggested by Taco at the 2018 \CONTEXT\ meeting.
+
+\unexpanded\def\tabl_x_c_cell_start#settings%
+ {\begingroup
+ \tabl_x_set_checked{#settings}%
+ \doifelsenextoptionalcs\tabl_x_start_cell_yes\tabl_x_start_cell_nop}
+
+\unexpanded\def\tabl_x_c_cell_stop
+ {\tabl_x_stop_cell
+ \endgroup}
+
+% \unexpanded\def\dummyxcell
+% {\tabl_x_start_cell_nop
+% \tabl_x_stop_cell}
+
+\def\tabl_x_flush_swapped
+ {\dorecurse\c_tabl_x_swapped
+ {\expandafter
+ \startxrow
+ \the\csname\??xtableswap##1\endcsname\relax
+ \stopxrow}}
+
+\def\tabl_x_collect_allocate
+ {\expandafter\newtoks\csname\??xtableswap\number\c_tabl_x_swapped\endcsname
+ \expandafter\let\expandafter\t_tabl_x_swapped\csname\??xtableswap\number\c_tabl_x_swapped\endcsname}
+
+\unexpanded\def\tabl_x_collect_cell_start#content\stopxcell
+ {\global\advance\c_tabl_x_swapped\plusone
+ \ifnum\c_tabl_x_swapped>\c_tabl_x_swapped_max
+ \global\c_tabl_x_swapped_max\c_tabl_x_swapped
+ \fi
+ \expandafter\let\expandafter\t_tabl_x_swapped\csname\??xtableswap\number\c_tabl_x_swapped\endcsname
+ \ifx\t_tabl_x_swapped\relax
+ \tabl_x_collect_allocate
+ \fi
+ \ifx\m_tabl_x_swapped_settings\empty
+ \gtoksapp\t_tabl_x_swapped{\tabl_x_c_cell_start#content\tabl_x_c_cell_stop}
+ \else
+ \gtoksapp\t_tabl_x_swapped\expandafter{\expandafter\tabl_x_c_cell_start\expandafter{\m_tabl_x_swapped_settings}#content\tabl_x_c_cell_stop}%
+ \fi}
+
+\unexpanded\def\startxcolumn % todo: arguments
+ {\begingroup
+ \global\c_tabl_x_swapped\zerocount
+ \let\startxcell\tabl_x_collect_cell_start
+ \let\stopxcell \relax
+ \doifelsenextoptionalcs\tabl_x_start_column_yes\relax}
+
+\def\tabl_x_start_column_yes[#1]%
+ {\xdef\m_tabl_x_swapped_settings{#1}}
+
+\unexpanded\def\stopxcolumn
+ {\endgroup}
+
+%D \stopbuffer
+%D \setupxtable[one][foregroundcolor=red]
+%D \setupxtable[two][foregroundcolor=blue]
+%D
+%D \startlinecorrection
+%D \startxtable
+%D \startxrow[one]
+%D \startxcell[width=5cm] Row 1, Column 1 \stopxcell
+%D \startxcell Row 1, Column 2 \stopxcell
+%D \startxcell Row 1, Column 3 \stopxcell
+%D \stopxrow
+%D \startxrow[two]
+%D \startxcell Row 2, Column 1 \stopxcell
+%D \startxcell Row 2, Column 2 \stopxcell
+%D \startxcell Row 2, Column 3 \stopxcell
+%D \stopxrow
+%D \stopxtable
+%D \stoplinecorrection
+%D
+%D \startlinecorrection
+%D \startxtable
+%D \startxcolumn[one]
+%D \startxcell[width=5cm] Row 1, Column 1 \stopxcell
+%D \startxcell Row 1, Column 2 \stopxcell
+%D \startxcell Row 1, Column 3 \stopxcell
+%D \stopxcolumn
+%D \startxcolumn[two]
+%D \startxcell Row 2, Column 1 \stopxcell
+%D \startxcell Row 2, Column 2 \stopxcell
+%D \startxcell Row 2, Column 3 \stopxcell
+%D \stopxcolumn
+%D \stopxtable
+%D \stoplinecorrection
+%D \stopbuffer
+%D
+%D \typebuffer \getbuffer
+
\protect \endinput
diff --git a/tex/context/base/mkiv/util-soc-imp-smtp.lua b/tex/context/base/mkiv/util-soc-imp-smtp.lua
index 62c05700b..621d1b6e3 100644
--- a/tex/context/base/mkiv/util-soc-imp-smtp.lua
+++ b/tex/context/base/mkiv/util-soc-imp-smtp.lua
@@ -3,7 +3,7 @@
local type, setmetatable, next = type, setmetatable, next
local find, lower, format = string.find, string.lower, string.format
-local osdate, osgetenv = os.data, os.getenv
+local osdate, osgetenv = os.date, os.getenv
local random = math.random
local socket = socket or require("socket")
@@ -254,7 +254,7 @@ function smtp.message(message)
end
smtp.send = protectsocket(function(mail)
- local snd = opensmtp(mail.server, mail.port, mail.create)
+ local snd = opensmtp(smtp,mail.server, mail.port, mail.create)
local ext = snd:greet(mail.domain)
snd:auth(mail.user, mail.password, ext)
snd:send(mail)
diff --git a/tex/context/base/mkiv/util-soc-imp-tp.lua b/tex/context/base/mkiv/util-soc-imp-tp.lua
index e2dbad402..e651e44f7 100644
--- a/tex/context/base/mkiv/util-soc-imp-tp.lua
+++ b/tex/context/base/mkiv/util-soc-imp-tp.lua
@@ -2,7 +2,7 @@
-- for more into : see util-soc.lua
local setmetatable, next, type, tonumber = setmetatable, next, type, tonumber
-local find, upper = string.find, string,upper
+local find, upper = string.find, string.upper
local socket = socket or require("socket")
local ltn12 = ltn12 or require("ltn12")