summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-11-07 12:49:36 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-11-07 12:49:36 +0100
commit75fbb107b15d01179a4b772844144e0661240e77 (patch)
treec5210f4f9ade25c89a540f755912a52966404792 /tex/context/base/mkiv
parent7830451577b876020de2a26bbfbf069625ab4d6f (diff)
downloadcontext-75fbb107b15d01179a4b772844144e0661240e77.tar.gz
2017-11-07 11:43:00
Diffstat (limited to 'tex/context/base/mkiv')
-rw-r--r--tex/context/base/mkiv/anch-pos.lua2
-rw-r--r--tex/context/base/mkiv/char-ini.lua2
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/font-ext.lua2
-rw-r--r--tex/context/base/mkiv/font-otr.lua2
-rw-r--r--tex/context/base/mkiv/font-ots.lua3
-rw-r--r--tex/context/base/mkiv/l-file.lua4
-rw-r--r--tex/context/base/mkiv/l-package.lua2
-rw-r--r--tex/context/base/mkiv/l-string.lua4
-rw-r--r--tex/context/base/mkiv/luat-cnf.lua17
-rw-r--r--tex/context/base/mkiv/luat-cod.lua9
-rw-r--r--tex/context/base/mkiv/luat-fio.lua4
-rw-r--r--tex/context/base/mkiv/luat-sto.lua55
-rw-r--r--tex/context/base/mkiv/lxml-tex.lua2
-rw-r--r--tex/context/base/mkiv/math-act.lua22
-rw-r--r--tex/context/base/mkiv/mlib-pdf.lua10
-rw-r--r--tex/context/base/mkiv/mult-fun.lua8
-rw-r--r--tex/context/base/mkiv/publ-ini.lua20
-rw-r--r--tex/context/base/mkiv/publ-ini.mkiv18
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin25796 -> 25806 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin249881 -> 249990 bytes
-rw-r--r--tex/context/base/mkiv/syst-lua.lua2
-rw-r--r--tex/context/base/mkiv/util-lib.lua7
-rw-r--r--tex/context/base/mkiv/util-lua.lua12
25 files changed, 110 insertions, 101 deletions
diff --git a/tex/context/base/mkiv/anch-pos.lua b/tex/context/base/mkiv/anch-pos.lua
index d082d8e92..e5f58c36c 100644
--- a/tex/context/base/mkiv/anch-pos.lua
+++ b/tex/context/base/mkiv/anch-pos.lua
@@ -22,7 +22,7 @@ more efficient.</p>
local tostring, next, rawget, rawset, setmetatable, tonumber = tostring, next, rawget, rawset, setmetatable, tonumber
local sort, sortedhash, sortedkeys = table.sort, table.sortedhash, table.sortedkeys
-local format, gmatch, match, find = string.format, string.gmatch, string.match, string.find
+local format, gmatch = string.format, string.gmatch
local rawget = rawget
local lpegmatch = lpeg.match
local insert, remove = table.insert, table.remove
diff --git a/tex/context/base/mkiv/char-ini.lua b/tex/context/base/mkiv/char-ini.lua
index c17eb2726..8bf35a8dd 100644
--- a/tex/context/base/mkiv/char-ini.lua
+++ b/tex/context/base/mkiv/char-ini.lua
@@ -14,7 +14,7 @@ if not modules then modules = { } end modules ['char-ini'] = {
local utfchar, utfbyte, utfvalues, ustring, utotable = utf.char, utf.byte, utf.values, utf.ustring, utf.totable
local concat, unpack, tohash, insert = table.concat, table.unpack, table.tohash, table.insert
local next, tonumber, type, rawget, rawset = next, tonumber, type, rawget, rawset
-local format, lower, gsub, find, match = string.format, string.lower, string.gsub, string.find, string.match
+local format, lower, gsub, find = string.format, string.lower, string.gsub, string.find
local P, R, S, C, Cs, Ct, Cc, V = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg.Ct, lpeg.Cc, lpeg.V
local formatters = string.formatters
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index a9e11c3e3..565388df2 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{2017.11.01 15:58}
+\newcontextversion{2017.11.07 11:37}
%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 f9a74be28..4254db4d5 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -41,7 +41,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2017.11.01 15:58}
+\edef\contextversion{2017.11.07 11:37}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/font-ext.lua b/tex/context/base/mkiv/font-ext.lua
index a393b18fe..0fa3f7279 100644
--- a/tex/context/base/mkiv/font-ext.lua
+++ b/tex/context/base/mkiv/font-ext.lua
@@ -792,7 +792,7 @@ local pop = { "pop" }
-- end)
local bp = number.dimenfactors.bp
-local r = 0.25*65536*bp
+local r = 16384 * bp -- 65536 // 4
local backcache = setmetatableindex(function(t,h)
local h = h * bp
diff --git a/tex/context/base/mkiv/font-otr.lua b/tex/context/base/mkiv/font-otr.lua
index c36f1ae42..5bac75052 100644
--- a/tex/context/base/mkiv/font-otr.lua
+++ b/tex/context/base/mkiv/font-otr.lua
@@ -1345,7 +1345,7 @@ formatreaders[4] = function(f,fontdata,offset)
offsets[i] = readushort(f)
end
-- format length language nofsegments searchrange entryselector rangeshift 4-tables
- local size = (length - 2 * 2 - 5 * 2 - 4 * nofsegments * 2) / 2
+ local size = (length - 2 * 2 - 5 * 2 - 4 * 2 * nofsegments) / 2
for i=1,size-1 do
indices[i] = readushort(f)
end
diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua
index 2e82de21a..246681d17 100644
--- a/tex/context/base/mkiv/font-ots.lua
+++ b/tex/context/base/mkiv/font-ots.lua
@@ -108,6 +108,9 @@ mechanisms. Both put some constraints on the code here.</p>
-- Remark: We can provide a fast loop when there are no disc nodes (tests show a 1%
-- gain). Smaller functions might perform better cache-wise. But ... memory becomes
-- faster anyway, so ...
+--
+-- Remark: Some optimizations made sense for 5.2 but seem less important for 5.3 but
+-- anyway served their purpose.
local type, next, tonumber = type, next, tonumber
local random = math.random
diff --git a/tex/context/base/mkiv/l-file.lua b/tex/context/base/mkiv/l-file.lua
index f2a27ad18..c04883d8b 100644
--- a/tex/context/base/mkiv/l-file.lua
+++ b/tex/context/base/mkiv/l-file.lua
@@ -96,6 +96,10 @@ function lfs.isfile(name)
return attributes(name,"mode") == "file"
end
+function lfs.isfound(name)
+ return attributes(name,"mode") == "file" and name or nil
+end
+
local colon = P(":")
local period = P(".")
local periods = P("..")
diff --git a/tex/context/base/mkiv/l-package.lua b/tex/context/base/mkiv/l-package.lua
index 6a4f9d011..d43c5c5c6 100644
--- a/tex/context/base/mkiv/l-package.lua
+++ b/tex/context/base/mkiv/l-package.lua
@@ -22,7 +22,7 @@ local gsub, format, find = string.gsub, string.format, string.find
local P, S, Cs, lpegmatch = lpeg.P, lpeg.S, lpeg.Cs, lpeg.match
local package = package
-local searchers = package.searchers
+local searchers = package.searchers or package.loaders
local insert, remove = table.insert, table.remove
-------.loaders = nil -- old stuff that we don't want
diff --git a/tex/context/base/mkiv/l-string.lua b/tex/context/base/mkiv/l-string.lua
index cda837615..8ae8d8d1d 100644
--- a/tex/context/base/mkiv/l-string.lua
+++ b/tex/context/base/mkiv/l-string.lua
@@ -220,11 +220,11 @@ string.unquote = string.unquoted
-- new
-if not string.bytetable then
+if not string.bytetable then -- used in font-cff.lua
local limit = 5000 -- we can go to 8000 in luajit and much higher in lua if needed
- function string.bytetable(str)
+ function string.bytetable(str) -- from a string
local n = #str
if n > limit then
local t = { byte(str,1,limit) }
diff --git a/tex/context/base/mkiv/luat-cnf.lua b/tex/context/base/mkiv/luat-cnf.lua
index 416ae34fa..46294741f 100644
--- a/tex/context/base/mkiv/luat-cnf.lua
+++ b/tex/context/base/mkiv/luat-cnf.lua
@@ -119,16 +119,21 @@ function texconfig.init()
-- shortcut and helper
- local bytecode = lua.bytecode
+ local setbytecode = lua.setbytecode
+ local getbytecode = lua.getbytecode
local function init(start)
local i = start
local t = os.clock()
- while bytecode[i] do
- bytecode[i]() ;
- bytecode[i] = nil ;
- i = i + 1
- -- collectgarbage('step')
+ while true do
+ local b = getbytecode(i)
+ if b then
+ b() ;
+ setbytecode(i,nil) ;
+ i = i + 1
+ else
+ break
+ end
end
return i - start, os.clock() - t
end
diff --git a/tex/context/base/mkiv/luat-cod.lua b/tex/context/base/mkiv/luat-cod.lua
index 3b0881147..445e365ff 100644
--- a/tex/context/base/mkiv/luat-cod.lua
+++ b/tex/context/base/mkiv/luat-cod.lua
@@ -20,14 +20,17 @@ texconfig.max_in_open = 1000
-- registering bytecode chunks
-local bytecode = lua.bytecode or { }
+----- bytecode = lua.bytecode or { } -- we use functions
local bytedata = lua.bytedata or { }
local bytedone = lua.bytedone or { }
-lua.bytecode = bytecode -- built in anyway
+---.bytecode = bytecode
lua.bytedata = bytedata
lua.bytedone = bytedone
+local setbytecode = lua.setbytecode
+local getbytecode = lua.getbytecode
+
lua.firstbytecode = 501
lua.lastbytecode = lua.lastbytecode or (lua.firstbytecode - 1) -- as we load ourselves again ... maybe return earlier
@@ -54,7 +57,7 @@ function lua.registercode(filename,options)
if environment.initex then
local n = lua.lastbytecode + 1
bytedata[n] = { name = barename, options = opts }
- bytecode[n] = code
+ setbytecode(n,code)
lua.lastbytecode = n
end
elseif environment.initex then
diff --git a/tex/context/base/mkiv/luat-fio.lua b/tex/context/base/mkiv/luat-fio.lua
index a215d1b16..806caefe6 100644
--- a/tex/context/base/mkiv/luat-fio.lua
+++ b/tex/context/base/mkiv/luat-fio.lua
@@ -84,7 +84,7 @@ if not resolvers.initialized() then
register('find_opentype_file' , function(name) return findbinfile(name,"otf") end, true)
register('find_output_file' , function(name) return name end, true)
register('find_pk_file' , findpk, true)
- register('find_sfd_file' , function(name) return findbinfile(name,"sfd") end, true)
+ -- register('find_sfd_file' , function(name) return findbinfile(name,"sfd") end, true)
register('find_truetype_file' , function(name) return findbinfile(name,"ttf") end, true)
register('find_type1_file' , function(name) return findbinfile(name,"pfb") end, true)
register('find_vf_file' , function(name) return findbinfile(name,"vf") end, true)
@@ -98,7 +98,7 @@ if not resolvers.initialized() then
register('read_map_file' , function(file) return loadbinfile(file,"map") end, true)
-- output
register('read_pk_file' , function(file) return loadbinfile(file,"pk") end, true) -- 600dpi/manfnt.720pk
- register('read_sfd_file' , function(file) return loadbinfile(file,"sfd") end, true)
+ -- register('read_sfd_file' , function(file) return loadbinfile(file,"sfd") end, true)
register('read_vf_file' , function(file) return loadbinfile(file,"vf" ) end, true)
-- register('find_font_file' , function(name) return findbinfile(name,"ofm") end, true)
diff --git a/tex/context/base/mkiv/luat-sto.lua b/tex/context/base/mkiv/luat-sto.lua
index b04d655c2..e67830b0d 100644
--- a/tex/context/base/mkiv/luat-sto.lua
+++ b/tex/context/base/mkiv/luat-sto.lua
@@ -11,8 +11,9 @@ if not modules then modules = { } end modules ['luat-sto'] = {
local type, next, setmetatable, getmetatable, collectgarbage = type, next, setmetatable, getmetatable, collectgarbage
local gmatch, format = string.gmatch, string.format
local serialize, concat, sortedhash = table.serialize, table.concat, table.sortedhash
-local bytecode = lua.bytecode
+local setbytecode = lua.setbytecode
local strippedloadstring = utilities.lua.strippedloadstring
+local loadstring = utilities.lua.loadstring
local formatters = string.formatters
local trace_storage = false
@@ -53,36 +54,6 @@ local n = 0 -- is that one used ?
if environment.initex then
- -- local function dump()
- -- local max = storage.max
- -- for i=1,#data do
- -- local d = data[i]
- -- local message, original, target = d[1], d[2] ,d[3]
- -- local c, code, name = 0, { }, nil
- -- -- we have a nice definer for this
- -- for str in gmatch(target,"([^%.]+)") do
- -- if name then
- -- name = name .. "." .. str
- -- else
- -- name = str
- -- end
- -- c = c + 1 ; code[c] = formatters["%s = %s or { }"](name,name)
- -- end
- -- max = max + 1
- -- if trace_storage then
- -- c = c + 1 ; code[c] = formatters["print('restoring %s from slot %s')"](message,max)
- -- end
- -- c = c + 1 ; code[c] = serialize(original,name)
- -- if trace_storage then
- -- report_storage('saving %a in slot %a, size %s',message,max,#code[c])
- -- end
- -- -- we don't need tracing in such tables
- -- bytecode[max] = strippedloadstring(concat(code,"\n"),storage.strip,format("slot %s (%s)",max,name))
- -- collectgarbage("step")
- -- end
- -- storage.max = max
- -- end
-
local function dump()
local max = storage.max
local strip = storage.strip
@@ -105,7 +76,15 @@ if environment.initex then
end
-- we don't need tracing in such tables
dumped = concat({ definition, comment, dumped },"\n")
- bytecode[max] = strippedloadstring(dumped,strip,formatters["slot %s (%s)"](max,name))
+ local code = nil
+ local name = formatters["slot %s (%s)"](max,name)
+ if LUAVERSION >= 5.3 and LUATEXFUNCTIONALITY >= 6454 then
+ local code = loadstring(dumped,name)
+ setbytecode(max,code,strip)
+ else
+ local code = strippedloadstring(dumped,name,strip)
+ setbytecode(max,code)
+ end
collectgarbage("step")
end
storage.max = max
@@ -131,18 +110,6 @@ function lua.collectgarbage(threshold)
end
end
--- -- we also need to count at generation time (nicer for message)
---
--- if lua.bytecode then -- from 0 upwards
--- local i, b = storage.min, lua.bytecode
--- while b[i] do
--- storage.noftables = i
--- b[i]()
--- b[i] = nil
--- i = i + 1
--- end
--- end
-
statistics.register("stored bytecode data", function()
local nofmodules = (storage.nofmodules > 0 and storage.nofmodules) or (status.luabytecodes - lua.firstbytecode - 1)
local nofdumps = (storage.noftables > 0 and storage.noftables ) or storage.max-storage.min + 1
diff --git a/tex/context/base/mkiv/lxml-tex.lua b/tex/context/base/mkiv/lxml-tex.lua
index 2fd26c3b2..5223fb8c9 100644
--- a/tex/context/base/mkiv/lxml-tex.lua
+++ b/tex/context/base/mkiv/lxml-tex.lua
@@ -1265,7 +1265,7 @@ function lxml.setsetup(id,pattern,setup)
report_lxml("%s lpath matches for pattern: %s","no",pattern)
end
else
- local a, b = match(setup,"^(.+:)([%*%-])$")
+ local a, b = match(setup,"^(.+:)([%*%-%+])$")
if a and b then
local collected = xmlapplylpath(getid(id),pattern)
if collected then
diff --git a/tex/context/base/mkiv/math-act.lua b/tex/context/base/mkiv/math-act.lua
index 5d33031cf..404ebbbcd 100644
--- a/tex/context/base/mkiv/math-act.lua
+++ b/tex/context/base/mkiv/math-act.lua
@@ -231,12 +231,13 @@ function mathematics.overloaddimensions(target,original,set)
if trace_defining then
report_math("overloading dimensions in %a @ %p",target.properties.fullname,target.parameters.size)
end
- local characters = target.characters
- local parameters = target.parameters
- local factor = parameters.factor
- local hfactor = parameters.hfactor
- local vfactor = parameters.vfactor
- local addprivate = fonts.helpers.addprivate
+ local characters = target.characters
+ local descriptions = target.descriptions
+ local parameters = target.parameters
+ local factor = parameters.factor
+ local hfactor = parameters.hfactor
+ local vfactor = parameters.vfactor
+ local addprivate = fonts.helpers.addprivate
-- to be sure
target.type = "virtual"
target.properties.virtualized = true
@@ -264,7 +265,14 @@ function mathematics.overloaddimensions(target,original,set)
--
local xoffset = data.xoffset
local yoffset = data.yoffset
- if xoffset then
+ if xoffset == "llx" then
+ local d = descriptions[unicode]
+ if d then
+ xoffset = - d.boundingbox[1] * hfactor
+ character.width = character.width + xoffset
+ xoffset = { "right", xoffset }
+ end
+ elseif xoffset then
xoffset = { "right", xoffset * hfactor }
end
if yoffset then
diff --git a/tex/context/base/mkiv/mlib-pdf.lua b/tex/context/base/mkiv/mlib-pdf.lua
index 0c2945316..7fd6cb62c 100644
--- a/tex/context/base/mkiv/mlib-pdf.lua
+++ b/tex/context/base/mkiv/mlib-pdf.lua
@@ -216,13 +216,14 @@ end
local function flushnormalpath(path, t, open)
local pth, ith, nt
+ local length = #path
if t then
nt = #t
else
t = { }
nt = 0
end
- for i=1,#path do
+ for i=1,length do
nt = nt + 1
pth = path[i]
if not ith then
@@ -242,7 +243,7 @@ local function flushnormalpath(path, t, open)
else
t[nt] = f_l(one.x_coord,one.y_coord)
end
- elseif #path == 1 then
+ elseif length == 1 then
-- special case .. draw point
local one = path[1]
nt = nt + 1
@@ -253,6 +254,7 @@ end
local function flushconcatpath(path, t, open)
local pth, ith, nt
+ local length = #path
if t then
nt = #t
else
@@ -261,7 +263,7 @@ local function flushconcatpath(path, t, open)
end
nt = nt + 1
t[nt] = f_cm(sx,rx,ry,sy,tx,ty)
- for i=1,#path do
+ for i=1,length do
nt = nt + 1
pth = path[i]
if not ith then
@@ -285,7 +287,7 @@ local function flushconcatpath(path, t, open)
else
t[nt] = f_l(mpconcat(one.x_coord,one.y_coord))
end
- elseif #path == 1 then
+ elseif length == 1 then
-- special case .. draw point
nt = nt + 1
local one = path[1]
diff --git a/tex/context/base/mkiv/mult-fun.lua b/tex/context/base/mkiv/mult-fun.lua
index 34492b30a..9b7062605 100644
--- a/tex/context/base/mkiv/mult-fun.lua
+++ b/tex/context/base/mkiv/mult-fun.lua
@@ -11,7 +11,7 @@ return {
-- "originlength", "tickstep ", "ticklength",
-- "autoarrows", "ahfactor",
-- "angleoffset", anglelength", anglemethod",
- "ahvariant", "ahdimple", "ahfactor",
+ "ahvariant", "ahdimple", "ahfactor", "ahscale",
"metapostversion",
"maxdimensions",
"drawoptionsfactor",
@@ -36,10 +36,10 @@ return {
"smoothed", "cornered", "superellipsed", "randomized", "randomizedcontrols", "squeezed", "enlonged", "shortened",
"punked", "curved", "unspiked", "simplified", "blownup", "stretched",
"enlarged", "leftenlarged", "topenlarged", "rightenlarged", "bottomenlarged",
- "crossed", "laddered", "randomshifted", "interpolated", "paralleled", "cutends", "peepholed",
+ "crossed", "laddered", "randomshifted", "interpolated", "perpendicular", "paralleled", "cutends", "peepholed",
"llenlarged", "lrenlarged", "urenlarged", "ulenlarged",
"llmoved", "lrmoved", "urmoved", "ulmoved",
- "rightarrow", "leftarrow", "centerarrow",
+ "rightarrow", "leftarrow", "centerarrow", "drawdoublearrows",
"boundingbox", "innerboundingbox", "outerboundingbox", "pushboundingbox", "popboundingbox",
"boundingradius", "boundingcircle", "boundingpoint",
"crossingunder", "insideof", "outsideof",
@@ -63,7 +63,7 @@ return {
"checkedbounds", "checkbounds", "strut", "rule",
"withmask", "bitmapimage",
"colordecimals", "ddecimal", "dddecimal", "ddddecimal", "colordecimalslist",
- "textext", "thetextext", "rawtextext", "textextoffset", "texbox", "thetexbox", "rawtexbox",
+ "textext", "thetextext", "rawtextext", "textextoffset", "texbox", "thetexbox", "rawtexbox", "istextext",
"verbatim",
"thelabel", "label",
"autoalign",
diff --git a/tex/context/base/mkiv/publ-ini.lua b/tex/context/base/mkiv/publ-ini.lua
index 130f9a49b..99a37e8b9 100644
--- a/tex/context/base/mkiv/publ-ini.lua
+++ b/tex/context/base/mkiv/publ-ini.lua
@@ -127,6 +127,7 @@ local ctx_btxsetafter = context.btxsetafter
local ctx_btxsetbacklink = context.btxsetbacklink
local ctx_btxsetfirstinternal = context.btxsetfirstinternal
local ctx_btxsetlastinternal = context.btxsetlastinternal
+local ctx_btxsetauthorfield = context.btxsetauthorfield
-- local ctx_btxsetdataset = function(s) setmacro("currentbtxdataset", s) end -- context.btxsetdataset
-- local ctx_btxsettag = function(s) setmacro("currentbtxtag", s) end -- context.btxsettag
@@ -2637,6 +2638,7 @@ do
local setter = specification.setter
local compressor = specification.compressor
local method = specification.method
+ local varfield = specification.varfield
--
local reference = publications.parenttag(dataset,reference)
--
@@ -2664,6 +2666,7 @@ do
language = ldata.language,
dataset = dataset,
tag = tag,
+ varfield = varfield,
-- combis = entry.userdata.btxcom,
-- luadata = ldata,
}
@@ -3107,11 +3110,6 @@ do
return keysorter(b,a)
end
- local currentbtxciteauthor = function()
- context.currentbtxciteauthor()
- return true -- needed?
- end
-
local function authorcompressor(found,specification)
-- HERE
if specification.sorttype == v_normal then
@@ -3219,7 +3217,13 @@ do
local partialinteractive = false
+ local currentbtxciteauthor = function()
+ context.currentbtxciteauthorbyfield()
+ return true -- needed?
+ end
+
local function authorgetter(first,last,key,specification) -- only first
+ ctx_btxsetauthorfield(first.varfield or "author")
if first.type == "author" then
ctx_btxsetfirst(currentbtxciteauthor) -- formatter (much slower)
else
@@ -3246,15 +3250,16 @@ do
return true
end
- -- author
+ -- author (the varfield hack is for editor and translator i.e author type)
local function setter(data,dataset,tag,entry)
- data.author, data.field, data.type = getcasted(dataset,tag,"author")
+ data.author, data.field, data.type = getcasted(dataset,tag,data.varfield or "author")
data.sortkey = text and lpegmatch(numberonly,text)
data.authorhash = getdetail(dataset,tag,"authorhash") -- todo let getcasted return
end
local function getter(first,last,_,specification)
+ ctx_btxsetauthorfield(specification.varfield or "author")
if first.type == "author" then
ctx_btxsetfirst(currentbtxciteauthor) -- formatter (much slower)
else
@@ -3269,6 +3274,7 @@ do
setup = "author",
setter = setter,
getter = getter,
+ varfield = presets.variant or "author",
compressor = authorcompressor,
})
end
diff --git a/tex/context/base/mkiv/publ-ini.mkiv b/tex/context/base/mkiv/publ-ini.mkiv
index 5e496866b..0802fa7d0 100644
--- a/tex/context/base/mkiv/publ-ini.mkiv
+++ b/tex/context/base/mkiv/publ-ini.mkiv
@@ -1182,7 +1182,11 @@
\unexpanded\def\btxflushauthorinverted {\btx_flush_author{inverted}} % #1
\unexpanded\def\btxflushauthorinvertedshort{\btx_flush_author{invertedshort}} % #1
-\unexpanded\def\currentbtxciteauthor % always author
+\let\currentbtxauthorfield\s!author
+
+\unexpanded\def\btxsetauthorfield#1{\edef\currentbtxauthorfield{#1}}
+
+\unexpanded\def\currentbtxciteauthorbyfield
{\begingroup
%\setbtxparameterset\s!cite\s!author
% the alternatives inherit from cite:author
@@ -1191,7 +1195,7 @@
\clf_btxauthor
{\currentbtxdataset}%
{\currentbtxtag}%
- {\s!author}%
+ {\currentbtxauthorfield}%
{%
combiner {\btxparameter\c!authorconversion}%
kind {cite}%
@@ -1203,6 +1207,10 @@
\relax
\endgroup}
+\unexpanded\def\currentbtxciteauthor
+ {\let\currentbtxauthorfield\s!author
+ \currentbtxciteauthorbyfield} % always author
+
\unexpanded\def\btxstartauthor#1#2#3% a state > 0 signals that some authors can clash
{\begingroup
\currentbtxauthorindex#1\relax
@@ -1226,12 +1234,6 @@
% \btxflushauthor{author}
% \btxflushauthor{editor}
-%
-% \btxflushauthor[name]{author}
-% \btxflushauthor[normal]{author}
-% \btxflushauthor[normalshort]{author}
-% \btxflushauthor[inverted]{author}
-% \btxflushauthor[invertedshort]{author}
% Interaction
%
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index fbcb8cc63..e21fd578f 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 7ef4d1822..25226669a 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/syst-lua.lua b/tex/context/base/mkiv/syst-lua.lua
index 86a9a28f3..35cd22123 100644
--- a/tex/context/base/mkiv/syst-lua.lua
+++ b/tex/context/base/mkiv/syst-lua.lua
@@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['syst-lua'] = {
license = "see context related readme files"
}
-local find, match = string.find, string.match
+local find = string.find
local S, C, P, lpegmatch, lpegtsplitat = lpeg.S, lpeg.C, lpeg.P, lpeg.match, lpeg.tsplitat
commands = commands or { }
diff --git a/tex/context/base/mkiv/util-lib.lua b/tex/context/base/mkiv/util-lib.lua
index 5c3f5f3cf..490cb3291 100644
--- a/tex/context/base/mkiv/util-lib.lua
+++ b/tex/context/base/mkiv/util-lib.lua
@@ -186,10 +186,11 @@ local function locate(required,version,trace,report,action)
report("checking lib paths")
end
package.extralibpath(environment.ownpath)
- local paths = package.libpaths()
+ local paths = package.libpaths()
+ local pattern = "/[^/]+%." .. os.libsuffix .. "$"
for i=1,#paths do
- required_path = paths[i]
- local found = check(lfs.isfile)
+ required_path = gsub(paths[i],pattern,"")
+ local found = check(lfs.isfound)
if type(found) == "string" and (not checkpattern or find(found,checkpattern)) then
return found
end
diff --git a/tex/context/base/mkiv/util-lua.lua b/tex/context/base/mkiv/util-lua.lua
index 1c25bcc03..bd74d0843 100644
--- a/tex/context/base/mkiv/util-lua.lua
+++ b/tex/context/base/mkiv/util-lua.lua
@@ -82,7 +82,7 @@ function luautilities.loadedluacode(fullname,forcestrip,name,macros)
if macros and macros.enabled then
-- local c = io.loaddata(fullname) -- not yet available
local f = io.open(fullname,"rb") local c = f:read("*a") f:close()
- local n = c and macros.resolvestring(c)
+ local n = c and macros.resolvestring("--[["..fullname.."]] "..c)
if n and #n ~= #c then
report_lua("preprocessed file %a: %i => %i bytes",fullname,#c,#n)
end
@@ -113,7 +113,7 @@ function luautilities.loadedluacode(fullname,forcestrip,name,macros)
end
end
-function luautilities.strippedloadstring(code,forcestrip,name) -- not executed
+function luautilities.strippedloadstring(code,name,forcestrip) -- not executed
local code, message = load(code)
if not code then
report_lua("loading of file %a failed:\n\t%s",name,message or "no message")
@@ -126,6 +126,14 @@ function luautilities.strippedloadstring(code,forcestrip,name) -- not executed
end
end
+function luautilities.loadstring(code,name) -- not executed
+ local code, message = load(code)
+ if not code then
+ report_lua("loading of file %a failed:\n\t%s",name,message or "no message")
+ end
+ return code, 0
+end
+
function luautilities.compile(luafile,lucfile,cleanup,strip,fallback) -- defaults: cleanup=false strip=true
report_lua("compiling %a into %a",luafile,lucfile)
os.remove(lucfile)