diff options
author | Karl Berry <karl@freefriends.org> | 2021-05-21 21:07:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-05-21 21:07:48 +0000 |
commit | e0843bcbd8aca384ac293fa563b5133a037f45be (patch) | |
tree | 3a797f29c2515984793dd18e15c31387e26cf971 /Master/texmf-dist | |
parent | f836540dd0d473fd1938c2f3a2cdd7ca1c76100e (diff) |
lualibs (21may21)
git-svn-id: svn://tug.org/texlive/trunk@59298 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
16 files changed, 242 insertions, 163 deletions
diff --git a/Master/texmf-dist/doc/luatex/lualibs/NEWS b/Master/texmf-dist/doc/luatex/lualibs/NEWS index 4c80d069873..cf8a853b6c1 100644 --- a/Master/texmf-dist/doc/luatex/lualibs/NEWS +++ b/Master/texmf-dist/doc/luatex/lualibs/NEWS @@ -1,4 +1,6 @@ History of the lualibs package +2021/05/20 v2.74/ + * sync with Context current as of 2021/05/20. 2020/12/30 v2.73/ * sync with Context current as of 2020/12/30. diff --git a/Master/texmf-dist/doc/luatex/lualibs/README.md b/Master/texmf-dist/doc/luatex/lualibs/README.md index cf330df159f..e2cd6be9bd7 100644 --- a/Master/texmf-dist/doc/luatex/lualibs/README.md +++ b/Master/texmf-dist/doc/luatex/lualibs/README.md @@ -1,10 +1,10 @@ # The Lualibs Package -VERSION: 2.73 +VERSION: 2.74 -DATE: 2020-12-30 +DATE: 2021-05-20 -FONTLOADERDATE: 2020-12-30 +FONTLOADERDATE: 2021-05-20 Lualibs is a collection of Lua modules useful for general programming. diff --git a/Master/texmf-dist/doc/luatex/lualibs/lualibs.pdf b/Master/texmf-dist/doc/luatex/lualibs/lualibs.pdf Binary files differindex 10274b447bd..23df3045e6a 100644 --- a/Master/texmf-dist/doc/luatex/lualibs/lualibs.pdf +++ b/Master/texmf-dist/doc/luatex/lualibs/lualibs.pdf diff --git a/Master/texmf-dist/source/luatex/lualibs/lualibs.dtx b/Master/texmf-dist/source/luatex/lualibs/lualibs.dtx index 7246e8541e8..73c5aafcc1e 100644 --- a/Master/texmf-dist/source/luatex/lualibs/lualibs.dtx +++ b/Master/texmf-dist/source/luatex/lualibs/lualibs.dtx @@ -1,9 +1,9 @@ % \iffalse meta-comment % -% Copyright (C) 2009--2019 by +% Copyright (C) 2009--2021 by % % PRAGMA ADE / ConTeXt Development Team -% The LuaLaTeX Dev Team +% The LaTeX Project Team % % See ConTeXt's mreadme.pdf for the license. % @@ -37,7 +37,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: lualibs 2020-12-30 v2.73 Lua additional functions.} +\Msg{* Package: lualibs 2021-05-20 v2.74 Lua additional functions.} \Msg{************************************************************************} \keepsilent @@ -48,9 +48,9 @@ \preamble This is a generated file. -Copyright (C) 2009--2019 by +Copyright (C) 2009--2021 by PRAGMA ADE / ConTeXt Development Team - The LuaLaTeX Dev Team + The LaTeX Project Team See ConTeXt's mreadme.pdf for the license. @@ -107,7 +107,7 @@ and lualibs-extended.lua. %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{lualibs.drv} - [2020/12/30 v2.73 Lua Libraries.] + [2021/05/20 v2.74 Lua Libraries.] \documentclass{ltxdoc} \usepackage{fancyvrb,xspace} \usepackage[x11names]{xcolor} @@ -115,8 +115,7 @@ and lualibs-extended.lua. \def\primarycolor{DodgerBlue4} %%-> rgb 16 78 139 | #104e8b \def\secondarycolor{Goldenrod4} %%-> rgb 139 105 200 | #8b6914 % -\usepackage[ - bookmarks=true, +\hypersetup{ colorlinks=true, linkcolor=\primarycolor, urlcolor=\secondarycolor, @@ -124,8 +123,8 @@ and lualibs-extended.lua. pdftitle={The lualibs package}, pdfsubject={Port of the ConTeXt Lua libraries}, pdfauthor={Elie Roux & Philipp Gesang}, - pdfkeywords={luatex, lualatex, unicode, opentype} -]{hyperref} + pdfkeywords={luatex, lualatex, unicode, opentype}} + \newcommand*\email[1]{\href{mailto:#1}{#1}} \usepackage{fontspec} \setmainfont[ @@ -208,10 +207,10 @@ and lualibs-extended.lua. % \GetFileInfo{lualibs.drv} % % \title{The \identifier{lualibs} package} -% \date{2020/12/30 v2.73} +% \date{2021/05/20 v2.74} % \author{Élie Roux · \email{elie.roux@telecom-bretagne.eu}\\ % Philipp Gesang · \email{phg@phi-gamma.net}\\ -% The \LaTeX3 Project · \email{https://github.com/latex3/lualibs/}\\ +% The \LaTeX{} Project · \email{https://github.com/latex3/lualibs/}\\ % } % % \maketitle @@ -429,8 +428,8 @@ lualibs = lualibs or { } lualibs.module_info = { name = "lualibs", - version = "2.73", --TAGVERSION - date = "2020-12-30", --TAGDATE + version = "2.74", --TAGVERSION + date = "2021-05-20", --TAGDATE description = "ConTeXt Lua standard libraries.", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL & Elie Roux & Philipp Gesang", copyright = "PRAGMA ADE / ConTeXt Development Team", @@ -583,8 +582,8 @@ local loadmodule = lualibs.loadmodule local lualibs_basic_module = { name = "lualibs-basic", - version = "2.73", --TAGVERSION - date = "2020-12-30", --TAGDATE + version = "2.74", --TAGVERSION + date = "2021-05-20", --TAGDATE description = "ConTeXt Lua libraries -- basic collection.", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL & Elie Roux & Philipp Gesang", copyright = "PRAGMA ADE / ConTeXt Development Team", @@ -665,8 +664,8 @@ lualibs = lualibs or { } local lualibs_extended_module = { name = "lualibs-extended", - version = "2.73", --TAGVERSION - date = "2020-12-30", --TAGDATE + version = "2.74", --TAGVERSION + date = "2021-05-20", --TAGDATE description = "ConTeXt Lua libraries -- extended collection.", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL & Elie Roux & Philipp Gesang", copyright = "PRAGMA ADE / ConTeXt Development Team", diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs-basic-merged.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs-basic-merged.lua index 92e571a7ccd..ac98df379a7 100644 --- a/Master/texmf-dist/tex/luatex/lualibs/lualibs-basic-merged.lua +++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs-basic-merged.lua @@ -1,6 +1,6 @@ -- merged file : lualibs-basic-merged.lua -- parent file : lualibs-basic.lua --- merge date : Wed Dec 30 17:55:54 2020 +-- merge date : 2021-05-20 23:14 do -- begin closure to overcome local limits and interference @@ -133,7 +133,7 @@ if not modules then modules={} end modules ['l-package']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } -local type=type +local type,unpack=type,unpack local gsub,format,find=string.gsub,string.format,string.find local insert,remove=table.insert,table.remove local P,S,Cs,lpegmatch=lpeg.P,lpeg.S,lpeg.Cs,lpeg.match @@ -163,6 +163,7 @@ local helpers=package.helpers or { }, methods={}, sequence={ + "reset loaded", "already loaded", "preload table", "qualified path", @@ -179,6 +180,7 @@ local methods=helpers.methods local builtin=helpers.builtin local extraluapaths={} local extralibpaths={} +local checkedfiles={} local luapaths=nil local libpaths=nil local oldluapath=nil @@ -312,10 +314,16 @@ end local function loadedaslib(resolved,rawname) local base=gsub(rawname,"%.","_") local init="luaopen_"..gsub(base,"%.","_") + local data={ resolved,init,"" } + checkedfiles[#checkedfiles+1]=data if helpers.trace then helpers.report("calling loadlib with '%s' with init '%s'",resolved,init) end - return package.loadlib(resolved,init) + local a,b,c=package.loadlib(resolved,init) + if not a and type(b)=="string" then + data[3]=string.fullstrip(b or "unknown error") + end + return a,b,c end helpers.loadedaslib=loadedaslib local function loadedbypath(name,rawname,paths,islib,what) @@ -354,6 +362,10 @@ local function loadedbyname(name,rawname) end end helpers.loadedbyname=loadedbyname +methods["reset loaded"]=function(name) + checkedfiles={} + return false +end methods["already loaded"]=function(name) return package.loaded[name] end @@ -395,6 +407,9 @@ end methods["not loaded"]=function(name) if helpers.trace then helpers.report("unable to locate '%s'",name or "?") + for i=1,#checkedfiles do + helpers.report("checked file '%s', initializer '%s', message '%s'",unpack(checkedfiles[i])) + end end return nil end @@ -2591,13 +2606,13 @@ do -- begin closure to overcome local limits and interference if not modules then modules={} end modules ['l-number']={ version=1.001, - comment="companion to luat-lib.mkiv", + comment="companion to luat-lib.mkxl", author="Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } local tostring,tonumber=tostring,tonumber -local format,floor,match,rep=string.format,math.floor,string.match,string.rep +local format,match,rep=string.format,string.match,string.rep local concat,insert=table.concat,table.insert local lpegmatch=lpeg.match local floor=math.floor @@ -3371,7 +3386,7 @@ elseif name=="macosx" then elseif find(architecture,"x86_64",1,true) then platform="osx-64" elseif find(architecture,"arm64",1,true) then - platform="osx-64" + platform="osx-arm" else platform="osx-ppc" end @@ -4698,7 +4713,6 @@ if not modules then modules={} end modules ['l-unicode']={ license="see context related readme files" } utf=utf or {} --- unicode=nil if not string.utfcharacters then local gmatch=string.gmatch function string.characters(str) diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs-basic.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs-basic.lua index 7b8893871b6..d01e4249d06 100644 --- a/Master/texmf-dist/tex/luatex/lualibs/lualibs-basic.lua +++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs-basic.lua @@ -7,9 +7,9 @@ -- lualibs.dtx (with options: `basic') -- This is a generated file. -- --- Copyright (C) 2009--2019 by +-- Copyright (C) 2009--2021 by -- PRAGMA ADE / ConTeXt Development Team --- The LuaLaTeX Dev Team +-- The LaTeX Project Team -- -- See ConTeXt's mreadme.pdf for the license. -- @@ -29,8 +29,8 @@ local loadmodule = lualibs.loadmodule local lualibs_basic_module = { name = "lualibs-basic", - version = "2.73", --TAGVERSION - date = "2020-12-30", --TAGDATE + version = "2.74", --TAGVERSION + date = "2021-05-20", --TAGDATE description = "ConTeXt Lua libraries -- basic collection.", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL & Elie Roux & Philipp Gesang", copyright = "PRAGMA ADE / ConTeXt Development Team", diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs-extended-merged.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs-extended-merged.lua index cac8889ca36..9cd4487bf26 100644 --- a/Master/texmf-dist/tex/luatex/lualibs/lualibs-extended-merged.lua +++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs-extended-merged.lua @@ -1,6 +1,6 @@ -- merged file : lualibs-extended-merged.lua -- parent file : lualibs-extended.lua --- merge date : Wed Dec 30 17:55:44 2020 +-- merge date : 2021-05-20 23:14 do -- begin closure to overcome local limits and interference @@ -54,25 +54,59 @@ local function points(n) n=n*ptf if n%1==0 then return format("%ipt",n) + else + return lpegmatch(stripzeros,format("%.5fpt",n)) + end +end +local function nupoints(n) + if n==0 then + return "0" + end + n=tonumber(n) + if not n or n==0 then + return "0" + end + n=n*ptf + if n%1==0 then + return format("%i",n) + else + return format("%.5f",n) end - return lpegmatch(stripzeros,format("%.5fpt",n)) end local function basepoints(n) if n==0 then - return "0pt" + return "0bp" end n=tonumber(n) if not n or n==0 then - return "0pt" + return "0bp" end n=n*bpf if n%1==0 then return format("%ibp",n) + else + return lpegmatch(stripzeros,format("%.5fbp",n)) + end +end +local function nubasepoints(n) + if n==0 then + return "0" + end + n=tonumber(n) + if not n or n==0 then + return "0" + end + n=n*bpf + if n%1==0 then + return format("%i",n) + else + return format("%.5f",n) end - return lpegmatch(stripzeros,format("%.5fbp",n)) end number.points=points +number.nupoints=nupoints number.basepoints=basepoints +number.nubasepoints=nubasepoints local rubish=spaceortab^0*newline local anyrubish=spaceortab+newline local stripped=(spaceortab^1/"")*newline @@ -350,7 +384,9 @@ local environment={ concat=table.concat, signed=number.signed, points=number.points, + nupoints=number.nupoints, basepoints=number.basepoints, + nubasepoints=number.nubasepoints, utfchar=utf.char, utfbyte=utf.byte, lpegmatch=lpeg.match, @@ -545,10 +581,18 @@ local format_p=function() n=n+1 return format("points(a%s)",n) end +local format_P=function() + n=n+1 + return format("nupoints(a%s)",n) +end local format_b=function() n=n+1 return format("basepoints(a%s)",n) end +local format_B=function() + n=n+1 + return format("nubasepoints(a%s)",n) +end local format_t=function(f) n=n+1 if f and f~="" then @@ -701,7 +745,7 @@ local builder=Cs { "start", +V("n") +V("N") +V("k") -+V("r")+V("h")+V("H")+V("u")+V("U")+V("p")+V("b")+V("t")+V("T")+V("l")+V("L")+V("I")+V("w") ++V("r")+V("h")+V("H")+V("u")+V("U")+V("p")+V("P")+V("b")+V("B")+V("t")+V("T")+V("l")+V("L")+V("I")+V("w") +V("W") +V("a") +V("A") @@ -739,7 +783,9 @@ local builder=Cs { "start", ["u"]=(prefix_any*P("u"))/format_u, ["U"]=(prefix_any*P("U"))/format_U, ["p"]=(prefix_any*P("p"))/format_p, + ["P"]=(prefix_any*P("P"))/format_P, ["b"]=(prefix_any*P("b"))/format_b, + ["B"]=(prefix_any*P("B"))/format_B, ["t"]=(prefix_tab*P("t"))/format_t, ["T"]=(prefix_tab*P("T"))/format_T, ["l"]=(prefix_any*P("l"))/format_l, @@ -3312,10 +3358,8 @@ local function stoptiming(instance) timer.loadtime=timer.loadtime+loadtime timer.timing=0 timer.starttime=0 - return loadtime end end - return 0 end local function benchmarktimer(instance) local timer=timers[instance or "notimer"] diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs-extended.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs-extended.lua index 8bd3eb2417c..cd815d53807 100644 --- a/Master/texmf-dist/tex/luatex/lualibs/lualibs-extended.lua +++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs-extended.lua @@ -7,9 +7,9 @@ -- lualibs.dtx (with options: `extended') -- This is a generated file. -- --- Copyright (C) 2009--2019 by +-- Copyright (C) 2009--2021 by -- PRAGMA ADE / ConTeXt Development Team --- The LuaLaTeX Dev Team +-- The LaTeX Project Team -- -- See ConTeXt's mreadme.pdf for the license. -- @@ -30,8 +30,8 @@ lualibs = lualibs or { } local lualibs_extended_module = { name = "lualibs-extended", - version = "2.73", --TAGVERSION - date = "2020-12-30", --TAGDATE + version = "2.74", --TAGVERSION + date = "2021-05-20", --TAGDATE description = "ConTeXt Lua libraries -- extended collection.", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL & Elie Roux & Philipp Gesang", copyright = "PRAGMA ADE / ConTeXt Development Team", diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs-lpeg.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs-lpeg.lua index b0868ba4886..50306e4ab69 100644 --- a/Master/texmf-dist/tex/luatex/lualibs/lualibs-lpeg.lua +++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs-lpeg.lua @@ -507,7 +507,7 @@ end -- todo: cache when string -function lpeg.replacer(one,two,makefunction,isutf) -- in principle we should sort the keys +function lpeg.replacer(one,two,makefunction,isutf) -- in principle we should sort the keys but we have a better one anyway local pattern local u = isutf and utf8char or 1 if type(one) == "table" then diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs-number.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs-number.lua index 9fd2f82f785..0ec60880d75 100644 --- a/Master/texmf-dist/tex/luatex/lualibs/lualibs-number.lua +++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs-number.lua @@ -1,16 +1,13 @@ if not modules then modules = { } end modules ['l-number'] = { version = 1.001, - comment = "companion to luat-lib.mkiv", + comment = "companion to luat-lib.mkxl", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } --- this module will be replaced when we have the bit library .. the number based sets --- might go away - local tostring, tonumber = tostring, tonumber -local format, floor, match, rep = string.format, math.floor, string.match, string.rep +local format, match, rep = string.format, string.match, string.rep local concat, insert = table.concat, table.insert local lpegmatch = lpeg.match local floor = math.floor @@ -18,51 +15,6 @@ local floor = math.floor number = number or { } local number = number --- begin obsolete code -- - --- if bit32 then --- --- local btest, bor = bit32.btest, bit32.bor --- --- function number.bit(p) --- return 2 ^ (p - 1) -- 1-based indexing --- end --- --- number.hasbit = btest --- number.setbit = bor --- --- function number.setbit(x,p) -- why not bor? --- return btest(x,p) and x or x + p --- end --- --- function number.clearbit(x,p) --- return btest(x,p) and x - p or x --- end --- --- else --- --- -- http://ricilake.blogspot.com/2007/10/iterating-bits-in-lua.html --- --- function number.bit(p) --- return 2 ^ (p - 1) -- 1-based indexing --- end --- --- function number.hasbit(x, p) -- typical call: if hasbit(x, bit(3)) then ... --- return x % (p + p) >= p --- end --- --- function number.setbit(x, p) --- return (x % (p + p) >= p) and x or x + p --- end --- --- function number.clearbit(x, p) --- return (x % (p + p) >= p) and x - p or x --- end --- --- end - --- end obsolete code -- - -- print(number.tobitstring(8)) -- print(number.tobitstring(14)) -- print(number.tobitstring(66)) diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs-os.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs-os.lua index 73841074c46..c7584ccce92 100644 --- a/Master/texmf-dist/tex/luatex/lualibs/lualibs-os.lua +++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs-os.lua @@ -359,7 +359,7 @@ elseif name == "macosx" then elseif find(architecture,"x86_64",1,true) then platform = "osx-64" elseif find(architecture,"arm64",1,true) then - platform = "osx-64" + platform = "osx-arm" else platform = "osx-ppc" end diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs-package.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs-package.lua index a35ec3e2a9c..ef37aebe74e 100644 --- a/Master/texmf-dist/tex/luatex/lualibs/lualibs-package.lua +++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs-package.lua @@ -16,7 +16,7 @@ if not modules then modules = { } end modules ['l-package'] = { -- -- local mylib = require("libtest") -- -- local mysql = require("luasql.mysql") -local type = type +local type, unpack = type, unpack local gsub, format, find = string.gsub, string.format, string.find local insert, remove = table.insert, table.remove @@ -70,6 +70,7 @@ local helpers = package.helpers or { methods = { }, sequence = { + "reset loaded", "already loaded", "preload table", "qualified path", -- beware, lua itself doesn't handle qualified paths (prepends ./) @@ -91,6 +92,7 @@ local builtin = helpers.builtin local extraluapaths = { } local extralibpaths = { } +local checkedfiles = { } local luapaths = nil -- delayed local libpaths = nil -- delayed local oldluapath = nil @@ -245,10 +247,17 @@ local function loadedaslib(resolved,rawname) -- todo: strip all before first - -- so, we can do a require("foo/bar") and initialize bar -- local base = gsub(file.basename(rawname),"%.","_") local init = "luaopen_" .. gsub(base,"%.","_") + local data = { resolved, init, "" } + checkedfiles[#checkedfiles+1] = data if helpers.trace then helpers.report("calling loadlib with '%s' with init '%s'",resolved,init) end - return package.loadlib(resolved,init) + local a, b, c = package.loadlib(resolved,init) + if not a and type(b) == "string" then +-- data[3] = gsub(b or "unknown error","[\n\r]","") + data[3] = string.fullstrip(b or "unknown error") + end + return a, b, c -- c can be 'init' end helpers.loadedaslib = loadedaslib @@ -295,6 +304,12 @@ end helpers.loadedbyname = loadedbyname +methods["reset loaded"] = function(name) + checkedfiles = { } + return false +end + + methods["already loaded"] = function(name) return package.loaded[name] end @@ -344,6 +359,9 @@ end methods["not loaded"] = function(name) if helpers.trace then helpers.report("unable to locate '%s'",name or "?") + for i=1,#checkedfiles do + helpers.report("checked file '%s', initializer '%s', message '%s'",unpack(checkedfiles[i])) + end end return nil end diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs-trac-inf.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs-trac-inf.lua index 3db912be1f6..e2736cfb6eb 100644 --- a/Master/texmf-dist/tex/luatex/lualibs/lualibs-trac-inf.lua +++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs-trac-inf.lua @@ -129,10 +129,8 @@ local function stoptiming(instance) timer.loadtime = timer.loadtime + loadtime timer.timing = 0 timer.starttime = 0 - return loadtime end end - return 0 end local function benchmarktimer(instance) diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs-url.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs-url.lua index 6f834d778d1..2e01ad40808 100644 --- a/Master/texmf-dist/tex/luatex/lualibs/lualibs-url.lua +++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs-url.lua @@ -379,53 +379,53 @@ end -- print(url.barepath("/test"),url.barepath("test/"),url.barepath("/test/"),url.barepath("test")) -- print(url.barepath("/x/yz"),url.barepath("x/yz/"),url.barepath("/x/yz/"),url.barepath("x/yz")) ---~ print(url.filename("file:///c:/oeps.txt")) ---~ print(url.filename("c:/oeps.txt")) ---~ print(url.filename("file:///oeps.txt")) ---~ print(url.filename("file:///etc/test.txt")) ---~ print(url.filename("/oeps.txt")) - ---~ from the spec on the web (sort of): - ---~ local function test(str) ---~ local t = url.hashed(str) ---~ t.constructed = url.construct(t) ---~ print(table.serialize(t)) ---~ end - ---~ inspect(url.hashed("http://www.pragma-ade.com/test%20test?test=test%20test&x=123%3d45")) ---~ inspect(url.hashed("http://www.pragma-ade.com/test%20test?test=test%20test&x=123%3d45")) - ---~ test("sys:///./colo-rgb") - ---~ test("/data/site/output/q2p-develop/resources/ecaboperception4_res/topicresources/58313733/figuur-cow.jpg") ---~ test("file:///M:/q2p/develop/output/q2p-develop/resources/ecaboperception4_res/topicresources/58313733") ---~ test("M:/q2p/develop/output/q2p-develop/resources/ecaboperception4_res/topicresources/58313733") ---~ test("file:///q2p/develop/output/q2p-develop/resources/ecaboperception4_res/topicresources/58313733") ---~ test("/q2p/develop/output/q2p-develop/resources/ecaboperception4_res/topicresources/58313733") - ---~ test("file:///cow%20with%20spaces") ---~ test("file:///cow%20with%20spaces.pdf") ---~ test("cow%20with%20spaces.pdf") ---~ test("some%20file") ---~ test("/etc/passwords") ---~ test("http://www.myself.com/some%20words.html") ---~ test("file:///c:/oeps.txt") ---~ test("file:///c|/oeps.txt") ---~ test("file:///etc/oeps.txt") ---~ test("file://./etc/oeps.txt") ---~ test("file:////etc/oeps.txt") ---~ test("ftp://ftp.is.co.za/rfc/rfc1808.txt") ---~ test("http://www.ietf.org/rfc/rfc2396.txt") ---~ test("ldap://[2001:db8::7]/c=GB?objectClass?one#what") ---~ test("mailto:John.Doe@example.com") ---~ test("news:comp.infosystems.www.servers.unix") ---~ test("tel:+1-816-555-1212") ---~ test("telnet://192.0.2.16:80/") ---~ test("urn:oasis:names:specification:docbook:dtd:xml:4.1.2") ---~ test("http://www.pragma-ade.com/spaced%20name") - ---~ test("zip:///oeps/oeps.zip#bla/bla.tex") ---~ test("zip:///oeps/oeps.zip?bla/bla.tex") - ---~ table.print(url.hashed("/test?test")) +-- print(url.filename("file:///c:/oeps.txt")) +-- print(url.filename("c:/oeps.txt")) +-- print(url.filename("file:///oeps.txt")) +-- print(url.filename("file:///etc/test.txt")) +-- print(url.filename("/oeps.txt")) + +-- from the spec on the web (sort of): + +-- local function test(str) +-- local t = url.hashed(str) +-- t.constructed = url.construct(t) +-- print(table.serialize(t)) +-- end + +-- inspect(url.hashed("http://www.pragma-ade.com/test%20test?test=test%20test&x=123%3d45")) +-- inspect(url.hashed("http://www.pragma-ade.com/test%20test?test=test%20test&x=123%3d45")) + +-- test("sys:///./colo-rgb") + +-- test("/data/site/output/q2p-develop/resources/ecaboperception4_res/topicresources/58313733/figuur-cow.jpg") +-- test("file:///M:/q2p/develop/output/q2p-develop/resources/ecaboperception4_res/topicresources/58313733") +-- test("M:/q2p/develop/output/q2p-develop/resources/ecaboperception4_res/topicresources/58313733") +-- test("file:///q2p/develop/output/q2p-develop/resources/ecaboperception4_res/topicresources/58313733") +-- test("/q2p/develop/output/q2p-develop/resources/ecaboperception4_res/topicresources/58313733") + +-- test("file:///cow%20with%20spaces") +-- test("file:///cow%20with%20spaces.pdf") +-- test("cow%20with%20spaces.pdf") +-- test("some%20file") +-- test("/etc/passwords") +-- test("http://www.myself.com/some%20words.html") +-- test("file:///c:/oeps.txt") +-- test("file:///c|/oeps.txt") +-- test("file:///etc/oeps.txt") +-- test("file://./etc/oeps.txt") +-- test("file:////etc/oeps.txt") +-- test("ftp://ftp.is.co.za/rfc/rfc1808.txt") +-- test("http://www.ietf.org/rfc/rfc2396.txt") +-- test("ldap://[2001:db8::7]/c=GB?objectClass?one#what") +-- test("mailto:John.Doe@example.com") +-- test("news:comp.infosystems.www.servers.unix") +-- test("tel:+1-816-555-1212") +-- test("telnet://192.0.2.16:80/") +-- test("urn:oasis:names:specification:docbook:dtd:xml:4.1.2") +-- test("http://www.pragma-ade.com/spaced%20name") + +-- test("zip:///oeps/oeps.zip#bla/bla.tex") +-- test("zip:///oeps/oeps.zip?bla/bla.tex") + +-- table.print(url.hashed("/test?test")) diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-str.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-str.lua index 2d3f4d669f1..0d1f39de9d7 100644 --- a/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-str.lua +++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-str.lua @@ -70,27 +70,63 @@ local function points(n) n = n * ptf if n % 1 == 0 then return format("%ipt",n) + else + return lpegmatch(stripzeros,format("%.5fpt",n)) -- plural as we need to keep the pt + end +end + +local function nupoints(n) + if n == 0 then + return "0" + end + n = tonumber(n) + if not n or n == 0 then + return "0" + end + n = n * ptf + if n % 1 == 0 then + return format("%i",n) + else + return format("%.5f",n) -- no strip end - return lpegmatch(stripzeros,format("%.5fpt",n)) -- plural as we need to keep the pt end local function basepoints(n) if n == 0 then - return "0pt" + return "0bp" end n = tonumber(n) if not n or n == 0 then - return "0pt" + return "0bp" end n = n * bpf if n % 1 == 0 then return format("%ibp",n) + else + return lpegmatch(stripzeros,format("%.5fbp",n)) -- plural as we need to keep the pt + end +end + +local function nubasepoints(n) + if n == 0 then + return "0" + end + n = tonumber(n) + if not n or n == 0 then + return "0" + end + n = n * bpf + if n % 1 == 0 then + return format("%i",n) + else + return format("%.5f",n) -- no strip end - return lpegmatch(stripzeros,format("%.5fbp",n)) -- plural as we need to keep the pt end -number.points = points -number.basepoints = basepoints +number.points = points +number.nupoints = nupoints +number.basepoints = basepoints +number.nubasepoints = nubasepoints -- str = " \n \ntest \n test\ntest " -- print("["..string.gsub(string.collapsecrlf(str),"\n","+").."]") @@ -357,7 +393,9 @@ end -- U+hexadecimal %...u character number -- U+HEXADECIMAL %...U character number -- points %p number (scaled points) +-- nupoints %P number (scaled points) / without unit / always 5 decimals -- basepoints %b number (scaled points) +-- nubasepoints %B number (scaled points) / without unit / always 5 decimals -- table concat %...t table -- table concat %{.}t table -- serialize %...T sequenced (no nested tables) @@ -616,7 +654,9 @@ local environment = { concat = table.concat, signed = number.signed, points = number.points, + nupoints = number.nupoints, basepoints = number.basepoints, + nubasepoints = number.nubasepoints, utfchar = utf.char, utfbyte = utf.byte, lpegmatch = lpeg.match, @@ -879,11 +919,21 @@ local format_p = function() return format("points(a%s)",n) end +local format_P = function() + n = n + 1 + return format("nupoints(a%s)",n) +end + local format_b = function() n = n + 1 return format("basepoints(a%s)",n) end +local format_B = function() + n = n + 1 + return format("nubasepoints(a%s)",n) +end + local format_t = function(f) n = n + 1 if f and f ~= "" then @@ -1125,7 +1175,7 @@ local builder = Cs { "start", -- + V("r") + V("h") + V("H") + V("u") + V("U") - + V("p") + V("b") + + V("p") + V("P") + V("b") + V("B") + V("t") + V("T") + V("l") + V("L") + V("I") @@ -1174,8 +1224,10 @@ local builder = Cs { "start", ["H"] = (prefix_any * P("H")) / format_H, -- %H => 0x0A1B2 (when - no 0x) was V ["u"] = (prefix_any * P("u")) / format_u, -- %u => u+0a1b2 (when - no u+) ["U"] = (prefix_any * P("U")) / format_U, -- %U => U+0A1B2 (when - no U+) - ["p"] = (prefix_any * P("p")) / format_p, -- %p => 12.345pt / maybe: P (and more units) - ["b"] = (prefix_any * P("b")) / format_b, -- %b => 12.342bp / maybe: B (and more units) + ["p"] = (prefix_any * P("p")) / format_p, -- %p => 12.345pt + ["P"] = (prefix_any * P("P")) / format_P, -- %p => 12.345 + ["b"] = (prefix_any * P("b")) / format_b, -- %b => 12.342bp + ["B"] = (prefix_any * P("B")) / format_B, -- %b => 12.342 ["t"] = (prefix_tab * P("t")) / format_t, -- %t => concat ["T"] = (prefix_tab * P("T")) / format_T, -- %t => sequenced ["l"] = (prefix_any * P("l")) / format_l, -- %l => boolean diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs.lua index 779f67c3c73..4a43d9f797e 100644 --- a/Master/texmf-dist/tex/luatex/lualibs/lualibs.lua +++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs.lua @@ -7,9 +7,9 @@ -- lualibs.dtx (with options: `lualibs') -- This is a generated file. -- --- Copyright (C) 2009--2019 by +-- Copyright (C) 2009--2021 by -- PRAGMA ADE / ConTeXt Development Team --- The LuaLaTeX Dev Team +-- The LaTeX Project Team -- -- See ConTeXt's mreadme.pdf for the license. -- @@ -25,8 +25,8 @@ lualibs = lualibs or { } lualibs.module_info = { name = "lualibs", - version = "2.73", --TAGVERSION - date = "2020-12-30", --TAGDATE + version = "2.74", --TAGVERSION + date = "2021-05-20", --TAGDATE description = "ConTeXt Lua standard libraries.", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL & Elie Roux & Philipp Gesang", copyright = "PRAGMA ADE / ConTeXt Development Team", |