diff options
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/mkii/cont-new.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/mkii/context.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/grph-inc.lua | 42 | ||||
-rw-r--r-- | tex/context/base/mkiv/grph-mem.lua | 164 | ||||
-rw-r--r-- | tex/context/base/mkiv/l-lpeg.lua | 59 | ||||
-rw-r--r-- | tex/context/base/mkiv/lpdf-pde.lua | 35 | ||||
-rw-r--r-- | tex/context/base/mkiv/meta-blb.lua | 10 | ||||
-rw-r--r-- | tex/context/base/mkiv/mlib-pdf.lua | 34 | ||||
-rw-r--r-- | tex/context/base/mkiv/mlib-pps.lua | 39 | ||||
-rw-r--r-- | tex/context/base/mkiv/status-files.pdf | bin | 26072 -> 26047 bytes | |||
-rw-r--r-- | tex/context/base/mkiv/status-lua.pdf | bin | 261351 -> 261372 bytes | |||
-rw-r--r-- | tex/context/base/mkiv/util-str.lua | 9 | ||||
-rw-r--r-- | tex/context/interface/mkiv/i-context.pdf | bin | 844439 -> 844400 bytes | |||
-rw-r--r-- | tex/context/interface/mkiv/i-readme.pdf | bin | 61066 -> 61065 bytes |
16 files changed, 264 insertions, 136 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index f1169ed0a..c0d945f51 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2018.06.23 12:12} +\newcontextversion{2018.06.24 18:28} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index 280407900..245d8dd30 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2018.06.23 12:12} +\edef\contextversion{2018.06.24 18:28} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index f621d7969..618004649 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2018.06.23 12:12} +\newcontextversion{2018.06.24 18:28} %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/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 73ec727ac..bb9a949b4 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -42,7 +42,7 @@ %D has to match \type {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2018.06.23 12:12} +\edef\contextversion{2018.06.24 18:28} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/grph-inc.lua b/tex/context/base/mkiv/grph-inc.lua index 7c6035d0a..ce37c7c62 100644 --- a/tex/context/base/mkiv/grph-inc.lua +++ b/tex/context/base/mkiv/grph-inc.lua @@ -372,22 +372,30 @@ function figures.setorder(list) -- can be table or string end end +local function guessfromstring(str) + if str then + for i=1,#figures_magics do + local pattern = figures_magics[i] + if lpegmatch(pattern.pattern,str) then + local format = pattern.format + if trace_figures then + report_inclusion("file %a has format %a",filename,format) + end + return format + end + end + end +end + +figures.guessfromstring = guessfromstring + function figures.guess(filename) local f = io.open(filename,'rb') if f then local str = f:read(100) f:close() if str then - for i=1,#figures_magics do - local pattern = figures_magics[i] - if lpegmatch(pattern.pattern,str) then - local format = pattern.format - if trace_figures then - report_inclusion("file %a has format %a",filename,format) - end - return format - end - end + return guessfromstring(str) end end end @@ -2079,11 +2087,10 @@ local function pdf_checker(data) local pdfdoc = nil request.scanimage = function(t) pdfdoc = openpdf(t.filename,request.userpassword,request.ownerpassword) - -- if pdfdoc then - -- used.pdfdoc = pdfdoc - -- -- nofpages - -- end if pdfdoc then + -- + pdfdoc.nofcopiedpages = 0 + -- local info = querypdf(pdfdoc,request.page) local bbox = info and info.boundingbox or { 0, 0, 0, 0 } return { @@ -2105,14 +2112,15 @@ local function pdf_checker(data) end request.copyimage = function(t) if pdfdoc then - -- local pdfdoc = used.pdfdoc local result = copypage(pdfdoc,request.page) - if pdfdoc.nofpages == 1 then -- and object usage + pdfdoc.nofcopiedpages = pdfdoc.nofcopiedpages + 1 + if pdfdoc.nofcopiedpages >= pdfdoc.nofpages then closepdf(pdfdoc) - -- used.pdfdoc = nil pdfdoc = nil end return result + else + -- message, should not happen as we always first scan so that reopens end end end diff --git a/tex/context/base/mkiv/grph-mem.lua b/tex/context/base/mkiv/grph-mem.lua index bb48ae8d5..ff3548350 100644 --- a/tex/context/base/mkiv/grph-mem.lua +++ b/tex/context/base/mkiv/grph-mem.lua @@ -20,67 +20,143 @@ local gsub = string.gsub local report = logs.reporter("memstream") local trace = false trackers.register ("graphics.memstreams", function(v) trace = v end) local data = { } -local opened = { } -local function setmemstream(name,stream,once) - if once and data[name] then +if pdfe then + + local function setmemstream(name,stream,once) + if once and data[name] then + if trace then + report("not overloading %a",name) -- + end + return data[name] + end + local kind = figures.guessfromstring(stream) + local identifier = false + if kind == "pdf" then + identifier = pdfe.new(stream,#stream,name) + if not identifier then + report("no valid pdf stream %a",name) + elseif trace then + report("setting %a with identifier %a",name,identifier) + end + else + identifier = "m_k_i_v_memstream_" .. name .. "." .. kind + io.savedata(identifier,stream) + end + if not identifier then + identifier = "invalid-memstream" + end + data[name] = identifier + return identifier + end + + resolvers.setmemstream = setmemstream + + function resolvers.finders.memstream(specification) + local name = specification.path + local identifier = data[name] + if identifier then + if trace then + report("reusing %a with identifier %a",name,identifier) + end + return identifier + end + local stream = io.loaddata(name) + if stream and stream ~= "" then + return setmemstream(name,stream) + end if trace then - report("not overloading %a",name) -- + report("no valid memstream %a",name) end - return data[name] + return resolvers.finders.notfound() end - local memstream, identifier = epdf.openMemStream(stream,#stream,name) - if not identifier then - report("no valid stream %a",name) - identifier = "invalid-memstream" - elseif trace then - report("setting %a with identifier %a",name,identifier) + + local flush = { } + + function resolvers.resetmemstream(name,afterpage) + if afterpage then + flush[#flush+1] = name + end end - data [name] = identifier - opened[name] = memstream - return identifier -end -resolvers.setmemstream = setmemstream + luatex.registerpageactions(function() + if #flush > 0 then + for i=1,#flush do + local identifier = data[name] + if identifier then + os.remove(identifier) + data[name] = nil + end + end + flush = { } + end + end) + +else -function resolvers.finders.memstream(specification) - local name = specification.path - local identifier = data[name] - if identifier then - if trace then - report("reusing %a with identifier %a",name,identifier) + local opened = { } + + local function setmemstream(name,stream,once) + if once and data[name] then + if trace then + report("not overloading %a",name) -- + end + return data[name] end + local memstream, identifier = epdf.openMemStream(stream,#stream,name) + if not identifier then + report("no valid stream %a",name) + identifier = "invalid-memstream" + elseif trace then + report("setting %a with identifier %a",name,identifier) + end + data [name] = identifier + opened[name] = memstream return identifier end - local stream = io.loaddata(name) - if not stream or stream == "" then - if trace then - report("no valid file %a",name) + + resolvers.setmemstream = setmemstream + + function resolvers.finders.memstream(specification) + local name = specification.path + local identifier = data[name] + if identifier then + if trace then + report("reusing %a with identifier %a",name,identifier) + end + return identifier + end + local stream = io.loaddata(name) + if not stream or stream == "" then + if trace then + report("no valid file %a",name) + end + return resolvers.finders.notfound() + else + return setmemstream(name,stream) end - return resolvers.finders.notfound() - else - return setmemstream(name,stream) end -end -local flush = { } + local flush = { } -function resolvers.resetmemstream(name,afterpage) - if afterpage then - flush[#flush+1] = name - else - opened[name] = nil + function resolvers.resetmemstream(name,afterpage) + if afterpage then + flush[#flush+1] = name + else + opened[name] = nil + end end -end -luatex.registerpageactions(function() - if #flush > 0 then - for i=1,#flush do - opened[flush[i]] = nil -- we keep of course data[name] because of reuse + luatex.registerpageactions(function() + if #flush > 0 then + for i=1,#flush do + opened[flush[i]] = nil -- we keep of course data[name] because of reuse + end + flush = { } end - flush = { } - end -end) + end) + +end figures.identifiers.list[#figures.identifiers.list+1] = function(specification) local name = specification.request.name diff --git a/tex/context/base/mkiv/l-lpeg.lua b/tex/context/base/mkiv/l-lpeg.lua index 45d254724..827564464 100644 --- a/tex/context/base/mkiv/l-lpeg.lua +++ b/tex/context/base/mkiv/l-lpeg.lua @@ -202,13 +202,13 @@ local fullstripper = whitespace^0 * C((whitespace^0 * nonwhitespace^1)^0) local collapser = Cs(spacer^0/"" * nonspacer^0 * ((spacer^0/" " * nonspacer^1)^0)) local nospacer = Cs((whitespace^1/"" + nonwhitespace^1)^0) -local b_collapser = Cs( whitespace^0 /"" * (nonwhitespace^1 + whitespace^1/" ")^0) -local e_collapser = Cs((whitespace^1 * P(-1)/"" + nonwhitespace^1 + whitespace^1/" ")^0) -local m_collapser = Cs( (nonwhitespace^1 + whitespace^1/" ")^0) +local b_collapser = Cs( whitespace^0 /"" * (nonwhitespace^1 + whitespace^1/" ")^0) +local e_collapser = Cs((whitespace^1 * endofstring/"" + nonwhitespace^1 + whitespace^1/" ")^0) +local m_collapser = Cs( (nonwhitespace^1 + whitespace^1/" ")^0) -local b_stripper = Cs( spacer^0 /"" * (nonspacer^1 + spacer^1/" ")^0) -local e_stripper = Cs((spacer^1 * P(-1)/"" + nonspacer^1 + spacer^1/" ")^0) -local m_stripper = Cs( (nonspacer^1 + spacer^1/" ")^0) +local b_stripper = Cs( spacer^0 /"" * (nonspacer^1 + spacer^1/" ")^0) +local e_stripper = Cs((spacer^1 * endofstring/"" + nonspacer^1 + spacer^1/" ")^0) +local m_stripper = Cs( (nonspacer^1 + spacer^1/" ")^0) patterns.stripper = stripper patterns.fullstripper = fullstripper @@ -289,7 +289,7 @@ patterns.propername = (uppercase + lowercase + underscore) * (uppercase + low patterns.somecontent = (anything - newline - space)^1 -- (utf8char - newline - space)^1 patterns.beginline = #(1-newline) -patterns.longtostring = Cs(whitespace^0/"" * ((patterns.quoted + nonwhitespace^1 + whitespace^1/"" * (P(-1) + Cc(" ")))^0)) +patterns.longtostring = Cs(whitespace^0/"" * ((patterns.quoted + nonwhitespace^1 + whitespace^1/"" * (endofstring + Cc(" ")))^0)) -- local function anywhere(pattern) -- slightly adapted from website -- return P { P(pattern) + 1 * V(1) } @@ -1133,23 +1133,36 @@ end -- moved here (before util-str) ------ digit = R("09") ------ period = P(".") ------ zero = P("0") -local trailingzeros = zero^0 * -digit -- suggested by Roberto R -local case_1 = period * trailingzeros / "" -local case_2 = period * (digit - trailingzeros)^1 * (trailingzeros / "") -local number = digits * (case_1 + case_2) -local stripper = Cs((number + 1)^0) +do -lpeg.patterns.stripzeros = stripper + local trailingzeros = zero^0 * -digit -- suggested by Roberto R + local stripper = Cs(( + digits * ( + period * trailingzeros / "" + + period * (digit - trailingzeros)^1 * (trailingzeros / "") + ) + 1 + )^0) --- local sample = "bla 11.00 bla 11 bla 0.1100 bla 1.00100 bla 0.00 bla 0.001 bla 1.1100 bla 0.100100100 bla 0.00100100100" --- collectgarbage("collect") --- str = string.rep(sample,10000) --- local ts = os.clock() --- lpegmatch(stripper,str) --- print(#str, os.clock()-ts, lpegmatch(stripper,sample)) + lpeg.patterns.stripzeros = stripper -- multiple in string + + local nonzero = digit - zero + + local trailingzeros = zero^1 * endofstring + local stripper = Cs( (1-period)^0 * ( + (period * trailingzeros/"") + + period * (nonzero^1 + (trailingzeros/"") + zero^1)^0 + )) + + lpeg.patterns.stripzero = stripper -- slightly more efficient + + -- local sample = "bla 11.00 bla 11 bla 0.1100 bla 1.00100 bla 0.00 bla 0.001 bla 1.1100 bla 0.100100100 bla 0.00100100100" + -- collectgarbage("collect") + -- str = string.rep(sample,10000) + -- local ts = os.clock() + -- lpegmatch(stripper,str) + -- print(#str, os.clock()-ts, lpegmatch(stripper,sample)) + +end -- for practical reasone we keep this here: @@ -1229,7 +1242,7 @@ local patterns = { } -- can be made weak local function containsws(what) local p = patterns[what] if not p then - local p1 = P(what) * (whitespace + P(-1)) * Cc(true) + local p1 = P(what) * (whitespace + endofstring) * Cc(true) local p2 = whitespace * P(p1) p = P(p1) + P(1-p2)^0 * p2 + Cc(false) patterns[what] = p diff --git a/tex/context/base/mkiv/lpdf-pde.lua b/tex/context/base/mkiv/lpdf-pde.lua index 3f12edd90..bc252b87c 100644 --- a/tex/context/base/mkiv/lpdf-pde.lua +++ b/tex/context/base/mkiv/lpdf-pde.lua @@ -793,8 +793,8 @@ if img then do -- recompress d.Filter = nil d.Length = nil - d.DecodeParms = nil - d.DL = nil + d.DecodeParms = nil -- not relevant + d.DL = nil -- needed? local s = entry() -- get uncompressed stream pdfflushstreamobject(s,d,true,usednum) -- compress stream else @@ -835,6 +835,9 @@ if img then do end local function copyobject(xref,copied,object,key,value) + if not value then + value = object.__raw__[key] + end local t = type(value) if t == "string" then return pdfconstant(value) @@ -949,7 +952,6 @@ if img then do local xobject = pdfdictionary { Group = copyobject(xref,copied,page,"Group"), LastModified = copyobject(xref,copied,page,"LastModified"), - MetaData = copyobject(xref,copied,root,"MetaData"), Metadata = copyobject(xref,copied,page,"Metadata"), PieceInfo = copyobject(xref,copied,page,"PieceInfo"), Resources = copyresources(pdfdoc,xref,copied,page), @@ -960,12 +962,26 @@ if img then do page[k] = v -- maybe nested end end - local content = "" - local ctype = contents.__type__ + local content = "" + local nolength = nil + local ctype = contents.__type__ -- we always recompress because image object streams can not be -- influenced (yet) if ctype == stream_code then - content = contents() -- uncompressed + if recompress then + content = contents() -- uncompressed + else + local Filter = copyobject(xref,copied,contents,"Filter") + local Length = copyobject(xref,copied,contents,"Length") + if Length and Filter then + nolength = true + xobject.Length = Length + xobject.Filter = Filter + content = contents(false) -- uncompressed + else + content = contents() -- uncompressed + end + end elseif ctype == array_code then content = { } for i=1,#contents do @@ -975,9 +991,10 @@ if img then do end -- still not nice: we double wrap now return newimage { - bbox = pageinfo.boundingbox, - stream = content, - attr = xobject(), + bbox = pageinfo.boundingbox, + nolength = nolength, + stream = content, -- todo: no compress, pass directly also length, filter etc + attr = xobject(), } end end diff --git a/tex/context/base/mkiv/meta-blb.lua b/tex/context/base/mkiv/meta-blb.lua index d3418199c..639e22052 100644 --- a/tex/context/base/mkiv/meta-blb.lua +++ b/tex/context/base/mkiv/meta-blb.lua @@ -306,10 +306,12 @@ local ft_reset, ft_analyze, ft_process do } ft_process = function(object,prescript,before,after) - object.path = false - object.color = false - object.grouped = true - object.istext = true + if prescript.ft_category then + object.path = false + object.color = false + object.grouped = true + object.istext = true + end end diff --git a/tex/context/base/mkiv/mlib-pdf.lua b/tex/context/base/mkiv/mlib-pdf.lua index 791d36607..ce4fd8817 100644 --- a/tex/context/base/mkiv/mlib-pdf.lua +++ b/tex/context/base/mkiv/mlib-pdf.lua @@ -48,19 +48,6 @@ local experiment = true -- uses context(node) that already does delayed nod local savedliterals = nil -- needs checking local mpsliteral = nodes.pool.register(node.new("whatsit",nodes.whatsitcodes.pdfliteral)) -- pdfliteral.mode = 1 --- we can have "withaccuracy 3" and then change formatters on the fly - --- local f_f = formatters["%F"] --- local f_m = formatters["%F %F m"] --- local f_c = formatters["%F %F %F %F %F %F c"] --- local f_l = formatters["%F %F l"] --- local f_cm = formatters["%F %F %F %F %F %F cm"] --- local f_M = formatters["%F M"] --- local f_j = formatters["%i j"] --- local f_J = formatters["%i J"] --- local f_d = formatters["[%s] %F d"] --- local f_w = formatters["%F w"] - local f_f = formatters["%.6F"] local f_m = formatters["%.6F %.6F m"] local f_c = formatters["%.6F %.6F %.6F %.6F %.6F %.6F c"] @@ -72,6 +59,19 @@ local f_J = formatters["%i J"] local f_d = formatters["[%s] %.6F d"] local f_w = formatters["%.3F w"] +directives.register("metapost.stripzeros",function() + f_f = formatters["%.6N"] + f_m = formatters["%.6N %.6N m"] + f_c = formatters["%.6N %.6N %.6N %.6N %.6N %.6N c"] + f_l = formatters["%.6N %.6N l"] + f_cm = formatters["%.6N %.6N %.6N %.6N %.6N %.6N cm"] + f_M = formatters["%.6N M"] + f_j = formatters["%i j"] + f_J = formatters["%i J"] + f_d = formatters["[%s] %.6N d"] + f_w = formatters["%.3N w"] +end) + directives.register("metapost.savetable",function(v) if type(v) == "string" then save_table = file.addsuffix(v,"mpl") @@ -560,14 +560,14 @@ function metapost.flush(result,flusher,askedfig,incontext) local open = path and path[1].left_type and path[#path].right_type -- at this moment only "end_point" local pen = object.pen if pen then - if pen.type == 'elliptical' then + if pen.type == "elliptical" then transformed, penwidth = pen_characteristics(original) -- boolean, value result[#result+1] = f_w(penwidth) -- todo: only if changed - if objecttype == 'fill' then - objecttype = 'both' + if objecttype == "fill" then + objecttype = "both" end else -- calculated by mplib itself - objecttype = 'fill' + objecttype = "fill" end end if transformed then diff --git a/tex/context/base/mkiv/mlib-pps.lua b/tex/context/base/mkiv/mlib-pps.lua index da1e9c4f7..6c2dfe4cd 100644 --- a/tex/context/base/mkiv/mlib-pps.lua +++ b/tex/context/base/mkiv/mlib-pps.lua @@ -97,13 +97,22 @@ end local f_f = formatters["%F"] local f_f3 = formatters["%.3F"] - local f_gray = formatters["%.3F g %.3F G"] local f_rgb = formatters["%.3F %.3F %.3F rg %.3F %.3F %.3F RG"] local f_cmyk = formatters["%.3F %.3F %.3F %.3F k %.3F %.3F %.3F %.3F K"] local f_cm = formatters["q %F %F %F %F %F %F cm"] local f_shade = formatters["MpSh%s"] +directives.register("metapost.stripzeros",function() + f_f = formatters["%N"] + f_f3 = formatters["%.3N"] + f_gray = formatters["%.3N g %.3N G"] + f_rgb = formatters["%.3N %.3N %.3N rg %.3N %.3N %.3N RG"] + f_cmyk = formatters["%.3N %.3N %.3N %.3N k %.3N %.3N %.3N %.3N K"] + f_cm = formatters["q %N %N %N %N %N %N cm"] + f_shade = formatters["MpSh%s"] +end) + local f_spot = formatters["/%s cs /%s CS %s SCN %s scn"] local function checked_color_pair(color,...) @@ -998,19 +1007,21 @@ local tx_reset, tx_analyze, tx_process do ----- pat = tsplitat(":") local pat = lpeg.tsplitter(":",tonumber) -- so that %F can do its work - -- local f_gray_yes = formatters["s=%F,a=%F,t=%F"] - -- local f_gray_nop = formatters["s=%F"] - -- local f_rgb_yes = formatters["r=%F,g=%F,b=%F,a=%F,t=%F"] - -- local f_rgb_nop = formatters["r=%F,g=%F,b=%F"] - -- local f_cmyk_yes = formatters["c=%F,m=%F,y=%F,k=%F,a=%F,t=%F"] - -- local f_cmyk_nop = formatters["c=%F,m=%F,y=%F,k=%F"] - - local f_gray_yes = formatters["s=%n,a=%n,t=%n"] - local f_gray_nop = formatters["s=%n"] - local f_rgb_yes = formatters["r=%n,g=%n,b=%n,a=%n,t=%n"] - local f_rgb_nop = formatters["r=%n,g=%n,b=%n"] - local f_cmyk_yes = formatters["c=%n,m=%n,y=%n,k=%n,a=%n,t=%n"] - local f_cmyk_nop = formatters["c=%n,m=%n,y=%n,k=%n"] + local f_gray_yes = formatters["s=%.3F,a=%i,t=%.3F"] + local f_gray_nop = formatters["s=%.3F"] + local f_rgb_yes = formatters["r=%.3F,g=%.3F,b=%.3F,a=%.3F,t=%.3F"] + local f_rgb_nop = formatters["r=%.3F,g=%.3F,b=%.3F"] + local f_cmyk_yes = formatters["c=%.3F,m=%.3F,y=%.3F,k=%.3F,a=%.3F,t=%.3F"] + local f_cmyk_nop = formatters["c=%.3F,m=%.3F,y=%.3F,k=%.3F"] + + directives.register("metapost.stripzeros",function() + f_gray_yes = formatters["s=%.3N,a=%i,t=%.3N"] + f_gray_nop = formatters["s=%.3N"] + f_rgb_yes = formatters["r=%.3N,g=%.3N,b=%.3N,a=%.3N,t=%.3N"] + f_rgb_nop = formatters["r=%.3N,g=%.3N,b=%.3N"] + f_cmyk_yes = formatters["c=%.3N,m=%.3N,y=%.3N,k=%.3N,a=%.3N,t=%.3N"] + f_cmyk_nop = formatters["c=%.3N,m=%.3N,y=%.3N,k=%.3N"] + end) if metapost.use_one_pass then diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex ae6be34a3..3c7be3c0b 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 062c3635a..466bd7c4c 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/util-str.lua b/tex/context/base/mkiv/util-str.lua index f575050ff..576e1f491 100644 --- a/tex/context/base/mkiv/util-str.lua +++ b/tex/context/base/mkiv/util-str.lua @@ -47,7 +47,7 @@ end if not number then number = { } end -- temp hack for luatex-fonts -local stripper = patterns.stripzeros +local stripper = patterns.stripzero local newline = patterns.newline local endofstring = patterns.endofstring local whitespace = patterns.whitespace @@ -368,6 +368,7 @@ end -- automatic %...a 'whatever' (string, table, ...) -- automatic %...A "whatever" (string, table, ...) -- zap %...z skip +-- stripped %...N %...N -- comma/period real %...m -- period/comma real %...M -- formatted float %...k n.m @@ -612,7 +613,7 @@ local sequenced=table.sequenced local formattednumber=number.formatted local sparseexponent=number.sparseexponent local formattedfloat=number.formattedfloat -local stripper=lpeg.patterns.stripzeros +local stripper=lpeg.patterns.stripzero ]] else @@ -640,7 +641,7 @@ else formattednumber = number.formatted, sparseexponent = number.sparseexponent, formattedfloat = number.formattedfloat, - stripper = lpeg.patterns.stripzeros, + stripper = lpeg.patterns.stripzero, } end @@ -914,7 +915,7 @@ end -- return format("tostring(tonumber(a%s) or a%s)",n,n) -- end -local format_N = function() -- strips leading and trailing zeros (also accepts string) +local format_N = function(f) -- strips leading and trailing zeros (also accepts string) n = n + 1 if not f or f == "" then return format("(((a%s > -0.0000000005 and a%s < 0.0000000005) and '0') or ((a%s %% 1 == 0) and format('%%i',a%s)) or lpegmatch(stripper,format('%%.9f',a%s)))",n,n,n,n,n) diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 69bc9732b..dcf89c5c7 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex 7d2466788..59f8e297a 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf |