diff options
author | Karl Berry <karl@freefriends.org> | 2015-05-15 23:23:10 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-05-15 23:23:10 +0000 |
commit | 8b7c04b3f228340eddb1cd1a82f95af652812536 (patch) | |
tree | b615a5cc4fcf06d146051cf03462b4a35a8c9f15 /Master/texmf-dist/tex | |
parent | d1ecd043e0f5614957c8a36932b134621474c505 (diff) |
context from current for tl15
git-svn-id: svn://tug.org/texlive/trunk@37419 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
31 files changed, 544 insertions, 320 deletions
diff --git a/Master/texmf-dist/tex/context/base/cont-new.mkiv b/Master/texmf-dist/tex/context/base/cont-new.mkiv index cf38042b642..e9f25937606 100644 --- a/Master/texmf-dist/tex/context/base/cont-new.mkiv +++ b/Master/texmf-dist/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2015.05.13 23:52} +\newcontextversion{2015.05.15 23:03} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/Master/texmf-dist/tex/context/base/context-version.pdf b/Master/texmf-dist/tex/context/base/context-version.pdf Binary files differindex cd9ca783da5..1145082b449 100644 --- a/Master/texmf-dist/tex/context/base/context-version.pdf +++ b/Master/texmf-dist/tex/context/base/context-version.pdf diff --git a/Master/texmf-dist/tex/context/base/context.mkiv b/Master/texmf-dist/tex/context/base/context.mkiv index a775cfa0207..389d784e41a 100644 --- a/Master/texmf-dist/tex/context/base/context.mkiv +++ b/Master/texmf-dist/tex/context/base/context.mkiv @@ -39,8 +39,8 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2015.05.13 23:52} -\edef\contextkind {beta} +\edef\contextversion{2015.05.15 23:03} +\edef\contextkind {current} %D For those who want to use this: diff --git a/Master/texmf-dist/tex/context/base/core-con.lua b/Master/texmf-dist/tex/context/base/core-con.lua index be462e1d2f2..37942ae7169 100644 --- a/Master/texmf-dist/tex/context/base/core-con.lua +++ b/Master/texmf-dist/tex/context/base/core-con.lua @@ -807,7 +807,7 @@ end implement { name = "ordinal", actions = ctxordinal, - arguments = { "string", "string" } + arguments = { "integer", "string" } } -- verbose numbers diff --git a/Master/texmf-dist/tex/context/base/core-sys.mkiv b/Master/texmf-dist/tex/context/base/core-sys.mkiv index 27bbec0b103..3d31dee53d6 100644 --- a/Master/texmf-dist/tex/context/base/core-sys.mkiv +++ b/Master/texmf-dist/tex/context/base/core-sys.mkiv @@ -208,27 +208,29 @@ \to \everydefinestartstop \unexpanded\def\syst_startstop_start#1% - {\namedstartstopparameter{#1}\c!before + {\namedstartstopparameter{#1}\c!before\relax \bgroup \def\currentstartstop{#1}% - \startstopparameter\c!commands + \startstopparameter\c!commands\relax % better: setups so that will show op soon \dostarttagged\t!construct\currentstartstop \usestartstopstyleandcolor\c!style\c!color} \unexpanded\def\syst_startstop_stop#1% {\dostoptagged \egroup - \namedstartstopparameter{#1}\c!after} + \namedstartstopparameter{#1}\c!after\relax} \unexpanded\def\syst_startstop_indeed#1% {\groupedcommand {\def\currentstartstop{#1}% - \startstopparameter\c!commands % will become setups + \startstopparameter\c!commands\relax % better: setups so that will show op soon \dostarttagged\t!construct\currentstartstop - \usestartstopstyleandcolor\c!style\c!color} - {\def\currentstartstop{#1}% + \usestartstopstyleandcolor\c!style\c!color + \startstopparameter\c!left\relax} + {\def\currentstartstop{#1}% safeguard, nto really needed + \startstopparameter\c!right\relax \dostoptagged - \startstopparameter\c!inbetween}} + \startstopparameter\c!inbetween\relax}} % \definestartstop[tracing][\c!style=\tt] diff --git a/Master/texmf-dist/tex/context/base/data-tmp.lua b/Master/texmf-dist/tex/context/base/data-tmp.lua index 8ee5792cc48..9e1515a2650 100644 --- a/Master/texmf-dist/tex/context/base/data-tmp.lua +++ b/Master/texmf-dist/tex/context/base/data-tmp.lua @@ -23,7 +23,8 @@ luatools with a recache feature.</p> --ldx]]-- local format, lower, gsub, concat = string.format, string.lower, string.gsub, table.concat -local concat, serialize, serializetofile = table.concat, table.serialize, table.tofile +----- serialize, serializetofile = table.serialize, table.tofile -- overloaded so no local +local concat = table.concat local mkdirs, isdir, isfile = dir.mkdirs, lfs.isdir, lfs.isfile local addsuffix, is_writable, is_readable = file.addsuffix, file.is_writable, file.is_readable local formatters = string.formatters @@ -349,15 +350,11 @@ local saveoptions = { compact = true } function caches.savedata(filepath,filename,data,raw) local tmaname, tmcname = caches.setluanames(filepath,filename) - local reduce, simplify = true, true - if raw then - reduce, simplify = false, false - end data.cache_uuid = os.uuid() if caches.direct then - file.savedata(tmaname,serialize(data,true,saveoptions)) + file.savedata(tmaname,table.serialize(data,true,saveoptions)) else - serializetofile(tmaname,data,true,saveoptions) + table.tofile(tmaname,data,true,saveoptions) end utilities.lua.compile(tmaname,tmcname) end @@ -429,7 +426,7 @@ function caches.savecontent(cachename,dataname,content,filename) content = content, uuid = os.uuid(), } - local ok = io.savedata(luaname,serialize(data,true)) + local ok = io.savedata(luaname,table.serialize(data,true)) if ok then if trace_locating then report_resolvers("category %a, cachename %a saved in %a",dataname,cachename,luaname) diff --git a/Master/texmf-dist/tex/context/base/font-otn.lua b/Master/texmf-dist/tex/context/base/font-otn.lua index 440eb34ec8e..b1bd4530478 100644 --- a/Master/texmf-dist/tex/context/base/font-otn.lua +++ b/Master/texmf-dist/tex/context/base/font-otn.lua @@ -2085,7 +2085,7 @@ local function normal_handle_contextchain(head,start,kind,chainname,contexts,seq if not replace then break elseif n > l then --- match = false + -- match = false break end else @@ -2163,7 +2163,7 @@ local function normal_handle_contextchain(head,start,kind,chainname,contexts,seq if not replace or replace == finish then break elseif n < 1 then --- match = false + -- match = false break end else @@ -2196,17 +2196,8 @@ local function normal_handle_contextchain(head,start,kind,chainname,contexts,seq break end end - elseif f == 2 then - match = seq[1][32] --- elseif f > 2 then --- match = false -- KE ? else - for n=f-1,1 do - if not seq[n][32] then - match = false - break - end - end + match = false end end -- after @@ -2287,15 +2278,8 @@ local function normal_handle_contextchain(head,start,kind,chainname,contexts,seq break end end - elseif s-l == 1 then - match = seq[s][32] else - for n=l+1,s do - if not seq[n][32] then - match = false - break - end - end + match = false end end end diff --git a/Master/texmf-dist/tex/context/base/font-otp.lua b/Master/texmf-dist/tex/context/base/font-otp.lua index 63e4184c19a..ebf36ed45d0 100644 --- a/Master/texmf-dist/tex/context/base/font-otp.lua +++ b/Master/texmf-dist/tex/context/base/font-otp.lua @@ -9,6 +9,8 @@ if not modules then modules = { } end modules ['font-otp'] = { -- todo: pack math (but not that much to share) -- -- pitfall 5.2: hashed tables can suddenly become indexed with nil slots +-- +-- unless we sort all hashes we can get a different pack order (no big deal but size can differ) local next, type = next, type local sort, concat = table.sort, table.concat diff --git a/Master/texmf-dist/tex/context/base/font-sty.mkvi b/Master/texmf-dist/tex/context/base/font-sty.mkvi index 673cf25aecd..5924a30338c 100644 --- a/Master/texmf-dist/tex/context/base/font-sty.mkvi +++ b/Master/texmf-dist/tex/context/base/font-sty.mkvi @@ -352,7 +352,7 @@ \def\font_styles_define_style_instance[#instance][#2][#3][#4]% [name] [rm|ss|tt|..] [sl|bf|...] [whatever] {\iffirstargument - \ifcsname#1\endcsname\else\font_styles_define_style_collection[#instance]\fi + \ifcsname#instance\endcsname\else\font_styles_define_style_collection[#instance]\fi \fi \iffourthargument \setvalue{\??stylecollection#instance:#2:#3}{#4}% diff --git a/Master/texmf-dist/tex/context/base/l-table.lua b/Master/texmf-dist/tex/context/base/l-table.lua index 97e0441eb09..b02f210cb94 100644 --- a/Master/texmf-dist/tex/context/base/l-table.lua +++ b/Master/texmf-dist/tex/context/base/l-table.lua @@ -39,7 +39,7 @@ end function table.keys(t) if t then local keys, k = { }, 0 - for key, _ in next, t do + for key in next, t do k = k + 1 keys[k] = key end @@ -50,44 +50,126 @@ function table.keys(t) end -- local function compare(a,b) --- local ta, tb = type(a), type(b) -- needed, else 11 < 2 --- if ta == tb then +-- local ta = type(a) -- needed, else 11 < 2 +-- local tb = type(b) -- needed, else 11 < 2 +-- if ta == tb and ta == "number" then -- return a < b -- else -- return tostring(a) < tostring(b) -- not that efficient -- end -- end +-- local function compare(a,b) +-- local ta = type(a) -- needed, else 11 < 2 +-- local tb = type(b) -- needed, else 11 < 2 +-- if ta == tb and (ta == "number" or ta == "string") then +-- return a < b +-- else +-- return tostring(a) < tostring(b) -- not that efficient +-- end +-- end + +-- local function sortedkeys(tab) +-- if tab then +-- local srt, category, s = { }, 0, 0 -- 0=unknown 1=string, 2=number 3=mixed +-- for key in next, tab do +-- s = s + 1 +-- srt[s] = key +-- if category == 3 then +-- -- no further check +-- else +-- local tkey = type(key) +-- if tkey == "string" then +-- category = (category == 2 and 3) or 1 +-- elseif tkey == "number" then +-- category = (category == 1 and 3) or 2 +-- else +-- category = 3 +-- end +-- end +-- end +-- if category == 0 or category == 3 then +-- sort(srt,compare) +-- else +-- sort(srt) +-- end +-- return srt +-- else +-- return { } +-- end +-- end + +-- local function compare(a,b) +-- local ta = type(a) -- needed, else 11 < 2 +-- local tb = type(b) -- needed, else 11 < 2 +-- if ta == tb and (ta == "number" or ta == "string") then +-- return a < b +-- else +-- return tostring(a) < tostring(b) -- not that efficient +-- end +-- end + +-- local function compare(a,b) +-- local ta = type(a) -- needed, else 11 < 2 +-- if ta == "number" or ta == "string" then +-- local tb = type(b) -- needed, else 11 < 2 +-- if ta == tb then +-- return a < b +-- end +-- end +-- return tostring(a) < tostring(b) -- not that efficient +-- end + local function compare(a,b) local ta = type(a) -- needed, else 11 < 2 - local tb = type(b) -- needed, else 11 < 2 - if ta == tb and ta == "number" then - return a < b - else - return tostring(a) < tostring(b) -- not that efficient + if ta == "number" then + local tb = type(b) -- needed, else 11 < 2 + if ta == tb then + return a < b + elseif tb == "string" then + return tostring(a) < b + end + elseif ta == "string" then + local tb = type(b) -- needed, else 11 < 2 + if ta == tb then + return a < b + else + return a < tostring(b) + end end + return tostring(a) < tostring(b) -- not that efficient end local function sortedkeys(tab) if tab then local srt, category, s = { }, 0, 0 -- 0=unknown 1=string, 2=number 3=mixed - for key,_ in next, tab do + for key in next, tab do s = s + 1 srt[s] = key if category == 3 then -- no further check + elseif category == 1 then + if type(key) ~= "string" then + category = 3 + end + elseif category == 2 then + if type(key) ~= "number" then + category = 3 + end else local tkey = type(key) if tkey == "string" then - category = (category == 2 and 3) or 1 + category = 1 elseif tkey == "number" then - category = (category == 1 and 3) or 2 + category = 2 else category = 3 end end end - if category == 0 or category == 3 then + if s < 2 then + -- nothing to sort + elseif category == 3 then sort(srt,compare) else sort(srt) @@ -101,13 +183,15 @@ end local function sortedhashonly(tab) if tab then local srt, s = { }, 0 - for key,_ in next, tab do + for key in next, tab do if type(key) == "string" then s = s + 1 srt[s] = key end end - sort(srt) + if s > 1 then + sort(srt) + end return srt else return { } @@ -117,13 +201,15 @@ end local function sortedindexonly(tab) if tab then local srt, s = { }, 0 - for key,_ in next, tab do + for key in next, tab do if type(key) == "number" then s = s + 1 srt[s] = key end end - sort(srt) + if s > 1 then + sort(srt) + end return srt else return { } @@ -133,13 +219,15 @@ end local function sortedhashkeys(tab,cmp) -- fast one if tab then local srt, s = { }, 0 - for key,_ in next, tab do + for key in next, tab do if key then s= s + 1 srt[s] = key end end - sort(srt,cmp) + if s > 1 then + sort(srt,cmp) + end return srt else return { } @@ -149,7 +237,7 @@ end function table.allkeys(t) local keys = { } for k, v in next, t do - for k, v in next, v do + for k in next, v do keys[k] = true end end @@ -172,19 +260,21 @@ local function sortedhash(t,cmp) else s = sortedkeys(t) -- the robust one end - local n = 0 local m = #s - local function kv() -- (s) - if n < m then - n = n + 1 - local k = s[n] - return k, t[k] + if m == 1 then + return next, t + elseif m > 0 then + local n = 0 + return function() + if n < m then + n = n + 1 + local k = s[n] + return k, t[k] + end end end - return kv -- , s - else - return nothing end + return nothing end table.sortedhash = sortedhash @@ -328,7 +418,7 @@ end local function copy(t, tables) -- taken from lua wiki, slightly adapted tables = tables or { } - local tcopy = {} + local tcopy = { } if not tables[t] then tables[t] = tcopy end @@ -388,7 +478,7 @@ function table.fromhash(t) return hsh end -local noquotes, hexify, handle, reduce, compact, inline, functions +local noquotes, hexify, handle, compact, inline, functions local reserved = table.tohash { -- intercept a language inconvenience: no reserved words as key 'and', 'break', 'do', 'else', 'elseif', 'end', 'false', 'for', 'function', 'if', @@ -396,33 +486,67 @@ local reserved = table.tohash { -- intercept a language inconvenience: no reserv 'NaN', 'goto', } +-- local function simple_table(t) +-- if #t > 0 then +-- local n = 0 +-- for _,v in next, t do +-- n = n + 1 +-- end +-- if n == #t then +-- local tt, nt = { }, 0 +-- for i=1,#t do +-- local v = t[i] +-- local tv = type(v) +-- if tv == "number" then +-- nt = nt + 1 +-- if hexify then +-- tt[nt] = format("0x%X",v) +-- else +-- tt[nt] = tostring(v) -- tostring not needed +-- end +-- elseif tv == "string" then +-- nt = nt + 1 +-- tt[nt] = format("%q",v) +-- elseif tv == "boolean" then +-- nt = nt + 1 +-- tt[nt] = v and "true" or "false" +-- else +-- return nil +-- end +-- end +-- return tt +-- end +-- end +-- return nil +-- end + local function simple_table(t) - if #t > 0 then + local nt = #t + if nt > 0 then local n = 0 for _,v in next, t do n = n + 1 + -- if type(v) == "table" then + -- return nil + -- end end - if n == #t then - local tt, nt = { }, 0 - for i=1,#t do + if n == nt then + local tt = { } + for i=1,nt do local v = t[i] local tv = type(v) if tv == "number" then - nt = nt + 1 if hexify then - tt[nt] = format("0x%X",v) + tt[i] = format("0x%X",v) else - tt[nt] = tostring(v) -- tostring not needed + tt[i] = tostring(v) -- tostring not needed end elseif tv == "string" then - nt = nt + 1 - tt[nt] = format("%q",v) + tt[i] = format("%q",v) elseif tv == "boolean" then - nt = nt + 1 - tt[nt] = v and "true" or "false" + tt[i] = v and "true" or "false" else - tt = nil - break + return nil end end return tt @@ -480,14 +604,6 @@ local function do_serialize(root,name,depth,level,indexed) end -- we could check for k (index) being number (cardinal) if root and next(root) ~= nil then - -- local first, last = nil, 0 -- #root cannot be trusted here (will be ok in 5.2 when ipairs is gone) - -- if compact then - -- -- NOT: for k=1,#root do (we need to quit at nil) - -- for k,v in ipairs(root) do -- can we use next? - -- if not first then first = k end - -- last = last + 1 - -- end - -- end local first, last = nil, 0 if compact then last = #root @@ -503,12 +619,10 @@ local function do_serialize(root,name,depth,level,indexed) end local sk = sortedkeys(root) for i=1,#sk do - local k = sk[i] - local v = root[k] - --~ if v == root then - -- circular - --~ else - local tv, tk = type(v), type(k) + local k = sk[i] + local v = root[k] + local tv = type(v) + local tk = type(k) if compact and first and tk == "number" and k >= first and k <= last then if tv == "number" then if hexify then @@ -517,11 +631,7 @@ local function do_serialize(root,name,depth,level,indexed) handle(format("%s %s,",depth,v)) -- %.99g end elseif tv == "string" then - if reduce and tonumber(v) then - handle(format("%s %s,",depth,v)) - else - handle(format("%s %q,",depth,v)) - end + handle(format("%s %q,",depth,v)) elseif tv == "table" then if next(v) == nil then handle(format("%s {},",depth)) @@ -577,34 +687,18 @@ local function do_serialize(root,name,depth,level,indexed) end end elseif tv == "string" then - if reduce and tonumber(v) then - if tk == "number" then - if hexify then - handle(format("%s [0x%X]=%s,",depth,k,v)) - else - handle(format("%s [%s]=%s,",depth,k,v)) - end - elseif tk == "boolean" then - handle(format("%s [%s]=%s,",depth,k and "true" or "false",v)) - elseif noquotes and not reserved[k] and lpegmatch(propername,k) then - handle(format("%s %s=%s,",depth,k,v)) + if tk == "number" then + if hexify then + handle(format("%s [0x%X]=%q,",depth,k,v)) else - handle(format("%s [%q]=%s,",depth,k,v)) + handle(format("%s [%s]=%q,",depth,k,v)) end + elseif tk == "boolean" then + handle(format("%s [%s]=%q,",depth,k and "true" or "false",v)) + elseif noquotes and not reserved[k] and lpegmatch(propername,k) then + handle(format("%s %s=%q,",depth,k,v)) else - if tk == "number" then - if hexify then - handle(format("%s [0x%X]=%q,",depth,k,v)) - else - handle(format("%s [%s]=%q,",depth,k,v)) - end - elseif tk == "boolean" then - handle(format("%s [%s]=%q,",depth,k and "true" or "false",v)) - elseif noquotes and not reserved[k] and lpegmatch(propername,k) then - handle(format("%s %s=%q,",depth,k,v)) - else - handle(format("%s [%q]=%q,",depth,k,v)) - end + handle(format("%s [%q]=%q,",depth,k,v)) end elseif tv == "table" then if next(v) == nil then @@ -690,7 +784,6 @@ local function do_serialize(root,name,depth,level,indexed) handle(format("%s [%q]=%q,",depth,k,tostring(v))) end end - --~ end end end if level > 0 then @@ -707,7 +800,6 @@ local function serialize(_handle,root,name,specification) -- handle wins noquotes = specification.noquotes hexify = specification.hexify handle = _handle or specification.handle or print - reduce = specification.reduce or false functions = specification.functions compact = specification.compact inline = specification.inline and compact @@ -724,7 +816,6 @@ local function serialize(_handle,root,name,specification) -- handle wins noquotes = false hexify = false handle = _handle or print - reduce = false compact = true inline = true functions = true @@ -798,15 +889,6 @@ end table.tohandle = serialize --- sometimes tables are real use (zapfino extra pro is some 85M) in which --- case a stepwise serialization is nice; actually, we could consider: --- --- for line in table.serializer(root,name,reduce,noquotes) do --- ...(line) --- end --- --- so this is on the todo list - local maxtab = 2*1024 function table.tofile(filename,root,name,specification) diff --git a/Master/texmf-dist/tex/context/base/math-fen.mkiv b/Master/texmf-dist/tex/context/base/math-fen.mkiv index b2f64890c23..9570eac83b7 100644 --- a/Master/texmf-dist/tex/context/base/math-fen.mkiv +++ b/Master/texmf-dist/tex/context/base/math-fen.mkiv @@ -303,6 +303,10 @@ % \installmathfencepair { \Lbrace } \Rbrace % \installmathfencepair } \Rbracemirrored { \Lbracemirrored +\appendtoks + \ignorediscretionaries % so $\mtext{a|b}$ works, this is ok because it's an \hbox +\to \everymathematics + % todo paren parent \let\lbrack\lbracket diff --git a/Master/texmf-dist/tex/context/base/math-ini.mkiv b/Master/texmf-dist/tex/context/base/math-ini.mkiv index 79c9a62043d..83c7554ebba 100644 --- a/Master/texmf-dist/tex/context/base/math-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/math-ini.mkiv @@ -842,13 +842,6 @@ % \activatemathcharacter\primeasciicode -% not needed: -% -% \activatemathcharacter\barasciicode -% \appendtoks -% \let |\letterbar -% \to \everymathematics - % not used: % % \mathcode\spaceasciicode\activemathcharcode diff --git a/Master/texmf-dist/tex/context/base/publ-imp-apa.mkvi b/Master/texmf-dist/tex/context/base/publ-imp-apa.mkvi index cf35a4b809e..9ab624bf82b 100644 --- a/Master/texmf-dist/tex/context/base/publ-imp-apa.mkvi +++ b/Master/texmf-dist/tex/context/base/publ-imp-apa.mkvi @@ -101,22 +101,28 @@ \definebtx [apa:\s!list:numbering] [apa:\s!list] + [\c!right={\space}] + +\definebtx + [apa:\s!list:numbering:default] + [apa:\s!list:numbering] \definebtx [apa:\s!list:numbering:num] [apa:\s!list:numbering] - [\c!stopper={.}, - \c!right={\space}] + [\c!stopper={.}] \definebtx [apa:\s!list:numbering:short] - [apa:\s!list:numbering:num] - [\c!stopper=] + [apa:\s!list:numbering] \definebtx [apa:\s!list:numbering:tag] - [apa:\s!list:numbering:num] - [\c!stopper=] + [apa:\s!list:numbering] + +\definebtx + [apa:\s!list:numbering:index] + [apa:\s!list:numbering] % Next, we define a namespace for each category diff --git a/Master/texmf-dist/tex/context/base/publ-imp-aps.mkvi b/Master/texmf-dist/tex/context/base/publ-imp-aps.mkvi index 9772fbb8751..28af82e748b 100644 --- a/Master/texmf-dist/tex/context/base/publ-imp-aps.mkvi +++ b/Master/texmf-dist/tex/context/base/publ-imp-aps.mkvi @@ -93,20 +93,28 @@ \definebtx [aps:\s!list:numbering] [aps:\s!list] + [left={[}, + right={]}] + +\definebtx + [aps:\s!list:numbering:default] + [aps:\s!list:numbering] \definebtx [aps:\s!list:numbering:num] [aps:\s!list:numbering] - [left={[}, - right={]}] \definebtx [aps:\s!list:numbering:short] - [aps:\s!list:numbering:num] + [aps:\s!list:numbering] \definebtx [aps:\s!list:numbering:tag] - [aps:\s!list:numbering:num] + [aps:\s!list:numbering] + +\definebtx + [aps:\s!list:numbering:index] + [aps:\s!list:numbering] %D In order to be able to get journals expanded (or normalized or abbreviated) you need %D to load a list: diff --git a/Master/texmf-dist/tex/context/base/publ-imp-default.mkvi b/Master/texmf-dist/tex/context/base/publ-imp-default.mkvi index 73520c7ffd1..c7c88d74a58 100644 --- a/Master/texmf-dist/tex/context/base/publ-imp-default.mkvi +++ b/Master/texmf-dist/tex/context/base/publ-imp-default.mkvi @@ -62,6 +62,10 @@ [\s!default:\s!list] \definebtx + [\s!default:\s!list:numbering:default] + [\s!default:\s!list:numbering] + +\definebtx [\s!default:\s!list:numbering:num] [\s!default:\s!list:numbering] @@ -74,6 +78,10 @@ [\s!default:\s!list:numbering:num] \definebtx + [\s!default:\s!list:numbering:index] + [\s!default:\s!list:numbering:num] + +\definebtx [\s!default:\s!list:author] [\s!default:\s!list] diff --git a/Master/texmf-dist/tex/context/base/publ-imp-list.mkvi b/Master/texmf-dist/tex/context/base/publ-imp-list.mkvi index d34e4bc24c9..23256de333c 100644 --- a/Master/texmf-dist/tex/context/base/publ-imp-list.mkvi +++ b/Master/texmf-dist/tex/context/base/publ-imp-list.mkvi @@ -50,6 +50,16 @@ } \stopsetups +% Hans: can the following setups be condensed to one using some variable? + +\startsetups[\s!btx:\s!list:\s!numbering:default] + \btxstartstyleandcolor [\currentbtxspecification:\s!list:\s!numbering:default] + \btxusecommand[\currentbtxspecification:\s!list:\s!numbering:default] { + \fastsetup{\s!btx:\s!list:\s!numbering} + } + \btxstopstyleandcolor +\stopsetups + \startsetups[\s!btx:\s!list:\s!numbering:num] \btxstartstyleandcolor [\currentbtxspecification:\s!list:\s!numbering:num] \btxusecommand[\currentbtxspecification:\s!list:\s!numbering:num] { @@ -58,10 +68,6 @@ \btxstopstyleandcolor \stopsetups -\startsetups[\s!btx:\s!list:\s!numbering:\v!yes] - \fastsetup{\s!btx:\s!list:\s!numbering:num} -\stopsetups - \startsetups[\s!btx:\s!list:\s!numbering:short] \btxstartstyleandcolor [\currentbtxspecification:\s!list:\s!numbering:short] \btxusecommand [\currentbtxspecification:\s!list:\s!numbering:short] { @@ -79,4 +85,12 @@ \btxstopstyleandcolor \stopsetups +\startsetups[\s!btx:\s!list:\s!numbering:index] + \btxstartstyleandcolor [\currentbtxspecification:\s!list:\s!numbering:index] + \btxusecommand [\currentbtxspecification:\s!list:\s!numbering:index] { + \fastsetup{\s!btx:\s!list:\s!numbering} + } + \btxstopstyleandcolor +\stopsetups + \protect diff --git a/Master/texmf-dist/tex/context/base/publ-ini.lua b/Master/texmf-dist/tex/context/base/publ-ini.lua index 4f7dd44130a..34eeaec1882 100644 --- a/Master/texmf-dist/tex/context/base/publ-ini.lua +++ b/Master/texmf-dist/tex/context/base/publ-ini.lua @@ -3202,7 +3202,16 @@ do ctx_btxnumberingsetup(variant or "num") end - listvariants[v_yes] = listvariants.num + -- listvariants[v_yes] = listvariants.num + + function listvariants.index(dataset,block,tag,variant,listindex) + local index = getdetail(dataset,tag,"index") + ctx_btxsetfirst(index or "?") + if trace_detail then + report("expanding %a list setup %a","index",variant) + end + ctx_btxnumberingsetup(variant or "index") + end function listvariants.tag(dataset,block,tag,variant,listindex) ctx_btxsetfirst(tag) diff --git a/Master/texmf-dist/tex/context/base/publ-ini.mkiv b/Master/texmf-dist/tex/context/base/publ-ini.mkiv index 2d55832f9c2..233734bb610 100644 --- a/Master/texmf-dist/tex/context/base/publ-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/publ-ini.mkiv @@ -1658,7 +1658,7 @@ \clf_btxtoregister{\currentbtxdataset}{\currentbtxtag}% \to \t_btx_reference_inject -\unexpanded\def\btxindexedauthor#1#2#3#4#5#6% alternative von last first junior +\unexpanded\def\btxindexedauthor#1#2#3#4#5#6% alternative von last initials first junior {\begingroup \def\currentbtxcitealternative{#1}% \ifx\currentbtxcitealternative\empty @@ -1675,6 +1675,16 @@ \fastsetup{\s!btx:\s!cite:\s!author:\currentbtxcitealternative}% \endgroup} +\unexpanded\def\btxregisterauthor + {\doifelsenextoptionalcs\publ_register_author_yes\publ_register_author_nop} + +\def\publ_register_author_yes[#1]#2% + {\clf_btxauthortoregister{#1}{#2}\relax} + +\def\publ_register_author_nop#1% + {\clf_btxauthortoregister{\currentbtxdataset}{#1}\relax} + + %D We hook some setters in the definition sets: % \installdefinitionsetmember \??btx {btxspecification} \??btxcitevariant {btxcitevariant} diff --git a/Master/texmf-dist/tex/context/base/publ-reg.lua b/Master/texmf-dist/tex/context/base/publ-reg.lua index 39469e510db..3f276b49abc 100644 --- a/Master/texmf-dist/tex/context/base/publ-reg.lua +++ b/Master/texmf-dist/tex/context/base/publ-reg.lua @@ -153,6 +153,9 @@ local shorts = { } function flushers.author(step,field,value) + if type(value) == "string" then + value = publications.authorcache[value] + end if type(value) == "table" and #value > 0 then local register = step.register local processor = step.processor @@ -160,7 +163,7 @@ function flushers.author(step,field,value) for i=1,#value do local a = value[i] local k = writers[field] { a } - local e = f_author(alternative,components(a,short)) + local e = f_author(alternative,components(a)) ctx_dosetfastregisterentry(register,e,k,processor or "","") end end @@ -175,3 +178,50 @@ function flushers.keyword(step,field,value) end end end + +-- publications.registerflushers = flushers + +local function btxtoregister(dataset,tag) + local current = datasets[dataset] + for i=1,#sequence do + local step = sequence[i] + local dset = step.dataset + if dset == v_all or dset == dataset then + local done = step.done + if not done[tag] then + local value, field, kind = getcasted(current,tag,step.field,specifications[step.specification]) + if value then + flushers[kind](step,field,value) + end + done[tag] = true + end + end + end +end + +local function authortoregister(dataset,hash) + local author = publications.authorcache[hash] + if author then + local current = datasets[dataset] + for i=1,#sequence do + local step = sequence[i] + local dset = step.dataset + if dset == v_all or dset == dataset then + local register = step.register + local processor = step.processor + local alternative = shorts[step.alternative or "invertedshort"] or "invertedshort" + local k = writers.author { author } + local e = f_author(alternative,components(author,short)) + ctx_dosetfastregisterentry(register,e,k,processor or "","") + end + end + end +end + +publications.authortoregister = authortoregister + +implement { + name = "btxauthortoregister", + actions = authortoregister, + arguments = { "string", "string" } +} diff --git a/Master/texmf-dist/tex/context/base/publ-tra.lua b/Master/texmf-dist/tex/context/base/publ-tra.lua index b90455aed02..4b03307acc2 100644 --- a/Master/texmf-dist/tex/context/base/publ-tra.lua +++ b/Master/texmf-dist/tex/context/base/publ-tra.lua @@ -471,10 +471,34 @@ function tracers.showvariants(dataset,pages) end end +function tracers.showhashedauthors(dataset,pages) + local components = publications.components.author + ctx_starttabulate { "|T|T|T|T|T|T|" } + ctx_NC() ctx_bold("hash") + ctx_NC() ctx_bold("vons") + ctx_NC() ctx_bold("surnames") + ctx_NC() ctx_bold("initials") + ctx_NC() ctx_bold("firstnames") + ctx_NC() ctx_bold("juniors") + ctx_NC() ctx_NR() ctx_HL() + for hash, data in sortedhash(publications.authorcache) do + local vons, surnames, initials, firstnames, juniors = components(data) + ctx_NC() context(hash) + ctx_NC() context(vons) + ctx_NC() context(surnames) + ctx_NC() context(initials) + ctx_NC() context(firstnames) + ctx_NC() context(juniors) + ctx_NC() ctx_NR() + end + ctx_stoptabulate() +end + commands.showbtxdatasetfields = tracers.showdatasetfields commands.showbtxdatasetcompleteness = tracers.showdatasetcompleteness commands.showbtxfields = tracers.showfields commands.showbtxtables = tracers.showtables commands.showbtxdatasetauthors = tracers.showdatasetauthors +commands.showbtxhashedauthors = tracers.showhashedauthors commands.showbtxentry = tracers.showentry commands.showbtxvariants = tracers.showvariants diff --git a/Master/texmf-dist/tex/context/base/publ-tra.mkiv b/Master/texmf-dist/tex/context/base/publ-tra.mkiv index 2f86a5624fc..6ef86ca5944 100644 --- a/Master/texmf-dist/tex/context/base/publ-tra.mkiv +++ b/Master/texmf-dist/tex/context/base/publ-tra.mkiv @@ -23,6 +23,7 @@ \unexpanded\def\showbtxdatasetfields {\dosingleempty\publ_show_dataset_fields} \unexpanded\def\showbtxdatasetcompleteness{\dosingleempty\publ_show_dataset_completeness} \unexpanded\def\showbtxdatasetauthors {\dosingleempty\publ_show_dataset_authors} +\unexpanded\def\showbtxhashedauthors {\dosingleempty\publ_show_hashed_authors} \unexpanded\def\showbtxfields {\dosingleempty\publ_show_fields} \unexpanded\def\showbtxtables {\dosingleempty\publ_show_tables} @@ -69,6 +70,9 @@ \ctxcommand{showbtxtables{}}% \endgroup} +\def\publ_show_hashed_authors[#1]% + {\ctxcommand{showbtxhashedauthors{}}} + \protect \continueifinputfile{publ-tra.mkiv} diff --git a/Master/texmf-dist/tex/context/base/status-files.pdf b/Master/texmf-dist/tex/context/base/status-files.pdf Binary files differindex 78e8b3da7bf..e43651ef87a 100644 --- a/Master/texmf-dist/tex/context/base/status-files.pdf +++ b/Master/texmf-dist/tex/context/base/status-files.pdf diff --git a/Master/texmf-dist/tex/context/base/status-lua.pdf b/Master/texmf-dist/tex/context/base/status-lua.pdf Binary files differindex 2db0c34065a..37e62b70be0 100644 --- a/Master/texmf-dist/tex/context/base/status-lua.pdf +++ b/Master/texmf-dist/tex/context/base/status-lua.pdf diff --git a/Master/texmf-dist/tex/context/base/typo-itc.lua b/Master/texmf-dist/tex/context/base/typo-itc.lua index c6528eee8b8..d3a31fad1bf 100644 --- a/Master/texmf-dist/tex/context/base/typo-itc.lua +++ b/Master/texmf-dist/tex/context/base/typo-itc.lua @@ -39,6 +39,7 @@ local getfont = nuts.getfont local getchar = nuts.getchar local getattr = nuts.getattr local setattr = nuts.setattr +local setfield = nuts.setfield local insert_node_after = nuts.insert_after local delete_node = nuts.delete @@ -132,14 +133,6 @@ end -- return with_attributes(new_correction_kern(kern),n) -- end -local function correction_glue(glue,n) - local g = new_correction_glue(glue) - if n then - setfield(g,"attr",getfield(n,"attr")) - end - return g -end - local function correction_kern(kern,n) local k = new_correction_kern(kern) if n then @@ -151,7 +144,7 @@ local function correction_kern(kern,n) return k end -local function correction_glue(n,glue) +local function correction_glue(glue,n) local g = new_correction_glue(glue) if n then local a = getfield(n,"attr") diff --git a/Master/texmf-dist/tex/context/base/typo-sus.lua b/Master/texmf-dist/tex/context/base/typo-sus.lua index 9eef6196bb0..0fe8e143adc 100644 --- a/Master/texmf-dist/tex/context/base/typo-sus.lua +++ b/Master/texmf-dist/tex/context/base/typo-sus.lua @@ -20,6 +20,11 @@ local closequote = { pf = true, } +local weird = { + lm = true, + no = true, +} + local categories = characters.categories local nodecodes = nodes.nodecodes @@ -187,6 +192,8 @@ function typesetters.marksuspects(head) if prev and pid == glue_code then done = 1 -- darkred end + elseif weird[code] then + done = 2 -- darkgreen else local prev, pid = goback(current) if prev then diff --git a/Master/texmf-dist/tex/context/base/util-prs.lua b/Master/texmf-dist/tex/context/base/util-prs.lua index ea34c2c279d..a3c1c6f8f23 100644 --- a/Master/texmf-dist/tex/context/base/util-prs.lua +++ b/Master/texmf-dist/tex/context/base/util-prs.lua @@ -21,6 +21,8 @@ parsers.patterns = patterns local setmetatableindex = table.setmetatableindex local sortedhash = table.sortedhash +local sortedkeys = table.sortedkeys +local tohash = table.tohash -- we share some patterns @@ -94,9 +96,7 @@ patterns.settings_to_hash_b = pattern_b_s patterns.settings_to_hash_c = pattern_c_s function parsers.make_settings_to_hash_pattern(set,how) - if type(str) == "table" then - return set - elseif how == "strict" then + if how == "strict" then return (pattern_c/set)^1 elseif how == "tolerant" then return (pattern_b/set)^1 @@ -106,7 +106,9 @@ function parsers.make_settings_to_hash_pattern(set,how) end function parsers.settings_to_hash(str,existing) - if type(str) == "table" then + if not str or str == "" then + return { } + elseif type(str) == "table" then if existing then for k, v in next, str do existing[k] = v @@ -115,17 +117,17 @@ function parsers.settings_to_hash(str,existing) else return str end - elseif str and str ~= "" then + else hash = existing or { } lpegmatch(pattern_a_s,str) return hash - else - return { } end end function parsers.settings_to_hash_tolerant(str,existing) - if type(str) == "table" then + if not str or str == "" then + return { } + elseif type(str) == "table" then if existing then for k, v in next, str do existing[k] = v @@ -134,17 +136,17 @@ function parsers.settings_to_hash_tolerant(str,existing) else return str end - elseif str and str ~= "" then + else hash = existing or { } lpegmatch(pattern_b_s,str) return hash - else - return { } end end function parsers.settings_to_hash_strict(str,existing) - if type(str) == "table" then + if not str or str == "" then + return nil + elseif type(str) == "table" then if existing then for k, v in next, str do existing[k] = v @@ -157,8 +159,6 @@ function parsers.settings_to_hash_strict(str,existing) hash = existing or { } lpegmatch(pattern_c_s,str) return next(hash) and hash - else - return nil end end @@ -174,10 +174,10 @@ patterns.settings_to_array = pattern -- we could use a weak table as cache function parsers.settings_to_array(str,strict) - if type(str) == "table" then - return str - elseif not str or str == "" then + if not str or str == "" then return { } + elseif type(str) == "table" then + return str elseif strict then if find(str,"{",1,true) then return lpegmatch(pattern,str) @@ -262,8 +262,8 @@ end function parsers.hash_to_string(h,separator,yes,no,strict,omit) if h then - local t, tn, s = { }, 0, table.sortedkeys(h) - omit = omit and table.tohash(omit) + local t, tn, s = { }, 0, sortedkeys(h) + omit = omit and tohash(omit) for i=1,#s do local key = s[i] if not omit or not omit[key] then @@ -478,7 +478,7 @@ local defaultspecification = { separator = ",", quote = '"' } -- database module function parsers.csvsplitter(specification) - specification = specification and table.setmetatableindex(specification,defaultspecification) or defaultspecification + specification = specification and setmetatableindex(specification,defaultspecification) or defaultspecification local separator = specification.separator local quotechar = specification.quote local separator = S(separator ~= "" and separator or ",") @@ -517,7 +517,7 @@ end -- local list, names = mycsvsplitter(crap) inspect(list) inspect(names) function parsers.rfc4180splitter(specification) - specification = specification and table.setmetatableindex(specification,defaultspecification) or defaultspecification + specification = specification and setmetatableindex(specification,defaultspecification) or defaultspecification local separator = specification.separator --> rfc: COMMA local quotechar = P(specification.quote) --> DQUOTE local dquotechar = quotechar * quotechar --> 2DQUOTE @@ -602,10 +602,10 @@ end -- print(utilities.parsers.unittotex("10^-32 %"),utilities.parsers.unittoxml("10^32 %")) local cache = { } -local spaces = lpeg.patterns.space^0 +local spaces = lpegpatterns.space^0 local dummy = function() end -table.setmetatableindex(cache,function(t,k) +setmetatableindex(cache,function(t,k) local separator = P(k) local value = (1-separator)^0 local pattern = spaces * C(value) * separator^0 * Cp() diff --git a/Master/texmf-dist/tex/context/base/util-tab.lua b/Master/texmf-dist/tex/context/base/util-tab.lua index 5eae0d5f676..618f34ceef8 100644 --- a/Master/texmf-dist/tex/context/base/util-tab.lua +++ b/Master/texmf-dist/tex/context/base/util-tab.lua @@ -11,7 +11,7 @@ utilities.tables = utilities.tables or { } local tables = utilities.tables local format, gmatch, gsub, sub = string.format, string.gmatch, string.gsub, string.sub -local concat, insert, remove = table.concat, table.insert, table.remove +local concat, insert, remove, sort = table.concat, table.insert, table.remove, table.sort local setmetatable, getmetatable, tonumber, tostring = setmetatable, getmetatable, tonumber, tostring local type, next, rawset, tonumber, tostring, load, select = type, next, rawset, tonumber, tostring, load, select local lpegmatch, P, Cs, Cc = lpeg.match, lpeg.P, lpeg.Cs, lpeg.Cc @@ -571,8 +571,42 @@ function table.serialize(root,name,specification) local t -- = { } local n = 1 +-- local function simple_table(t) +-- local ts = #t +-- if ts > 0 then +-- local n = 0 +-- for _, v in next, t do +-- n = n + 1 +-- if type(v) == "table" then +-- return nil +-- end +-- end +-- if n == ts then +-- local tt = { } +-- local nt = 0 +-- for i=1,ts do +-- local v = t[i] +-- local tv = type(v) +-- nt = nt + 1 +-- if tv == "number" then +-- tt[nt] = v +-- elseif tv == "string" then +-- tt[nt] = format("%q",v) -- f_string(v) +-- elseif tv == "boolean" then +-- tt[nt] = v and "true" or "false" +-- else +-- return nil +-- end +-- end +-- return tt +-- end +-- end +-- return nil +-- end + local function simple_table(t) - if #t > 0 then + local nt = #t + if nt > 0 then local n = 0 for _, v in next, t do n = n + 1 @@ -580,19 +614,17 @@ function table.serialize(root,name,specification) return nil end end - if n == #t then + if n == nt then local tt = { } - local nt = 0 - for i=1,#t do + for i=1,nt do local v = t[i] local tv = type(v) - nt = nt + 1 if tv == "number" then - tt[nt] = v + tt[i] = v -- not needed tostring(v) elseif tv == "string" then - tt[nt] = format("%q",v) -- f_string(v) + tt[i] = format("%q",v) -- f_string(v) elseif tv == "boolean" then - tt[nt] = v and "true" or "false" + tt[i] = v and "true" or "false" else return nil end @@ -636,13 +668,13 @@ function table.serialize(root,name,specification) if last > 0 then first = 1 end - local sk = sortedkeys(root) -- inline fast version? + local sk = sortedkeys(root) -- inline fast version?\ for i=1,#sk do local k = sk[i] local v = root[k] local tv = type(v) local tk = type(k) - if first and tk == "number" and k >= first and k <= last then + if first and tk == "number" and k <= last and k >= first then if tv == "number" then n = n + 1 t[n] = f_val_num(depth,v) elseif tv == "string" then @@ -680,11 +712,11 @@ function table.serialize(root,name,specification) elseif tv == "table" then if next(v) == nil then if tk == "number" then - n = n + 1 t[n] = f_key_num_value_not(depth,k,v) + n = n + 1 t[n] = f_key_num_value_not(depth,k) elseif tk == "string" then - n = n + 1 t[n] = f_key_str_value_not(depth,k,v) + n = n + 1 t[n] = f_key_str_value_not(depth,k) elseif tk == "boolean" then - n = n + 1 t[n] = f_key_boo_value_not(depth,k,v) + n = n + 1 t[n] = f_key_boo_value_not(depth,k) end else local st = simple_table(v) diff --git a/Master/texmf-dist/tex/context/base/x-asciimath.lua b/Master/texmf-dist/tex/context/base/x-asciimath.lua index efa6a7736d6..51f401e6640 100644 --- a/Master/texmf-dist/tex/context/base/x-asciimath.lua +++ b/Master/texmf-dist/tex/context/base/x-asciimath.lua @@ -1817,7 +1817,7 @@ local uncrapped = { ["_"] = "\\underline{\\enspace}", } -local function convert(str) +local function convert(str,nowrap) if #str > 0 then local unicoded = lpegmatch(u_parser,str) or str if lpegmatch(p_onechar,unicoded) then @@ -1834,6 +1834,8 @@ local function convert(str) if message then report_asciimath("%s: %s : %s",message,str,texcoded) ctx_type(formatters["<%s>"](message)) + elseif nowrap then + context(texcoded) else ctx_mathematics(texcoded) end @@ -1936,11 +1938,17 @@ if not context then end interfaces.implement { - name = "asciimath", -- module_asciimath_convert + name = "asciimath", actions = convert, arguments = "string" } +interfaces.implement { + name = "justasciimath", + actions = convert, + arguments = { "string", true }, +} + local ctx_typebuffer = context.typebuffer local ctx_mathematics = context.mathematics local ctx_color = context.color diff --git a/Master/texmf-dist/tex/context/base/x-asciimath.mkiv b/Master/texmf-dist/tex/context/base/x-asciimath.mkiv index cc98b54acca..1d62fb93d32 100644 --- a/Master/texmf-dist/tex/context/base/x-asciimath.mkiv +++ b/Master/texmf-dist/tex/context/base/x-asciimath.mkiv @@ -156,8 +156,20 @@ }}% \to \everysetupasciimath -\unexpanded\def\asciimath#1% - {\clf_asciimath{\detokenize\expandafter{\normalexpanded{#1}}}} +\newtoks\everyascimath + +% \appendtoks +% \ignorediscretionaries +% \to \everyasciimath + +\unexpanded\def\asciimath + {\doifnextoptionalelse\asciimath_yes\asciimath_nop} + +\def\asciimath_yes[#1]#2% + {\mathematics[#1]{\clf_justasciimath{\detokenize\expandafter{\normalexpanded{#2}}}}} + +\def\asciimath_nop#1% + {\mathematics{\clf_justasciimath{\detokenize\expandafter{\normalexpanded{#1}}}}} \unexpanded\def\ctxmoduleasciimath#1% {\ctxlua{moduledata.asciimath.#1}} diff --git a/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua b/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua index 0e0e5ebba0e..81883b8b8fc 100644 --- a/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 05/13/15 23:52:22 +-- merge date : 05/15/15 23:03:46 do -- begin closure to overcome local limits and interference @@ -1041,7 +1041,7 @@ end function table.keys(t) if t then local keys,k={},0 - for key,_ in next,t do + for key in next,t do k=k+1 keys[k]=key end @@ -1052,32 +1052,51 @@ function table.keys(t) end local function compare(a,b) local ta=type(a) - local tb=type(b) - if ta==tb and ta=="number" then - return a<b - else - return tostring(a)<tostring(b) + if ta=="number" then + local tb=type(b) + if ta==tb then + return a<b + elseif tb=="string" then + return tostring(a)<b + end + elseif ta=="string" then + local tb=type(b) + if ta==tb then + return a<b + else + return a<tostring(b) + end end + return tostring(a)<tostring(b) end local function sortedkeys(tab) if tab then local srt,category,s={},0,0 - for key,_ in next,tab do + for key in next,tab do s=s+1 srt[s]=key if category==3 then + elseif category==1 then + if type(key)~="string" then + category=3 + end + elseif category==2 then + if type(key)~="number" then + category=3 + end else local tkey=type(key) if tkey=="string" then - category=(category==2 and 3) or 1 + category=1 elseif tkey=="number" then - category=(category==1 and 3) or 2 + category=2 else category=3 end end end - if category==0 or category==3 then + if s<2 then + elseif category==3 then sort(srt,compare) else sort(srt) @@ -1090,13 +1109,15 @@ end local function sortedhashonly(tab) if tab then local srt,s={},0 - for key,_ in next,tab do + for key in next,tab do if type(key)=="string" then s=s+1 srt[s]=key end end - sort(srt) + if s>1 then + sort(srt) + end return srt else return {} @@ -1105,13 +1126,15 @@ end local function sortedindexonly(tab) if tab then local srt,s={},0 - for key,_ in next,tab do + for key in next,tab do if type(key)=="number" then s=s+1 srt[s]=key end end - sort(srt) + if s>1 then + sort(srt) + end return srt else return {} @@ -1120,13 +1143,15 @@ end local function sortedhashkeys(tab,cmp) if tab then local srt,s={},0 - for key,_ in next,tab do + for key in next,tab do if key then s=s+1 srt[s]=key end end - sort(srt,cmp) + if s>1 then + sort(srt,cmp) + end return srt else return {} @@ -1135,7 +1160,7 @@ end function table.allkeys(t) local keys={} for k,v in next,t do - for k,v in next,v do + for k in next,v do keys[k]=true end end @@ -1154,19 +1179,21 @@ local function sortedhash(t,cmp) else s=sortedkeys(t) end - local n=0 local m=#s - local function kv() - if n<m then - n=n+1 - local k=s[n] - return k,t[k] + if m==1 then + return next,t + elseif m>0 then + local n=0 + return function() + if n<m then + n=n+1 + local k=s[n] + return k,t[k] + end end end - return kv - else - return nothing end + return nothing end table.sortedhash=sortedhash table.sortedpairs=sortedhash @@ -1308,39 +1335,36 @@ function table.fromhash(t) end return hsh end -local noquotes,hexify,handle,reduce,compact,inline,functions +local noquotes,hexify,handle,compact,inline,functions local reserved=table.tohash { 'and','break','do','else','elseif','end','false','for','function','if', 'in','local','nil','not','or','repeat','return','then','true','until','while', 'NaN','goto', } local function simple_table(t) - if #t>0 then + local nt=#t + if nt>0 then local n=0 for _,v in next,t do n=n+1 end - if n==#t then - local tt,nt={},0 - for i=1,#t do + if n==nt then + local tt={} + for i=1,nt do local v=t[i] local tv=type(v) if tv=="number" then - nt=nt+1 if hexify then - tt[nt]=format("0x%X",v) + tt[i]=format("0x%X",v) else - tt[nt]=tostring(v) + tt[i]=tostring(v) end elseif tv=="string" then - nt=nt+1 - tt[nt]=format("%q",v) + tt[i]=format("%q",v) elseif tv=="boolean" then - nt=nt+1 - tt[nt]=v and "true" or "false" + tt[i]=v and "true" or "false" else - tt=nil - break + return nil end end return tt @@ -1394,7 +1418,8 @@ local function do_serialize(root,name,depth,level,indexed) for i=1,#sk do local k=sk[i] local v=root[k] - local tv,tk=type(v),type(k) + local tv=type(v) + local tk=type(k) if compact and first and tk=="number" and k>=first and k<=last then if tv=="number" then if hexify then @@ -1403,11 +1428,7 @@ local function do_serialize(root,name,depth,level,indexed) handle(format("%s %s,",depth,v)) end elseif tv=="string" then - if reduce and tonumber(v) then - handle(format("%s %s,",depth,v)) - else - handle(format("%s %q,",depth,v)) - end + handle(format("%s %q,",depth,v)) elseif tv=="table" then if next(v)==nil then handle(format("%s {},",depth)) @@ -1463,34 +1484,18 @@ local function do_serialize(root,name,depth,level,indexed) end end elseif tv=="string" then - if reduce and tonumber(v) then - if tk=="number" then - if hexify then - handle(format("%s [0x%X]=%s,",depth,k,v)) - else - handle(format("%s [%s]=%s,",depth,k,v)) - end - elseif tk=="boolean" then - handle(format("%s [%s]=%s,",depth,k and "true" or "false",v)) - elseif noquotes and not reserved[k] and lpegmatch(propername,k) then - handle(format("%s %s=%s,",depth,k,v)) + if tk=="number" then + if hexify then + handle(format("%s [0x%X]=%q,",depth,k,v)) else - handle(format("%s [%q]=%s,",depth,k,v)) + handle(format("%s [%s]=%q,",depth,k,v)) end + elseif tk=="boolean" then + handle(format("%s [%s]=%q,",depth,k and "true" or "false",v)) + elseif noquotes and not reserved[k] and lpegmatch(propername,k) then + handle(format("%s %s=%q,",depth,k,v)) else - if tk=="number" then - if hexify then - handle(format("%s [0x%X]=%q,",depth,k,v)) - else - handle(format("%s [%s]=%q,",depth,k,v)) - end - elseif tk=="boolean" then - handle(format("%s [%s]=%q,",depth,k and "true" or "false",v)) - elseif noquotes and not reserved[k] and lpegmatch(propername,k) then - handle(format("%s %s=%q,",depth,k,v)) - else - handle(format("%s [%q]=%q,",depth,k,v)) - end + handle(format("%s [%q]=%q,",depth,k,v)) end elseif tv=="table" then if next(v)==nil then @@ -1587,7 +1592,6 @@ local function serialize(_handle,root,name,specification) noquotes=specification.noquotes hexify=specification.hexify handle=_handle or specification.handle or print - reduce=specification.reduce or false functions=specification.functions compact=specification.compact inline=specification.inline and compact @@ -1604,7 +1608,6 @@ local function serialize(_handle,root,name,specification) noquotes=false hexify=false handle=_handle or print - reduce=false compact=true inline=true functions=true @@ -12719,15 +12722,8 @@ local function normal_handle_contextchain(head,start,kind,chainname,contexts,seq break end end - elseif f==2 then - match=seq[1][32] else - for n=f-1,1 do - if not seq[n][32] then - match=false - break - end - end + match=false end end if match and s>l then @@ -12777,15 +12773,8 @@ local function normal_handle_contextchain(head,start,kind,chainname,contexts,seq break end end - elseif s-l==1 then - match=seq[s][32] else - for n=l+1,s do - if not seq[n][32] then - match=false - break - end - end + match=false end end end diff --git a/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-otn.lua b/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-otn.lua index 343e1826e0f..dd3aa61530d 100644 --- a/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-otn.lua +++ b/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-otn.lua @@ -376,7 +376,7 @@ local function copy_glyph(g) -- next and prev are untouched ! end end --- +-- -- start is a mark and we need to keep that one @@ -1834,15 +1834,8 @@ local function normal_handle_contextchain(head,start,kind,chainname,contexts,seq break end end - elseif f == 2 then - match = seq[1][32] else - for n=f-1,1 do - if not seq[n][32] then - match = false - break - end - end + match = false end end -- after @@ -1895,15 +1888,8 @@ local function normal_handle_contextchain(head,start,kind,chainname,contexts,seq break end end - elseif s-l == 1 then - match = seq[s][32] else - for n=l+1,s do - if not seq[n][32] then - match = false - break - end - end + match = false end end end |