summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-05-18 22:10:13 +0000
committerKarl Berry <karl@freefriends.org>2013-05-18 22:10:13 +0000
commit0ee744b73c1c0e6ead0d311c9ceeaa96c0a3ee7b (patch)
tree022d1e6a511f9b6fe864228ab4d1f164cbc1cc60 /Master
parent83a088d792eae526aebb1961564db25fc6902ed1 (diff)
lualibs (18may13)
git-svn-id: svn://tug.org/texlive/trunk@30555 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/luatex/lualibs/NEWS2
-rw-r--r--Master/texmf-dist/doc/luatex/lualibs/README1
-rw-r--r--Master/texmf-dist/doc/luatex/lualibs/lualibs.pdfbin85114 -> 83381 bytes
-rw-r--r--Master/texmf-dist/source/luatex/lualibs/Makefile3
-rw-r--r--Master/texmf-dist/source/luatex/lualibs/lualibs.dtx24
-rw-r--r--Master/texmf-dist/source/luatex/lualibs/test-lualibs.lua2
-rw-r--r--Master/texmf-dist/tex/luatex/lualibs/lualibs-basic-merged.lua8
-rw-r--r--Master/texmf-dist/tex/luatex/lualibs/lualibs-basic.lua2
-rw-r--r--Master/texmf-dist/tex/luatex/lualibs/lualibs-extended-merged.lua144
-rw-r--r--Master/texmf-dist/tex/luatex/lualibs/lualibs-extended.lua6
-rw-r--r--Master/texmf-dist/tex/luatex/lualibs/lualibs-file.lua6
-rw-r--r--Master/texmf-dist/tex/luatex/lualibs/lualibs-util-fmt.lua76
-rw-r--r--Master/texmf-dist/tex/luatex/lualibs/lualibs-util-jsn.lua5
-rw-r--r--Master/texmf-dist/tex/luatex/lualibs/lualibs-util-prs.lua41
-rw-r--r--Master/texmf-dist/tex/luatex/lualibs/lualibs.lua4
15 files changed, 205 insertions, 119 deletions
diff --git a/Master/texmf-dist/doc/luatex/lualibs/NEWS b/Master/texmf-dist/doc/luatex/lualibs/NEWS
index 14da4dae298..8637458e8da 100644
--- a/Master/texmf-dist/doc/luatex/lualibs/NEWS
+++ b/Master/texmf-dist/doc/luatex/lualibs/NEWS
@@ -1,5 +1,5 @@
History of the lualibs package
-2013/05/05 v2.0/
+2013/05/18 v2.0/
* sync with Context beta as of 2013.04.29 20:30
* merge with mtx-package
* split in basic and extended collection, allowing for partial
diff --git a/Master/texmf-dist/doc/luatex/lualibs/README b/Master/texmf-dist/doc/luatex/lualibs/README
index 499ceb8a7cf..a1961295038 100644
--- a/Master/texmf-dist/doc/luatex/lualibs/README
+++ b/Master/texmf-dist/doc/luatex/lualibs/README
@@ -66,7 +66,6 @@ Source files:
lualibs-util-sto.lua tex/luatex/lualibs/lualibs-util-sto.lua
lualibs-util-str.lua tex/luatex/lualibs/lualibs-util-str.lua
lualibs-util-tab.lua tex/luatex/lualibs/lualibs-util-tab.lua
- lualibs-util-fmt.lua tex/luatex/lualibs/lualibs-util-fmt.lua
lualibs-util-tpl.lua tex/luatex/lualibs/lualibs-util-tpl.lua
LICENSE doc/luatex/lualibs/LICENSE
Makefile source/luatex/lualibs/Makefile
diff --git a/Master/texmf-dist/doc/luatex/lualibs/lualibs.pdf b/Master/texmf-dist/doc/luatex/lualibs/lualibs.pdf
index 0b65edd1ce8..a0faa9884bd 100644
--- a/Master/texmf-dist/doc/luatex/lualibs/lualibs.pdf
+++ b/Master/texmf-dist/doc/luatex/lualibs/lualibs.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/luatex/lualibs/Makefile b/Master/texmf-dist/source/luatex/lualibs/Makefile
index 4a08cf0b716..453d6cc45ad 100644
--- a/Master/texmf-dist/source/luatex/lualibs/Makefile
+++ b/Master/texmf-dist/source/luatex/lualibs/Makefile
@@ -3,7 +3,8 @@
NAME = lualibs
DTX = $(wildcard *.dtx)
DOC_DTX = $(patsubst %.dtx, %.pdf, $(DTX))
-MODULES = $(wildcard lualibs-*.lua)
+LUALIBS = $(wildcard lualibs-*.lua)
+MODULES = $(filter-out $(UNPACKED),$(LUALIBS))
# Files grouped by generation mode
TESTSCRIPT = test-lualibs.lua
diff --git a/Master/texmf-dist/source/luatex/lualibs/lualibs.dtx b/Master/texmf-dist/source/luatex/lualibs/lualibs.dtx
index b8c74c01373..f2edf918fdf 100644
--- a/Master/texmf-dist/source/luatex/lualibs/lualibs.dtx
+++ b/Master/texmf-dist/source/luatex/lualibs/lualibs.dtx
@@ -33,7 +33,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: lualibs 2013/05/04 v2.00 Lua additional functions.}
+\Msg{* Package: lualibs 2013/05/18 v2.00 Lua additional functions.}
\Msg{************************************************************************}
\keepsilent
@@ -100,7 +100,7 @@ and the derived file lualibs.lua.
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{lualibs.drv}
- [2013/05/04 v2.00 Lua Libraries.]
+ [2013/05/18 v2.00 Lua Libraries.]
\documentclass{ltxdoc}
\usepackage{fancyvrb,xspace}
\usepackage[x11names]{xcolor}
@@ -201,7 +201,7 @@ and the derived file lualibs.lua.
% \GetFileInfo{lualibs.drv}
%
% \title{The \identifier{lualibs} package}
-% \date{2013/05/04 v2.00}
+% \date{2013/05/18 v2.00}
% \author{Élie Roux · \email{elie.roux@telecom-bretagne.eu}\\
% Philipp Gesang · \email{philipp.gesang@alumni.uni-heidelberg.de}}
%
@@ -403,12 +403,6 @@ and the derived file lualibs.lua.
% ...
% \end{verbatim}\end{quote}
%
-% Note that there is one exception to the packaging:
-% \fileent{lualibs-util-jsn.lua} cannot be successfully packaged because
-% it follows a different coding convention, returning a \LUA table on exit.
-% Therefore, the file is loaded separately as part of the \identifier{extended}
-% set like any other \LUA module.
-%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \part{\fileent{lualibs.lua}}
@@ -423,7 +417,7 @@ lualibs = lualibs or { }
lualibs.module_info = {
name = "lualibs",
version = 2.00,
- date = "2013/04/30",
+ date = "2013/05/18",
description = "ConTeXt Lua standard libraries.",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL & Elie Roux & Philipp Gesang",
copyright = "PRAGMA ADE / ConTeXt Development Team",
@@ -539,7 +533,7 @@ end
--- This restores the default of loading everything should a package
--- have requested otherwise. Will be gone once there is a canonical
--- interface for parameterized loading of libraries.
-lualibs.load_extended = true
+config.lualibs.load_extended = true
-- vim:tw=71:sw=2:ts=2:expandtab
@@ -564,7 +558,7 @@ local loadmodule = lualibs.loadmodule
local lualibs_basic_module = {
name = "lualibs-basic",
version = 2.00,
- date = "2013/04/30",
+ date = "2013/05/18",
description = "ConTeXt Lua libraries -- basic collection.",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL & Elie Roux & Philipp Gesang",
copyright = "PRAGMA ADE / ConTeXt Development Team",
@@ -645,7 +639,7 @@ lualibs = lualibs or { }
local lualibs_extended_module = {
name = "lualibs-extended",
version = 2.00,
- date = "2013/04/30",
+ date = "2013/05/18",
description = "ConTeXt Lua libraries -- extended collection.",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL & Elie Roux & Philipp Gesang",
copyright = "PRAGMA ADE / ConTeXt Development Team",
@@ -780,7 +774,7 @@ if loaded == false then
loadmodule("lualibs-util-prs.lua")--- miscellaneous parsers; cool. cool cool cool
----------("lualibs-util-fmt.lua")---!column formatter (rarely used)
loadmodule("lualibs-util-dim.lua")--- conversions between dimensions
- ----------("lualibs-util-jsn.lua")--- JSON parser
+ loadmodule("lualibs-util-jsn.lua")--- JSON parser
----------("lualibs-trac-set.lua")---!generalization of trackers
----------("lualibs-trac-log.lua")---!logging
@@ -796,8 +790,6 @@ if loaded == false then
----------("lualibs-core-con.lua")---
end
-loadmodule"lualibs-util-jsn.lua"--- cannot be merged because of return statement
-
unfake_context() --- TODO check if this works at runtime
lualibs.extended_loaded = true
diff --git a/Master/texmf-dist/source/luatex/lualibs/test-lualibs.lua b/Master/texmf-dist/source/luatex/lualibs/test-lualibs.lua
index b74fde16f94..55cecfb0b0b 100644
--- a/Master/texmf-dist/source/luatex/lualibs/test-lualibs.lua
+++ b/Master/texmf-dist/source/luatex/lualibs/test-lualibs.lua
@@ -15,7 +15,7 @@ local luafiles = {
"lualibs-util-jsn.lua", "lualibs-util-lua.lua",
"lualibs-util-prs.lua", "lualibs-util-sta.lua",
"lualibs-util-sto.lua", "lualibs-util-str.lua",
- "lualibs-util-tab.lua", "lualibs-util-fmt.lua",
+ "lualibs-util-tab.lua",
"lualibs-util-tpl.lua", "lualibs.lua",
"lualibs-basic.lua", "lualibs-basic-merged.lua",
"lualibs-extended.lua", "lualibs-extended-merged.lua",
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 19c148ca3e8..358b028300c 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 : Thu May 9 16:30:14 2013
+-- merge date : Sat May 18 12:25:19 2013
do -- begin closure to overcome local limits and interference
@@ -2874,7 +2874,11 @@ function file.splitname(str,splitdrive)
end
end
function file.splitbase(str)
- return str and lpegmatch(pattern_d,str)
+ if str then
+ return lpegmatch(pattern_d,str)
+ else
+ return "",str
+ end
end
function file.nametotable(str,splitdrive)
if str then
diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs-basic.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs-basic.lua
index 4530756fdb8..5f6bc0fbc77 100644
--- a/Master/texmf-dist/tex/luatex/lualibs/lualibs-basic.lua
+++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs-basic.lua
@@ -27,7 +27,7 @@ local loadmodule = lualibs.loadmodule
local lualibs_basic_module = {
name = "lualibs-basic",
version = 2.00,
- date = "2013/04/30",
+ date = "2013/05/18",
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 4df0eb6f9cd..fe87e8a09b8 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 : Thu May 9 16:30:14 2013
+-- merge date : Sat May 18 12:25:20 2013
do -- begin closure to overcome local limits and interference
@@ -1066,7 +1066,9 @@ patterns.settings_to_hash_a=pattern_a_s
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 how=="strict" then
+ if type(str)=="table" then
+ return set
+ elseif how=="strict" then
return (pattern_c/set)^1
elseif how=="tolerant" then
return (pattern_b/set)^1
@@ -1075,7 +1077,16 @@ function parsers.make_settings_to_hash_pattern(set,how)
end
end
function parsers.settings_to_hash(str,existing)
- if str and str~="" then
+ if type(str)=="table" then
+ if existing then
+ for k,v in next,str do
+ existing[k]=v
+ end
+ return exiting
+ else
+ return str
+ end
+ elseif str and str~="" then
hash=existing or {}
lpegmatch(pattern_a_s,str)
return hash
@@ -1084,7 +1095,16 @@ function parsers.settings_to_hash(str,existing)
end
end
function parsers.settings_to_hash_tolerant(str,existing)
- if str and str~="" then
+ if type(str)=="table" then
+ if existing then
+ for k,v in next,str do
+ existing[k]=v
+ end
+ return exiting
+ else
+ return str
+ end
+ elseif str and str~="" then
hash=existing or {}
lpegmatch(pattern_b_s,str)
return hash
@@ -1093,7 +1113,16 @@ function parsers.settings_to_hash_tolerant(str,existing)
end
end
function parsers.settings_to_hash_strict(str,existing)
- if str and str~="" then
+ if type(str)=="table" then
+ if existing then
+ for k,v in next,str do
+ existing[k]=v
+ end
+ return exiting
+ else
+ return str
+ end
+ elseif str and str~="" then
hash=existing or {}
lpegmatch(pattern_c_s,str)
return next(hash) and hash
@@ -1106,7 +1135,9 @@ local value=P(lbrace*C((nobrace+nestedbraces)^0)*rbrace)+C((nestedbraces+(1-comm
local pattern=spaces*Ct(value*(separator*value)^0)
patterns.settings_to_array=pattern
function parsers.settings_to_array(str,strict)
- if not str or str=="" then
+ if type(str)=="table" then
+ return str
+ elseif not str or str=="" then
return {}
elseif strict then
if find(str,"{") then
@@ -1594,6 +1625,107 @@ end -- closure
do -- begin closure to overcome local limits and interference
+if not modules then modules={} end modules ['util-jsn']={
+ version=1.001,
+ comment="companion to m-json.mkiv",
+ author="Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright="PRAGMA ADE / ConTeXt Development Team",
+ license="see context related readme files"
+}
+local P,V,R,S,C,Cc,Cs,Ct,Cf,Cg=lpeg.P,lpeg.V,lpeg.R,lpeg.S,lpeg.C,lpeg.Cc,lpeg.Cs,lpeg.Ct,lpeg.Cf,lpeg.Cg
+local lpegmatch=lpeg.match
+local format=string.format
+local utfchar=utf.char
+local concat=table.concat
+local tonumber,tostring,rawset,type=tonumber,tostring,rawset,type
+local json=utilities.json or {}
+utilities.json=json
+local lbrace=P("{")
+local rbrace=P("}")
+local lparent=P("[")
+local rparent=P("]")
+local comma=P(",")
+local colon=P(":")
+local dquote=P('"')
+local whitespace=lpeg.patterns.whitespace
+local optionalws=whitespace^0
+local escape=C(P("\\u")/"0x"*S("09","AF","af"))/function(s) return utfchar(tonumber(s)) end
+local jstring=dquote*Cs((escape+(1-dquote))^0)*dquote
+local jtrue=P("true")*Cc(true)
+local jfalse=P("false")*Cc(false)
+local jnull=P("null")*Cc(nil)
+local jnumber=(1-whitespace-rparent-rbrace-comma)^1/tonumber
+local key=jstring
+local jsonconverter={ "value",
+ object=lbrace*Cf(Ct("")*V("pair")*(comma*V("pair"))^0,rawset)*rbrace,
+ pair=Cg(optionalws*key*optionalws*colon*V("value")),
+ array=Ct(lparent*V("value")*(comma*V("value"))^0*rparent),
+ value=optionalws*(jstring+V("object")+V("array")+jtrue+jfalse+jnull+jnumber+#rparent)*optionalws,
+}
+function json.tolua(str)
+ return lpegmatch(jsonconverter,str)
+end
+local function tojson(value,t)
+ local kind=type(value)
+ if kind=="table" then
+ local done=false
+ local size=#value
+ if size==0 then
+ for k,v in next,value do
+ if done then
+ t[#t+1]=","
+ else
+ t[#t+1]="{"
+ done=true
+ end
+ t[#t+1]=format("%q:",k)
+ tojson(v,t)
+ end
+ if done then
+ t[#t+1]="}"
+ else
+ t[#t+1]="{}"
+ end
+ elseif size==1 then
+ t[#t+1]="["
+ tojson(value[1],t)
+ t[#t+1]="]"
+ else
+ for i=1,size do
+ if done then
+ t[#t+1]=","
+ else
+ t[#t+1]="["
+ done=true
+ end
+ tojson(value[i],t)
+ end
+ t[#t+1]="]"
+ end
+ elseif kind=="string" then
+ t[#t+1]=format("%q",value)
+ elseif kind=="number" then
+ t[#t+1]=value
+ elseif kind=="boolean" then
+ t[#t+1]=tostring(value)
+ end
+ return t
+end
+function json.tostring(value)
+ local kind=type(value)
+ if kind=="table" then
+ return concat(tojson(value,{}),"")
+ elseif kind=="string" or kind=="number" then
+ return value
+ else
+ return tostring(value)
+ end
+end
+
+end -- closure
+
+do -- begin closure to overcome local limits and interference
+
if not modules then modules={} end modules ['trac-inf']={
version=1.001,
comment="companion to trac-inf.mkiv",
diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs-extended.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs-extended.lua
index edd0a215b56..5029c88cb1f 100644
--- a/Master/texmf-dist/tex/luatex/lualibs/lualibs-extended.lua
+++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs-extended.lua
@@ -28,7 +28,7 @@ lualibs = lualibs or { }
local lualibs_extended_module = {
name = "lualibs-extended",
version = 2.00,
- date = "2013/04/30",
+ date = "2013/05/18",
description = "ConTeXt Lua libraries -- extended collection.",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL & Elie Roux & Philipp Gesang",
copyright = "PRAGMA ADE / ConTeXt Development Team",
@@ -130,7 +130,7 @@ if loaded == false then
loadmodule("lualibs-util-prs.lua")--- miscellaneous parsers; cool. cool cool cool
----------("lualibs-util-fmt.lua")---!column formatter (rarely used)
loadmodule("lualibs-util-dim.lua")--- conversions between dimensions
- ----------("lualibs-util-jsn.lua")--- JSON parser
+ loadmodule("lualibs-util-jsn.lua")--- JSON parser
----------("lualibs-trac-set.lua")---!generalization of trackers
----------("lualibs-trac-log.lua")---!logging
@@ -146,8 +146,6 @@ if loaded == false then
----------("lualibs-core-con.lua")---
end
-loadmodule"lualibs-util-jsn.lua"--- cannot be merged because of return statement
-
unfake_context() --- TODO check if this works at runtime
lualibs.extended_loaded = true
diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs-file.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs-file.lua
index 29416caf03b..acb4216b0d4 100644
--- a/Master/texmf-dist/tex/luatex/lualibs/lualibs-file.lua
+++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs-file.lua
@@ -153,7 +153,11 @@ function file.splitname(str,splitdrive)
end
function file.splitbase(str)
- return str and lpegmatch(pattern_d,str) -- returns path, base+suffix
+ if str then
+ return lpegmatch(pattern_d,str) -- returns path, base+suffix (path has / appended, might change at some point)
+ else
+ return "", str -- assume no path
+ end
end
---- stripslash = C((1 - P("/")^1*P(-1))^0)
diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-fmt.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-fmt.lua
deleted file mode 100644
index 371a5dfcece..00000000000
--- a/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-fmt.lua
+++ /dev/null
@@ -1,76 +0,0 @@
-if not modules then modules = { } end modules ['util-fmt'] = {
- version = 1.001,
- comment = "companion to luat-lib.mkiv",
- author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
- copyright = "PRAGMA ADE / ConTeXt Development Team",
- license = "see context related readme files"
-}
-
-utilities = utilities or { }
-utilities.formatters = utilities.formatters or { }
-local formatters = utilities.formatters
-
-local concat, format = table.concat, string.format
-local tostring, type = tostring, type
-local strip = string.strip
-
-local lpegmatch = lpeg.match
-local stripper = lpeg.patterns.stripzeros
-
-function formatters.stripzeros(str)
- return lpegmatch(stripper,str)
-end
-
-function formatters.formatcolumns(result,between)
- if result and #result > 0 then
- between = between or " "
- local widths, numbers = { }, { }
- local first = result[1]
- local n = #first
- for i=1,n do
- widths[i] = 0
- end
- for i=1,#result do
- local r = result[i]
- for j=1,n do
- local rj = r[j]
- local tj = type(rj)
- if tj == "number" then
- numbers[j] = true
- end
- if tj ~= "string" then
- rj = tostring(rj)
- r[j] = rj
- end
- local w = #rj
- if w > widths[j] then
- widths[j] = w
- end
- end
- end
- for i=1,n do
- local w = widths[i]
- if numbers[i] then
- if w > 80 then
- widths[i] = "%s" .. between
- else
- widths[i] = "%0" .. w .. "i" .. between
- end
- else
- if w > 80 then
- widths[i] = "%s" .. between
- elseif w > 0 then
- widths[i] = "%-" .. w .. "s" .. between
- else
- widths[i] = "%s"
- end
- end
- end
- local template = strip(concat(widths))
- for i=1,#result do
- local str = format(template,unpack(result[i]))
- result[i] = strip(str)
- end
- end
- return result
-end
diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-jsn.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-jsn.lua
index 7493f108d22..29587cd3834 100644
--- a/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-jsn.lua
+++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-jsn.lua
@@ -11,6 +11,9 @@ if not modules then modules = { } end modules ['util-jsn'] = {
-- a correct stream. If not, we have some fatal error anyway. So, we can just rely
-- on strings being strings (apart from the unicode escape which is not in 5.1) and
-- as we first catch known types we just assume that anything else is a number.
+--
+-- Reminder for me: check usage in framework and extend when needed. Also document
+-- it in the cld lib documentation.
local P, V, R, S, C, Cc, Cs, Ct, Cf, Cg = lpeg.P, lpeg.V, lpeg.R, lpeg.S, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Cf, lpeg.Cg
local lpegmatch = lpeg.match
@@ -141,5 +144,3 @@ end
-- inspect(tmp)
-- inspect(json.tostring(true))
-
-return json
diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-prs.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-prs.lua
index 31e7ffa535b..cdf497588ea 100644
--- a/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-prs.lua
+++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-prs.lua
@@ -93,7 +93,9 @@ 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 how == "strict" then
+ if type(str) == "table" then
+ return set
+ elseif how == "strict" then
return (pattern_c/set)^1
elseif how == "tolerant" then
return (pattern_b/set)^1
@@ -103,7 +105,16 @@ function parsers.make_settings_to_hash_pattern(set,how)
end
function parsers.settings_to_hash(str,existing)
- if str and str ~= "" then
+ if type(str) == "table" then
+ if existing then
+ for k, v in next, str do
+ existing[k] = v
+ end
+ return exiting
+ else
+ return str
+ end
+ elseif str and str ~= "" then
hash = existing or { }
lpegmatch(pattern_a_s,str)
return hash
@@ -113,7 +124,16 @@ function parsers.settings_to_hash(str,existing)
end
function parsers.settings_to_hash_tolerant(str,existing)
- if str and str ~= "" then
+ if type(str) == "table" then
+ if existing then
+ for k, v in next, str do
+ existing[k] = v
+ end
+ return exiting
+ else
+ return str
+ end
+ elseif str and str ~= "" then
hash = existing or { }
lpegmatch(pattern_b_s,str)
return hash
@@ -123,7 +143,16 @@ function parsers.settings_to_hash_tolerant(str,existing)
end
function parsers.settings_to_hash_strict(str,existing)
- if str and str ~= "" then
+ if type(str) == "table" then
+ if existing then
+ for k, v in next, str do
+ existing[k] = v
+ end
+ return exiting
+ else
+ return str
+ end
+ elseif str and str ~= "" then
hash = existing or { }
lpegmatch(pattern_c_s,str)
return next(hash) and hash
@@ -144,7 +173,9 @@ patterns.settings_to_array = pattern
-- we could use a weak table as cache
function parsers.settings_to_array(str,strict)
- if not str or str == "" then
+ if type(str) == "table" then
+ return str
+ elseif not str or str == "" then
return { }
elseif strict then
if find(str,"{") then
diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs.lua
index ae498b20de5..5e4d818e93f 100644
--- a/Master/texmf-dist/tex/luatex/lualibs/lualibs.lua
+++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs.lua
@@ -23,7 +23,7 @@ lualibs = lualibs or { }
lualibs.module_info = {
name = "lualibs",
version = 2.00,
- date = "2013/04/30",
+ date = "2013/05/18",
description = "ConTeXt Lua standard libraries.",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL & Elie Roux & Philipp Gesang",
copyright = "PRAGMA ADE / ConTeXt Development Team",
@@ -101,7 +101,7 @@ end
--- This restores the default of loading everything should a package
--- have requested otherwise. Will be gone once there is a canonical
--- interface for parameterized loading of libraries.
-lualibs.load_extended = true
+config.lualibs.load_extended = true
-- vim:tw=71:sw=2:ts=2:expandtab