From 9ee2de8e49ca2d5d9b5068067e1970d7d2993112 Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Thu, 17 Jul 2014 14:15:04 +0200 Subject: 2014-07-17 13:27:00 --- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4429 -> 4444 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/data-res.lua | 19 ++-- tex/context/base/file-job.lua | 114 ++++++++++++--------- tex/context/base/publ-aut.lua | 10 +- tex/context/base/publ-dat.lua | 3 + tex/context/base/publ-ini.lua | 25 ++--- tex/context/base/status-files.pdf | Bin 24948 -> 24971 bytes tex/context/base/status-lua.pdf | Bin 326383 -> 326426 bytes tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 11 files changed, 106 insertions(+), 71 deletions(-) (limited to 'tex') diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index f61e4b9e4..5bd79250a 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{2014.07.17 11:19} +\newcontextversion{2014.07.17 13:24} %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 224939b24..fe0a62735 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 947076800..6ce975ae7 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -28,7 +28,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2014.07.17 11:19} +\edef\contextversion{2014.07.17 13:24} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/data-res.lua b/tex/context/base/data-res.lua index 7887dee7e..69bdc508c 100644 --- a/tex/context/base/data-res.lua +++ b/tex/context/base/data-res.lua @@ -710,12 +710,19 @@ function resolvers.resetextrapath() end function resolvers.registerextrapath(paths,subpaths) - paths = settings_to_array(paths) - subpaths = settings_to_array(subpaths) - local ep = instance.extra_paths or { } - local oldn = #ep - local newn = oldn - local nofpaths = #paths + if not subpaths or subpaths == "" then + if not paths or path == "" then + return -- invalid spec + elseif done[paths] then + return -- already done + end + end + local paths = settings_to_array(paths) + local subpaths = settings_to_array(subpaths) + local ep = instance.extra_paths or { } + local oldn = #ep + local newn = oldn + local nofpaths = #paths local nofsubpaths = #subpaths if nofpaths > 0 then if nofsubpaths > 0 then diff --git a/tex/context/base/file-job.lua b/tex/context/base/file-job.lua index bbc7abcd0..85fa996de 100644 --- a/tex/context/base/file-job.lua +++ b/tex/context/base/file-job.lua @@ -44,6 +44,12 @@ local cleanpath = resolvers.cleanpath local inputstack = resolvers.inputstack local resolveprefix = resolvers.resolve +local hasscheme = url.hasscheme + +local jobresolvers = resolvers.jobs + +local registerextrapath = resolvers.registerextrapath + local v_outer = variables.outer local v_text = variables.text local v_project = variables.project @@ -57,7 +63,7 @@ local c_prefix = variables.prefix local function findctxfile(name) -- loc ? any ? if is_qualified_path(name) then -- maybe when no suffix do some test for tex return name - elseif not url.hasscheme(name) then + elseif not hasscheme(name) then return resolvers.finders.byscheme("loc",name) or "" else return resolvers.findtexfile(name) or "" @@ -82,11 +88,11 @@ function commands.locatefilepath(name) end function commands.usepath(paths) - resolvers.registerextrapath(paths) + registerextrapath(paths) end function commands.usesubpath(subpaths) - resolvers.registerextrapath(nil,subpaths) + registerextrapath(nil,subpaths) end function commands.allinputpaths() @@ -246,7 +252,7 @@ end commands.useanyfile = useanyfile -function resolvers.jobs.usefile(name,onlyonce,notext) +function jobresolvers.usefile(name,onlyonce,notext) local s = suffixes[suffixonly(name)] if s then -- s(removesuffix(name),onlyonce,notext) @@ -404,10 +410,11 @@ luatex.registerstopactions(function() logspoptarget() end) -job.structure = job.structure or { } -job.structure.collected = job.structure.collected or { } -job.structure.tobesaved = root -job.structure.components = { } +local jobstructure = job.structure or { } +job.structure = jobstructure +jobstructure.collected = jobstructure.collected or { } +jobstructure.tobesaved = root +jobstructure.components = { } local function initialize() local function collect(root,result) @@ -423,7 +430,7 @@ local function initialize() end return result end - job.structure.components = collect(job.structure.collected,{}) + jobstructure.components = collect(jobstructure.collected,{}) end job.register('job.structure.collected',root,initialize) @@ -435,48 +442,63 @@ local context_processfilemany = context.processfilemany local context_processfileonce = context.processfileonce local context_processfilenone = context.processfilenone +local function processfilecommon(name,action) + if not hasscheme(name) then + local path = dirname(name) + if path ~= "" then + registerextrapath(path) + report_jobfiles("adding search path %a",path) + end + end + action(name) +end + +local function processfilemany(name) processfilecommon(name,context_processfilemany) end +local function processfileonce(name) processfilecommon(name,context_processfileonce) end +local function processfilenone(name) processfilecommon(name,context_processfilenone) end + local processors = utilities.storage.allocate { -- [v_outer] = { - -- [v_text] = { "many", context_processfilemany }, - -- [v_project] = { "once", context_processfileonce }, - -- [v_environment] = { "once", context_processfileonce }, - -- [v_product] = { "once", context_processfileonce }, - -- [v_component] = { "many", context_processfilemany }, + -- [v_text] = { "many", processfilemany }, + -- [v_project] = { "once", processfileonce }, + -- [v_environment] = { "once", processfileonce }, + -- [v_product] = { "once", processfileonce }, + -- [v_component] = { "many", processfilemany }, -- }, [v_text] = { - [v_text] = { "many", context_processfilemany }, - [v_project] = { "once", context_processfileonce }, -- dubious - [v_environment] = { "once", context_processfileonce }, - [v_product] = { "many", context_processfilemany }, -- dubious - [v_component] = { "many", context_processfilemany }, + [v_text] = { "many", processfilemany }, + [v_project] = { "once", processfileonce }, -- dubious + [v_environment] = { "once", processfileonce }, + [v_product] = { "many", processfilemany }, -- dubious + [v_component] = { "many", processfilemany }, }, [v_project] = { - [v_text] = { "many", context_processfilemany }, - [v_project] = { "none", context_processfilenone }, - [v_environment] = { "once", context_processfileonce }, - [v_product] = { "none", context_processfilenone }, - [v_component] = { "none", context_processfilenone }, + [v_text] = { "many", processfilemany }, + [v_project] = { "none", processfilenone }, + [v_environment] = { "once", processfileonce }, + [v_product] = { "none", processfilenone }, + [v_component] = { "none", processfilenone }, }, [v_environment] = { - [v_text] = { "many", context_processfilemany }, - [v_project] = { "none", context_processfilenone }, - [v_environment] = { "once", context_processfileonce }, - [v_product] = { "none", context_processfilenone }, - [v_component] = { "none", context_processfilenone }, + [v_text] = { "many", processfilemany }, + [v_project] = { "none", processfilenone }, + [v_environment] = { "once", processfileonce }, + [v_product] = { "none", processfilenone }, + [v_component] = { "none", processfilenone }, }, [v_product] = { - [v_text] = { "many", context_processfilemany }, - [v_project] = { "once", context_processfileonce }, - [v_environment] = { "once", context_processfileonce }, - [v_product] = { "many", context_processfilemany }, - [v_component] = { "many", context_processfilemany }, + [v_text] = { "many", processfilemany }, + [v_project] = { "once", processfileonce }, + [v_environment] = { "once", processfileonce }, + [v_product] = { "many", processfilemany }, + [v_component] = { "many", processfilemany }, }, [v_component] = { - [v_text] = { "many", context_processfilemany }, - [v_project] = { "once", context_processfileonce }, - [v_environment] = { "once", context_processfileonce }, - [v_product] = { "none", context_processfilenone }, - [v_component] = { "many", context_processfilemany }, + [v_text] = { "many", processfilemany }, + [v_project] = { "once", processfileonce }, + [v_environment] = { "once", processfileonce }, + [v_product] = { "none", processfilenone }, + [v_component] = { "many", processfilemany }, } } @@ -496,7 +518,7 @@ local stop = { [v_component] = context.stoptext, } -resolvers.jobs.processors = processors +jobresolvers.processors = processors local function topofstack(what) local stack = stacks[what] @@ -523,13 +545,13 @@ local function justacomponent() end end -resolvers.jobs.productcomponent = productcomponent -resolvers.jobs.justacomponent = justacomponent +jobresolvers.productcomponent = productcomponent +jobresolvers.justacomponent = justacomponent -function resolvers.jobs.currentproject () return topofstack(v_project ) end -function resolvers.jobs.currentproduct () return topofstack(v_product ) end -function resolvers.jobs.currentcomponent () return topofstack(v_component ) end -function resolvers.jobs.currentenvironment() return topofstack(v_environment) end +function jobresolvers.currentproject () return topofstack(v_project ) end +function jobresolvers.currentproduct () return topofstack(v_product ) end +function jobresolvers.currentcomponent () return topofstack(v_component ) end +function jobresolvers.currentenvironment() return topofstack(v_environment) end local done = { } local tolerant = false -- too messy, mkii user with the wrong sructure should adapt diff --git a/tex/context/base/publ-aut.lua b/tex/context/base/publ-aut.lua index 17c6a2fba..73d50f614 100644 --- a/tex/context/base/publ-aut.lua +++ b/tex/context/base/publ-aut.lua @@ -28,8 +28,11 @@ local publications = publications or { } local datasets = publications.datasets or { } publications.datasets = datasets -publications.authors = publications.authors or { } -local authors = publications.authors +local writers = publications.writers or { } +publications.writers = writers + +local authors = publications.authors or { } +publications.authors = authors -- local function makesplitter(separator) -- return Ct { "start", @@ -409,6 +412,9 @@ local function writer(key,snippets) return concat(snippets," ",1,s) end +writers.author = writer +writers.editor = editor + local function newsplitter(splitter) return table.setmetatableindex({},function(t,k) -- could be done in the sorter but seldom that many shared local v = splitter(k,true) -- in other cases diff --git a/tex/context/base/publ-dat.lua b/tex/context/base/publ-dat.lua index 1823b33c2..f35ae2fa9 100644 --- a/tex/context/base/publ-dat.lua +++ b/tex/context/base/publ-dat.lua @@ -48,6 +48,9 @@ local publications = publications local datasets = publications.datasets or { } publications.datasets = datasets +local writers = publications.writers or { } +publications.writers = writers + publications.statistics = publications.statistics or { } local publicationsstats = publications.statistics diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua index 7ab03fb45..191e11db8 100644 --- a/tex/context/base/publ-ini.lua +++ b/tex/context/base/publ-ini.lua @@ -23,7 +23,7 @@ local settings_to_array, settings_to_set = utilities.parsers.settings_to_array, local sortedkeys, sortedhash = table.sortedkeys, table.sortedhash local setmetatableindex = table.setmetatableindex local lpegmatch = lpeg.match -local P, C, Ct, R, Carg = lpeg.P, lpeg.C, lpeg.Ct, lpeg.R, lpeg.Carg +local P, S, C, Ct, R, Carg = lpeg.P, lpeg.S, lpeg.C, lpeg.Ct, lpeg.R, lpeg.Carg local report = logs.reporter("publications") local report_cite = logs.reporter("publications","cite") @@ -35,6 +35,7 @@ local trace_missing = false trackers.register("publications.cite.missing", local trace_references = false trackers.register("publications.cite.references", function(v) trace_references = v end) local datasets = publications.datasets +local writers = publications.writers local variables = interfaces.variables @@ -1095,7 +1096,7 @@ end -- experiment -local splitspec = lpeg.splitat(lpeg.S(":.")) +local splitspec = lpeg.splitat(S(":.")) local splitter = sorters.splitters.utf local strip = sorters.strip @@ -1107,14 +1108,10 @@ local function newsplitter(splitter) end) end -local writers = { - author = publications.authors.sorters.writer, - editor = publications.authors.sorters.writer, -} - local template = [[ - local strip = sorters.strip - return function(entry,detail,splitted,i,writers) -- snippets + local strip = sorters.strip + local writers = publications.writers + return function(entry,detail,splitted,i) -- snippets return { index = i, split = { %s, splitted[tostring(i)] } @@ -1128,12 +1125,12 @@ local function byspec(dataset,list,method) -- todo: yearsuffix local result = { } local splitted = newsplitter(splitter) -- saves mem -- local snippets = { } -- saves mem - local fields = utilities.parsers.settings_to_array(method) + local fields = settings_to_array(method) for i=1,#fields do - local f = utilities.parsers.settings_to_array(fields[i]) + local f = settings_to_array(fields[i]) local r = { } for i=1,#f do - local a, b = lpeg.match(splitspec,f[i]) + local a, b = lpegmatch(splitspec,f[i]) if b then if a == "detail" or a == "entry" then local w = writers[b] @@ -1163,9 +1160,9 @@ local function byspec(dataset,list,method) -- todo: yearsuffix local entry = luadata[tag] local detail = details[tag] if entry and detail then - result[i] = prepare(entry,detail,splitted,i,writers) -- ,snippets) + result[i] = prepare(entry,detail,splitted,i) -- ,snippets) else - result[i] = prepare(dummy,dummy,splitted,i,writers) -- ,snippets) + result[i] = prepare(dummy,dummy,splitted,i) -- ,snippets) end end end diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 49f117626..4cd7076d1 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 11ce54457..0b0f756c7 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index c6ac4511a..87e016321 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 : 07/17/14 11:19:17 +-- merge date : 07/17/14 13:24:59 do -- begin closure to overcome local limits and interference -- cgit v1.2.3