summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/context-version.pdfbin4176 -> 4173 bytes
-rw-r--r--tex/context/base/mkiv/char-ini.mkiv5
-rw-r--r--tex/context/base/mkiv/cldf-ini.lua253
-rw-r--r--tex/context/base/mkiv/cldf-scn.lua2
-rw-r--r--tex/context/base/mkiv/colo-ini.mkiv2
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv3
-rw-r--r--tex/context/base/mkiv/core-con.lua19
-rw-r--r--tex/context/base/mkiv/core-env.lua6
-rw-r--r--tex/context/base/mkiv/font-ctx.lua2
-rw-r--r--tex/context/base/mkiv/font-otn.lua2
-rw-r--r--tex/context/base/mkiv/font-ots.lua4
-rw-r--r--tex/context/base/mkiv/font-syn.lua2
-rw-r--r--tex/context/base/mkiv/grph-rul.lua143
-rw-r--r--tex/context/base/mkiv/grph-rul.mkiv39
-rw-r--r--tex/context/base/mkiv/lang-url.mkiv1
-rw-r--r--tex/context/base/mkiv/lpdf-ano.lua129
-rw-r--r--tex/context/base/mkiv/luat-cnf.lua2
-rw-r--r--tex/context/base/mkiv/lxml-ini.lua5
-rw-r--r--tex/context/base/mkiv/lxml-ini.mkiv4
-rw-r--r--tex/context/base/mkiv/lxml-tab.lua43
-rw-r--r--tex/context/base/mkiv/lxml-tex.lua69
-rw-r--r--tex/context/base/mkiv/mlib-pdf.lua24
-rw-r--r--tex/context/base/mkiv/mlib-pps.lua6
-rw-r--r--tex/context/base/mkiv/mlib-run.lua39
-rw-r--r--tex/context/base/mkiv/mult-low.lua4
-rw-r--r--tex/context/base/mkiv/mult-prm.lua2
-rw-r--r--tex/context/base/mkiv/node-aux.lua18
-rw-r--r--tex/context/base/mkiv/node-res.lua18
-rw-r--r--tex/context/base/mkiv/node-rul.lua147
-rw-r--r--tex/context/base/mkiv/node-rul.mkiv51
-rw-r--r--tex/context/base/mkiv/page-brk.mkiv23
-rw-r--r--tex/context/base/mkiv/publ-imp-apa.mkvi4
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin9092 -> 9068 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin265380 -> 266580 bytes
-rw-r--r--tex/context/base/mkiv/strc-flt.mkvi4
-rw-r--r--tex/context/base/mkiv/strc-ref.lua20
-rw-r--r--tex/context/base/mkiv/strc-ref.mkvi50
-rw-r--r--tex/context/base/mkiv/syst-aux.mkiv32
-rw-r--r--tex/context/base/mkiv/syst-ini.mkiv3
-rw-r--r--tex/context/base/mkiv/toks-ini.lua40
-rw-r--r--tex/context/base/mkiv/toks-tra.lua24
-rw-r--r--tex/context/base/mkiv/trac-tex.lua4
-rw-r--r--tex/context/base/mkiv/typo-brk.lua1
-rw-r--r--tex/context/interface/common/i-en-xml.xml12
-rw-r--r--tex/context/modules/mkiv/x-mathml.mkiv2
-rw-r--r--tex/generic/context/luatex/luatex-fonts-def.lua2
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua6
-rw-r--r--tex/generic/context/luatex/luatex-test.tex18
49 files changed, 1002 insertions, 289 deletions
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index 45f21e293..073cf0ee3 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/char-ini.mkiv b/tex/context/base/mkiv/char-ini.mkiv
index 28bfbc1cf..fd531f132 100644
--- a/tex/context/base/mkiv/char-ini.mkiv
+++ b/tex/context/base/mkiv/char-ini.mkiv
@@ -45,7 +45,10 @@
\def\utfchar #1{\clf_utfchar \numexpr#1\relax}
\def\safechar#1{\clf_safechar\numexpr#1\relax}
-\unexpanded\def\Ux#1{\Uchar"#1\relax} % used in xml
+\unexpanded\def\Ux #1{\Uchar\numexpr"#1\relax} % used in xml
+ \def\eUx#1{\Uchar\numexpr"#1\relax} % used in xml
+
+\unexpanded\def\expandUx{\let\Ux\eUx}
\def\checkedchar {\relax\ifmmode\expandafter\checkedmathchar\else\expandafter\checkedtextchar\fi} % #1#2
\def\checkedmathchar#1#2{#2}
diff --git a/tex/context/base/mkiv/cldf-ini.lua b/tex/context/base/mkiv/cldf-ini.lua
index c6cc39abc..c6e734e73 100644
--- a/tex/context/base/mkiv/cldf-ini.lua
+++ b/tex/context/base/mkiv/cldf-ini.lua
@@ -6,7 +6,8 @@ if not modules then modules = { } end modules ['cldf-ini'] = {
license = "see context related readme files"
}
--- see cldf-tod.* !
+-- also see cldf-tod.* !
+-- old code moved to cldf-old.lua
-- maybe:
--
@@ -704,18 +705,21 @@ end
local containseol = patterns.containseol
-local writer
+local writer = nil
+local prtwriter = nil
-- if luafunctions then
- writer = function (parent,command,first,...) -- already optimized before call
- local t = { first, ... }
+ writer = function (parent,command,...) -- already optimized before call
flush(currentcatcodes,command) -- todo: ctx|prt|texcatcodes
local direct = false
- for i=1,#t do
- local ti = t[i]
- local typ = type(ti)
+ -- local t = { ... }
+ -- for i=1,#t do
+ -- local ti = t[i]
+ for i=1,select("#",...) do
+ local ti = (select(i,...))
if direct then
+ local typ = type(ti)
if typ == "string" or typ == "number" then
flush(currentcatcodes,ti)
else -- node.write
@@ -726,93 +730,124 @@ local writer
-- nothing
elseif ti == "" then
flush(currentcatcodes,"{}")
- elseif typ == "string" then
- -- is processelines seen ?
- if processlines and lpegmatch(containseol,ti) then
- flush(currentcatcodes,"{")
- local flushlines = parent.__flushlines or flushlines
- flushlines(ti)
- flush(currentcatcodes,"}")
- elseif currentcatcodes == contentcatcodes then
+ else
+ local typ = type(ti)
+ if typ == "string" then
+ -- is processlines seen ?
+ if processlines and lpegmatch(containseol,ti) then
+ flush(currentcatcodes,"{")
+ local flushlines = parent.__flushlines or flushlines
+ flushlines(ti)
+ flush(currentcatcodes,"}")
+ elseif currentcatcodes == contentcatcodes then
+ flush(currentcatcodes,"{",ti,"}")
+ else
+ flush(currentcatcodes,"{")
+ flush(contentcatcodes,ti)
+ flush(currentcatcodes,"}")
+ end
+ elseif typ == "number" then
+ -- numbers never have funny catcodes
flush(currentcatcodes,"{",ti,"}")
- else
- flush(currentcatcodes,"{")
- flush(contentcatcodes,ti)
- flush(currentcatcodes,"}")
- end
- elseif typ == "number" then
- -- numbers never have funny catcodes
- flush(currentcatcodes,"{",ti,"}")
- elseif typ == "table" then
- local tn = #ti
- if tn == 0 then
- local done = false
- for k, v in next, ti do
- if done then
- if v == "" then
- flush(currentcatcodes,",",k,'=')
+ elseif typ == "table" then
+ local tn = #ti
+ if tn == 0 then
+ local done = false
+ for k, v in next, ti do
+ if done then
+ if v == "" then
+ flush(currentcatcodes,",",k,'=')
+ else
+ flush(currentcatcodes,",",k,"={",v,"}")
+ end
else
- flush(currentcatcodes,",",k,"={",v,"}")
+ if v == "" then
+ flush(currentcatcodes,"[",k,"=")
+ else
+ flush(currentcatcodes,"[",k,"={",v,"}")
+ end
+ done = true
end
+ end
+ if done then
+ flush(currentcatcodes,"]")
else
- if v == "" then
- flush(currentcatcodes,"[",k,"=")
- else
- flush(currentcatcodes,"[",k,"={",v,"}")
- end
- done = true
+ flush(currentcatcodes,"[]")
end
- end
- if done then
- flush(currentcatcodes,"]")
- else
- flush(currentcatcodes,"[]")
- end
- elseif tn == 1 then -- some 20% faster than the next loop
- local tj = ti[1]
- if type(tj) == "function" then
- flush(currentcatcodes,"[\\cldl",storefunction(tj),"]")
- -- flush(currentcatcodes,"[",storefunction(tj),"]")
- else
- flush(currentcatcodes,"[",tj,"]")
- end
- else -- is concat really faster than flushes here? probably needed anyway (print artifacts)
- flush(currentcatcodes,"[")
- for j=1,tn do
- local tj = ti[j]
+ elseif tn == 1 then -- some 20% faster than the next loop
+ local tj = ti[1]
if type(tj) == "function" then
- if j == tn then
- flush(currentcatcodes,"\\cldl",storefunction(tj),"]")
- -- flush(currentcatcodes,"",storefunction(tj),"]")
- else
- flush(currentcatcodes,"\\cldl",storefunction(tj),",")
- -- flush(currentcatcodes,"",storefunction(tj),",")
- end
+ flush(currentcatcodes,"[\\cldl",storefunction(tj),"]")
+ -- flush(currentcatcodes,"[",storefunction(tj),"]")
else
- if j == tn then
- flush(currentcatcodes,tj,"]")
+ flush(currentcatcodes,"[",tj,"]")
+ end
+ else -- is concat really faster than flushes here? probably needed anyway (print artifacts)
+ flush(currentcatcodes,"[")
+ for j=1,tn do
+ local tj = ti[j]
+ if type(tj) == "function" then
+ if j == tn then
+ flush(currentcatcodes,"\\cldl",storefunction(tj),"]")
+ -- flush(currentcatcodes,"",storefunction(tj),"]")
+ else
+ flush(currentcatcodes,"\\cldl",storefunction(tj),",")
+ -- flush(currentcatcodes,"",storefunction(tj),",")
+ end
else
- flush(currentcatcodes,tj,",")
+ if j == tn then
+ flush(currentcatcodes,tj,"]")
+ else
+ flush(currentcatcodes,tj,",")
+ end
end
end
end
- end
- elseif typ == "function" then
- flush(currentcatcodes,"{\\cldl ",storefunction(ti),"}") -- todo: ctx|prt|texcatcodes
- -- flush(currentcatcodes,"{",storefunction(ti),"}") -- todo: ctx|prt|texcatcodes
- elseif typ == "boolean" then
- if ti then
- flushdirect(currentcatcodes,"\r")
+ elseif typ == "function" then
+ flush(currentcatcodes,"{\\cldl ",storefunction(ti),"}") -- todo: ctx|prt|texcatcodes
+ -- flush(currentcatcodes,"{",storefunction(ti),"}") -- todo: ctx|prt|texcatcodes
+ elseif typ == "boolean" then
+ if ti then
+ flushdirect(currentcatcodes,"\r")
+ else
+ direct = true
+ end
+ elseif typ == "thread" then
+ report_context("coroutines not supported as we cannot yield across boundaries")
+ elseif isnode(ti) then -- slow
+ flush(currentcatcodes,"{\\cldl",storenode(ti),"}")
+ -- flush(currentcatcodes,"{",storenode(ti),"}")
else
- direct = true
+ report_context("error: %a gets a weird argument %a",command,ti)
end
- elseif typ == "thread" then
- report_context("coroutines not supported as we cannot yield across boundaries")
- elseif isnode(ti) then -- slow
- flush(currentcatcodes,"{\\cldl",storenode(ti),"}")
- -- flush(currentcatcodes,"{",storenode(ti),"}")
+ end
+ end
+ end
+
+ -- if performance really matters we can consider a compiler but it will never
+ -- pay off
+
+ prtwriter = function (command,...) -- already optimized before call
+ flush(prtcatcodes,command)
+ for i=1,select("#",...) do
+ local ti = (select(i,...))
+ if ti == nil then
+ -- nothing
+ elseif ti == "" then
+ flush(prtcatcodes,"{}")
else
- report_context("error: %a gets a weird argument %a",command,ti)
+ local tp = type(ti)
+ if tp == "string" or tp == "number"then
+ flush(prtcatcodes,"{",ti,"}")
+ elseif tp == "function" then
+ flush(prtcatcodes,"{\\cldl ",storefunction(ti),"}")
+ -- flush(currentcatcodes,"{",storefunction(ti),"}") -- todo: ctx|prt|texcatcodes
+ elseif isnode(ti) then
+ flush(prtcatcodes,"{\\cldl",storenode(ti),"}")
+ -- flush(currentcatcodes,"{",storenode(ti),"}")
+ else
+ report_context("fatal error: prt %a gets a weird argument %a",command,ti)
+ end
end
end
end
@@ -915,8 +950,9 @@ local writer
--
-- end
-local generics = { } context.generics = generics
-local indexer = nil
+local generics = { } context.generics = generics
+local indexer = nil
+local prtindexer = nil
-- if environment.initex then
@@ -1001,26 +1037,47 @@ local indexer = nil
-- only for internal usage:
-function context.constructcsonly(k) -- not much faster than the next but more mem efficient
- local c = "\\" .. tostring(generics[k] or k)
- local v = function()
- flush(prtcatcodes,c)
- end
- rawset(context,k,v)
- return v
-end
+do
-function context.constructcs(k)
- local c = "\\" .. tostring(generics[k] or k)
- local v = function(first,...)
- if first == nil then
+ function context.constructcsonly(k) -- not much faster than the next but more mem efficient
+ local c = "\\" .. tostring(generics[k] or k)
+ local v = function()
flush(prtcatcodes,c)
- else
- return writer(context,c,first,...)
end
+ rawset(context,k,v) -- context namespace
+ return v
+ end
+
+ function context.constructcs(k)
+ local c = "\\" .. tostring(generics[k] or k)
+ local v = function(first,...)
+ if first == nil then
+ flush(prtcatcodes,c)
+ else
+ return prtwriter(c,first,...)
+ end
+ end
+ rawset(context,k,v) -- context namespace
+ return v
end
- rawset(context,k,v)
- return v
+
+ local function prtindexer(t,k)
+ local c = "\\" .. tostring(generics[k] or k)
+ local v = function(first,...)
+ if first == nil then
+ flush(prtcatcodes,c)
+ else
+ return prtwriter(c,first,...)
+ end
+ end
+ rawset(t,k,v) -- protected namespace
+ return v
+ end
+
+ context.protected = { } -- we could check for _ in the context namespace
+
+ setmetatable(context.protected, { __index = prtindexer, __call = prtwriter } )
+
end
-- local splitformatters = utilities.strings.formatters.new(true) -- not faster (yet)
diff --git a/tex/context/base/mkiv/cldf-scn.lua b/tex/context/base/mkiv/cldf-scn.lua
index 5f7e0c74b..755d7fed7 100644
--- a/tex/context/base/mkiv/cldf-scn.lua
+++ b/tex/context/base/mkiv/cldf-scn.lua
@@ -149,6 +149,8 @@ end
-- it's convenient to have copies here:
+interfaces.defined = tokens.defined
+
interfaces.setmacro = tokens.setters.macro
interfaces.setcount = tokens.setters.count
interfaces.setdimen = tokens.setters.dimen
diff --git a/tex/context/base/mkiv/colo-ini.mkiv b/tex/context/base/mkiv/colo-ini.mkiv
index 0e8973c72..ebe390070 100644
--- a/tex/context/base/mkiv/colo-ini.mkiv
+++ b/tex/context/base/mkiv/colo-ini.mkiv
@@ -16,6 +16,8 @@
\writestatus{loading}{ConTeXt Color Macros / Initialization}
+%D Todo: move color space in color attribute (last two bits)
+
%D This module implements color. Since \MKII\ and \MKIV\ use a completely
%D different approach, this module only implements a few generic mechanisms.
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index fde4d04e7..5ecf859bd 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{2016.02.08 15:35}
+\newcontextversion{2016.02.15 10:26}
%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 f9a085ebf..4b266fcde 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -39,7 +39,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2016.02.08 15:35}
+\edef\contextversion{2016.02.15 10:26}
\edef\contextkind {beta}
%D For those who want to use this:
@@ -508,6 +508,7 @@
\loadmarkfile{grph-inc}
\loadmarkfile{grph-fig}
\loadmarkfile{grph-raw}
+\loadmarkfile{grph-rul}
\loadmarkfile{pack-box}
\loadmarkfile{pack-bar}
diff --git a/tex/context/base/mkiv/core-con.lua b/tex/context/base/mkiv/core-con.lua
index 58d7c9e02..ca44c53ca 100644
--- a/tex/context/base/mkiv/core-con.lua
+++ b/tex/context/base/mkiv/core-con.lua
@@ -264,11 +264,6 @@ function converters.Character (n) return chr (n,upper_offset) end
function converters.characters(n) return chrs(n,lower_offset) end
function converters.Characters(n) return chrs(n,upper_offset) end
-converters['a'] = converters.characters
-converters['A'] = converters.Characters
-converters['AK'] = converters.Characters
-converters['KA'] = converters.Characters
-
implement { name = "alphabetic", actions = { alphabetic, context }, arguments = { "integer", "string" } }
implement { name = "Alphabetic", actions = { Alphabetic, context }, arguments = { "integer", "string" } }
@@ -577,6 +572,11 @@ implement {
-- this is a temporary solution: we need a better solution when we have
-- more languages
+converters['a'] = converters.characters
+converters['A'] = converters.Characters
+converters['AK'] = converters.Characters -- obsolete
+converters['KA'] = converters.Characters -- obsolete
+
function converters.spanishnumerals(n) return alphabetic(n,"es") end
function converters.Spanishnumerals(n) return Alphabetic(n,"es") end
function converters.sloviannumerals(n) return alphabetic(n,"sl") end
@@ -588,6 +588,15 @@ converters['characters:sl'] = converters.sloveniannumerals
converters['Characters:es'] = converters.Spanishnumerals
converters['Characters:sl'] = converters.Sloveniannumerals
+-- bonus
+
+converters['a:es'] = converters.spanishnumerals
+converters['a:sl'] = converters.sloveniannumerals
+converters['A:es'] = converters.Spanishnumerals
+converters['A:sl'] = converters.Sloveniannumerals
+
+-- end of bonus
+
converters.sequences = converters.sequences or { }
local sequences = converters.sequences
diff --git a/tex/context/base/mkiv/core-env.lua b/tex/context/base/mkiv/core-env.lua
index 866176171..06c9708d6 100644
--- a/tex/context/base/mkiv/core-env.lua
+++ b/tex/context/base/mkiv/core-env.lua
@@ -13,7 +13,6 @@ if not modules then modules = { } end modules ['core-env'] = {
local P, C, S, Cc, lpegmatch, patterns = lpeg.P, lpeg.C, lpeg.S, lpeg.Cc, lpeg.match, lpeg.patterns
-local newtoken = newtoken or token
local context = context
local texgetcount = tex.getcount
@@ -23,6 +22,8 @@ local allocate = utilities.storage.allocate
local setmetatableindex = table.setmetatableindex
local setmetatablecall = table.setmetatablecall
+local createtoken = token.create
+
tex.modes = allocate { }
tex.systemmodes = allocate { }
tex.constants = allocate { }
@@ -38,10 +39,9 @@ local systemmodes = { }
-- undefined: mode == 0 or cmdname = "undefined_cs"
-local create = newtoken.create
local cache = table.setmetatableindex(function(t,k)
- local v = create(k)
+ local v = createtoken(k)
t[k] = v
return v
end)
diff --git a/tex/context/base/mkiv/font-ctx.lua b/tex/context/base/mkiv/font-ctx.lua
index a99d2ed91..8b8934c92 100644
--- a/tex/context/base/mkiv/font-ctx.lua
+++ b/tex/context/base/mkiv/font-ctx.lua
@@ -2044,7 +2044,7 @@ do
implement {
name = "doifelsecurrentfonthasfeature",
- actions = { currentfonthasfeature, commands.doifelse },
+ actions = { constructors.currentfonthasfeature, commands.doifelse },
arguments = "string"
}
diff --git a/tex/context/base/mkiv/font-otn.lua b/tex/context/base/mkiv/font-otn.lua
index 8df01bdbf..8815f2a14 100644
--- a/tex/context/base/mkiv/font-otn.lua
+++ b/tex/context/base/mkiv/font-otn.lua
@@ -1929,6 +1929,8 @@ local function chaindisk(head,start,last,kind,chainname,ck,lookuphash,chainlooku
else
break
end
+ else
+ break -- added
end
end
diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua
index 207d14650..5cbdbab23 100644
--- a/tex/context/base/mkiv/font-ots.lua
+++ b/tex/context/base/mkiv/font-ots.lua
@@ -1542,6 +1542,8 @@ function chainprocs.gpos_pair(head,start,stop,dataset,sequence,currentlookup,rlm
end
done = true
break
+ else
+ break
end
end
return head, start, done
@@ -1893,6 +1895,8 @@ local function chaindisk(head,start,last,dataset,sequence,chainlookup,rlmode,k,c
else
break
end
+ else
+ break -- added
end
end
diff --git a/tex/context/base/mkiv/font-syn.lua b/tex/context/base/mkiv/font-syn.lua
index 5e2d3a1ef..3bfc62d41 100644
--- a/tex/context/base/mkiv/font-syn.lua
+++ b/tex/context/base/mkiv/font-syn.lua
@@ -73,7 +73,7 @@ fonts.treatments = treatments
names.data = names.data or allocate { }
-names.version = 1.125
+names.version = 1.130
names.basename = "names"
names.saved = false
names.loaded = false
diff --git a/tex/context/base/mkiv/grph-rul.lua b/tex/context/base/mkiv/grph-rul.lua
new file mode 100644
index 000000000..c0ba5f9d8
--- /dev/null
+++ b/tex/context/base/mkiv/grph-rul.lua
@@ -0,0 +1,143 @@
+if not modules then modules = { } end modules ['grph-rul'] = {
+ version = 1.001,
+ comment = "companion to grph-rul.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local attributes = attributes
+local nodes = nodes
+local context = context
+
+local ruleactions = nodes.rules.ruleactions
+local userrule = nodes.rules.userrule
+local bpfactor = number.dimenfactors.bp
+local pdfprint = pdf.print
+
+local getattribute = tex.getattribute
+
+local a_color = attributes.private('color')
+local a_transparency = attributes.private('transparency')
+local a_colorspace = attributes.private('colormodel')
+
+do
+
+ local simplemetapost = metapost.simple
+ local cachesize = 0
+ local maxcachesize = 256*1024
+ local cachethreshold = 1024
+
+ -- local maxcachesize = 8*1024
+ -- local cachethreshold = 1024/2
+
+ local cache = table.setmetatableindex(function(t,k)
+ local v = simplemetapost("rulefun",k) -- w, h, d
+ cachesize = cachesize + #v
+ if cachesize > maxcachesize then
+ -- print("old",cachesize)
+ for k, v in next, t do
+ local n = #v
+ if n > cachethreshold then
+ t[k] = nil
+ cachesize = cachesize - n
+ end
+ end
+ -- print("new",cachesize)
+ end
+ -- print(cachesize,maxcachesize,cachethreshold,#v)
+ t[k] = v
+ return v
+ end)
+
+ local makecode = utilities.templates.replacer [[
+ beginfig(1);
+ RuleWidth := %width% ;
+ RuleHeight := %height% ;
+ RuleDepth := %depth% ;
+ RuleThickness := %line% ;
+ RuleFactor := %factor% ;
+ RuleOffset := %offset% ;
+ def RuleColor = %color% enddef ;
+ %data%;
+ endfig ;
+ ]]
+
+ ruleactions.mp = function(p,h,v,i,n)
+ local code = makecode {
+ data = p.data,
+ width = p.width * bpfactor,
+ height = p.height * bpfactor,
+ depth = p.depth * bpfactor,
+ factor = (p.factor or 0) * bpfactor, -- needs checking
+ offset = p.offset or 0,
+ line = (p.line or 65536) * bpfactor,
+ color = attributes.colors.mpcolor(p.ma,p.ca,p.ta),
+ }
+ local m = cache[code]
+ if m and m ~= "" then
+ pdfprint("direct",m)
+ end
+ end
+
+end
+
+do
+
+ local f_rectangle = string.formatters["%F w %F %F %F %F re %s"]
+ local f_radtangle = string.formatters[ [[
+ %F w %F %F m
+ %F %F l %F %F %F %F y
+ %F %F l %F %F %F %F y
+ %F %F l %F %F %F %F y
+ %F %F l %F %F %F %F y
+ h %s
+ ]] ]
+
+ ruleactions.fill = function(p,h,v,i,n)
+ local l = (p.line or 65536)*bpfactor
+ local r = p and (p.radius or 0)*bpfactor or 0
+ local w = h * bpfactor
+ local h = v * bpfactor
+ local m = nil
+ local t = i == "fill" and "f" or "s"
+ local o = l / 2
+ if r > 0 then
+ w = w - o
+ h = h - o
+ m = f_radtangle(l, r,o, w-r,o, w,o,w,r, w,h-r, w,h,w-r,h, r,h, o,h,o,h-r, o,r, o,o,r,o, t)
+ else
+ w = w - l
+ h = h - l
+ m = f_rectangle(l,o,o,w,h,t)
+ end
+ pdfprint("direct",m)
+ end
+
+ ruleactions.draw = ruleactions.fill
+ ruleactions.stroke = ruleactions.fill
+
+end
+
+interfaces.implement {
+ name = "frule",
+ arguments = { {
+ { "width", "dimension" },
+ { "height", "dimension" },
+ { "depth", "dimension" },
+ { "radius", "dimension" },
+ { "line", "dimension" },
+ { "type", "string" },
+ { "data", "string" },
+ } } ,
+ actions = function(t)
+ if t.type == "mp" then
+ t.ma = getattribute(a_colorspace) or 1
+ t.ca = getattribute(a_color)
+ t.ta = getattribute(a_transparency)
+ end
+ local r = userrule(t)
+ context(r)
+ end
+}
+
diff --git a/tex/context/base/mkiv/grph-rul.mkiv b/tex/context/base/mkiv/grph-rul.mkiv
new file mode 100644
index 000000000..8e293e151
--- /dev/null
+++ b/tex/context/base/mkiv/grph-rul.mkiv
@@ -0,0 +1,39 @@
+%D \module
+%D [ file=grph-rul,
+%D version=2016.02.05, % from experiments
+%D title=\CONTEXT\ Graphic Macros,
+%D subtitle=Rule Trickery,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Graphic Macros / Rule Trickery}
+
+\registerctxluafile{grph-rul}{1.001}
+
+\unprotect
+
+\unexpanded\def\frule{\relax\clf_frule} % kind of low level
+
+% just for fun:
+
+% \defineoverlay[normalframe]
+% [\frule
+% width \overlaywidth
+% height\overlayheight
+% line \overlaylinewidth
+% \relax]
+
+% \defineoverlay[ovalframe]
+% [\frule
+% width \overlaywidth
+% height \overlayheight
+% line \overlaylinewidth
+% radius \framedparameter\c!frameradius % \p_framed_backgroundradius % \framedradius
+% \relax]
+
+\protect \endinput
diff --git a/tex/context/base/mkiv/lang-url.mkiv b/tex/context/base/mkiv/lang-url.mkiv
index e7d62ba01..db5b97516 100644
--- a/tex/context/base/mkiv/lang-url.mkiv
+++ b/tex/context/base/mkiv/lang-url.mkiv
@@ -59,6 +59,7 @@
\let\|\letterbar
\let~=\lettertilde
\let|=\letterbar
+ \let\Ux\eUx
\to \everyhyphenatedurl
\let\hyphenatedurlseparator \empty % \periodcentered
diff --git a/tex/context/base/mkiv/lpdf-ano.lua b/tex/context/base/mkiv/lpdf-ano.lua
index 94cc41412..21bc1e076 100644
--- a/tex/context/base/mkiv/lpdf-ano.lua
+++ b/tex/context/base/mkiv/lpdf-ano.lua
@@ -34,6 +34,7 @@ local report_bookmark = logs.reporter("backend","bookmarks")
local variables = interfaces.variables
local v_auto = variables.auto
local v_page = variables.page
+local v_name = variables.name
local factor = number.dimenfactors.bp
@@ -368,6 +369,7 @@ local destinationactions = {
-- [v_minheight] = function(r,w,h,d) return f_fitbv(r,(getvpos()+h)*factor) end, -- left coordinate, fit height of content in window
[v_minheight] = function(r,w,h,d) return f_fitbv(r,gethpos()*factor) end, -- left coordinate, fit height of content in window [v_fit] = f_fit, -- fit page in window
[v_tight] = f_fitb, -- fit content in window
+ [v_fit] = f_fit,
}
local mapping = {
@@ -386,11 +388,9 @@ local defaultaction = destinationactions[defaultview]
-- A complication is that we need to use named destinations when we have views so we
-- end up with a mix. A previous versions just output multiple destinations but not
--- that we noved all to here we can be more sparse.
+-- that we moved all to here we can be more sparse.
-local pagedestinations = { }
-
-table.setmetatableindex(pagedestinations,function(t,k)
+local pagedestinations = table.setmetatableindex(function(t,k)
local v = pdfdelayedobject(f_fit(k))
t[k] = v
return v
@@ -398,7 +398,7 @@ end)
local function flushdestination(width,height,depth,names,view)
local r = pdfpagereference(texgetcount("realpageno"))
- if view == defaultview or not view or view == "" then
+ if (references.innermethod ~= v_name) and (view == defaultview or not view or view == "") then
r = pagedestinations[r]
else
local action = view and destinationactions[view] or defaultaction
@@ -424,33 +424,92 @@ function nodeinjections.destination(width,height,depth,names,view)
-- we could save some aut's by using a name when given but it doesn't pay off apart
-- from making the code messy and tracing hard .. we only save some destinations
-- which we already share anyway
- for n=1,#names do
- local name = names[n]
- if usedviews[name] then
- -- already done, maybe a warning
- elseif type(name) == "number" then
- if noview then
+ -- for n=1,#names do
+ -- local name = names[n]
+ -- if usedviews[name] then
+ -- -- already done, maybe a warning
+ -- elseif type(name) == "number" then
+ -- if noview then
+ -- usedviews[name] = view
+ -- names[n] = false
+ -- elseif method == v_page then
+ -- usedviews[name] = view
+ -- names[n] = false
+ -- else
+ -- local used = usedinternals[name]
+ -- if used and used ~= defaultview then
+ -- usedviews[name] = view
+ -- names[n] = autoprefix .. name
+ -- doview = true
+ -- else
+ -- -- names[n] = autoprefix .. name
+ -- names[n] = false
+ -- end
+ -- end
+ -- elseif method == v_page then
+ -- usedviews[name] = view
+ -- else
+ -- usedviews[name] = view
+ -- doview = true
+ -- end
+ -- end
+
+ if method == v_page then
+ for n=1,#names do
+ local name = names[n]
+ if usedviews[name] then
+ -- already done, maybe a warning
+ elseif type(name) == "number" then
+ if noview then
+ usedviews[name] = view
+ names[n] = false
+ else
+ usedviews[name] = view
+ names[n] = false
+ end
+ else
usedviews[name] = view
- names[n] = false
- elseif method == v_page then
+ end
+ end
+ elseif method == v_name then
+ for n=1,#names do
+ local name = names[n]
+ if usedviews[name] then
+ -- already done, maybe a warning
+ elseif type(name) == "number" then
+ local used = usedinternals[name]
usedviews[name] = view
- names[n] = false
+ names[n] = autoprefix .. name
+ doview = true
else
- local used = usedinternals[name]
- if used and used ~= defaultview then
+ usedviews[name] = view
+ doview = true
+ end
+ end
+ else
+ for n=1,#names do
+ local name = names[n]
+ if usedviews[name] then
+ -- already done, maybe a warning
+ elseif type(name) == "number" then
+ if noview then
usedviews[name] = view
- names[n] = autoprefix .. name
- doview = true
- else
- -- names[n] = autoprefix .. name
names[n] = false
+ else
+ local used = usedinternals[name]
+ if used and used ~= defaultview then
+ usedviews[name] = view
+ names[n] = autoprefix .. name
+ doview = true
+ else
+ -- names[n] = autoprefix .. name
+ names[n] = false
+ end
end
+ else
+ usedviews[name] = view
+ doview = true
end
- elseif method == v_page then
- usedviews[name] = view
- else
- usedviews[name] = view
- doview = true
end
end
if doview then
@@ -461,7 +520,8 @@ end
-- we could share dictionaries ... todo
local function somedestination(destination,internal,page) -- no view anyway
- if references.innermethod ~= v_page then
+ local method = references.innermethod
+ if method == v_auto then
if type(destination) == "number" then
if not internal then
internal = destination
@@ -481,9 +541,21 @@ local function somedestination(destination,internal,page) -- no view anyway
S = pdf_goto,
D = destination,
}
+ elseif destination then
+ -- hopefully this one is flushed
+ return pdfdictionary {
+ S = pdf_goto,
+ D = destination,
+ }
+ end
+ elseif method == v_name then
+ if not destination and internal then
+ flaginternals[internal] = true -- for bookmarks and so
+ if type(destination) ~= "string" then
+ destination = autoprefix .. internal
+ end
end
if destination then
- -- hopefully this one is flushed
return pdfdictionary {
S = pdf_goto,
D = destination,
@@ -712,7 +784,8 @@ end)
runners["inner"] = function(var,actions)
local internal = false
local inner = nil
- if references.innermethod == v_auto then
+ local method = references.innermethod
+ if method == v_auto or method == v_name then
local vi = var.i
if vi then
local vir = vi.references
diff --git a/tex/context/base/mkiv/luat-cnf.lua b/tex/context/base/mkiv/luat-cnf.lua
index 0f6b8598f..3d9889c0b 100644
--- a/tex/context/base/mkiv/luat-cnf.lua
+++ b/tex/context/base/mkiv/luat-cnf.lua
@@ -64,7 +64,7 @@ function texconfig.init()
"string", "table", "coroutine", "debug", "file", "io", "lpeg", "math", "os", "package", "bit32",
},
basictex = { -- noad
- "callback", "font", "img", "lang", "lua", "node", "pdf", "status", "tex", "texconfig", "texio", "token", "newtoken"
+ "callback", "font", "img", "lang", "lua", "node", "pdf", "status", "tex", "texconfig", "texio", "token",
},
extralua = {
"gzip", "zip", "zlib", "lfs", "ltn12", "mime", "socket", "md5", "profiler", "unicode", "utf",
diff --git a/tex/context/base/mkiv/lxml-ini.lua b/tex/context/base/mkiv/lxml-ini.lua
index 982fb4622..6026b1090 100644
--- a/tex/context/base/mkiv/lxml-ini.lua
+++ b/tex/context/base/mkiv/lxml-ini.lua
@@ -1,4 +1,4 @@
-if not modules then modules = { } end modules ['lxml-ini'] = {
+ if not modules then modules = { } end modules ['lxml-ini'] = {
version = 1.001,
comment = "this module is the basis for the lxml-* ones",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
@@ -104,6 +104,9 @@ implement { name = "xmlstripped", actions = lxml.stripped, arg
implement { name = "xmlstrippednolines", actions = lxml.stripped, arguments = { "string", "string", true } }
implement { name = "xmltag", actions = lxml.tag, arguments = "string" }
implement { name = "xmltext", actions = lxml.text, arguments = { "string", "string" } }
+implement { name = "xmlpure", actions = lxml.pure, arguments = { "string", "string" } }
+implement { name = "xmlflushtext", actions = lxml.text, arguments = "string" }
+implement { name = "xmlflushpure", actions = lxml.pure, arguments = "string" }
implement { name = "xmltobuffer", actions = lxml.tobuffer, arguments = { "string", "string", "string" } }
implement { name = "xmltobufferverbose", actions = lxml.tobuffer, arguments = { "string", "string", "string", true } }
implement { name = "xmltofile", actions = lxml.tofile, arguments = { "string", "string", "string" } }
diff --git a/tex/context/base/mkiv/lxml-ini.mkiv b/tex/context/base/mkiv/lxml-ini.mkiv
index e913be620..1770d087c 100644
--- a/tex/context/base/mkiv/lxml-ini.mkiv
+++ b/tex/context/base/mkiv/lxml-ini.mkiv
@@ -104,12 +104,16 @@
\let\xmlstrippednolines \clf_xmlstrippednolines
\let\xmltag \clf_xmltag
\let\xmltext \clf_xmltext
+\let\xmlpure \clf_xmlpure
\let\xmltobuffer \clf_xmltobuffer % id pattern name
\let\xmltobufferverbose \clf_xmltobufferverbose % id pattern name
\let\xmltofile \clf_xmltofile % id pattern filename
\let\xmltoparameters \clf_xmltoparameters
\let\xmlverbatim \clf_xmlverbatim
+\let\xmlflushtext \clf_xmlflushtext
+\let\xmlflushpure \clf_xmlflushpure
+
\unexpanded\def\xmlinfo #1{\hbox{\ttxx[\clf_xmlname{#1}]}}
\unexpanded\def\xmlshow #1{\startpacked\ttx\xmlverbatim{#1}\stoppacked}
diff --git a/tex/context/base/mkiv/lxml-tab.lua b/tex/context/base/mkiv/lxml-tab.lua
index 23f424995..b03c7eb43 100644
--- a/tex/context/base/mkiv/lxml-tab.lua
+++ b/tex/context/base/mkiv/lxml-tab.lua
@@ -793,7 +793,48 @@ do
+ p_rest/fromdec
)
- xml.reparsedentitylpeg = reparsedentity
+ local hash = table.setmetatableindex(function(t,k)
+ local v = utfchar(k)
+ t[k] = v
+ return v
+ end)
+
+ local function fromuni(s)
+ local n = tonumber(s,16)
+ if n then
+ return hash[n]
+ else
+ return formatters["u:%s"](s), true
+ end
+ end
+
+ local function fromhex(s)
+ local n = tonumber(s,16)
+ if n then
+ return hash[n]
+ else
+ return formatters["h:%s"](s), true
+ end
+ end
+
+ local function fromdec(s)
+ local n = tonumber(s)
+ if n then
+ return hash[n]
+ else
+ return formatters["d:%s"](s), true
+ end
+ end
+
+ local unescapedentity =
+ P("U+") * (p_rest/fromuni)
+ + P("#") * (
+ P("x") * (p_rest/fromhex)
+ + p_rest/fromdec
+ )
+
+ xml.reparsedentitylpeg = reparsedentity -- with \Ux{...} for special tex entities
+ xml.unescapedentitylpeg = unescapedentity -- normal characters
end
diff --git a/tex/context/base/mkiv/lxml-tex.lua b/tex/context/base/mkiv/lxml-tex.lua
index abb807181..7a0ef3e64 100644
--- a/tex/context/base/mkiv/lxml-tex.lua
+++ b/tex/context/base/mkiv/lxml-tex.lua
@@ -91,11 +91,20 @@ lxml.entities = lxml.entities or { }
storage.register("lxml/entities",lxml.entities,"lxml.entities")
-local xmlentities = xml.entities -- these are more or less standard entities
-local texentities = lxml.entities -- these are specific for a tex run
-local parsedentity = xml.reparsedentitylpeg
+local xmlentities = xml.entities -- these are more or less standard entities
+local texentities = lxml.entities -- these are specific for a tex run
+local reparsedentity = xml.reparsedentitylpeg -- \Ux{...}
+local unescapedentity = xml.unescapedentitylpeg
+local parsedentity = reparsedentity
+local useelement = false -- probably no longer needed / used
-local useelement = false -- probably no longer needed / used
+function lxml.startunescaped()
+ parsedentity = unescapedentity
+end
+
+function lxml.stopunescaped()
+ parsedentity = reparsedentity
+end
directives.register("lxml.entities.useelement",function(v)
useelement = v
@@ -150,10 +159,17 @@ function lxml.resolvedentity(str)
-- normally this is already solved while loading the file
local chr, err = lpegmatch(parsedentity,str)
if chr then
- if trace_entities then
- report_xml("passing entity %a as %a using %a",str,chr,"ctxcatcodes")
+ if parsedentity == reparsedentity then
+ if trace_entities then
+ report_xml("passing entity %a as %a using %a",str,chr,"ctxcatcodes")
+ end
+ context(chr)
+ else
+ contextsprint(notcatcodes,chr)
+ if trace_entities then
+ report_xml("passing entity %a as %a using %a",str,chr,"notcatcodes")
+ end
end
- context(chr)
elseif err then
if trace_entities then
report_xml("passing faulty entity %a as %a",str,err)
@@ -293,6 +309,14 @@ function lxml.stopraw()
forceraw = false
end
+function lxml.startraw()
+ forceraw = true
+end
+
+function lxml.stopraw()
+ forceraw = false
+end
+
function lxml.rawroot()
return rawroot
end
@@ -1704,9 +1728,34 @@ function lxml.context(id,pattern) -- the content, untouched by commands
end
function lxml.text(id,pattern)
- local collected = (pattern and xmlapplylpath(getid(id),pattern)) or getid(id)
- if collected and #collected > 0 then
- text(collected)
+ if pattern then
+ local collected = xmlapplylpath(getid(id),pattern)
+ if collected and #collected > 0 then
+ text(collected)
+ end
+ else
+ local e = getid(id)
+ if e then
+ text(e.dt)
+ end
+ end
+end
+
+function lxml.pure(id,pattern)
+ if pattern then
+ local collected = xmlapplylpath(getid(id),pattern)
+ if collected and #collected > 0 then
+ parsedentity = unescapedentity
+ text(collected)
+ parsedentity = reparsedentity
+ end
+ else
+ parsedentity = unescapedentity
+ local e = getid(id)
+ if e then
+ text(e.dt)
+ end
+ parsedentity = reparsedentity
end
end
diff --git a/tex/context/base/mkiv/mlib-pdf.lua b/tex/context/base/mkiv/mlib-pdf.lua
index fb76a52e3..10327c01d 100644
--- a/tex/context/base/mkiv/mlib-pdf.lua
+++ b/tex/context/base/mkiv/mlib-pdf.lua
@@ -428,13 +428,19 @@ function metapost.flush(result,flusher,askedfig)
result[#result+1] = "q"
if objects then
resetplugins(result) -- we should move the colorinitializer here
-local savedpath = nil
-local savedhtap = nil
+ local savedpath = nil
+ local savedhtap = nil
for o=1,#objects do
local object = objects[o]
local objecttype = object.type
- if objecttype == "start_bounds" or objecttype == "stop_bounds" then
- -- skip
+ if objecttype == "text" then
+ result[#result+1] = "q"
+ local ot = object.transform -- 3,4,5,6,1,2
+ result[#result+1] = f_cm(ot[3],ot[4],ot[5],ot[6],ot[1],ot[2]) -- TH: formatters["%F %F m %F %F %F %F 0 0 cm"](unpack(ot))
+ flushfigure(result) -- flush accumulated literals
+ result = { }
+ textfigure(object.font,object.dsize,object.text,object.width,object.height,object.depth)
+ result[#result+1] = "Q"
elseif objecttype == "special" then
if processspecial then
processspecial(object.prescript)
@@ -447,14 +453,8 @@ local savedhtap = nil
elseif objecttype == "stop_clip" then
result[#result+1] = "Q"
miterlimit, linecap, linejoin, dashed = -1, -1, -1, "" -- was false
- elseif objecttype == "text" then
- result[#result+1] = "q"
- local ot = object.transform -- 3,4,5,6,1,2
- result[#result+1] = f_cm(ot[3],ot[4],ot[5],ot[6],ot[1],ot[2]) -- TH: formatters["%F %F m %F %F %F %F 0 0 cm"](unpack(ot))
- flushfigure(result) -- flush accumulated literals
- result = { }
- textfigure(object.font,object.dsize,object.text,object.width,object.height,object.depth)
- result[#result+1] = "Q"
+ elseif objecttype == "start_bounds" or objecttype == "stop_bounds" then
+ -- skip
else
-- we use an indirect table as we want to overload
-- entries but this is not possible in userdata
diff --git a/tex/context/base/mkiv/mlib-pps.lua b/tex/context/base/mkiv/mlib-pps.lua
index a14d6c409..c016e0f36 100644
--- a/tex/context/base/mkiv/mlib-pps.lua
+++ b/tex/context/base/mkiv/mlib-pps.lua
@@ -741,9 +741,9 @@ function metapost.graphic_base_pass(specification) -- name will change (see mlib
context(stopjob)
end
-function metapost.process(...)
- startjob(false)
- processmetapost(...)
+function metapost.process(mpx, data, trialrun, flusher, multipass, isextrapass, askedfig, plugmode) -- overloads
+ startjob(plugmode)
+ processmetapost(mpx, data, trialrun, flusher, multipass, isextrapass, askedfig)
stopjob()
end
diff --git a/tex/context/base/mkiv/mlib-run.lua b/tex/context/base/mkiv/mlib-run.lua
index 5ec1f9c6b..f20461bbb 100644
--- a/tex/context/base/mkiv/mlib-run.lua
+++ b/tex/context/base/mkiv/mlib-run.lua
@@ -525,7 +525,7 @@ end
-- goodie
-function metapost.quickanddirty(mpxformat,data)
+function metapost.quickanddirty(mpxformat,data,plugmode)
if not data then
mpxformat = "metafun"
data = mpxformat
@@ -545,7 +545,7 @@ function metapost.quickanddirty(mpxformat,data)
end
}
local data = formatters["; beginfig(1) ;\n %s\n ; endfig ;"](data)
- metapost.process(mpxformat, { data }, false, flusher, false, false, "all")
+ metapost.process(mpxformat, { data }, false, flusher, false, false, "all", plugmode)
if code then
return {
bbox = bbox or { 0, 0, 0, 0 },
@@ -573,3 +573,38 @@ function metapost.getstatistics(memonly)
return t
end
end
+
+do
+
+ local result = { }
+ local width = 0
+ local height = 0
+ local depth = 0
+ local mpx = false
+
+ local flusher = {
+ startfigure = function(n,llx,lly,urx,ury)
+ result = { }
+ width = urx - llx
+ height = ury
+ depth = -lly
+ end,
+ flushfigure = function(t)
+ for i=1,#t do
+ result[#result+1] = t[i]
+ end
+ end,
+ stopfigure = function()
+ end
+ }
+
+ function metapost.simple(format,code) -- even less than metapost.quickcanddirty
+ local mpx = metapost.format(format or "metafun","metafun")
+ -- metapost.setoutercolor(2)
+ metapost.process(mpx,code,false,flusher,false,false,1,true) -- last true is plugmode !
+ local stream = concat(result," ")
+ result = nil -- cleanup
+ return stream, width, height, depth
+ end
+
+end
diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua
index 3ad62e2f0..124a11c4d 100644
--- a/tex/context/base/mkiv/mult-low.lua
+++ b/tex/context/base/mkiv/mult-low.lua
@@ -132,7 +132,7 @@ return {
"zerowidthspace", "zerowidthnonjoiner", "zerowidthjoiner", "zwnj", "zwj",
"optionalspace", "asciispacechar",
--
- "Ux",
+ "Ux", "eUx",
},
["helpers"] = {
--
@@ -416,5 +416,7 @@ return {
"nospace", "nospacing", "dospacing",
--
"naturalhbox", "naturalvbox", "naturalhpack", "naturalvpack",
+ --
+ "frule",
}
}
diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua
index 4c222548a..931ffb007 100644
--- a/tex/context/base/mkiv/mult-prm.lua
+++ b/tex/context/base/mkiv/mult-prm.lua
@@ -246,6 +246,7 @@ return {
"dvivariable",
"efcode",
"hjcode",
+ "firstvalidlanguage",
"fontid",
"formatname",
"gleaders",
@@ -778,6 +779,7 @@ return {
"fontcharic",
"fontcharwd",
"fontdimen",
+ "firstvalidlanguage",
"fontid",
"fontname",
"formatname",
diff --git a/tex/context/base/mkiv/node-aux.lua b/tex/context/base/mkiv/node-aux.lua
index 38df55eef..ebe113fc6 100644
--- a/tex/context/base/mkiv/node-aux.lua
+++ b/tex/context/base/mkiv/node-aux.lua
@@ -111,6 +111,24 @@ function nodes.takebox(id)
end
end
+local splitbox = tex.splitbox
+nodes.splitbox = splitbox
+
+function nuts.splitbox(id,height)
+ return tonut(splitbox(id,height))
+end
+
+-- function nodes.takelist(n)
+-- -- when we need it
+-- end
+
+function nuts.takelist(n)
+ local l = getlist(n)
+ setlist(n)
+ free_node(n)
+ return l
+end
+
nuts.takebox = takebox
tex.takebox = nodes.takebox -- sometimes more clear
diff --git a/tex/context/base/mkiv/node-res.lua b/tex/context/base/mkiv/node-res.lua
index 91de6171d..5bc414b68 100644
--- a/tex/context/base/mkiv/node-res.lua
+++ b/tex/context/base/mkiv/node-res.lua
@@ -167,6 +167,7 @@ local noad = register_nut(new_nut("noad"))
local rule = register_nut(new_nut("rule")) setfield(rule, "dir","TLT")
local emptyrule = register_nut(new_nut("rule",rulecodes.empty)) setfield(rule, "dir","TLT")
+local userrule = register_nut(new_nut("rule",rulecodes.user)) setfield(rule, "dir","TLT")
local hlist = register_nut(new_nut("hlist")) setfield(hlist,"dir","TLT")
local vlist = register_nut(new_nut("vlist")) setfield(vlist,"dir","TLT")
@@ -374,6 +375,23 @@ function nutpool.emptyrule(width,height,depth,dir) -- w/h/d == nil will let them
return n
end
+function nutpool.userrule(width,height,depth,dir) -- w/h/d == nil will let them adapt
+ local n = copy_nut(userrule)
+ if width then -- also 0 else adapt
+ setfield(n,"width",width)
+ end
+ if height then -- also 0 else adapt
+ setfield(n,"height",height)
+ end
+ if depth then -- also 0 else adapt
+ setfield(n,"depth",depth)
+ end
+ if dir then
+ setfield(n,"dir",dir)
+ end
+ return n
+end
+
function nutpool.latelua(code)
local n = copy_nut(latelua)
setfield(n,"string",code)
diff --git a/tex/context/base/mkiv/node-rul.lua b/tex/context/base/mkiv/node-rul.lua
index d341bbd53..6d6c5fd02 100644
--- a/tex/context/base/mkiv/node-rul.lua
+++ b/tex/context/base/mkiv/node-rul.lua
@@ -11,6 +11,7 @@ if not modules then modules = { } end modules ['node-rul'] = {
--
-- todo: make robust for layers ... order matters
+
local attributes, nodes, node = attributes, nodes, node
local nuts = nodes.nuts
@@ -36,6 +37,9 @@ local setlist = nuts.setlist
local nodecodes = nodes.nodecodes
local tasks = nodes.tasks
+local properties = nodes.properties
+local attribs = node.current_attr
+
local glyph_code = nodecodes.glyph
local disc_code = nodecodes.disc
local rule_code = nodecodes.rule
@@ -106,6 +110,7 @@ local dimenfactor = fonts.helpers.dimenfactor
local splitdimen = number.splitdimen
local v_yes = variables.yes
+local v_all = variables.all
local v_foreground = variables.foreground
local nodecodes = nodes.nodecodes
@@ -125,12 +130,14 @@ local dir_code = nodecodes.dir
local userskip_code = skipcodes.userskip
local spaceskip_code = skipcodes.spaceskip
local xspaceskip_code = skipcodes.xspaceskip
+local leader_code = skipcodes.leaders
local kerning_code = kerncodes.kern
local nodepool = nuts.pool
local new_rule = nodepool.rule
+local new_userrule = nodepool.userrule
local new_kern = nodepool.kern
local new_glue = nodepool.glue
@@ -152,11 +159,13 @@ local checkdir = true
-- todo: switching inside math
+-- handlers
+
local function processwords(attribute,data,flush,head,parent) -- we have hlistdir and local dir
local n = head
if n then
local f, l, a, d, i, class
- local continue, done, strip, level = false, false, true, -1
+ local continue, leaders, done, strip, level = false, false, false, true, -1
while n do
local id = getid(n)
if id == glyph_code or id == rule_code then
@@ -181,7 +190,9 @@ local function processwords(attribute,data,flush,head,parent) -- we have hlistdi
f, l, a = n, n, aa
level, class = newlevel, newclass
d = data[class]
- continue = d.continue == v_yes
+ local c = d.continue
+ leaders = c == v_all
+ continue = leaders or c == v_yes
end
else
if f then
@@ -219,7 +230,7 @@ local function processwords(attribute,data,flush,head,parent) -- we have hlistdi
elseif id == glue_code then
-- catch \underbar{a} \underbar{a} (subtype test is needed)
local subtype = getsubtype(n)
- if getattr(n,attribute) and (subtype == userskip_code or subtype == spaceskip_code or subtype == xspaceskip_code) then
+ if getattr(n,attribute) and (subtype == userskip_code or subtype == spaceskip_code or subtype == xspaceskip_code or (leaders and subtype >= leader_code)) then
l = n
else
head, done = flush(head,f,l,d,level,parent,strip), true
@@ -255,14 +266,40 @@ end
--
-nodes.rules = nodes.rules or { }
-nodes.rules.data = nodes.rules.data or { }
+local rules = nodes.rules or { }
+nodes.rules = rules
+rules.data = rules.data or { }
-storage.register("nodes/rules/data", nodes.rules.data, "nodes.rules.data")
+storage.register("nodes/rules/data", rules.data, "nodes.rules.data")
-local data = nodes.rules.data
+local data = rules.data
+
+-- we implement user rules here as it takes less code this way
+
+local function userrule(t)
+ local r = new_userrule(t.width or 0,t.height or 0,t.depth or 0)
+ setfield(r,"attr",attribs())
+ properties[r] = t
+ return tonode(r)
+end
-function nodes.rules.define(settings)
+rules.userrule = userrule
+local ruleactions = { }
+rules.ruleactions = ruleactions
+
+callback.register("process_rule",function(n,h,v)
+ local n = tonut(n)
+ local p = properties[n]
+ local i = p.type or "draw"
+ local a = ruleactions[i]
+ if a then
+ a(p,h,v,i,n)
+ end
+end)
+
+--
+
+function rules.define(settings)
data[#data+1] = settings
context(#data)
end
@@ -288,18 +325,26 @@ local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but a
if not f then
return head
end
- local w = list_dimensions(getfield(parent,"glue_set"),getfield(parent,"glue_sign"),getfield(parent,"glue_order"),f,getnext(l))
- local method, offset, continue, dy, order, max = d.method, d.offset, d.continue, d.dy, d.order, d.max
- local rulethickness, unit = d.rulethickness, d.unit
- local ma, ca, ta = d.ma, d.ca, d.ta
- local colorspace = ma > 0 and ma or getattr(f,a_colorspace) or 1
- local color = ca > 0 and ca or getattr(f,a_color)
- local transparency = ta > 0 and ta or getattr(f,a_transparency)
- local foreground = order == v_foreground
-
- local e = dimenfactor(unit,getfont(f)) -- what if no glyph node
-
- local rt = tonumber(rulethickness)
+ local w, ht, dp = list_dimensions(getfield(parent,"glue_set"),getfield(parent,"glue_sign"),getfield(parent,"glue_order"),f,getnext(l))
+ local method = d.method
+ local offset = d.offset
+ local continue = d.continue
+ local dy = d.dy
+ local order = d.order
+ local max = d.max
+ local mp = d.mp
+ local rulethickness = d.rulethickness
+ local unit = d.unit
+ local ma = d.ma
+ local ca = d.ca
+ local ta = d.ta
+ local colorspace = ma > 0 and ma or getattr(f,a_colorspace) or 1
+ local color = ca > 0 and ca or getattr(f,a_color)
+ local transparency = ta > 0 and ta or getattr(f,a_transparency)
+ local foreground = order == v_foreground
+ local layer = getattr(f,a_viewerlayer)
+ local e = dimenfactor(unit,getfont(f)) -- what if no glyph node
+ local rt = tonumber(rulethickness)
if rt then
rulethickness = e * rulethickness / 2
else
@@ -310,7 +355,7 @@ local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but a
rulethickness = 1/5
end
end
-
+ --
if level > max then
level = max
end
@@ -320,22 +365,10 @@ local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but a
else
m = 0
end
- for i=1,level do
- local ht = (offset+(i-1)*dy)*e + rulethickness - m
- local dp = -(offset+(i-1)*dy)*e + rulethickness + m
- local r = new_rule(w,ht,dp)
- local v = getattr(f,a_viewerlayer)
- -- quick hack
- if v then
- setattr(r,a_viewerlayer,v)
- end
- --
- if color then
- setattr(r,a_colorspace,colorspace)
- setattr(r,a_color,color)
- end
- if transparency then
- setattr(r,a_transparency,transparency)
+
+ local function inject(r,w,ht,dp)
+ if layer then
+ setattr(r,a_viewerlayer,layer)
end
local k = new_kern(-w)
if foreground then
@@ -351,14 +384,45 @@ local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but a
level,w,ht,dp,n_tostring(f,l),n_tosequence(f,l,true))
end
end
+
+ if mp and mp ~= "" then
+ local r = userrule {
+ width = w,
+ height = ht,
+ depth = dp,
+ type = "mp",
+ factor = e,
+ offset = offset,
+ line = rulethickness,
+ data = mp,
+ ma = colorspace,
+ ca = color,
+ ta = transparency,
+ }
+ inject(tonut(r),w,ht,dp)
+ else
+ for i=1,level do
+ local ht = (offset+(i-1)*dy)*e + rulethickness - m
+ local dp = -(offset+(i-1)*dy)*e + rulethickness + m
+ local r = new_rule(w,ht,dp)
+ if color then
+ setattr(r,a_colorspace,colorspace)
+ setattr(r,a_color,color)
+ end
+ if transparency then
+ setattr(r,a_transparency,transparency)
+ end
+ inject(r,w,ht,dp)
+ end
+ end
return head
end
local process = nodes.processwords
-nodes.rules.handler = function(head) return process(a_ruled,data,flush_ruled,head) end
+rules.handler = function(head) return process(a_ruled,data,flush_ruled,head) end
-function nodes.rules.enable()
+function rules.enable()
tasks.enableaction("shipouts","nodes.rules.handler")
end
@@ -428,7 +492,7 @@ local implement = interfaces.implement
implement {
name = "definerule",
- actions = { nodes.rules.define, context },
+ actions = { rules.define, context },
arguments = {
{
{ "continue" },
@@ -442,6 +506,7 @@ implement {
{ "ma", "integer" },
{ "ca", "integer" },
{ "ta", "integer" },
+ { "mp", "string" },
}
}
}
@@ -449,7 +514,7 @@ implement {
implement {
name = "enablerules",
onlyonce = true,
- actions = nodes.rules.enable
+ actions = rules.enable
}
implement {
diff --git a/tex/context/base/mkiv/node-rul.mkiv b/tex/context/base/mkiv/node-rul.mkiv
index 87277337e..a3df8481f 100644
--- a/tex/context/base/mkiv/node-rul.mkiv
+++ b/tex/context/base/mkiv/node-rul.mkiv
@@ -119,12 +119,13 @@
order {\barparameter\c!order}%
rulethickness {\barparameter\c!rulethickness}%
method \barparameter\c!method
+ max \barparameter\c!max\space % number
+ mp {\includeMPgraphic{\barparameter\c!mp}}
ma \thecolormodelattribute
ca \thecolorattribute\p_node_rules_color
ta \thetransparencyattribute\p_node_rules_color
offset \barparameter\c!offset\space % number
dy \barparameter\c!dy\space % number
- max \barparameter\c!max
\relax}}
\unexpanded\def\node_rules_redefine#1%
@@ -216,6 +217,8 @@
\definebar[\v!overstrikes] [\v!overstrike] [\c!continue=\v!no]
\definebar[\v!understrikes][\v!understrike][\c!continue=\v!no]
+% \setupbar[\v!overstrike][continue=all]
+
% we want these always so ...
\ifdefined\normalmathunderbar
@@ -253,6 +256,52 @@
\unexpanded\def\setupunderbar[#1]% too incompatible for the moment
{}
+%D Experimental new feature:
+
+\startuseMPgraphic{rules:under:random}
+ draw
+ ((0,RuleDepth) ... (RuleWidth,RuleDepth)) randomized (4*RuleThickness)
+ shifted (0,RuleFactor*RuleOffset)
+ withpen pencircle scaled RuleThickness
+ withcolor RuleColor ;
+ setbounds currentpicture to unitsquare xysized(RuleWidth,RuleHeight) ;
+\stopuseMPgraphic
+
+\startuseMPgraphic{rules:under:dash}
+ draw
+ ((0,RuleDepth) ... (RuleWidth,RuleDepth))
+ shifted (0,RuleFactor*RuleOffset)
+ dashed dashpattern(off 5/RuleFactor on 0 off 5/RuleFactor)
+ withpen pencircle scaled RuleThickness
+ withcolor RuleColor ;
+ setbounds currentpicture to unitsquare xysized(RuleWidth,RuleHeight) ;
+\stopuseMPgraphic
+
+\startuseMPgraphic{rules:under:dots}
+ draw
+ ((0,RuleDepth) ... (RuleWidth,RuleDepth))
+ shifted (0,RuleFactor*RuleOffset)
+ dashed dashpattern(on RuleFactor/2 off RuleFactor/2)
+ withpen pencircle scaled RuleThickness
+ withcolor RuleColor ;
+ setbounds currentpicture to unitsquare xysized(RuleWidth,RuleHeight) ;
+\stopuseMPgraphic
+
+\definebar
+ [undergraphic]
+ [\c!mp=rules:under:dash,
+ \c!offset=-.2,
+ \c!order=\v!background]
+
+\definebar[underrandom] [undergraphic][\c!mp=rules:under:random]
+\definebar[underrandoms][underrandom] [\c!continue=\v!yes]
+
+\definebar[underdash] [undergraphic][\c!mp=rules:under:dash]
+\definebar[underdashes] [underdash] [\c!continue=\v!yes]
+
+\definebar[underdot] [undergraphic][\c!mp=rules:under:dots]
+\definebar[underdots] [underdot] [\c!continue=\v!yes]
+
%D This will move: (a bit duplicated)
\installcorenamespace{shift}
diff --git a/tex/context/base/mkiv/page-brk.mkiv b/tex/context/base/mkiv/page-brk.mkiv
index 914553253..eabcb74f8 100644
--- a/tex/context/base/mkiv/page-brk.mkiv
+++ b/tex/context/base/mkiv/page-brk.mkiv
@@ -113,6 +113,20 @@
\endgroup
\fi}
+\unexpanded\def\usepageparameter#1%
+ {\edef\m_page_breaks_asked{#1\c!page}%
+ \ifx\m_page_breaks_asked\empty\else
+ \firstargumenttrue
+ \page_breaks_process[\m_page_breaks_asked]%
+ \fi}
+
+\unexpanded\def\dousepageparameter#1%
+ {\edef\m_page_breaks_asked{#1}%
+ \ifx\m_spac_align_asked\empty\else
+ \firstargumenttrue
+ \page_breaks_process[\m_page_breaks_asked]%
+ \fi}
+
\unexpanded\def\resetpagebreak % used elsewhere too
{\global\settrue\c_page_breaks_enabled}
@@ -270,6 +284,7 @@
\newtoks\everybeforecolumnbreak
\newtoks\everyaftercolumnbreak
+\newtoks\everysynchronizecolumn
\let\page_breaks_columns_current_option \empty
\let\page_breaks_columns_current_options\empty
@@ -320,7 +335,13 @@
\fi
\relax
\the\everyaftercolumnbreak
- \endgroup}
+ \endgroup
+ % outside group e.g. setting hsize
+ \the\everysynchronizecolumn}
+
+\appendtoks
+ \page_otr_command_set_hsize
+\to \everysynchronizecolumn
%D Test page breaks.
diff --git a/tex/context/base/mkiv/publ-imp-apa.mkvi b/tex/context/base/mkiv/publ-imp-apa.mkvi
index b9d265105..fae2dcc6d 100644
--- a/tex/context/base/mkiv/publ-imp-apa.mkvi
+++ b/tex/context/base/mkiv/publ-imp-apa.mkvi
@@ -73,6 +73,10 @@
[apa:\s!list]
\definebtx
+ [apa:\s!list:withauthor]
+ [apa:\s!list:author]
+
+\definebtx
[apa:\s!list:editor]
[apa:\s!list:author]
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 4fae21343..6c8d173f1 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 42f9a5e70..3d6989eb9 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-flt.mkvi b/tex/context/base/mkiv/strc-flt.mkvi
index 48f264319..3f1261cb4 100644
--- a/tex/context/base/mkiv/strc-flt.mkvi
+++ b/tex/context/base/mkiv/strc-flt.mkvi
@@ -950,13 +950,13 @@
\ifsinglesided
\doubleexpandafter\firstoftwoarguments
\else
- \doubleexpandafter\doifelseoddfloatpage
+ \doubleexpandafter\doifelseoddpagefloat
\fi
\else
\expandafter\firstoftwoarguments
\fi}
-\def\doifelseoddfloatpage
+\def\doifelseoddpagefloat
{\ifodd\purenumber\strc_float_realpage\space
\expandafter\firstoftwoarguments
\else
diff --git a/tex/context/base/mkiv/strc-ref.lua b/tex/context/base/mkiv/strc-ref.lua
index d9b7798e4..0cb9962d3 100644
--- a/tex/context/base/mkiv/strc-ref.lua
+++ b/tex/context/base/mkiv/strc-ref.lua
@@ -50,6 +50,8 @@ local v_file = variables.file
local v_unknown = variables.unknown
local v_page = variables.page
local v_auto = variables.auto
+local v_yes = variables.yes
+local v_name = variables.name
local context = context
local commands = commands
@@ -1877,8 +1879,10 @@ local defaultinnermethod = defaultinnermethod
references.innermethod = innermethod -- don't mess with this one directly
function references.setinnermethod(m)
- if toboolean(m) or m == v_page then
+ if toboolean(m) or m == v_page or m == v_yes then
innermethod = v_page
+ elseif m == v_name then
+ innermethod = v_name
else
innermethod = v_auto
end
@@ -1910,7 +1914,7 @@ local destinationattributes = { }
local function setinternalreference(specification)
local internal = specification.internal
local destination = unsetvalue
- if innermethod == v_auto then
+ if innermethod == v_auto or innermethod == v_name then
local t, tn = { }, 0 -- maybe add to current (now only used for tracing)
local reference = specification.reference
if reference then
@@ -1932,9 +1936,13 @@ local function setinternalreference(specification)
end
-- ugly .. later we decide to ignore it when we have a real one
-- but for testing we might want to see them all
- if internal then
- tn = tn + 1
- t[tn] = internal -- when number it's internal
+
+ if innermethod == v_page then
+ -- we dont' want too many #1 #2 #3 etc
+ if internal then
+ tn = tn + 1
+ t[tn] = internal -- when number it's internal
+ end
end
destination = references.mark(t,nil,nil,specification.view) -- returns an attribute
end
@@ -2002,7 +2010,7 @@ function references.setandgetattribute(data) -- maybe do internal automatically
if done then
attr = setinternalreference {
prefix = prefix,
- reference = tag,
+ reference = rdat.reference,
internal = rdat.internal,
view = rdat.view
} or unsetvalue
diff --git a/tex/context/base/mkiv/strc-ref.mkvi b/tex/context/base/mkiv/strc-ref.mkvi
index 404bef62f..c9f627712 100644
--- a/tex/context/base/mkiv/strc-ref.mkvi
+++ b/tex/context/base/mkiv/strc-ref.mkvi
@@ -259,7 +259,13 @@
\strc_references_flush_destination_nodes
\egroup
\strc_references_inject_after % new
- \fi}
+ \else\ifvoid\b_strc_destination_nodes\else
+ \strc_references_inject_before % new
+ \dontleavehmode\hbox \bgroup
+ \strc_references_flush_destination_nodes
+ \egroup
+ \strc_references_inject_after % new
+ \fi\fi}
\def\strc_references_set_page_only_destination_attribute#labels% could in fact be fully expandable
{\ifreferencing
@@ -333,7 +339,13 @@
\strc_references_flush_destination_nodes
\egroup
\strc_references_inject_after % new
- \fi}
+ \else\ifvoid\b_strc_destination_nodes\else
+ \strc_references_inject_before % new
+ \dontleavehmode\hbox \bgroup
+ \strc_references_flush_destination_nodes
+ \egroup
+ \strc_references_inject_after % new
+ \fi\fi}
\unexpanded\def\strc_references_direct_full
{\strc_references_direct_full_user\empty}
@@ -1438,16 +1450,16 @@
\unexpanded\def\directgoto
{\ifconditional\uselocationstrut
- \expandafter\dodirectgoto
+ \expandafter\strc_references_direct_goto
\else
- \expandafter\dodirectgotohtdp
+ \expandafter\strc_references_direct_goto_htdp
\fi}
\unexpanded\def\goto
{\ifconditional\uselocationstrut
- \expandafter\dogoto
+ \expandafter\strc_references_goto
\else
- \expandafter\dogotohtdp
+ \expandafter\strc_references_goto_htdp
\fi}
% The unbox trick is needed in order to permit \par inside a reference. Otherwise
@@ -1460,7 +1472,7 @@
\def\revivesavedreferenceattribute % sometimes handy as no test etc needed
{\attribute\referenceattribute\lastsavedreferenceattribute}
-\def\dodirectgoto#content[#label]% no test for valid references
+\def\strc_references_direct_goto#content[#label]% no test for valid references
{\dontleavehmode
\begingroup
\attribute\referenceattribute\attributeunsetvalue
@@ -1487,7 +1499,7 @@
\fi
\endgroup}
-\def\dodirectgotohtdp#content[#label]% no test for valid references
+\def\strc_references_direct_goto_htdp#content[#label]% no test for valid references
{\dontleavehmode
\begingroup
\global\lastsavedreferenceattribute\attributeunsetvalue
@@ -1513,7 +1525,7 @@
\fi
\endgroup}
-\def\dogoto#content#dummy[#label]% #dummy gobbles spaces
+\def\strc_references_goto#content#dummy[#label]% #dummy gobbles spaces
{\dontleavehmode
\begingroup
%\setbox\referencebox\hbox\bgroup % experiment, might change again to non \par support
@@ -1545,19 +1557,19 @@
\begingroup
\iflocation
\clf_doifelsereference{\referenceprefix}{#label}{\extrareferencearguments}%
- {\expandafter\startgoto_yes}%
- {\expandafter\startgoto_nop}%
+ {\expandafter\strc_references_start_goto_yes}%
+ {\expandafter\strc_references_start_goto_nop}%
\else
- \expandafter\startgoto_nop
+ \expandafter\strc_references_start_goto_nop
\fi}
-\unexpanded\def\startgoto_nop
- {\let\stopgoto\stopgoto_nop}
+\unexpanded\def\strc_references_start_goto_nop
+ {\let\stopgoto\strc_references_stop_goto_nop}
-\unexpanded\def\stopgoto_nop
+\unexpanded\def\strc_references_stop_goto_nop
{\endgroup}
-\unexpanded\def\startgoto_yes
+\unexpanded\def\strc_references_start_goto_yes
{\expandtexincurrentreference
\clf_injectcurrentreferencehtdp
\ht\strutbox
@@ -1568,13 +1580,13 @@
\global\lastsavedreferenceattribute\lastreferenceattribute
\attribute\referenceattribute\lastreferenceattribute
\dostarttagged\t!link\empty
- \let\stopgoto\stopgoto_yes}
+ \let\stopgoto\strc_references_stop_goto_yes}
-\unexpanded\def\stopgoto_yes
+\unexpanded\def\strc_references_stop_goto_yes
{\dostoptagged
\endgroup}
-\def\dogotohtdp#content#dummy[#label]% dummy gobbles spaces
+\def\strc_references_goto_htdp#content#dummy[#label]% dummy gobbles spaces
{\dontleavehmode
\begingroup
\global\lastsavedreferenceattribute\attributeunsetvalue
diff --git a/tex/context/base/mkiv/syst-aux.mkiv b/tex/context/base/mkiv/syst-aux.mkiv
index 726b3d644..94e5f468e 100644
--- a/tex/context/base/mkiv/syst-aux.mkiv
+++ b/tex/context/base/mkiv/syst-aux.mkiv
@@ -6851,7 +6851,7 @@
\unexpanded\def\addvalue#1#2% cs item
{\ifcsname#1\endcsname\else\expandafter\let\csname#1\endcsname\empty\fi
\normalexpanded{\noexpand\addtocommalist{#2}\expandafter\noexpand\csname#1\endcsname}}
-
+
\def\unspaced#1%
{\syst_helpers_unspaced#1\end}
@@ -6954,7 +6954,7 @@
\unexpanded\def\getrawxparameters {\dogetparameters\dosetrawxvalue}
\unexpanded\def\globalgetrawparameters{\dogetparameters\dosetrawgvalue} % obsolete
-
+
%D Sort of obsolete:
\newcount\c_syst_helpers_mod
@@ -6968,14 +6968,14 @@
\unexpanded\def\DoMod#1by#2to#3{\dosetmodulo {#1}{#2}{#3}}
\unexpanded\def\DoDiv#1by#2to#3{\dosetdivision{#1}{#2}{#3}}
-
+
\def\syst_helpers_unprotected#1\par
{#1\protect}
\unexpanded\def\unprotected
{\unprotect
\syst_helpers_unprotected}
-
+
% awaiting the definitive implementation
% \ifdefined\resettimer \else
@@ -6989,11 +6989,17 @@
\let\elapsedseconds \elapsedtime
\newcount\c_syst_helpers_test_feature_n
+\chardef \c_syst_helpers_test_feature_m\zerocount
+
+\def\currentfeaturetest{\number\c_syst_helpers_test_feature_n}
\unexpanded\def\testfeature#1#2%
- {\def\syst_helpers_test_feature_step
+ {\chardef\c_syst_helpers_test_feature_m#1\relax
+ \def\syst_helpers_test_feature_step
{\advance\c_syst_helpers_test_feature_n\plusone
- \ifnum\c_syst_helpers_test_feature_n>#1\else#2\expandafter\syst_helpers_test_feature_step\fi}%
+ \ifnum\c_syst_helpers_test_feature_n>\c_syst_helpers_test_feature_m\else
+ #2\expandafter\syst_helpers_test_feature_step
+ \fi}%
\retestfeature}
\unexpanded\def\retestfeature % timer support is new per 10/5/2005
@@ -7003,7 +7009,7 @@
\resettimer
\c_syst_helpers_test_feature_n\zerocount
\syst_helpers_test_feature_step
- \writestatus\m!system{feature test done (\elapsedseconds s)}%
+ \writestatus\m!system{\number\c_syst_helpers_test_feature_m\space feature tests done (\elapsedseconds s)}%
\wait
\egroup}
@@ -7015,7 +7021,7 @@
\let\wait\relax
\testfeature{#1}{#2}%
\endgroup}
-
+
%D \macros
%D {freezedimenmacro}
%D
@@ -7027,7 +7033,7 @@
\unexpanded\def\freezedimenmacro#1%
{\edef#1{\the\dimexpr#1}}
-
+
%D The next macro negates a macro (dimension or number, or actually, whatever.
%D It's a typical example of \type {\if} usage:
%D
@@ -7037,12 +7043,12 @@
%D \stoptyping
\def\negated#1{\if-#1\else-#1\fi} % does only work in macros or text
-
+
\def\gobbleassigndimen#1\\{}
\def\assigndimen#1#2%
{\afterassignment\gobbleassigndimen#1=#2\zeropoint\\}
-
+
\unexpanded\def\appended#1#2#3{\expandafter#1\expandafter#2\expandafter{#2#3}}
\unexpanded\def\appendvalue #1{\expandafter\appended\expandafter \def\csname#1\endcsname}
\unexpanded\def\appendgvalue#1{\expandafter\appended\expandafter\gdef\csname#1\endcsname}
@@ -7054,7 +7060,7 @@
\unexpanded\def\prependvalue #1{\expandafter\prepended\expandafter \def\csname#1\endcsname}
\unexpanded\def\prependgvalue#1{\expandafter\prepended\expandafter\gdef\csname#1\endcsname}
-
+
%D \macros
%D {dowithrange}
%D
@@ -7113,7 +7119,7 @@
{\syst_helpers_process_word#1 \_e_o_w_}% no \unskip
\let\processword\relax
-
+
%D \macros
%D {startnointerference}
%D
diff --git a/tex/context/base/mkiv/syst-ini.mkiv b/tex/context/base/mkiv/syst-ini.mkiv
index 12ceba15e..f461c0e47 100644
--- a/tex/context/base/mkiv/syst-ini.mkiv
+++ b/tex/context/base/mkiv/syst-ini.mkiv
@@ -234,6 +234,9 @@
\let\newfam\newfamily
+
+\ifdefined\firstvalidlanguage \firstvalidlanguage\plusone \fi
+
% Watch out, for the moment we disable the check for already being defined
% later we will revert this but first all chardefs must be replaced.
diff --git a/tex/context/base/mkiv/toks-ini.lua b/tex/context/base/mkiv/toks-ini.lua
index b66c24c16..132605d38 100644
--- a/tex/context/base/mkiv/toks-ini.lua
+++ b/tex/context/base/mkiv/toks-ini.lua
@@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['toks-ini'] = {
tokens = tokens or { }
local tokens = tokens
-local newtoken = newtoken or token
+local token = token -- the built in one
local tonumber = tonumber
local tostring = tostring
local utfchar = utf.char
@@ -18,7 +18,7 @@ local concat = table.concat
if setinspector then
- local istoken = newtoken.is_token
+ local istoken = token.is_token
local simple = { letter = "letter", other_char = "other" }
local function astable(t)
@@ -54,21 +54,27 @@ if setinspector then
end
-local scan_toks = newtoken.scan_toks
-local scan_string = newtoken.scan_string
-local scan_int = newtoken.scan_int
-local scan_code = newtoken.scan_code
-local scan_dimen = newtoken.scan_dimen
-local scan_glue = newtoken.scan_glue
-local scan_keyword = newtoken.scan_keyword
-local scan_token = newtoken.scan_token
-local scan_word = newtoken.scan_word
-local scan_number = newtoken.scan_number
-local scan_csname = newtoken.scan_csname
-
-local get_next = newtoken.get_next
-
-local set_macro = newtoken.set_macro
+local scan_toks = token.scan_toks
+local scan_string = token.scan_string
+local scan_int = token.scan_int
+local scan_code = token.scan_code
+local scan_dimen = token.scan_dimen
+local scan_glue = token.scan_glue
+local scan_keyword = token.scan_keyword
+local scan_token = token.scan_token
+local scan_word = token.scan_word
+local scan_number = token.scan_number
+local scan_csname = token.scan_csname
+
+local get_next = token.get_next
+
+local set_macro = token.set_macro
+local get_cmdname = token.get_cmdname
+local create_token = token.create
+
+function tokens.defined(name)
+ return get_cmdname(create_token(name)) ~= "undefined_cs"
+end
-- set_macro = function(k,v,g)
-- if g == "global" then
diff --git a/tex/context/base/mkiv/toks-tra.lua b/tex/context/base/mkiv/toks-tra.lua
index 4b0b82f0a..a1408b0b8 100644
--- a/tex/context/base/mkiv/toks-tra.lua
+++ b/tex/context/base/mkiv/toks-tra.lua
@@ -11,7 +11,7 @@ local format, gsub = string.format, string.gsub
local tostring = tostring
local tokens = tokens
-local newtoken = newtoken or token
+local token = token -- the built in one
local tex = tex
local context = context
local commands = commands
@@ -33,8 +33,8 @@ local report = logs.reporter("tokens","collectors")
-- flush : print back to tex
-- test : fancy stuff
-local get_next = newtoken.get_next
-local create = newtoken.create
+local get_next = token.get_next
+local create_token = token.create
function collectors.install(tag,end_cs)
local data, d = { }, 0
@@ -261,20 +261,20 @@ collectors.dowithwords = collectors.test
-- This is only used in old articles ... will move to a module:
-tokens.vbox = create("vbox")
-tokens.hbox = create("hbox")
-tokens.vtop = create("vtop")
-tokens.bgroup = create(utfbyte("{"),1)
-tokens.egroup = create(utfbyte("}"),2)
+tokens.vbox = create_token("vbox")
+tokens.hbox = create_token("hbox")
+tokens.vtop = create_token("vtop")
+tokens.bgroup = create_token(utfbyte("{"),1)
+tokens.egroup = create_token(utfbyte("}"),2)
-tokens.letter = function(chr) return create(utfbyte(chr),11) end
-tokens.other = function(chr) return create(utfbyte(chr),12) end
+tokens.letter = function(chr) return create_token(utfbyte(chr),11) end
+tokens.other = function(chr) return create_token(utfbyte(chr),12) end
tokens.letters = function(str)
local t, n = { }, 0
for chr in utfvalues(str) do
n = n + 1
- t[n] = create(chr, 11)
+ t[n] = create_token(chr, 11)
end
return t
end
@@ -283,7 +283,7 @@ function collectors.defaultwords(t,str)
if t then
local n = #t
n = n + 1 ; t[n] = tokens.bgroup
- n = n + 1 ; t[n] = create("red")
+ n = n + 1 ; t[n] = create_token("red")
for i=1,#str do
n = n + 1 ; t[n] = tokens.other('*')
end
diff --git a/tex/context/base/mkiv/trac-tex.lua b/tex/context/base/mkiv/trac-tex.lua
index 24dc3f1bd..86f3b539f 100644
--- a/tex/context/base/mkiv/trac-tex.lua
+++ b/tex/context/base/mkiv/trac-tex.lua
@@ -13,7 +13,7 @@ local next = next
local texhashtokens = tex.hashtokens
local trackers = trackers
-local newtoken = newtoken or token
+local token = token
local saved = { }
function trackers.savehash()
@@ -23,7 +23,7 @@ end
function trackers.dumphashtofile(filename,delta)
local list = { }
local hash = tex.hashtokens()
- local create = newtoken.create
+ local create = token.create
for name, token in next, hash do
if not delta or not saved[name] then
if token[2] ~= 0 then -- still old interface
diff --git a/tex/context/base/mkiv/typo-brk.lua b/tex/context/base/mkiv/typo-brk.lua
index 2e6ac7ab1..2f97f1869 100644
--- a/tex/context/base/mkiv/typo-brk.lua
+++ b/tex/context/base/mkiv/typo-brk.lua
@@ -71,6 +71,7 @@ local kerncodes = nodes.kerncodes
local glyph_code = nodecodes.glyph
local kern_code = nodecodes.kern
+local math_code = nodecodes.math
local fontkern_code = kerncodes.fontkern
local userkern_code = kerncodes.userkern
diff --git a/tex/context/interface/common/i-en-xml.xml b/tex/context/interface/common/i-en-xml.xml
index ce90f7bb1..363364e08 100644
--- a/tex/context/interface/common/i-en-xml.xml
+++ b/tex/context/interface/common/i-en-xml.xml
@@ -44,6 +44,18 @@
<cd:arguments><cd:resolve name="xml-node-path"/></cd:arguments>
</cd:command>
+ <cd:command name="xmlpure">
+ <cd:arguments><cd:resolve name="xml-node-path"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlflushtext">
+ <cd:arguments><cd:resolve name="xml-node"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlflushpure">
+ <cd:arguments><cd:resolve name="xml-node"/></cd:arguments>
+ </cd:command>
+
<cd:command name="xmlnonspace">
<cd:arguments><cd:resolve name="xml-node-path"/></cd:arguments>
</cd:command>
diff --git a/tex/context/modules/mkiv/x-mathml.mkiv b/tex/context/modules/mkiv/x-mathml.mkiv
index 7b474275b..a5be5ddb0 100644
--- a/tex/context/modules/mkiv/x-mathml.mkiv
+++ b/tex/context/modules/mkiv/x-mathml.mkiv
@@ -1729,7 +1729,7 @@
} {
\xmldoifelse {#1} {.[oneof(@encoding,'asciimath','am')]} {
\ifdefined\asciimath
- \expanded{\asciimath{\xmlflush{#1}}}
+ \expanded{\asciimath{\xmlflushpure{#1}}}
\else
\hbox{\tt no am loaded}
\fi
diff --git a/tex/generic/context/luatex/luatex-fonts-def.lua b/tex/generic/context/luatex/luatex-fonts-def.lua
index f0941ecdc..494ac00a9 100644
--- a/tex/generic/context/luatex/luatex-fonts-def.lua
+++ b/tex/generic/context/luatex/luatex-fonts-def.lua
@@ -47,7 +47,7 @@ local filename_1 = P("file:")/isfile * (namespec/thename)
local filename_2 = P("[") * P(true)/isname * (((1-P("]"))^0)/thename) * P("]")
local fontname_1 = P("name:")/isname * (namespec/thename)
local fontname_2 = P(true)/issome * (namespec/thename)
-local sometext = (R("az","AZ","09") + S("+-."))^1
+local sometext = (R("az","AZ","09") + S("+-.{}"))^1
local truevalue = P("+") * spaces * (sometext/istrue)
local falsevalue = P("-") * spaces * (sometext/isfalse)
local keyvalue = (C(sometext) * spaces * P("=") * spaces * C(sometext))/iskey
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 52a68c867..85d215e19 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/sources/luatex-fonts.lua
--- merge date : 02/08/16 15:35:20
+-- merge date : 02/15/16 10:26:35
do -- begin closure to overcome local limits and interference
@@ -13146,6 +13146,8 @@ local function chaindisk(head,start,last,kind,chainname,ck,lookuphash,chainlooku
else
break
end
+ else
+ break
end
end
if sweepoverflow then
@@ -16183,7 +16185,7 @@ local filename_1=P("file:")/isfile*(namespec/thename)
local filename_2=P("[")*P(true)/isname*(((1-P("]"))^0)/thename)*P("]")
local fontname_1=P("name:")/isname*(namespec/thename)
local fontname_2=P(true)/issome*(namespec/thename)
-local sometext=(R("az","AZ","09")+S("+-."))^1
+local sometext=(R("az","AZ","09")+S("+-.{}"))^1
local truevalue=P("+")*spaces*(sometext/istrue)
local falsevalue=P("-")*spaces*(sometext/isfalse)
local keyvalue=(C(sometext)*spaces*P("=")*spaces*C(sometext))/iskey
diff --git a/tex/generic/context/luatex/luatex-test.tex b/tex/generic/context/luatex/luatex-test.tex
index f851aab6f..9844428ac 100644
--- a/tex/generic/context/luatex/luatex-test.tex
+++ b/tex/generic/context/luatex/luatex-test.tex
@@ -1,4 +1,4 @@
-% texformat=luatex-plain
+texformat=luatex-plain
%D \module
%D [ file=luatex-test,
@@ -131,4 +131,20 @@ $\root3\of x$
$\sin{x}$
+\bgroup
+
+ % drawback: no features (so use basemode)
+
+ \font\crapa=lmroman12-regular:mode=base;liga=yes;kern=yes; at 12pt
+ \font\crapb=lmsans12-regular:mode=base;liga=yes;kern=yes; at 30pt
+ %\font\mine=file:luatex-fonts-demo-vf-4.lua:1=lmroman12-regular;2=lmsans12-regular{0x41-0x5A+0x30-0x39+0x21}; at 12pt
+ \font\mine=file:luatex-fonts-demo-vf-4.lua:1=\fontid\crapa;2=\fontid\crapb{0x41-0x5A+0x30-0x39+0x21}; at 12pt
+
+ \crapa Test\par
+ \crapb Test\par
+
+ \mine Zomaar een eindje fiets! En dan weer terug.
+
+\egroup
+
\end