From 8f88a20980422e11f20ff88b1c3152df30ec0c03 Mon Sep 17 00:00:00 2001 From: Marius Date: Mon, 4 Nov 2013 12:40:14 +0200 Subject: beta 2013.11.04 11:26 --- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4107 -> 4104 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/m-graph.mkiv | 3 + tex/context/base/status-files.pdf | Bin 24535 -> 24559 bytes tex/context/base/status-lua.pdf | Bin 225201 -> 225277 bytes tex/context/base/strc-ref.lua | 99 +++++++++++++++++---- tex/context/base/util-prs.lua | 36 +++++++- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 9 files changed, 120 insertions(+), 24 deletions(-) (limited to 'tex') diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index a421678d7..e3afc90d0 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2013.11.01 15:02} +\newcontextversion{2013.11.04 11:26} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index 7d6ad88e5..8d46d3fd6 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index e40bdb0ab..730cc4684 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2013.11.01 15:02} +\edef\contextversion{2013.11.04 11:26} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/m-graph.mkiv b/tex/context/base/m-graph.mkiv index 64cf46157..62c4ec4cb 100644 --- a/tex/context/base/m-graph.mkiv +++ b/tex/context/base/m-graph.mkiv @@ -32,6 +32,9 @@ \continueifinputfile{m-graph.mkiv} +%D We put this test here as in \type {meta-tex.mkiv} it would abort due to redefinition +%D of namespaces. + \starttext \startMPpage[instance=graph] diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index db17dcbd9..2d2f3f1dd 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index 46c3ef27e..9f87ac30b 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/strc-ref.lua b/tex/context/base/strc-ref.lua index 9b4ec6ab7..62559ebb3 100644 --- a/tex/context/base/strc-ref.lua +++ b/tex/context/base/strc-ref.lua @@ -14,7 +14,7 @@ if not modules then modules = { } end modules ['strc-ref'] = { -- todo: autoload components when ::: -local format, find, gmatch, match, concat = string.format, string.find, string.gmatch, string.match, table.concat +local format, find, gmatch, match, strip = string.format, string.find, string.gmatch, string.match, string.strip local floor = math.floor local rawget, tonumber = rawget, tonumber local lpegmatch = lpeg.match @@ -65,6 +65,7 @@ local logspushtarget = logs.pushtarget local logspoptarget = logs.poptarget local settings_to_array = utilities.parsers.settings_to_array +local process_settings = utilities.parsers.process_stripped_settings local unsetvalue = attributes.unsetvalue local structures = structures @@ -287,21 +288,37 @@ function references.set(kind,prefix,tag,data) tobesaved[prefix] = pd end local n = 0 - for ref in gmatch(tag,"[^,]+") do - if ref ~= "" then - if check_duplicates and pd[ref] then - if prefix and prefix ~= "" then - report_references("redundant reference %a in namespace %a",ref,prefix) - else - report_references("redundant reference %a",ref) - end + -- for ref in gmatch(tag,"[^,]+") do + -- if ref ~= "" then + -- if check_duplicates and pd[ref] then + -- if prefix and prefix ~= "" then + -- report_references("redundant reference %a in namespace %a",ref,prefix) + -- else + -- report_references("redundant reference %a",ref) + -- end + -- else + -- n = n + 1 + -- pd[ref] = data + -- context.dofinishsomereference(kind,prefix,ref) + -- end + -- end + -- end + local function action(ref) + if ref == "" then + -- skip + elseif check_duplicates and pd[ref] then + if prefix and prefix ~= "" then + report_references("redundant reference %a in namespace %a",ref,prefix) else - n = n + 1 - pd[ref] = data - context.dofinishsomereference(kind,prefix,ref) + report_references("redundant reference %a",ref) end + else + n = n + 1 + pd[ref] = data + context.dofinishsomereference(kind,prefix,ref) end end + process_settings(tag,action) return n > 0 end @@ -392,14 +409,23 @@ local function register_from_lists(collected,derived,pages,sections) derived[component] = c end local t = { kind, i, entry } - for s in gmatch(reference,"%s*([^,]+)") do - if trace_referencing then + -- for s in gmatch(reference,"%s*([^,]+)") do + -- if trace_referencing then + -- report_references("list entry %a provides %a reference %a on realpage %a",i,kind,s,realpage) + -- end + -- c[s] = c[s] or t -- share them + -- d[s] = d[s] or t -- share them + -- g[s] = g[s] or t -- first wins + -- end + local function action(s) +-- if trace_referencing then report_references("list entry %a provides %a reference %a on realpage %a",i,kind,s,realpage) - end +-- end c[s] = c[s] or t -- share them d[s] = d[s] or t -- share them g[s] = g[s] or t -- first wins end + process_settings(reference,action) end end end @@ -804,13 +830,21 @@ local function loadexternalreferences(name,utilitydata) target = { } external[prefix] = target end - for s in gmatch(reference,"%s*([^,]+)") do + -- for s in gmatch(reference,"%s*([^,]+)") do + -- if trace_importing then + -- report_importing("registering %s reference, kind %a, name %a, prefix %a, reference %a", + -- "external",kind,name,prefix,s) + -- end + -- target[s] = target[s] or entry + -- end + local function action(s) if trace_importing then report_importing("registering %s reference, kind %a, name %a, prefix %a, reference %a", "external",kind,name,prefix,s) end target[s] = target[s] or entry end + process_settings(reference,action) end end end @@ -918,7 +952,23 @@ local function loadproductreferences(productname,componentname,utilitydata) ptarget = { } productreferences[prefix] = ptarget end - for s in gmatch(reference,"%s*([^,]+)") do + -- for s in gmatch(reference,"%s*([^,]+)") do + -- if ptarget then + -- if trace_importing then + -- report_importing("registering %s reference, kind %a, name %a, prefix %a, reference %a", + -- "product",kind,productname,prefix,s) + -- end + -- ptarget[s] = ptarget[s] or entry + -- end + -- if ctarget then + -- if trace_importing then + -- report_importing("registering %s reference, kind %a, name %a, prefix %a, referenc %a", + -- "component",kind,productname,prefix,s) + -- end + -- ctarget[s] = ctarget[s] or entry + -- end + -- end + local function action(s) if ptarget then if trace_importing then report_importing("registering %s reference, kind %a, name %a, prefix %a, reference %a", @@ -934,6 +984,7 @@ local function loadproductreferences(productname,componentname,utilitydata) ctarget[s] = ctarget[s] or entry end end + process_settings(reference,action) end end end @@ -1667,15 +1718,25 @@ function references.setinternalreference(prefix,tag,internal,view) -- needs chec if tag then if prefix and prefix ~= "" then prefix = prefix .. ":" -- watch out, : here - for ref in gmatch(tag,"[^,]+") do + -- for ref in gmatch(tag,"[^,]+") do + -- tn = tn + 1 + -- t[tn] = prefix .. ref + -- end + local function action(ref) tn = tn + 1 t[tn] = prefix .. ref end + process_settings(tag,action) else - for ref in gmatch(tag,"[^,]+") do + -- for ref in gmatch(tag,"[^,]+") do + -- tn = tn + 1 + -- t[tn] = ref + -- end + local function action(ref) tn = tn + 1 t[tn] = ref end + process_settings(tag,action) end end if internal and innermethod == "names" then -- mixed or page diff --git a/tex/context/base/util-prs.lua b/tex/context/base/util-prs.lua index 7a8c3ce39..29a57e094 100644 --- a/tex/context/base/util-prs.lua +++ b/tex/context/base/util-prs.lua @@ -40,8 +40,8 @@ local newline = lpegpatterns.newline local anything = lpegpatterns.anything local endofstring = lpegpatterns.endofstring -local nobrace = 1 - ( lbrace + rbrace ) -local noparent = 1 - ( lparent + rparent) +local nobrace = 1 - (lbrace + rbrace ) +local noparent = 1 - (lparent + rparent) -- we could use a Cf Cg construct @@ -189,6 +189,38 @@ function parsers.settings_to_array(str,strict) end end +-- this one also strips end spaces before separators +-- +-- "{123} , 456 " -> "123" "456" + +local separator = space^0 * comma * space^0 +local value = P(lbrace * C((nobrace + nestedbraces)^0) * rbrace) + + C((nestedbraces + (1-(space^0*(comma+P(-1)))))^0) +local withvalue = Carg(1) * value / function(f,s) return f(s) end +local pattern_a = spaces * Ct(value*(separator*value)^0) +local pattern_b = spaces * withvalue * (separator*withvalue)^0 + +function parsers.stripped_settings_to_array(str) + if not str or str == "" then + return { } + else + return lpegmatch(pattern_a,str) + end +end + +function parsers.process_stripped_settings(str,action) + if not str or str == "" then + return { } + else + return lpegmatch(pattern_b,str,1,action) + end +end + +-- parsers.process_stripped_settings("{123} , 456 ",function(s) print("["..s.."]") end) +-- parsers.process_stripped_settings("123 , 456 ",function(s) print("["..s.."]") end) + +-- + local function set(t,v) t[#t+1] = v end diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 03b817496..d46a163a8 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 11/01/13 15:02:08 +-- merge date : 11/04/13 11:26:47 do -- begin closure to overcome local limits and interference -- cgit v1.2.3