summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2009-09-09 14:31:00 +0200
committerHans Hagen <pragma@wxs.nl>2009-09-09 14:31:00 +0200
commit8683bfc5e51de9f4436c7deebd9517c9f2779f0a (patch)
tree3031e2270b20777bba40f54fdb7e5129323a5f06
parentc6e9f914fe93f3f674c20fded71bf7e18b8df600 (diff)
downloadcontext-8683bfc5e51de9f4436c7deebd9517c9f2779f0a.tar.gz
beta 2009.09.09 14:31
-rw-r--r--scripts/context/lua/mtx-server-ctx-help.lua4
-rw-r--r--tex/context/base/bibl-tra.mkiv2
-rw-r--r--tex/context/base/cont-new.tex2
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/core-con.lua54
-rw-r--r--tex/context/base/core-fnt.mkiv6
-rw-r--r--tex/context/base/core-spa.mkii12
-rw-r--r--tex/context/base/grph-trf.mkii4
-rw-r--r--tex/context/base/grph-trf.mkiv6
-rw-r--r--tex/context/base/l-xml.lua2
-rw-r--r--tex/context/base/lxml-ini.mkiv2
-rw-r--r--tex/context/base/lxml-tab.lua3
-rw-r--r--tex/context/base/math-for.mkiv2
-rw-r--r--tex/context/base/math-ini.mkiv55
-rw-r--r--tex/context/base/math-map.lua68
-rw-r--r--tex/context/base/math-noa.lua69
-rw-r--r--tex/context/base/mult-def.lua8
-rw-r--r--tex/context/base/mult-en.tex4
-rw-r--r--tex/context/base/mult-nl.tex4
-rw-r--r--tex/context/base/mult-sys.tex1
-rw-r--r--tex/context/base/pack-box.mkiv5
-rw-r--r--tex/context/base/pack-obj.mkiv4
-rw-r--r--tex/context/base/page-ini.mkii2
-rw-r--r--tex/context/base/page-ini.mkiv14
-rw-r--r--tex/context/base/page-one.mkiv2
-rw-r--r--tex/context/base/page-sid.mkiv2
-rw-r--r--tex/context/base/s-inf-01.tex203
-rw-r--r--tex/context/base/strc-doc.lua19
-rw-r--r--tex/context/base/strc-flt.mkiv66
-rw-r--r--tex/context/base/strc-ini.lua12
-rw-r--r--tex/context/base/strc-lst.lua2
-rw-r--r--tex/context/base/strc-mat.mkiv28
-rw-r--r--tex/context/base/strc-num.lua90
-rw-r--r--tex/context/base/strc-num.mkiv11
-rw-r--r--tex/context/base/strc-pag.lua89
-rw-r--r--tex/context/base/strc-pag.mkiv38
-rw-r--r--tex/context/base/strc-ref.lua8
-rw-r--r--tex/context/base/strc-ref.mkiv6
-rw-r--r--tex/context/base/strc-reg.lua1
-rw-r--r--tex/context/base/strc-reg.mkiv11
-rw-r--r--tex/context/base/strc-sbe.mkiv3
-rw-r--r--tex/context/base/strc-sec.mkiv4
-rw-r--r--tex/context/base/supp-num.tex23
-rw-r--r--tex/context/base/syst-aux.mkiv2
-rw-r--r--tex/context/base/tabl-tab.mkiv8
-rw-r--r--tex/context/base/tabl-tsp.mkiv4
-rw-r--r--tex/context/base/x-ldx.tex9
-rw-r--r--tex/context/interface/keys-en.xml4
-rw-r--r--tex/context/interface/keys-nl.xml4
-rw-r--r--tex/generic/context/luatex-fonts-merged.lua2
50 files changed, 703 insertions, 283 deletions
diff --git a/scripts/context/lua/mtx-server-ctx-help.lua b/scripts/context/lua/mtx-server-ctx-help.lua
index c53d9f6e0..c06f3cec4 100644
--- a/scripts/context/lua/mtx-server-ctx-help.lua
+++ b/scripts/context/lua/mtx-server-ctx-help.lua
@@ -298,7 +298,7 @@ local function translate(tag,int,noformat)
if noformat then
return ti[tag] or te[tag] or tag
else
- return document.setups.formats.special:format(ti[tag] or te[tag] or tag)
+ return format(document.setups.formats.special,ti[tag] or te[tag] or tag)
end
end
@@ -307,7 +307,7 @@ local function translated(e,int)
local s = attributes.type or "?"
local tag = s:match("^cd:(.*)$")
if attributes.default == "yes" then
- return document.setups.formats.default:format(tag)
+ return format(document.setups.formats.default,tag or "?")
elseif tag then
return translate(tag,int)
else
diff --git a/tex/context/base/bibl-tra.mkiv b/tex/context/base/bibl-tra.mkiv
index 84e8bf44c..2be7f47bf 100644
--- a/tex/context/base/bibl-tra.mkiv
+++ b/tex/context/base/bibl-tra.mkiv
@@ -185,7 +185,7 @@
\setuplist
[pubs]
- [\c!state=\s!start,
+ [\c!state=\v!start,
\c!width=]
\installstructurelistprocessor{pubs:userdata}%
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 2c4dba4bb..10c71dd06 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.08.30 12:25}
+\newcontextversion{2009.09.09 14:31}
%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 c4c4523a9..05612a3e0 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.08.30 12:25}
+\edef\contextversion{2009.09.09 14:31}
%D For those who want to use this:
diff --git a/tex/context/base/core-con.lua b/tex/context/base/core-con.lua
index 47d6ca658..b8ca17387 100644
--- a/tex/context/base/core-con.lua
+++ b/tex/context/base/core-con.lua
@@ -147,42 +147,64 @@ converters.chr = chr
converters.chrs = chrs
converters.maxchrs = maxchrs
-local function do_alphabetic(n,max,chr)
- if n > max then
- do_alphabetic(floor((n-1)/max),max,chr)
- n = (n-1)%max+1
- end
- characters.flush(chr(n))
-end
-
--~ more efficient but needs testing
--~
--~ local escapes = utffilters.private.escapes
--~
---~ local function do_alphabetic(n,max,chr)
+--~ local function do_alphabetic(n,mapping,chr)
+--~ local max = #mapping
--~ if n > max then
--~ do_alphabetic(floor((n-1)/max),max,chr)
--~ n = (n-1)%max+1
--~ end
---~ n = chr(n)
+--~ n = chr(n,mapping)
--~ texsprint(ctxcatcodes,escapes[n] or utfchar(n))
--~ end
--~ local lccodes, uccodes = characters.lccode, characters.uccode
-local function lowercased(n) return characters.lccode(code[n] or fallback) end
-local function uppercased(n) return characters.uccode(code[n] or fallback) end
+--~ local function do_alphabetic(n,mapping,chr)
+--~ local max = #mapping
+--~ if n > max then
+--~ do_alphabetic(floor((n-1)/max),mapping,chr)
+--~ n = (n-1)%max+1
+--~ end
+--~ characters.flush(chr(n,mapping))
+--~ end
+--~
+--~ local function lowercased(n,mapping) return characters.lccode(mapping[n] or fallback) end
+--~ local function uppercased(n,mapping) return characters.uccode(mapping[n] or fallback) end
+--~
+--~ function converters.alphabetic(n,code)
+--~ do_alphabetic(n,counters[code] or counters['**'],lowercased) -- lccode catches wrong tables
+--~ end
+--~
+--~ function converters.Alphabetic(n,code)
+--~ do_alphabetic(n,counters[code] or counters['**'],uppercased)
+--~ end
+
+--
+
+local function do_alphabetic(n,mapping,mapper)
+ local chr = mapper(mapping[n] or fallback)
+ local max = #mapping
+ if n > max then
+ do_alphabetic(floor((n-1)/max),mapping,mapper)
+ n = (n-1)%max+1
+ end
+ characters.flush(chr)
+end
function converters.alphabetic(n,code)
- local code = counters[code] or counters['**']
- do_alphabetic(n,#code,lowercased) -- lccode catches wrong tables
+ do_alphabetic(n,counters[code] or counters['**'],characters.lccode)
end
function converters.Alphabetic(n,code)
- local code = counters[code] or counters['**']
- do_alphabetic(n,#code,uppercased)
+ do_alphabetic(n,counters[code] or counters['**'],characters.uccode)
end
+--
+
function converters.character (n) chr (n,96) end
function converters.Character (n) chr (n,64) end
function converters.characters(n) chrs(n,96) end
diff --git a/tex/context/base/core-fnt.mkiv b/tex/context/base/core-fnt.mkiv
index e65739858..acc5eb752 100644
--- a/tex/context/base/core-fnt.mkiv
+++ b/tex/context/base/core-fnt.mkiv
@@ -123,8 +123,7 @@
\def\textskip
{\scratchdimen\stretchedspaceamount
\hskip\stretchedspacefactor\scratchdimen}%
- \@EA\processtokens\@EA\relax\@EA\textkern\@EA\relax\@EA
- \textskip\@EA{\textstring}%
+ \@EA\processtokens\@EA\relax\@EA\textkern\@EA\relax\@EA\textskip\@EA{\textstring}%
\fi
\egroup}
@@ -216,8 +215,7 @@
\def\underbarmethodc#1#2#3% PERIOD
{\hbox to #1
- {\dimen4=#3
- \advance\dimen4 .2ex
+ {\dimen4=\dimexpr#3+.2ex\relax
\hskip-.25em
\xleaders
\hbox{\hskip.25em\lower\dimen4\hbox{.}}
diff --git a/tex/context/base/core-spa.mkii b/tex/context/base/core-spa.mkii
index 7c97bcc9c..4f365b498 100644
--- a/tex/context/base/core-spa.mkii
+++ b/tex/context/base/core-spa.mkii
@@ -1590,11 +1590,9 @@
\fi}
\def\dosetupwhitespace % quick test for no list
- {\ifcsname\??ws\??ws\currentwhitespace\endcsname
- \csname\??ws\??ws\currentwhitespace\endcsname
- \else
- \expandafter\processcommalist\expandafter[\currentwhitespace]\dowhitespacemethod % can be raw
- \fi\relax
+ {\doifdefinedelse{\??ws\??ws\currentwhitespace}% no ifcsname due to nested \lineheight
+ {\getvalue{\??ws\??ws\currentwhitespace}}%
+ {\processcommacommand[\currentwhitespace]\dowhitespacemethod}%
\ifgridsnapping
\setfalse\flexiblewhitespace
\ifdim\ctxparskip>\zeropoint
@@ -1659,8 +1657,8 @@
% \def\dowhitespacemethod#1%
% {\executeifdefined{\??ws\??ws#1}{\ctxparskip#1}\relax}
-\def\dowhitespacemethod#1%
- {\ifcsname\??ws\??ws#1\endcsname\csname\??ws\??ws#1\endcsname\else\ctxparskip#1\fi\relax}
+\def\dowhitespacemethod#1% \doifdefined because of \lineheight
+ {\doifdefinedelse{\??ws\??ws#1}{\getvalue{\??ws\??ws#1}}{\ctxparskip#1}\relax}
\def\nowhitespace
{\ifdim\parskip>\zeropoint\relax
diff --git a/tex/context/base/grph-trf.mkii b/tex/context/base/grph-trf.mkii
index 798a9b0b4..3e32395b4 100644
--- a/tex/context/base/grph-trf.mkii
+++ b/tex/context/base/grph-trf.mkii
@@ -262,6 +262,7 @@
\else\ifdim\scaleboxdimy>\scaleboxvsize
\global\scaleboxdimx\zeropoint \global\scaleboxdimy\scaleboxvsize
\fi\fi
+ \setscaleboxbydimension
\fi}
\def\setscaleboxbyscale
@@ -380,7 +381,8 @@
\scratchdimen\scaleboxoutervsize % \textheight
\fi
\fi\fi\fi}
- {\scaleboxoutervsize\scaleparameter\c!maxheight}%
+ {\scratchdimen\scaleparameter\c!maxheight
+ \scaleboxoutervsize\scratchdimen}%
\doifelsenothing{\scaleparameter\c!height}
{\scaleboxvsize\scratchdimen}
{\scaleboxvsize\scaleparameter\c!height}%
diff --git a/tex/context/base/grph-trf.mkiv b/tex/context/base/grph-trf.mkiv
index 798a9b0b4..191dc254a 100644
--- a/tex/context/base/grph-trf.mkiv
+++ b/tex/context/base/grph-trf.mkiv
@@ -14,6 +14,8 @@
%D It may be that some functionality got lost. If it concerns
%D defined features, let me know and it will be sorted out.
+%D We will move the calculations to lua.
+
\writestatus{loading}{ConTeXt Graphic Macros / Transformations}
\unprotect
@@ -262,6 +264,7 @@
\else\ifdim\scaleboxdimy>\scaleboxvsize
\global\scaleboxdimx\zeropoint \global\scaleboxdimy\scaleboxvsize
\fi\fi
+ \setscaleboxbydimension
\fi}
\def\setscaleboxbyscale
@@ -380,7 +383,8 @@
\scratchdimen\scaleboxoutervsize % \textheight
\fi
\fi\fi\fi}
- {\scaleboxoutervsize\scaleparameter\c!maxheight}%
+ {\scratchdimen\scaleparameter\c!maxheight
+ \scaleboxoutervsize\scratchdimen}%
\doifelsenothing{\scaleparameter\c!height}
{\scaleboxvsize\scratchdimen}
{\scaleboxvsize\scaleparameter\c!height}%
diff --git a/tex/context/base/l-xml.lua b/tex/context/base/l-xml.lua
index bae492a32..5164890ae 100644
--- a/tex/context/base/l-xml.lua
+++ b/tex/context/base/l-xml.lua
@@ -303,7 +303,7 @@ dt[0] = top
local attributes = attribute^0
local text = justtext / add_text
- local balanced = P { "[" * ((1 - S"[]") + V(1))^0 * "]" } -- taken from lpeg manual, () example
+ local balanced = P { "[" * ((1 - S("[]")) + V(1))^0 * "]" } -- taken from lpeg manual, () example
local emptyelement = (spacing * open * name * attributes * optionalspace * slash * close) / add_empty
local beginelement = (spacing * open * name * attributes * optionalspace * close) / add_begin
diff --git a/tex/context/base/lxml-ini.mkiv b/tex/context/base/lxml-ini.mkiv
index 02271284e..f6cf8d83f 100644
--- a/tex/context/base/lxml-ini.mkiv
+++ b/tex/context/base/lxml-ini.mkiv
@@ -246,7 +246,7 @@
{\collectingtoks\@EA{\the\collectingtoks#1}}
\def\startexpandedcollect#1\stopexpandedcollect
- {\expanded{\collectingtoks{\the\collectingtoks#1}}}
+ {\normalexpanded{\collectingtoks{\the\collectingtoks#1}}}
\def\startcollecting{\collectingtoks\emptytoks}
\def\stopcollecting {\the\collectingtoks}
diff --git a/tex/context/base/lxml-tab.lua b/tex/context/base/lxml-tab.lua
index 38d19f4b9..290c31579 100644
--- a/tex/context/base/lxml-tab.lua
+++ b/tex/context/base/lxml-tab.lua
@@ -277,6 +277,7 @@ local dquote = S('"')
local equal = P('=')
local slash = P('/')
local colon = P(':')
+local ampersand = P('&')
local valid = R('az', 'AZ', '09') + S('_-.')
local name_yes = C(valid^1) * colon * C(valid^1)
local name_nop = C(P(true)) * C(valid^1)
@@ -290,7 +291,7 @@ local justtext = C((1-open)^1)
local somespace = space^1
local optionalspace = space^0
-local value = (squote * C((1 - squote)^0) * squote) + (dquote * C((1 - dquote)^0) * dquote)
+local value = (squote * C((1 - squote)^0) * squote) + (dquote * C((1 - dquote)^0) * dquote) -- ampersand and < also invalid in value
local attribute = (somespace * name * optionalspace * equal * optionalspace * value) / add_attribute
local attributes = attribute^0
diff --git a/tex/context/base/math-for.mkiv b/tex/context/base/math-for.mkiv
index 87aeaa4e0..b8f6beb5e 100644
--- a/tex/context/base/math-for.mkiv
+++ b/tex/context/base/math-for.mkiv
@@ -37,6 +37,8 @@
\ifx\fontattributehash \empty\else\dosetfontattribute \fontattributehash #1\fi
\ifx\colorattributehash\empty\else\dosetcolorattribute\colorattributehash#2\fi}
+\def\getformulaparameters{\getparameters[\??fm]}
+
%D \macros
%D {setupformulas}
diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv
index cb5a63440..51a9f8433 100644
--- a/tex/context/base/math-ini.mkiv
+++ b/tex/context/base/math-ini.mkiv
@@ -42,19 +42,23 @@
\registerctxluafile{math-map}{1.001}
\registerctxluafile{math-noa}{1.001}
-\definesystemattribute[mathalph]
+\definesystemattribute[mathalphabet]
\definesystemattribute[mathsize]
-\definesystemattribute[mathpunc]
+\definesystemattribute[mathpunctuation]
+\definesystemattribute[mathgreek]
% todo: only in mmode
-% \def\setmathattribute#1#2{\dosetattribute{mathalph}{\ctxlua{tex.sprint(mathematics.sync_a_both (\number\dogetattribute{mathalph},"#1","#2"))}}}
-% \def\setmathalphabet #1{\dosetattribute{mathalph}{\ctxlua{tex.sprint(mathematics.sync_a_name (\number\dogetattribute{mathalph},"#1"))}}}
-% \def\setmathstyle #1{\dosetattribute{mathalph}{\ctxlua{tex.sprint(mathematics.sync_a_style(\number\dogetattribute{mathalph},"#1"))}}}
+\unexpanded\def\mathgreekupright{\dosetattribute {mathgreek}{11}}
+\unexpanded\def\mathgreekitalic {\dosetattribute {mathgreek}{22}}
+\unexpanded\def\mathgreekdefault{\doresetattribute{mathgreek}}
-\def\setmathattribute#1#2{\ctxlua{mathematics.sync_a_both ("#1","#2")}}
-\def\setmathalphabet #1{\ctxlua{mathematics.sync_a_name ("#1")}}
-\def\setmathstyle #1{\ctxlua{mathematics.sync_a_style("#1")}}
+\let\mathgreeknormal\mathgreekupright
+\let\mathgreeknone \mathgreekdefault
+
+\def\setmathattribute#1#2{\ifmmode\ctxlua{mathematics.sync_a_both ("#1","#2")}\fi}
+\def\setmathalphabet #1{\ifmmode\ctxlua{mathematics.sync_a_name ("#1")}\fi}
+\def\setmathstyle #1{\ifmmode\ctxlua{mathematics.sync_a_style("#1")}\fi}
\unexpanded\def\mr {\setmathattribute{regular}{tf}}
@@ -414,6 +418,39 @@
\setupmathematics
[\v!compact=no]
+%D Delayed: greek.
+%D
+%D \starttyping
+%D \usetypescript[cambria]\setupbodyfont[cambria]
+%D \startTEXpage
+%D $\alpha \mathgreekupright \alpha \mathgreekitalic \alpha$
+%D \stopTEXpage
+%D \stoptyping
+
+% [lc uc] normal (upright) = 1, italic = 2, none = 0
+
+\setevalue{\??mo:greek:\v!normal:\v!normal}{\dosetattribute {mathgreek}{11}}
+\setevalue{\??mo:greek:\v!normal:\v!italic}{\dosetattribute {mathgreek}{12}}
+\setevalue{\??mo:greek:\v!normal:\v!none }{\dosetattribute {mathgreek}{10}}
+\setevalue{\??mo:greek:\v!italic:\v!normal}{\dosetattribute {mathgreek}{21}}
+\setevalue{\??mo:greek:\v!italic:\v!italic}{\dosetattribute {mathgreek}{22}}
+\setevalue{\??mo:greek:\v!italic:\v!none }{\dosetattribute {mathgreek}{20}}
+\setevalue{\??mo:greek:\v!none :\v!normal}{\dosetattribute {mathgreek}{01}}
+\setevalue{\??mo:greek:\v!none :\v!italic}{\dosetattribute {mathgreek}{02}}
+\setevalue{\??mo:greek:\v!none :\v!none }{\doresetattribute{mathgreek}}
+
+\appendtoks
+ \csname
+ \??mo:greek%
+ :\ifcsname\??mo:lcgreek:\@@molcgreek\endcsname\@@molcgreek\else\v!none\fi
+ :\ifcsname\??mo:ucgreek:\@@moucgreek\endcsname\@@moucgreek\else\v!none\fi
+ \endcsname
+\to \everymathematics
+
+\setupmathematics
+ [lcgreek=\v!none,
+ ucgreek=\v!none]
+
%D \macros
%D {enablemathpunctuation,disablemathpunctuation}
%D
@@ -437,7 +474,7 @@
\to \everysetupmathematics
\appendtoks
- \ifconditional\automathpunctuation\dosetattribute{mathpunc}\plusone\fi
+ \ifconditional\automathpunctuation\dosetattribute{mathpunctuation}\plusone\fi
\to \everymathematics
\setupmathematics
diff --git a/tex/context/base/math-map.lua b/tex/context/base/math-map.lua
index b16936c3a..cf54971f9 100644
--- a/tex/context/base/math-map.lua
+++ b/tex/context/base/math-map.lua
@@ -20,6 +20,9 @@ if not modules then modules = { } end modules ['math-map'] = {
-- maybe: script/scriptscript dynamic,
local type, next = type, next
+local floor = math.floor
+
+local texattribute = tex.attribute
mathematics = mathematics or { }
@@ -295,48 +298,26 @@ end
-- of course we could do some div/mod trickery instead
---~ function mathematics.sync_a_both(attribute,alphabet,style)
---~ local data = alphabets[alphabet or "regular"] or alphabets.regular
---~ data = data[style or "tf"] or data.tf
---~ return data and data.attribute or attribute
---~ end
-
---~ function mathematics.sync_a_style(attribute,style)
---~ local r = attribs[attribute]
---~ local alphabet = r and r.alphabet or "regular"
---~ local data = alphabets[alphabet][style]
---~ return data and data.attribute or attribute
---~ end
-
---~ function mathematics.sync_a_name(attribute,alphabet)
---~ local r = attribs[attribute]
---~ local style = r and r.style or "tf"
---~ local data = alphabets[alphabet][style]
---~ return data and data.attribute or attribute
---~ end
-
-local mathalph = attributes.private("mathalph")
-
-local texattribute = tex.attribute
+local mathalphabet = attributes.private("mathalphabet")
function mathematics.sync_a_both(alphabet,style)
local data = alphabets[alphabet or "regular"] or alphabets.regular
data = data[style or "tf"] or data.tf
- texattribute[mathalph] = data and data.attribute or texattribute[mathalph]
+ texattribute[mathalphabet] = data and data.attribute or texattribute[mathalphabet]
end
function mathematics.sync_a_style(style)
- local r = attribs[attribute]
+ local r = attribs[mathalphabet]
local alphabet = r and r.alphabet or "regular"
local data = alphabets[alphabet][style]
- texattribute[mathalph] = data and data.attribute or texattribute[mathalph]
+ texattribute[mathalphabet] = data and data.attribute or texattribute[mathalphabet]
end
function mathematics.sync_a_name(alphabet)
- local r = attribs[attribute]
+ local r = attribs[mathalphabet]
local style = r and r.style or "tf"
local data = alphabets[alphabet][style]
- texattribute[mathalph] = data and data.attribute or texattribute[mathalph]
+ texattribute[mathalphabet] = data and data.attribute or texattribute[mathalphabet]
end
local issymbol = mathematics.alphabets.regular.tf.symbols
@@ -363,3 +344,34 @@ function mathematics.remap_alphabets(attribute,char)
end
return nil
end
+
+-- [lc uc] normal (upright) = 1, italic = 2, none = 0
+
+mathematics.lcgreek = {
+ upright = {
+ [0x1D6FC] = 0x003B1,
+ },
+}
+
+mathematics.ucgreek = {
+ upright = {
+ },
+}
+
+local lcgreek, ucgreek = mathematics.lcgreek, mathematics.ucgreek
+
+lcgreek.italic = table.swapped(lcgreek.upright)
+ucgreek.italic = table.swapped(ucgreek.upright)
+
+lcgreek[1], lcgreek[2] = lcgreek.upright, ucgreek.italic
+ucgreek[1], ucgreek[2] = lcgreek.upright, ucgreek.italic
+
+function mathematics.remap_greek(attribute,char)
+ local lc, uc = floor(attribute/10), attribute % 10
+ local g = lcgreek[lc] or ucgreek[uc]
+ if g then
+ local newchar = g[char]
+ return newchar ~= char and newchar
+ end
+ return nil
+end
diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua
index ae7e2f063..f8484dfb4 100644
--- a/tex/context/base/math-noa.lua
+++ b/tex/context/base/math-noa.lua
@@ -140,7 +140,8 @@ noads.process = process
-- character remapping
-local attribute = attributes.private("mathalph")
+local mathalphabet = attributes.private("mathalphabet")
+local mathgreek = attributes.private("mathgreek")
noads.processors.relocate = { }
@@ -149,33 +150,49 @@ local function report_remap(tag,id,old,new,extra)
end
local remap_alphabets = mathematics.remap_alphabets
+local remap_greek = mathematics.remap_greek
local fcs = fonts.color.set
+local function relocate(pointer,what,char,newchar)
+ local fam = pointer.fam
+ local id = font_of_family(fam)
+ local tfmdata = fontdata[id]
+ if tfmdata and tfmdata.characters[newchar] then -- we could probably speed this up
+ if trace_remapping then
+ report_remap(what,id,char,newchar)
+ end
+ if trace_analyzing then
+ fcs(pointer,"font:isol")
+ end
+ pointer.char = newchar
+ return true
+ elseif trace_remapping then
+ report_remap(what,id,char,newchar," fails")
+ end
+ return false
+end
+
noads.processors.relocate[math_char] = function(pointer)
- local a = has_attribute(pointer,attribute)
+ local done = 0
+ local a = has_attribute(pointer,mathalphabet)
if a and a > 0 then
- local fam = pointer.fam
- set_attribute(pointer,attribute,0)
+ set_attribute(pointer,mathalphabet,0)
local char = pointer.char
local newchar = remap_alphabets(a,char)
- if newchar then
- local id = font_of_family(fam)
- local tfmdata = fontdata[id]
- if tfmdata and tfmdata.characters[newchar] then -- we could probably speed this up
- if trace_remapping then
- report_remap("char",id,char,newchar)
- end
- if trace_analyzing then
- fcs(pointer,"font:isol")
- end
- pointer.char = newchar
- return
- elseif trace_remapping then
- report_remap("char",id,char,newchar," fails")
- end
+ if newchar and relocate(pointer,"char",char,newchar) then
+ done = done + 1
end
end
- if trace_analyzing then
+ local a = has_attribute(pointer,mathgreek)
+ if a and a > 0 then
+ set_attribute(pointer,mathgreek,0)
+ local char = pointer.char
+ local newchar = remap_greek(a,char)
+ if newchar and relocate(pointer,"greek",char,newchar) then
+ done = done + 1
+ end
+ end
+ if done > 0 and trace_analyzing then
fcs(pointer,"font:medi")
end
end
@@ -207,15 +224,15 @@ end
-- todo: just replace the character by an ord noad
-- and remove the right delimiter as well
-local attribute = attributes.private("mathsize")
+local mathsize = attributes.private("mathsize")
noads.processors.resize = { }
noads.processors.resize[math_fence] = function(pointer)
if pointer.subtype == 1 then -- left
- local a = has_attribute(pointer,attribute)
+ local a = has_attribute(pointer,mathsize)
if a and a > 0 then
- set_attribute(pointer,attribute,0)
+ set_attribute(pointer,mathsize,0)
local d = pointer.delim
local df = d.small_fam
local id = font_of_family(df)
@@ -234,7 +251,7 @@ end
-- respacing
-local attribute = attributes.private("mathpunc")
+local mathpunctuation = attributes.private("mathpunctuation")
noads.processors.respace = { }
@@ -244,9 +261,9 @@ local chardata = characters.data
noads.processors.respace[math_noad] = function(pointer)
if pointer.subtype == noad_ord then
- local a = has_attribute(pointer,attribute)
+ local a = has_attribute(pointer,mathpunctuation)
if a and a > 0 then
- set_attribute(pointer,attribute,0)
+ set_attribute(pointer,mathpunctuation,0)
local current_nucleus = pointer.nucleus
if current_nucleus.id == math_char then
local current_char = current_nucleus.char
diff --git a/tex/context/base/mult-def.lua b/tex/context/base/mult-def.lua
index 4626896a9..c1678f68d 100644
--- a/tex/context/base/mult-def.lua
+++ b/tex/context/base/mult-def.lua
@@ -15286,10 +15286,10 @@ return {
["strong"]={
["cs"]="strong",
["de"]="strong",
- ["en"]="sterk",
+ ["en"]="strong",
["fr"]="strong",
["it"]="strong",
- ["nl"]="strong",
+ ["nl"]="sterk",
["pe"]="محکم",
["ro"]="strong",
},
@@ -15956,10 +15956,10 @@ return {
["weak"]={
["cs"]="weak",
["de"]="weak",
- ["en"]="zwak",
+ ["en"]="weak",
["fr"]="weak",
["it"]="weak",
- ["nl"]="weak",
+ ["nl"]="zwak",
["pe"]="هفته",
["ro"]="weak",
},
diff --git a/tex/context/base/mult-en.tex b/tex/context/base/mult-en.tex
index ddc1dbf1e..8d4ab2919 100644
--- a/tex/context/base/mult-en.tex
+++ b/tex/context/base/mult-en.tex
@@ -420,7 +420,7 @@
\setinterfacevariable{stopper}{stopper}
\setinterfacevariable{stretch}{stretch}
\setinterfacevariable{strict}{strict}
-\setinterfacevariable{strong}{sterk}
+\setinterfacevariable{strong}{strong}
\setinterfacevariable{strut}{strut}
\setinterfacevariable{sub}{sub}
\setinterfacevariable{subbackward}{subbackward}
@@ -487,7 +487,7 @@
\setinterfacevariable{very}{very}
\setinterfacevariable{verystrict}{verystrict}
\setinterfacevariable{verytolerant}{verytolerant}
-\setinterfacevariable{weak}{zwak}
+\setinterfacevariable{weak}{weak}
\setinterfacevariable{wednesday}{wednesday}
\setinterfacevariable{week}{week}
\setinterfacevariable{weekday}{weekday}
diff --git a/tex/context/base/mult-nl.tex b/tex/context/base/mult-nl.tex
index f4d6a2127..50e1bbf6f 100644
--- a/tex/context/base/mult-nl.tex
+++ b/tex/context/base/mult-nl.tex
@@ -420,7 +420,7 @@
\setinterfacevariable{stopper}{afsluiter}
\setinterfacevariable{stretch}{rek}
\setinterfacevariable{strict}{streng}
-\setinterfacevariable{strong}{strong}
+\setinterfacevariable{strong}{sterk}
\setinterfacevariable{strut}{strut}
\setinterfacevariable{sub}{sub}
\setinterfacevariable{subbackward}{subachteruit}
@@ -487,7 +487,7 @@
\setinterfacevariable{very}{zeer}
\setinterfacevariable{verystrict}{zeerstreng}
\setinterfacevariable{verytolerant}{zeersoepel}
-\setinterfacevariable{weak}{weak}
+\setinterfacevariable{weak}{zwak}
\setinterfacevariable{wednesday}{woensdag}
\setinterfacevariable{week}{week}
\setinterfacevariable{weekday}{weekdag}
diff --git a/tex/context/base/mult-sys.tex b/tex/context/base/mult-sys.tex
index 2bf22e208..40d8d49d3 100644
--- a/tex/context/base/mult-sys.tex
+++ b/tex/context/base/mult-sys.tex
@@ -158,6 +158,7 @@
\definesystemconstant {hasnumber}
\definesystemconstant {hastitle}
\definesystemconstant {hascaption}
+\definesystemconstant {haslevel}
%D A more experienced \TEX\ user will recognize the next four
%D constants. We need these because font-definitions are
diff --git a/tex/context/base/pack-box.mkiv b/tex/context/base/pack-box.mkiv
index 2ab765d7d..a497b1f59 100644
--- a/tex/context/base/pack-box.mkiv
+++ b/tex/context/base/pack-box.mkiv
@@ -538,11 +538,6 @@
%
% \input tufte
%
-% \placesomefloat[right]{none}
-% {\bleed[width=5cm,height=3cm,location=rb]{\externalfigure[koe][bleed]}}
-%
-% \input tufte
-%
% \placefigure
% [top,none]
% {} % no caption
diff --git a/tex/context/base/pack-obj.mkiv b/tex/context/base/pack-obj.mkiv
index cea526ef0..81220e324 100644
--- a/tex/context/base/pack-obj.mkiv
+++ b/tex/context/base/pack-obj.mkiv
@@ -292,7 +292,7 @@
{% \initializepaper
\forgetall
\dontshowcomposition
- \setbox\scratchbox\vbox
+ \setbox\scratchbox\vbox attr \viewerlayerattribute \attribute\viewerlayerattribute
{\doinsertobject{#1}{#2}}%
\setbox\scratchbox#3%
{\vbox to #5\scaledpoint
@@ -304,7 +304,7 @@
%\vss\box\scratchbox
\vss\hbox to #4\scaledpoint{\box\scratchbox\hss}% fix Chof
\fi\fi}}%
- \forcecolorhack % needed in order to use layers etc
+% \forcecolorhack % needed in order to use layers etc
\box\scratchbox
\endgroup}
diff --git a/tex/context/base/page-ini.mkii b/tex/context/base/page-ini.mkii
index 65bc27f53..816b7d944 100644
--- a/tex/context/base/page-ini.mkii
+++ b/tex/context/base/page-ini.mkii
@@ -1,4 +1,4 @@
-%D \module
+ %D \module
%D [ file=page-ini,
%D version=2000.10.20,
%D title=\CONTEXT\ Page Macros,
diff --git a/tex/context/base/page-ini.mkiv b/tex/context/base/page-ini.mkiv
index 6beba4492..913cbf99f 100644
--- a/tex/context/base/page-ini.mkiv
+++ b/tex/context/base/page-ini.mkiv
@@ -187,13 +187,13 @@
{\appendtoks\dowithotrcommand#1\to\registeredotrcommands}
\def\dopresetotrcommand#1%
- {\expandafter\let\expandafter#1\csname\@@OTR
- \ifcsname\@@OTR\OTRidentifier\expandafter\gobbleoneargument\string#1\endcsname
- \OTRidentifier
- \else\ifcsname\@@OTR\OTRdefault\expandafter\gobbleoneargument\string#1\endcsname % fallback
- \OTRdefault
- \fi\fi
- \expandafter\gobbleoneargument\string#1\endcsname}
+ {\expandafter\let\expandafter#1\csname\@@OTR
+ \ifcsname\@@OTR\OTRidentifier\expandafter\gobbleoneargument\string#1\endcsname
+ \OTRidentifier
+ \else\ifcsname\@@OTR\OTRdefault\expandafter\gobbleoneargument\string#1\endcsname % fallback
+ \OTRdefault
+ \fi\fi
+ \expandafter\gobbleoneargument\string#1\endcsname}
\def\activateotr#1#2%
{\def\OTRidentifier{#1}%
diff --git a/tex/context/base/page-one.mkiv b/tex/context/base/page-one.mkiv
index 73f69d582..4c7ea8dfa 100644
--- a/tex/context/base/page-one.mkiv
+++ b/tex/context/base/page-one.mkiv
@@ -622,7 +622,7 @@
\else
\topofinsertfalse
\fi
- \global\advance\topinserted \ht\floatbox+\dp\floatbox+\floatbottomskip\relax
+ \global\advance\topinserted\dimexpr\ht\floatbox+\dp\floatbox+\floatbottomskip\relax
\insert\topins
{\forgetall
\iftopofinsert
diff --git a/tex/context/base/page-sid.mkiv b/tex/context/base/page-sid.mkiv
index ecfa195e6..3de537787 100644
--- a/tex/context/base/page-sid.mkiv
+++ b/tex/context/base/page-sid.mkiv
@@ -395,7 +395,7 @@
\ifdim\sidefloatwidth>\zeropoint % new, see prikkels
\noindent
\ifinner\else\vadjust{\penalty\minusone}\fi
- \hskip\sidefloatwidth
+ \hskip\sidefloatwidth\relax
%\else
% we have a margin or edge float
\fi
diff --git a/tex/context/base/s-inf-01.tex b/tex/context/base/s-inf-01.tex
new file mode 100644
index 000000000..a2a693ae2
--- /dev/null
+++ b/tex/context/base/s-inf-01.tex
@@ -0,0 +1,203 @@
+%D \module
+%D [ file=s-inf-01,
+%D version=2009.07.09,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Information 1 (\MKII/\MKIV\ usage),
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D Some day I will generalize this table mechanism.
+
+\startluacode
+ local format, gsub, find, match = string.format, string.gsub, string.find, string.match
+ local texsprint, ctxcatcodes = tex.sprint, tex.ctxcatcodes
+
+ local list, size, comp, used, nope = { }, { }, { }, { mkii = { }, mkiv = { } }, { 0, 0, 0, 0 }
+
+ local omit = {
+ "char%-def%.lua",
+ "mult%-def%.lua", "mult%-..%.tex", "mult%-m..%.tex",
+ }
+ local skip = {
+ "prag%-.*%.tex", "docs%-.*.tex", "list%-.*%.tex", "test%-.*%.tex", "demo%-.*%.tex",
+ "opti%-.*%.tex", "chrt%-.*%.tex",
+ }
+ local types = {
+ "tex", "mkii", "mkiv", "lua"
+ }
+
+ local function collect(list,suffix,n)
+ local path = file.dirname(resolvers.find_file("context.tex"),".")
+ local pattern = path .. "/*." .. suffix
+ local texfiles = dir.glob(pattern)
+ for _, name in ipairs(texfiles) do
+ local base = file.basename(name)
+ local category = match(base,"^([a-z][a-z][a-z][a-z])%-[a-z0-9]+%.[a-z]+")
+ if category and lfs.isfile(name) then
+ local okay = true
+ for s=1,#skip do
+ if find(base,skip[s]) then
+ okay = false
+ break
+ end
+ end
+ if okay then
+ local lm, sm, cm = list[category], size[category], comp[category]
+ if not lm then
+ lm, sm, cm = { 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0 }
+ list[category], size[category], comp[category] = lm, sm, cm
+ end
+ lm[n] = lm[n] + 1
+ local done = true
+ for o=1,#omit do
+ if find(base,omit[o]) then
+ done = false
+ break
+ end
+ end
+ local data = io.loaddata(name)
+ if suffix == "lua" then
+ data = gsub(data,"%-%-%[%[.-%]%]%-%-","")
+ data = gsub(data,"%-%-.-[\n\r]","")
+ else
+ data = gsub(data,"%%.-[\n\r]","")
+ end
+ data = gsub(data,"%s","")
+ sm[n+4] = sm[n+4] + #data
+ if done then
+ sm[n] = sm[n] + #data
+ else
+ cm[n] = cm[n] + 1
+ end
+ end
+ end
+ end
+ end
+
+ local function prepare(what)
+ if next(list) then
+ -- already loaded
+ else
+ for k, v in ipairs(types) do
+ collect(list,v,k)
+ end
+ for category, _ in pairs(list) do
+ pattern ="{"..category.."%-"
+ for suffix, t in pairs(used) do
+ local data = io.loaddata(resolvers.find_file("context."..suffix))
+ if find(data,pattern) then
+ t[category] = true
+ end
+ end
+ end
+ end
+ local max, what = 0, (what == "size" and size) or list
+ for k, v in table.sortedpairs(what) do
+ for i=1,4 do if v[i] > max then max = v[i] end end
+ end
+ return max, what, function(n) return n/max end
+ end
+
+ function document.context_state_1(what)
+ local max, what, norm = prepare(what)
+ texsprint(ctxcatcodes,"\\starttabulate[|Tc|T|T|T|T|]")
+ texsprint(ctxcatcodes,"\\NC category\\NC")
+ for i, t in ipairs(types) do
+ local n, m = 0, 0
+ for k, v in pairs(list) do
+ local nn, mm = what[k][i], what[k][i+4]
+ n = n + nn
+ m = m + (mm or nn)
+ end
+ texsprint(ctxcatcodes,format("\\Top{%s}{%s}{%s}{%s}\\NC",t,norm(max),n,m))
+ end
+ texsprint(ctxcatcodes,"\\NC\\NR\\HL")
+ for k, v in table.sortedpairs(what) do
+ local c = (what == size and comp[k]) or nope
+ local cat = format("%s~%s~~%s",(used.mkii[k] and "ii") or "~~",(used.mkiv[k] and "iv") or "~~",k)
+ texsprint(ctxcatcodes,"\\NC",cat,"\\NC")
+ for i, t in ipairs(types) do
+ texsprint(ctxcatcodes,format("\\Bar{%s}{%s}{%s}{%s}\\NC",t,v[i],c[i],norm(v[i])))
+ end
+ texsprint(ctxcatcodes,"\\NR")
+ end
+ texsprint(ctxcatcodes,"\\stoptabulate")
+ end
+
+ function document.context_state_2(what)
+ local max, what, norm = prepare(what)
+ for k, v in table.sortedpairs(what) do
+ local c = (what == size and comp[k]) or nope
+ texsprint(ctxcatcodes,format("\\StartUp{%s}",k))
+ for i, t in ipairs(types) do
+ texsprint(ctxcatcodes,format("\\Up{%s}{%s}",t,norm(v[i])))
+ end
+ texsprint(ctxcatcodes,"\\StopUp")
+ end
+ end
+
+\stopluacode
+
+\definecolor[bar:tex] [middlegreen]
+\definecolor[bar:mkii][middleblue]
+\definecolor[bar:mkiv][middlered]
+\definecolor[bar:lua] [middlegray]
+
+\def\Top#1#2#3#4%
+ {\hbox to 5em{\hss#3}%
+ \enspace
+ \hbox to #2\dimexpr 20em\relax{#1\ifnum#3=#4\else~#4\rlap{~+}\fi\hss}}
+
+\def\Bar#1#2#3#4%
+ {\ifcase#2\else
+ \hbox to 5em{\hss\ifcase#3\else\llap{-~}\fi#2}%
+ \enspace
+ \blackrule[color=bar:#1,width=#4\dimexpr 20em\relax,height=.8\strutht]%
+ \fi}
+
+\newcount\UpCounter
+
+\def\StartUp#1%
+ {\dontleavehmode\framed[frame=off,align={middle,low},height=18em]\bgroup
+ \def\StopUp
+ {\par\nointerlineskip\blackrule[height=1pt,width=4em,depth=0pt,color=darkgray]%
+ \par\tttf\strut#1\par
+ \egroup
+ \ifnum\UpCounter=17 \par \UpCounter\zerocount\else \kern1em \advance\UpCounter\plusone \fi}}
+
+\def\Up#1#2%
+ {\scratchdimen#2\dimexpr 16em\relax
+ \ifdim\scratchdimen=\zeropoint
+ \kern1em
+ \else
+ \ifdim\scratchdimen<\onepoint \scratchdimen\onepoint \fi
+ \blackrule[color=bar:#1,height=\scratchdimen,width=1em]%
+ \fi}
+
+\def\Show#1#2#3%
+ {\startTEXpage[offset=1em,width=fit]
+ \hbox{\tttf\strut\currentdate~-~#1}
+ \ctxlua{document.context_state_\number#2("#3")}
+ \stopTEXpage}
+
+% \doifnotmode{demo}{\endinput}
+
+\starttext
+ \Show
+ {The number of files used in ConTeXt (modules and styles are excluded).}
+ {1}{number}
+ \Show
+ {The size of (core) files used in ConTeXt (- indicates exclusion of large data files; + indicates inclusion of large data files; comment and spaces removed.)}
+ {1}{size}
+ \Show
+ {The relative number of files used in ConTeXt (tex, mkii, mkiv, lua).}
+ {2}{number}
+ \Show
+ {The relative size of files used in ConTeXt (tex, mkii, mkiv, lua).}
+ {2}{size}
+\stoptext
diff --git a/tex/context/base/strc-doc.lua b/tex/context/base/strc-doc.lua
index e99718d95..051c682ec 100644
--- a/tex/context/base/strc-doc.lua
+++ b/tex/context/base/strc-doc.lua
@@ -58,7 +58,7 @@ function documents.reset()
data.forced = { }
data.ownnumbers = { }
data.status = { }
- data.checkers = { }
+--~ data.checkers = { }
data.depth = 0
end
@@ -130,6 +130,8 @@ storage.register("structure/sections/levelmap", structure.sections.levelmap, "st
sections.verbose = true
+levelmap.block = -1
+
function sections.setlevel(name,level) -- level can be number or parent (=string)
local l = tonumber(level)
if not l then
@@ -157,6 +159,7 @@ function sections.setblock(name)
end
function sections.pushblock(name)
+ structure.counters.check(0) -- we assume sane usage of \page between blocks
local block = name or data.block
data.blocks[#data.blocks+1] = block
data.block = block
@@ -233,6 +236,7 @@ function sections.somelevel(given)
status[i] = nil
end
end
+structure.counters.check(newdepth)
ownnumbers[newdepth] = given.numberdata.ownnumber or ""
given.numberdata.ownnumber = nil
data.depth = newdepth
@@ -383,8 +387,8 @@ function sections.userdata(depth,key,default)
end
end
-function sections.setchecker(name,level,command)
- data.checkers[name] = (name and command and level > 0 and { level, command }) or nil
+function sections.setchecker(name,level,command) -- hm, checkers are not saved
+ data.checkers[name] = (name and command and level >= 0 and { level, command }) or nil
end
function sections.current()
@@ -466,7 +470,7 @@ function sections.typesetnumber(entry,kind,...) -- kind='section','number','pref
criterium = 0
end
--
- local firstprefix, lastprefix = 0, 100
+ local firstprefix, lastprefix = 0, 16
if segments then
local f, l = (tostring(segments)):match("^(.-):(.+)$")
if f and l then
@@ -486,12 +490,13 @@ function sections.typesetnumber(entry,kind,...) -- kind='section','number','pref
if numbers then
local done, preceding = false, false
local function process(index) -- move to outer
+ -- todo: too much (100 steps)
local number = numbers and (numbers[index] or 0)
local ownnumber = ownnumbers and ownnumbers[index] or ""
if number > criterium or (ownnumber ~= "") then
- local block = entry.block
+ local block = (entry.block ~= "" and entry.block) or sections.currentblock() -- added
if preceding then
- local separator = sets.get("structure:separators",b,s,preceding,".")
+ local separator = sets.get("structure:separators",block,separatorset,preceding,".")
if separator then
processors.sprint(ctxcatcodes,separator)
end
@@ -505,7 +510,7 @@ function sections.typesetnumber(entry,kind,...) -- kind='section','number','pref
-- traditional (e.g. used in itemgroups)
texsprint(ctxcatcodes,format("\\convertnumber{%s}{%s}",conversion,number))
else
- local theconversion = sets.get("structure:conversions",block,conversion,index,"numbers")
+ local theconversion = sets.get("structure:conversions",block,conversionset,index,"numbers")
processors.sprint(ctxcatcodes,theconversion,function(str)
return format("\\convertnumber{%s}{%s}",str or "numbers",number)
end)
diff --git a/tex/context/base/strc-flt.mkiv b/tex/context/base/strc-flt.mkiv
index 2ccf3ea6a..ff0304573 100644
--- a/tex/context/base/strc-flt.mkiv
+++ b/tex/context/base/strc-flt.mkiv
@@ -112,7 +112,7 @@
\c!number=\v!yes,
\c!prefix=\v!no,
\c!prefixconnector=.,
-\c!way=bychapter,
+\c!way=\v!by\v!chapter,
\c!prefixsegments=2:2,
% \c!way=\@@nrway,
% \c!blockway=\@@nrblockway,
@@ -1161,14 +1161,11 @@
\blank[\floatsharedparameter\c!spaceafter]}
\ifx\someherefloat\undefined \let\someherefloat\doplacefloatbox \fi
+\ifx\someslotfloat\undefined \let\someslotfloat\doplacefloatbox \fi
\ifx\somefixdfloat\undefined \let\somefixdfloat\doplacefloatbox \fi
-\ifx\somepagefloat\undefined \let\somepagefloat\doplacefloatbox \fi
\ifx\sometopsfloat\undefined \let\sometopsfloat\doplacefloatbox \fi
\ifx\somebotsfloat\undefined \let\somebotsfloat\doplacefloatbox \fi
-
\ifx\somesidefloat\undefined \let\somesidefloat\doplacefloatbox \fi
-\ifx\somefacefloat\undefined \let\somefacefloat\doplacefloatbox \fi
-\ifx\sometextfloat\undefined \let\sometextfloat\doplacefloatbox \fi
% test case:
%
@@ -1263,7 +1260,7 @@
{\page[\v!preference]%
\docheckiffloatfits
\ifroomforfloat
- \placesomeherefloat[#1]%
+ \someherefloat[#1]%
\else
\showmessage\m!floatblocks9\empty
\doreversesavefloat
@@ -1274,7 +1271,7 @@
\page[\v!preference]%
\docheckiffloatfits
\ifroomforfloat
- \placesomeherefloat[#1]%
+ \someherefloat[#1]%
\else
\dosavefloat
\fi
@@ -1299,15 +1296,15 @@
\def\sometopbottomfloat[#1]%
{\doifelse\floatmethod\v!auto
{\ifdim\pagetotal<\floatautofactor\pagegoal % when empty page, maxdimen
- \placesometopsfloat[#1]%
+ \sometopsfloat[#1]%
\else
- \placesomebotsfloat[#1]%
+ \somebotsfloat[#1]%
\fi}
{\doifelse\floatmethod\v!top
- {\placesometopsfloat[#1]}
+ {\sometopsfloat[#1]}
{\doifelse\floatmethod\v!bottom
- {\placesomebotsfloat[#1]}
- {\placesomeherefloat[#1]}}}}
+ {\somebotsfloat[#1]}
+ {\someherefloat[#1]}}}}
% De onderstaande macro wordt gebruikt bij de macros
% voor het plaatsen van tabellen en figuren (klopt niet
@@ -2094,16 +2091,18 @@
\installfloathandler {fxtb} \someslotfloat
\installfloathandler {fxbt} \someslotfloat
-\registerotrcommand\placesomeslotfloat % \def\placesomeslotfloat {\OTRcommand\someslotfloat}
-\registerotrcommand\placesomeherefloat % \def\placesomeherefloat {\OTRcommand\someherefloat}
-\registerotrcommand\placesomefixdfloat % \def\placesomefixdfloat {\OTRcommand\somefixdfloat}
-\registerotrcommand\placesomepagefloat % \def\placesomepagefloat {\OTRcommand\somepagefloat}
-\registerotrcommand\placesomeleftpagefloat % \def\placesomeleftpagefloat {\OTRcommand\someleftpagefloat}
-\registerotrcommand\placesomerightpagefloat % \def\placesomerightpagefloat{\OTRcommand\somerightpagefloat}
-\registerotrcommand\placesometopsfloat % \def\placesometopsfloat {\OTRcommand\sometopsfloat}
-\registerotrcommand\placesomebotsfloat % \def\placesomebotsfloat {\OTRcommand\somebotsfloat}
-\registerotrcommand\placesomesidefloat % \def\placesomesidefloat {\OTRcommand\somesidefloat}
-\registerotrcommand\placesomefacefloat % \def\placesomefacefloat {\OTRcommand\somefacefloat}
+% no \registerotrcommand\placesome* here!, this has to be cleaned up:
+
+% \def\placesomeslotfloat {\OTRcommand\someslotfloat} % \def\placesomeslotfloat {\someslotfloat}
+% \def\placesomefixdfloat {\OTRcommand\somefixdfloat} % \def\placesomefixdfloat {\somefixdfloat}
+% \def\placesomesidefloat {\OTRcommand\somesidefloat} % \def\placesomesidefloat {\somesidefloat}
+% \def\placesomefacefloat {\OTRcommand\somefacefloat} % \def\placesomefacefloat {\somefacefloat}
+% \def\placesomepagefloat {\OTRcommand\somepagefloat} % \def\placesomepagefloat {\somepagefloat}
+% \def\placesomeleftpagefloat {\OTRcommand\someleftpagefloat} % \def\placesomeleftpagefloat {\someleftpagefloat}
+% \def\placesomerightpagefloat{\OTRcommand\somerightpagefloat} % \def\placesomerightpagefloat{\somerightpagefloat}
+% \def\placesomeherefloat {\OTRcommand\someherefloat} % \def\placesomeherefloat {\someherefloat}
+% \def\placesometopsfloat {\OTRcommand\sometopsfloat} % \def\placesometopsfloat {\sometopsfloat}
+% \def\placesomebotsfloat {\OTRcommand\somebotsfloat} % \def\placesomebotsfloat {\somebotsfloat}
\def\someleftsidefloat [#1]{\somesidefloat[#1]\presetindentation}
\def\somerightsidefloat [#1]{\somesidefloat[#1]}
@@ -2117,15 +2116,24 @@
\def\someinrightedgefloat [#1]{\somesidefloat[#1]}
\def\someinmarginfloat [#1]{\somesidefloat[#1]}
\def\someherefloat [#1]{\someelsefloat[\v!here,#1]}
-
\def\somebackspacefloat [#1]{\somesidefloat[#1]}
\def\somecutspacefloat [#1]{\somesidefloat[#1]}
-\def\somefixdfloat {\placesomefixdfloat}
-\def\somepagefloat {\placesomepagefloat}
-\def\someleftpagefloat {\placesomeleftpagefloat}
-\def\somerightpagefloat{\placesomerightpagefloat}
-\def\somefacefloat {\placesomefacefloat}
-\def\someslotfloat {\placesomeslotfloat}
+\def\sometopsfloat {\OTRcommand\sometopsfloat}
+\def\somebotsfloat {\OTRcommand\somebotsfloat}
+\def\someherefloat {\OTRcommand\someherefloat}
+\def\someslotfloat {\OTRcommand\someslotfloat}
+\def\somefixdfloat {\OTRcommand\somefixdfloat}
+\def\somefacefloat {\OTRcommand\somefacefloat}
+\def\somepagefloat {\OTRcommand\somepagefloat}
+\def\someleftpagefloat {\OTRcommand\someleftpagefloat}
+\def\somerightpagefloat{\OTRcommand\somerightpagefloat}
+
+% \def\someslotfloat {\placesomeslotfloat}
+% \def\somefixdfloat {\placesomefixdfloat}
+% \def\somefacefloat {\placesomefacefloat}
+% \def\somepagefloat {\placesomepagefloat}
+% \def\someleftpagefloat {\placesomeleftpagefloat}
+% \def\somerightpagefloat{\placesomerightpagefloat}
\protect \endinput
diff --git a/tex/context/base/strc-ini.lua b/tex/context/base/strc-ini.lua
index fa01be3f2..e4d4922f2 100644
--- a/tex/context/base/strc-ini.lua
+++ b/tex/context/base/strc-ini.lua
@@ -26,6 +26,8 @@ local type, next, tonumber, tostring = type, next, tonumber, tostring
local ctxcatcodes, xmlcatcodes = tex.ctxcatcodes, 11 -- tex.xmlcatcodes
+local trace_processors = false trackers.register("structure.processors", function(v) trace_processors = v end)
+
-- move this
commands = commands or { }
@@ -205,11 +207,16 @@ end
function processors.sprint(catcodes,str,fnc,...)
local p, s = splitter:match(str)
+ local code
if registered[p] then
- texsprint(catcodes,format("\\applyprocessor{%s}{%s}",p,(fnc and fnc(s,...)) or s))
+ code = format("\\applyprocessor{%s}{%s}",p,(fnc and fnc(s,...)) or s)
else
- texsprint(catcodes,(fnc and fnc(str,...)) or str)
+ code = (fnc and fnc(str,...)) or str
+ end
+ if trace_processors then
+ logs.report("processors","cct: %s, seq: %s",catcodes,code)
end
+ texsprint(catcodes,code)
end
function processors.apply(str)
@@ -271,6 +278,7 @@ function sets.get(namespace,block,name,level,default) -- check if name is passed
if not ds then
return default
end
+--~ print(namespace,block,name,level,ds)
local dn
if name and name ~= "" then
if block and block ~= "" then
diff --git a/tex/context/base/strc-lst.lua b/tex/context/base/strc-lst.lua
index d6559a75c..65bf8b4c7 100644
--- a/tex/context/base/strc-lst.lua
+++ b/tex/context/base/strc-lst.lua
@@ -103,7 +103,7 @@ function lists.enhance(n)
if l then
--
l.directives = nil -- might change
- -- save in the right order (happen sat shipout)
+ -- save in the right order (happens at shipout)
lists.tobesaved[#lists.tobesaved+1] = l
-- default enhancer (cross referencing)
l.references.realpage = texcount.realpageno
diff --git a/tex/context/base/strc-mat.mkiv b/tex/context/base/strc-mat.mkiv
index 097b1d710..bff243207 100644
--- a/tex/context/base/strc-mat.mkiv
+++ b/tex/context/base/strc-mat.mkiv
@@ -50,17 +50,17 @@
[\v!formula]
[\c!numberconversionset=\v!formula]
-\def\storecurrentformulanumber#1#2#3#4% ref, todo:str, \sync % todo: title etc (like float)
+\def\storecurrentformulanumber#1#2#3#4#5% ref, todo:str, \sync % todo: title etc (like float)
{\dostructurecountercomponent
{formula}%
- \getfloatparameters
+ \getformulaparameters
\formulaparameter
\detokenizedformulaparameter
\relax
\relax
\relax
[\c!name=\currentformula,\s!counter=\currentformula,%
- \s!hascaption=\v!yes,\s!hasnumber=\v!yes,\s!hastitle=\v!yes,%
+ \s!hascaption=\v!yes,\s!hasnumber=\v!yes,\s!hastitle=\v!yes,\s!haslevel=#5,%
\c!reference=#1,\c!title=,\c!bookmark=]%
[#2]%
\globallet\currentformulanumber\laststructurecounternumber
@@ -93,13 +93,13 @@
\def\dododoformulanumber#1#2#3#4% (#1,#2)=outer(ref,sub) (#3,#4)=inner(ref,sub)
{\hbox\bgroup
\ifconditional\handleformulanumber
- \ifconditional\incrementformulanumber
- \ifconditional\insidesubformulas
- \incrementsubstructurecounter[\v!formula][2]%
- \else
- \incrementstructurecounter[\v!formula]%
- \fi
- \fi
+% \ifconditional\incrementformulanumber
+% \ifconditional\insidesubformulas
+% \incrementsubstructurecounter[\v!formula][2]%
+% \else
+% \incrementstructurecounter[\v!formula]%
+% \fi
+% \fi
%
% main counter
\setbox0\hbox{\ignorespaces#2\unskip}%
@@ -111,7 +111,7 @@
\glet\currentformulasynchronize\relax
\glet\currentformulaattribute \relax
\else
- \storecurrentformulanumber\currentformulareference\empty\currentformulasynchronize\currentformulaattribute
+ \storecurrentformulanumber\currentformulareference\empty\currentformulasynchronize\currentformulaattribute1%
\fi
% subcounter
\setbox0\hbox{\ignorespaces#4\unskip}%
@@ -123,7 +123,7 @@
\glet\currentsubformulasynchronize\relax
\glet\currentsubformulaattribute \relax
\else
- \storecurrentformulanumber\currentsubformulareference\empty\currentsubformulasynchronize\currentsubformulaattribute
+ \storecurrentformulanumber\currentsubformulareference\empty\currentsubformulasynchronize\currentsubformulaattribute2%
\fi
%
\rm % nodig ?
@@ -543,13 +543,13 @@
\def\dostartsubformulas[#1]%
{\ifconditional\incrementformulanumber
- \incrementstructurecounter[\v!formula]%
+ \incrementstructurecounter[\v!formula]% ?????
\edef\subformulasreference{#1}% messy
\ifx\subformulasreference\empty
\glet\currentformulassynchronize\relax
\glet\currentformulasattribute \relax
\else
- \storecurrentformulanumber\subformulasreference\empty\currentformulassynchronize\currentformulasattribute
+ \storecurrentformulanumber\subformulasreference\empty\currentformulassynchronize\currentformulasattribute2%
\fi
\fi
\settrue\insidesubformulas}
diff --git a/tex/context/base/strc-num.lua b/tex/context/base/strc-num.lua
index bd0c4eb08..e32657019 100644
--- a/tex/context/base/strc-num.lua
+++ b/tex/context/base/strc-num.lua
@@ -11,14 +11,17 @@ local next, type = next, type
local min, max = math.min, math.max
local texsprint, texcount = tex.sprint, tex.count
+local trace_counters = false trackers.register("structure.counters", function(v) trace_counters = v end)
+
structure = structure or { }
structure.helpers = structure.helpers or { }
structure.sections = structure.sections or { }
structure.counters = structure.counters or { }
structure.documents = structure.documents or { }
-structure.counters = structure.counters or { }
-structure.counters.data = structure.counters.data or { }
+structure.counters = structure.counters or { }
+structure.counters.data = structure.counters.data or { }
+structure.counters.specials = structure.counters.specials or { }
local helpers = structure.helpers
local sections = structure.sections
@@ -31,6 +34,7 @@ local variables = interfaces.variables
local counterdata = counters.data
local counterranges, tbs = { }, 0
+local counterspecials = counters.specials
counters.collected = counters.collected or { }
counters.tobesaved = counters.tobesaved or { }
@@ -120,6 +124,7 @@ local function allocate(name,i)
if not cd then
cd = {
level = 1,
+--~ block = "", -- todo
numbers = nil,
state = variables.start, -- true
data = { }
@@ -154,14 +159,18 @@ function counters.record(name,i)
end
local function savevalue(name,i)
- local cd = counterdata[name].data[i]
- local cs = tobesaved[name][i]
- local cc = collected[name]
- local cr = cd.range
- local old = (cc and cc[i] and cc[i][cr]) or 0
- cs[cr] = cd.number
- cd.range = cr + 1
- return old
+ if name then
+ local cd = counterdata[name].data[i]
+ local cs = tobesaved[name][i]
+ local cc = collected[name]
+ local cr = cd.range
+ local old = (cc and cc[i] and cc[i][cr]) or 0
+ cs[cr] = cd.number
+ cd.range = cr + 1
+ return old
+ else
+ return 0
+ end
end
function counters.define(name, start, counter) -- todo: step
@@ -259,6 +268,24 @@ function counters.setoffset(name,value)
counters.setvalue(name,"offset",value)
end
+
+local function synchronize(name,d)
+ local dc = d.counter
+ if dc then
+ if trace_counters then
+ logs.report("counters","setting counter %s with name %s to %s",dc,name,d.number)
+ end
+ tex.setcount("global",dc,d.number)
+ end
+ local cs = counterspecials[name]
+ if cs then
+ if trace_counters then
+ logs.report("counters","invoking special for name %s",name)
+ end
+ cs()
+ end
+end
+
function counters.reset(name,n)
local cd = counterdata[name]
if cd then
@@ -267,7 +294,8 @@ function counters.reset(name,n)
savevalue(name,i)
d.number = d.start or 0
d.own = nil
- if d.counter then texcount[d.counter] = d.number end
+--~ print("\n",name,d.number)
+ synchronize(name,d)
end
cd.numbers = nil
end
@@ -279,7 +307,7 @@ function counters.set(name,n,value)
local d = allocate(name,n)
d.number = value or 0
d.own = nil
- if d.counter then texcount[d.counter] = d.number end
+ synchronize(name,d)
end
end
@@ -289,7 +317,7 @@ local function check(name,data,start,stop)
savevalue(name,i)
d.number = d.start or 0
d.own = nil
- if d.counter then texcount[d.counter] = d.number end
+ synchronize(name,d)
end
end
@@ -299,10 +327,15 @@ function counters.setown(name,n,value)
local d = allocate(name,n)
d.own = value
d.number = (d.number or d.start or 0) + (d.step or 0)
- if cd.level and cd.level > 0 then -- 0 is signal that we reset manually
- check(name,data,n+1) -- where is check defined
+ local level = cd.level
+ if not level or level == -1 then
+ -- -1 is signal that we reset manually
+ elseif level > 0 then
+ check(name,d,n+1)
+ elseif level == 0 then
+ -- happens elsewhere
end
- if d.counter then texcount[d.counter] = d.number end
+ synchronize(name,d)
end
end
@@ -339,20 +372,29 @@ function counters.add(name,n,delta)
local data = cd.data
local d = allocate(name,n)
d.number = (d.number or d.start or 0) + delta*(d.step or 0)
- if cd.level and cd.level > 0 then -- 0 is signal that we reset manually
+ local level = cd.level
+ if not level or level == -1 then
+ -- -1 is signal that we reset manually
+ elseif level > 0 then
+ -- within countergroup
check(name,data,n+1)
+ elseif level == 0 then
+ -- happens elsewhere
end
- if d.counter then texcount[d.counter] = d.number end
- return d.number
+ synchronize(name,d)
+ return d.number -- not needed
end
return 0
end
-function counters.check(level)
- for _, v in next, counterdata do
- if v.level == level then -- is level for whole counter!
- local data = v.data
- check(name,data)
+function counters.check(level) -- not used (yet)
+ for name, cd in next, counterdata do
+ -- logs.report("counters","%s %s %s",name,cd.level,level)
+ if cd.level == level then
+ if trace_counters then
+ logs.report("counters","resetting %s at level %s",name,level)
+ end
+ counters.reset(name)
end
end
end
diff --git a/tex/context/base/strc-num.mkiv b/tex/context/base/strc-num.mkiv
index b839d3656..3ea666290 100644
--- a/tex/context/base/strc-num.mkiv
+++ b/tex/context/base/strc-num.mkiv
@@ -232,7 +232,7 @@
separatorset = "\structurecounterparameter{#1}\c!prefixseparatorset",
conversion = "\structurecounterparameter{#1}\c!prefixconversion",
conversionset = "\structurecounterparameter{#1}\c!prefixconversionset",
- stopper = \!!bs\structurecounterparameter{#1}\c!prefixstopper\!!es,
+ % stopper = \!!bs\structurecounterparameter{#1}\c!prefixstopper\!!es,
set = "\structurecounterparameter{#1}\c!prefixset",
segments = "\structurecounterparameter{#1}\c!prefixsegments",
connector = \!!bs\structurecounterparameter{#1}\c!prefixconnector\!!es,
@@ -347,10 +347,11 @@
\def\dostructurecountercomponent#1#2#3#4#5#6#7[#8][#9]%
{\begingroup
%
- #2[#8]%
+ #2[\s!haslevel=1,#8]%
\edef\hasstructurecountercaption{#3\s!hascaption}%
- \edef\hasstructurecountertitle{#3\s!hastitle}%
- \edef\hasstructurecounternumber{#3\s!hasnumber}%
+ \edef\hasstructurecountertitle {#3\s!hastitle}%
+ \edef\hasstructurecounternumber {#3\s!hasnumber}%
+ \edef\hasstructurecounterlevel {#3\s!haslevel}%
%
\edef\currentname{#3\c!name}%
\ifx\currentname\empty
@@ -364,7 +365,7 @@
\doif{#3\c!title}\v!none{\setfalse\hasstructurecountercaption\setfalse\hasstructurecounternumber}% will become obsolete
%
\ifx\hasstructurecounternumber\v!yes
- \incrementstructurecounter[\currentcounter]%
+ \doincrementsubstructurecounter[\currentcounter][\hasstructurecounterlevel]%
\fi
%
\ifx\hasstructurecountercaption\v!yes
diff --git a/tex/context/base/strc-pag.lua b/tex/context/base/strc-pag.lua
index a8e2ce0d6..564961191 100644
--- a/tex/context/base/strc-pag.lua
+++ b/tex/context/base/strc-pag.lua
@@ -11,6 +11,8 @@ local texcount, format = tex.count, string.format
local ctxcatcodes = tex.ctxcatcodes
local texsprint, texwrite = tex.sprint, tex.write
+local trace_counters = false trackers.register("structure.counters", function(v) trace_counters = v end)
+
structure.pages = structure.pages or { }
local helpers = structure.helpers or { }
@@ -35,49 +37,69 @@ end
job.register('jobpages.collected', jobpages.tobesaved, initializer)
-local specification = { }
+local specification = { } -- to be checked
-function pages.save(userspec)
+function pages.save(prefixdata,numberdata)
local realpage, userpage = texcount.realpageno, texcount.userpageno
- local data = {
- number = userpage,
- specification = helpers.simplify(userspec or specification),
- block = sections.currentblock(),
- }
- tobesaved[realpage] = data
- if not collected[realpage] then
- collected[realpage] = data
+ if realpage > 0 then
+ if trace_counters then
+ logs.report("counters","saving page %s.%s",realpage,userpage)
+ end
+ local data = {
+ number = userpage,
+ block = sections.currentblock(),
+ prefixdata = prefixdata and helpers.simplify(prefixdata),
+ numberdata = numberdata and helpers.simplify(numberdata),
+ }
+ tobesaved[realpage] = data
+ if not collected[realpage] then
+ collected[realpage] = data
+ end
+ elseif trace_counters then
+ logs.report("counters","not saving page %s.%s",realpage,userpage)
end
end
-function pages.pagenumber(localspec)
- local deltaspec
- if localspec then
- for k,v in next, localspec do
- if v ~= "" and v ~= specification[k] then
- if not deltaspec then deltaspec = { } end
- deltaspec[k] = v
+function structure.counters.specials.userpage()
+ local r = texcount.realpageno
+ if r > 0 then
+ local t = tobesaved[r]
+ if t then
+ t.number = texcount.userpageno
+ if trace_counters then
+ logs.report("counters","forcing pagenumber of realpage %s to %s",r,t.number)
end
end
end
- if deltaspec then
- return { realpage = texcount.realpageno, specification = deltaspec }
- else
- return { realpage = texcount.realpageno }
- end
end
---
+--~ function pages.pagenumber(localspec)
+--~ local deltaspec
+--~ if localspec then
+--~ for k,v in next, localspec do
+--~ if v ~= "" and v ~= specification[k] then
+--~ if not deltaspec then deltaspec = { } end
+--~ deltaspec[k] = v
+--~ end
+--~ end
+--~ end
+--~ if deltaspec then
+--~ return { realpage = texcount.realpageno, specification = deltaspec }
+--~ else
+--~ return { realpage = texcount.realpageno }
+--~ end
+--~ end
local function convertnumber(str,n)
return format("\\convertnumber{%s}{%s}",str or "numbers",n)
end
-function pages.number(realdata,pagespecification)
- local userpage, block = realdata.number, realdata.block or ""
- local conversionset = (pagespecification and pagespecification.conversionset) or realdata.conversionset or ""
- local conversion = (pagespecification and pagespecification.conversion ) or realdata.conversion or ""
- local stopper = (pagespecification and pagespecification.stopper ) or realdata.stopper or ""
+function pages.number(realdata,pagespec)
+ local userpage, block = realdata.number, realdata.block or "" -- sections.currentblock()
+ local numberspec = realdata.numberdata
+ local conversionset = (pagespec and pagespec.conversionset and pagespec.conversionset ~= "") or (numberspec and numberspec.conversionset ~= "" and numberspec.conversionset) or ""
+ local conversion = (pagespec and pagespec.conversion and pagespec.conversion ~= "") or (numberspec and numberspec.conversion ~= "" and numberspec.conversion ) or ""
+ local stopper = (pagespec and pagespec.stopper and pagespec.stopper ~= "") or (numberspec and numberspec.stopper ~= "" and numberspec.stopper ) or ""
if conversion ~= "" then
texsprint(ctxcatcodes,format("\\convertnumber{%s}{%s}",conversion,number))
else
@@ -119,11 +141,11 @@ function pages.analyse(entry,pagespecification)
return pagedata, false, "current spec blocks prefix"
end
-- stored preferences
- if entry.prefix == no then
- return pagedata, false, "entry blocks prefix"
- end
+--~ if entry.prefix == no then
+--~ return pagedata, false, "entry blocks prefix"
+--~ end
-- stored page state
- pagespecification = pagedata.specification
+ pagespecification = pagedata.prefixdata
if pagespecification and pagespecification.prefix == no then
return pagedata, false, "pagedata blocks prefix"
end
@@ -143,10 +165,9 @@ end
function helpers.prefixpage(data,prefixspec,pagespec)
if data then
local pagedata, prefixdata, e = pages.analyse(data,pagespec)
---~ tex.write(e)
if pagedata then
if prefixdata then
- sections.typesetnumber(prefixdata,"prefix",prefixspec or false,prefixdata or false,pagedata.specification or false)
+ sections.typesetnumber(prefixdata,"prefix",prefixspec or false,prefixdata or false,pagedata.prefixdata or false)
end
pages.number(pagedata,pagespec)
end
diff --git a/tex/context/base/strc-pag.mkiv b/tex/context/base/strc-pag.mkiv
index 276cf8b78..192972d87 100644
--- a/tex/context/base/strc-pag.mkiv
+++ b/tex/context/base/strc-pag.mkiv
@@ -55,9 +55,29 @@
% prefixset=mine,
% prefixseparatorset=mine]
-\definestructurecounter[\s!realpage][\c!prefix=\v!no,\c!start=1,\c!prefixsegments=] % \c!counter=realpage
-\definestructurecounter[\s!userpage][\c!prefix=\v!no,\c!start=1,\c!prefixsegments=] % \c!counter=userpage
-\definestructurecounter[\s!subpage] [\c!prefix=\v!no,\c!start=1,\c!prefixsegments=] % \c!counter=subpage
+% \definestructureconversionset[frontpart:pagenumber][][romannumerals]
+% \definestructureconversionset[bodypart:pagenumber] [][numbers]
+%
+% \setupuserpagenumber[way=byblock]
+% \setupuserpagenumber[way=bychapter]
+% \setupuserpagenumber[numberconversionset=pagenumber]
+%
+% \starttext
+% \startfrontmatter
+% \completecontent[criterium=all]
+% \chapter{tufte} \section{one} \input tufte \page \section{two} \input tufte \page
+% \chapter{tufte} \section{one} \input tufte \page \section{two} \input tufte \page
+% \stopfrontmatter
+% \startbodymatter
+% \chapter{knuth} \section{one} \input knuth \page \section{two} \input knuth \page \section{three} \input knuth \page
+% \chapter{knuth} \section{one} \input knuth \page \section{two} \input knuth \page \section{three} \input knuth \page
+% \stopbodymatter
+% \stoptext
+
+
+\definestructurecounter[\s!realpage][\c!prefix=\v!no,\c!start=1,\c!prefixsegments=,\s!counter=realpageno]
+\definestructurecounter[\s!userpage][\c!prefix=\v!no,\c!start=1,\c!prefixsegments=,\s!counter=userpageno]
+\definestructurecounter[\s!subpage] [\c!prefix=\v!no,\c!start=1,\c!prefixsegments=,\s!counter=subpageno]
\newtoks\everysetuprealpagenumber % todo: set state: none, start, stop, reset
\newtoks\everysetupuserpagenumber % todo: set state: none, start, stop, reset
@@ -86,17 +106,21 @@
\let\setuppagenumber\setupuserpagenumber
\let\resetpagenumber\resetuserpagenumber
-\def\savecurrentpagestate
- {\ctxlua{structure.pages.save {
+\def\savecurrentpagestate % \normalexpanded?
+ {\ctxlua{structure.pages.save({
prefix = "\structurecounterparameter\s!userpage\c!prefix",
separatorset = "\structurecounterparameter\s!userpage\c!prefixseparatorset",
conversion = "\structurecounterparameter\s!userpage\c!prefixconversion",
conversionset = "\structurecounterparameter\s!userpage\c!prefixconversionset",
set = "\structurecounterparameter\s!userpage\c!prefixset",
- stopper = \!!bs\structurecounterparameter\s!userpage\c!prefixstopper\!!es,
segments = "\structurecounterparameter\s!userpage\c!prefixsegments",
connector = \!!bs\structurecounterparameter\s!userpage\c!prefixconnector\!!es,
- }}}
+ },{
+ conversion = "\structurecounterparameter\s!userpage\c!numberconversion",
+ conversionset = "\structurecounterparameter\s!userpage\c!numberconversionset",
+ stopper = \!!bs\structurecounterparameter\s!userpage\c!numberstopper\!!es,
+ }
+ )}}
\prependtoks
\savecurrentpagestate
diff --git a/tex/context/base/strc-ref.lua b/tex/context/base/strc-ref.lua
index db2a8d25a..a0f95def2 100644
--- a/tex/context/base/strc-ref.lua
+++ b/tex/context/base/strc-ref.lua
@@ -909,7 +909,13 @@ filters.section.title = filters.generic.title
filters.section.page = filters.generic.page
filters.section.default = filters.section.number
---~ filters.float = { }
+filters.formula = {}
+
+filters.formula.default = filters.section.number
+
+filters.float = { }
+
+filters.float.default = filters.section.number
--~ filters.float.title = filters.generic.title
--~ filters.float.number = filters.generic.number
diff --git a/tex/context/base/strc-ref.mkiv b/tex/context/base/strc-ref.mkiv
index c3c07964a..5b2045fb8 100644
--- a/tex/context/base/strc-ref.mkiv
+++ b/tex/context/base/strc-ref.mkiv
@@ -1219,7 +1219,7 @@
\begingroup
\dosetfontattribute\??ur\c!style
\dosetcolorattribute\??ur\c!color
- \ctxlua{jobreferences.urls.get("#1","\@@uralternative","\@@urspace")}%
+ \hyphenatedurl{\ctxlua{jobreferences.urls.get("#1","\@@uralternative","\@@urspace")}}%
\endgroup}
%D This macro is hooked into a support macro, and thereby
@@ -1272,10 +1272,10 @@
\def\dofromurl#1%
{\dosetfontattribute \??ur\c!style
\dosetcolorattribute\??ur\c!color
- #1}
+ \hyphenatedurl{#1}}
\def\dofromfile#1%
- {#1}
+ {\hyphenatedurl{#1}}
%D We also support:
%D
diff --git a/tex/context/base/strc-reg.lua b/tex/context/base/strc-reg.lua
index 06e7ff916..6c7c26efe 100644
--- a/tex/context/base/strc-reg.lua
+++ b/tex/context/base/strc-reg.lua
@@ -382,6 +382,7 @@ end
function jobregisters.analysed(class,options)
local data = collected[class]
if data and data.entries then
+ options = options or { }
sorters.language = options.language or sorters.defaultlanguage
jobregisters.filter(data,options) -- filter entries into results (criteria)
jobregisters.prepare(data,options) -- adds split table parallel to list table
diff --git a/tex/context/base/strc-reg.mkiv b/tex/context/base/strc-reg.mkiv
index a4892ad4f..5de28c394 100644
--- a/tex/context/base/strc-reg.mkiv
+++ b/tex/context/base/strc-reg.mkiv
@@ -321,7 +321,7 @@
\xdef\currentregistersynchronize{\ctxlatelua{jobregisters.enhance("\currentregister",\currentregisternumber)}}%
\fi
\currentregistersynchronize % here?
- \attribute\destinationattribute\lastdestinationattribute \strut % todo
+ \attribute\destinationattribute\lastdestinationattribute \forcecolorhack % no \strut as it will be removed during cleanup
\endgroup}
\def\doregister[#1][#2]%
@@ -499,7 +499,14 @@
{\dodoubleempty\dodetermineregistercharacteristics}
\def\dodetermineregistercharacteristics[#1][#2]%
- {\edef\utilityregisterlength{\ctxlua{jobregisters.analyse('\currentregister')}}%
+ {\begingroup
+ \edef\currentregister{#1}%
+ \setupregister[\currentregister][#2]%
+ \normalexpanded{\endgroup\noexpand\xdef\noexpand\utilityregisterlength{\ctxlua{jobregisters.analyse('\currentregister',{
+ language = "\registerparameter\s!language",
+ compress = "\registerparameter\c!compress",
+ criterium = "\registerparameter\c!criterium",
+ })}}}% brrr
\ifcase\utilityregisterlength\relax
\resetsystemmode\v!register
\else
diff --git a/tex/context/base/strc-sbe.mkiv b/tex/context/base/strc-sbe.mkiv
index 7db3cedb0..7b13e860b 100644
--- a/tex/context/base/strc-sbe.mkiv
+++ b/tex/context/base/strc-sbe.mkiv
@@ -78,7 +78,8 @@
\let\currentstructureblock\s!unknown
\def\startstructureblock[#1]%
- {\begingroup
+ {%\ctxlua{structure.counters.check(0)}% we assume sane usage of \page, as this is the only workable place (in push)
+ \begingroup
\edef\currentstructureblock{\ctxlua{structure.sections.pushblock("#1")}}%
\csname #1true\endcsname % for old times sake
\setsystemmode\currentstructureblock
diff --git a/tex/context/base/strc-sec.mkiv b/tex/context/base/strc-sec.mkiv
index 507efc41c..200ff56f2 100644
--- a/tex/context/base/strc-sec.mkiv
+++ b/tex/context/base/strc-sec.mkiv
@@ -102,7 +102,9 @@
\fi}
\def\structuresectionlevel#1%
- {\executeifdefined{\??nh#1\c!level}0}
+ {\executeifdefined{\??nh#1\c!level}{-1}}
+
+\setvalue{\??nh block\c!level}{0} % -1 == manual
% head -> structurehead
diff --git a/tex/context/base/supp-num.tex b/tex/context/base/supp-num.tex
index 130fd3938..d192ab548 100644
--- a/tex/context/base/supp-num.tex
+++ b/tex/context/base/supp-num.tex
@@ -195,23 +195,25 @@
%D Although we could do with one pass, a second pass for
%D handling the stored sequence is more readable.
-\startmode[mkiv]
+\ifnum\texengine=\luatexengine
\def\dohandledigits
- {\mathcode`\,="003B \mathcode`\.="003A % pretty hard coded
+ {\mathcode`\,="002C \mathcode`\.="002E % pretty hard coded
\expandafter\handletokens\collecteddigits\with\scandigits
\ifcase\powerdigits\else\digitpowerseparator^{\savedpowerdigits}\fi}
-\stopmode
+ \chardef\mathaxisfontid\zerocount
-\startnotmode[mkiv]
+\else
\def\dohandledigits
{\mathcode`\,="013B \mathcode`\.="013A % pretty hard coded
\expandafter\handletokens\collecteddigits\with\scandigits
\ifcase\powerdigits\else\digitpowerseparator^{\savedpowerdigits}\fi}
-\stopnotmode
+ \chardef\mathaxisfontid\plustwo
+
+\fi
\def\doscandigit#1%
{\ifcase\skipdigit\@EA\hbox\else\@EA\hphantom\fi\bgroup
@@ -230,7 +232,6 @@
\fi}%
\egroup}
-
%D The signs can be made smaller and sqeezed into the width
%D of a digit. Watch the \type {\mathaxisheight} trickery (this
%D font related register stored the math axis).
@@ -317,9 +318,9 @@
{\ifcase\digitsignmode#1\else
\hbox
{\setbox\scratchbox\hbox{0}%
- \scratchdimen\mathaxisheight\textfont2
+ \scratchdimen\mathaxisheight\textfont\mathaxisfontid
\def\digitsgn##1##2%
- {\advance\scratchdimen-\mathaxisheight##12
+ {\advance\scratchdimen-\mathaxisheight##1\mathaxisfontid
\raise\scratchdimen
\hbox to \wd\scratchbox{\hss$##2#1$\hss}}%
\ifcase\digitsignmode\or
@@ -390,7 +391,7 @@
%D
%D We also permit:
-\let\Digits=\digits
+\let\Digits\digits
%D These macros are complicated by the fact that we also
%D have to support cases like:
@@ -435,8 +436,8 @@
\handletokens#1\with\scandigittemplate}
\def\scandigittemplate#1%
- {\if #1.\ifcase\digitinputmode\chardef\digitinputmode1 \fi% period
- \else\if#1,\ifcase\digitinputmode\chardef\digitinputmode2 \fi% comma
+ {\if #1.\ifcase\digitinputmode\chardef\digitinputmode\plusone \fi% period
+ \else\if#1,\ifcase\digitinputmode\chardef\digitinputmode\plustwo \fi% comma
\fi\fi}
\protect \endinput
diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv
index 3873bf326..513f1c5e8 100644
--- a/tex/context/base/syst-aux.mkiv
+++ b/tex/context/base/syst-aux.mkiv
@@ -4135,7 +4135,7 @@
% {\long\def\AfterGroup{#2\egroup}%
% \bgroup\aftergroup\AfterGroup#1}
-\long\def\HandleNoGroup % retrofit into mkii
+\def\HandleNoGroup % retrofit into mkii
{\ifnum\currentgrouptype=\@@semisimplegroup
\expandafter\HandleNoGroupA
\else
diff --git a/tex/context/base/tabl-tab.mkiv b/tex/context/base/tabl-tab.mkiv
index 429f41add..1b83d4dd8 100644
--- a/tex/context/base/tabl-tab.mkiv
+++ b/tex/context/base/tabl-tab.mkiv
@@ -1296,11 +1296,11 @@
\letvalue{\e!stop \v!tabletail}=\undefined
\expanded
- {\def\csname\e!start\v!tablehead\endcsname##1\csname\e!stop\v!tablehead\endcsname%
+ {\long\def\csname\e!start\v!tablehead\endcsname##1\csname\e!stop\v!tablehead\endcsname%
{\noexpand\setTABLEhead##1\noexpand\end}}
\expanded
- {\def\csname\e!start\v!tabletail\endcsname##1\csname\e!stop\v!tabletail\endcsname%
+ {\long\def\csname\e!start\v!tabletail\endcsname##1\csname\e!stop\v!tabletail\endcsname%
{\noexpand\setTABLEtail##1\noexpand\end}}
%D The second argument is a dummy one, by scanning for it, we
@@ -1312,8 +1312,8 @@
\newconditional\preventTABLEbreak
\newconditional\someTABLEhead
-\def\dosetTABLEhead[#1][#2]#3\end{\setvalue{@@TABLEhead#1}{\TABLEnoalign{\global\settrue\someTABLEhead}#3}}
-\def\dosetTABLEtail[#1][#2]#3\end{\setvalue{@@TABLEtail#1}{\TABLEnoalign{\global\settrue\someTABLEtail}#3}}
+\long\def\dosetTABLEhead[#1][#2]#3\end{\setvalue{@@TABLEhead#1}{\TABLEnoalign{\global\settrue\someTABLEhead}#3}}
+\long\def\dosetTABLEtail[#1][#2]#3\end{\setvalue{@@TABLEtail#1}{\TABLEnoalign{\global\settrue\someTABLEtail}#3}}
%D Redudant \type{\HL}'s are removed automatically, so
%D mid||lines can be used without problems.
diff --git a/tex/context/base/tabl-tsp.mkiv b/tex/context/base/tabl-tsp.mkiv
index 49bb7ad90..7e680ed5d 100644
--- a/tex/context/base/tabl-tsp.mkiv
+++ b/tex/context/base/tabl-tsp.mkiv
@@ -29,7 +29,9 @@
% \splitfloat [settings] {\placetable[optional args]{test}} {content}
-\definenumber
+% \def\s!noftablesplits{nofsplittables}
+
+\definenumber % we need a nicer name like nofsplittables, we then also need to set \s!parent
[\??si]
[\c!way=\v!by\v!text,
\c!conversion=\@@siconversion]
diff --git a/tex/context/base/x-ldx.tex b/tex/context/base/x-ldx.tex
index 140413e7d..750529649 100644
--- a/tex/context/base/x-ldx.tex
+++ b/tex/context/base/x-ldx.tex
@@ -29,12 +29,12 @@
\startxmlsetups ldx:variable
\xmlflush{#1}
- \expanded{\variable{\xmlflush{#1}}}
+% \expanded{\variable{\xmlflush{#1}}}
\stopxmlsetups
\startxmlsetups ldx:function
\dontleavehmode{\bf function}\space\xmlflush{#1}
- \expanded{\function{\xmlflush{#1}}}
+% \expanded{\function{\xmlflush{#1}}}
\stopxmlsetups
\startxmlsetups ldx:com
@@ -78,7 +78,7 @@
\startxmlsetups ldx:code
\startpacked
- \xmlflush{#1}
+ \xmlflush{#1}\relax
\stoppacked
\stopxmlsetups
@@ -94,7 +94,7 @@
} {
\dontleavehmode \hbox to \hsize \bgroup
\strut
- \hskip.25\dimexpr\xmlattdef{#1}{n}{0}em\relax
+ \hskip.25\dimexpr\xmlattdef{#1}{n}{0}em\relax\relax % extra relax needed !
\xmldoif {\xmlatt{#1}{comment}} {yes} {\tt}
\xmlflush{#1}
\hss
@@ -188,4 +188,3 @@
topspace=2cm]
\endinput
-
diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml
index b4f30ced6..d2183128b 100644
--- a/tex/context/interface/keys-en.xml
+++ b/tex/context/interface/keys-en.xml
@@ -423,7 +423,7 @@
<cd:variable name='stopper' value='stopper'/>
<cd:variable name='stretch' value='stretch'/>
<cd:variable name='strict' value='strict'/>
- <cd:variable name='strong' value='sterk'/>
+ <cd:variable name='strong' value='strong'/>
<cd:variable name='strut' value='strut'/>
<cd:variable name='sub' value='sub'/>
<cd:variable name='subbackward' value='subbackward'/>
@@ -490,7 +490,7 @@
<cd:variable name='very' value='very'/>
<cd:variable name='verystrict' value='verystrict'/>
<cd:variable name='verytolerant' value='verytolerant'/>
- <cd:variable name='weak' value='zwak'/>
+ <cd:variable name='weak' value='weak'/>
<cd:variable name='wednesday' value='wednesday'/>
<cd:variable name='week' value='week'/>
<cd:variable name='weekday' value='weekday'/>
diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml
index de0462f71..8f217ffbb 100644
--- a/tex/context/interface/keys-nl.xml
+++ b/tex/context/interface/keys-nl.xml
@@ -423,7 +423,7 @@
<cd:variable name='stopper' value='afsluiter'/>
<cd:variable name='stretch' value='rek'/>
<cd:variable name='strict' value='streng'/>
- <cd:variable name='strong' value='strong'/>
+ <cd:variable name='strong' value='sterk'/>
<cd:variable name='strut' value='strut'/>
<cd:variable name='sub' value='sub'/>
<cd:variable name='subbackward' value='subachteruit'/>
@@ -490,7 +490,7 @@
<cd:variable name='very' value='zeer'/>
<cd:variable name='verystrict' value='zeerstreng'/>
<cd:variable name='verytolerant' value='zeersoepel'/>
- <cd:variable name='weak' value='weak'/>
+ <cd:variable name='weak' value='zwak'/>
<cd:variable name='wednesday' value='woensdag'/>
<cd:variable name='week' value='week'/>
<cd:variable name='weekday' value='weekdag'/>
diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua
index ccb86d261..ad4c1896b 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 : 08/30/09 12:27:16
+-- merge date : 09/09/09 14:33:34
do -- begin closure to overcome local limits and interference