From db237f90e36d8862262f16f579eb98c1948faa03 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Fri, 4 Jul 2014 15:55:00 +0200 Subject: beta 2014.07.04 15:55 --- tex/context/base/attr-lay.mkiv | 2 + tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4427 -> 4439 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/data-tre.lua | 85 +++++++++++++++------ tex/context/base/lpdf-ren.lua | 36 +++++++-- tex/context/base/math-stc.mkvi | 6 +- tex/context/base/status-files.pdf | Bin 24927 -> 24940 bytes tex/context/base/status-lua.pdf | Bin 249534 -> 249536 bytes tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 10 files changed, 102 insertions(+), 33 deletions(-) (limited to 'tex') diff --git a/tex/context/base/attr-lay.mkiv b/tex/context/base/attr-lay.mkiv index 6055c2a73..8181417ab 100644 --- a/tex/context/base/attr-lay.mkiv +++ b/tex/context/base/attr-lay.mkiv @@ -33,6 +33,7 @@ \setupviewerlayer [\c!state=\v!start, \c!title=, + \c!export=\v!yes, % exportable is ugly \c!printable=\v!yes, \c!scope=\v!local, % maybe global but needs checking with layout \c!method=\v!none] @@ -43,6 +44,7 @@ title = "\viewerlayerparameter\c!title", visible = "\viewerlayerparameter\c!state", editable = "\v!yes", + export = "\viewerlayerparameter\c!export", printable = "\viewerlayerparameter\c!printable", scope = "\viewerlayerparameter\c!scope" }}% diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 0c5dbb485..22bda98b0 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.03 14:52} +\newcontextversion{2014.07.04 15:55} %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 b95c4f339..bb3c1a555 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 de7086acb..f92d65902 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.03 14:52} +\edef\contextversion{2014.07.04 15:55} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/data-tre.lua b/tex/context/base/data-tre.lua index 3f11ca878..940701c3f 100644 --- a/tex/context/base/data-tre.lua +++ b/tex/context/base/data-tre.lua @@ -6,11 +6,23 @@ if not modules then modules = { } end modules ['data-tre'] = { license = "see context related readme files" } --- \input tree://oeps1/**/oeps.tex +-- tree://e:/temporary/mb-mp/**/drawing.jpg" +-- tree://e:/temporary/mb-mp/**/Drawing.jpg" +-- tree://t:./**/tufte.tex" +-- tree://t:/./**/tufte.tex" +-- tree://t:/**/tufte.tex" +-- dirlist://e:/temporary/mb-mp/**/drawing.jpg" +-- dirlist://e:/temporary/mb-mp/**/Drawing.jpg" +-- dirlist://e:/temporary/mb-mp/**/just/some/place/drawing.jpg" +-- dirlist://e:/temporary/mb-mp/**/images/drawing.jpg" +-- dirlist://e:/temporary/mb-mp/**/images/drawing.jpg?option=fileonly" +-- dirlist://///storage-2/resources/mb-mp/**/drawing.jpg" +-- dirlist://e:/**/drawing.jpg" local find, gsub, lower = string.find, string.gsub, string.lower local basename, dirname, joinname = file.basename, file.dirname, file .join local globdir, isdir = dir.glob, lfs.isdir +local P, lpegmatch = lpeg.P, lpeg.match local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) @@ -19,6 +31,7 @@ local report_trees = logs.reporter("resolvers","trees") local resolvers = resolvers local resolveprefix = resolvers.resolve local notfound = resolvers.finders.notfound +local lookup = resolvers.get_from_content -- A tree search is rather dumb ... there is some basic caching of searched trees -- but nothing is cached over runs ... it's also a wildcard one so we cannot use @@ -87,37 +100,65 @@ end -- deal and we don't want too much overhead. local collectors = { } +local splitter = lpeg.splitat("/**/") +local stripper = lpeg.replacer { [P("/") * P("*")^1 * P(-1)] = "" } table.setmetatableindex(collectors, function(t,k) - local rootname = gsub(k,"[/%*]+$","") + local rootname = lpegmatch(stripper,k) local dataname = joinname(rootname,"dirlist") - local data = caches.loadcontent(dataname,"files",dataname) - local content = data and data.content - local lookup = resolvers.get_from_content + local content = caches.loadcontent(dataname,"files",dataname) if not content then content = resolvers.scanfiles(rootname) caches.savecontent(dataname,"files",content,dataname) end - local files = content.files - local v = function(filename) - local path, name = lookup(content,filename) - if not path then - return filename - elseif type(path) == "table" then - -- maybe a warning that the first name is taken - path = path[1] - end - return joinname(rootname,path,name) - end - t[k] = v - return v + t[k] = content + return content end) function resolvers.finders.dirlist(specification) -- can be called directly too - local spec = specification.filename - if spec ~= "" then - local path, name = dirname(spec), basename(spec) - return path and collectors[path](name) or notfound() + local filename = specification.filename + if filename ~= "" then + local root, rest = lpegmatch(splitter,filename) + if root and rest then + local path, name = dirname(rest), basename(rest) + if name ~= rest then + local content = collectors[root] + local p, n = lookup(content,name) + if not p then + return notfound() + end + local pattern = ".*/" .. path .. "$" + local istable = type(p) == "table" + if istable then + for i=1,#p do + local pi = p[i] + if pi == path or find(pi,pattern) then + return joinname(root,pi,n) + end + end + else + if p == path or find(p,pattern) then + return joinname(root,p,n) + end + end + local queries = specification.queries + if queries and queries.option == "fileonly" then + return joinname(root,istable and p[1] or p,n) + end + return notfound() + end + end + local path, name = dirname(filename), basename(filename) + local root = lpegmatch(stripper,path) + local content = collectors[path] + local p, n = lookup(content,name) + if not p then + return notfound() + elseif type(p) == "table" then + -- maybe a warning that the first name is taken + p = p[1] + end + return joinname(root,p,n) end return notfound() end diff --git a/tex/context/base/lpdf-ren.lua b/tex/context/base/lpdf-ren.lua index 37b706420..61676d5a8 100644 --- a/tex/context/base/lpdf-ren.lua +++ b/tex/context/base/lpdf-ren.lua @@ -54,12 +54,27 @@ local pdf_ocg = pdfconstant("OCG") local pdf_ocmd = pdfconstant("OCMD") local pdf_off = pdfconstant("OFF") local pdf_on = pdfconstant("ON") +local pdf_view = pdfconstant("View") +local pdf_design = pdfconstant("Design") local pdf_toggle = pdfconstant("Toggle") local pdf_setocgstate = pdfconstant("SetOCGState") local copy_node = node.copy -local lpdf_usage = pdfdictionary { Print = pdfdictionary { PrintState = pdf_off } } +local pdf_print = { + [v_yes] = pdfdictionary { PrintState = pdf_on }, + [v_no ] = pdfdictionary { PrintState = pdf_off }, +} + +local pdf_intent = { + [v_yes] = pdf_view, + [v_no] = pdf_design, +} + +local pdf_export = { + [v_yes] = pdf_on, + [v_no] = pdf_off, +} -- We can have references to layers before they are places, for instance from -- hide and vide actions. This is why we need to be able to force usage of layers @@ -99,10 +114,13 @@ local function useviewerlayer(name) -- move up so that we can use it as local local nn = pdfreserveobject() local nr = pdfreference(nn) local nd = pdfdictionary { - Type = pdf_ocg, - Name = specification.title or "unknown", - Intent = ((specification.editable ~= v_no) and pdf_design) or nil, -- disable layer hiding by user - Usage = ((specification.printable == v_no) and lpdf_usage) or nil, -- printable or not + Type = pdf_ocg, + Name = specification.title or "unknown", + Usage = { + Intent = pdf_intent[specification.editable or v_yes], -- disable layer hiding by user (useless) + Print = pdf_print [specification.printable or v_yes], -- printable or not + Export = pdf_export[specification.export or v_yes], -- export or not + }, } cache[#cache+1] = { nn, nd } pdfln[tag] = nr -- was n @@ -165,6 +183,14 @@ local function flushtextlayers() ON = videlayers, OFF = hidelayers, BaseState = pdf_on, + +AS = pdfarray { + pdfdictionary { + Category = pdfarray { pdfconstant("Print") }, + Event = pdfconstant("Print"), + OCGs = (viewerlayers.hasorder and sortedlayers) or nil, + } +}, }, } addtocatalog("OCProperties",d) diff --git a/tex/context/base/math-stc.mkvi b/tex/context/base/math-stc.mkvi index 76a07db5c..140d0244b 100644 --- a/tex/context/base/math-stc.mkvi +++ b/tex/context/base/math-stc.mkvi @@ -376,7 +376,7 @@ \egroup % \ifdim\htdp\scratchboxone>\zeropoint - \scratchoffset\dimexpr\scratchvoffset + \scratchoffset\scratchvoffset \kern-\scratchwidth \math_stackers_top\bgroup \raise\dimexpr\dp\scratchboxone+\scratchheight+\scratchoffset+\scratchtopoffset\relax @@ -385,7 +385,7 @@ \fi % \ifdim\htdp\scratchboxtwo>\zeropoint - \scratchoffset\dimexpr\scratchvoffset + \scratchoffset\scratchvoffset \kern-\scratchwidth \math_stackers_bottom\bgroup \lower\dimexpr\ht\scratchboxtwo+\scratchdepth+\scratchoffset+\scratchbottomoffset\relax @@ -467,7 +467,7 @@ % \math_stackers_check_unicode{#codepoint}% % - \ifx\currentmathtext\empty + \ifx\math_stackers_middle\empty \setbox\scratchboxthree\emptyhbox \else \setmathtextbox\scratchboxthree\hbox{\math_stackers_middletext}% diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 95da7c75e..5bfd7eade 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 b095cf6bc..1da58153a 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 a62958c1c..52a65ea57 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/03/14 14:52:08 +-- merge date : 07/04/14 15:55:31 do -- begin closure to overcome local limits and interference -- cgit v1.2.3