diff options
author | Hans Hagen <pragma@wxs.nl> | 2018-01-12 08:12:50 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2018-01-12 08:12:50 +0100 |
commit | d0edf3e90e8922d9c672f24ecdc5d44fe2716f31 (patch) | |
tree | 5b618b87aa5078a8c744c94bbf058d69cd7111b2 /tex/context/base/mkiv/grph-inc.lua | |
parent | 409a95f63883bd3b91699d39645e39a8a761457c (diff) | |
download | context-d0edf3e90e8922d9c672f24ecdc5d44fe2716f31.tar.gz |
2018-01-08 23:11:00
Diffstat (limited to 'tex/context/base/mkiv/grph-inc.lua')
-rw-r--r-- | tex/context/base/mkiv/grph-inc.lua | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/tex/context/base/mkiv/grph-inc.lua b/tex/context/base/mkiv/grph-inc.lua index 8df33f73c..5f403ebc7 100644 --- a/tex/context/base/mkiv/grph-inc.lua +++ b/tex/context/base/mkiv/grph-inc.lua @@ -40,7 +40,7 @@ run TeX code from within Lua. Some more functionality will move to Lua. -- todo: store loaded pages per pdf file someplace -local tonumber, tostring = tonumber, tostring +local tonumber, tostring, next = tonumber, tostring, next local format, lower, find, match, gsub = string.format, string.lower, string.find, string.match, string.gsub local longtostring = string.longtostring local contains = table.contains @@ -558,10 +558,12 @@ function figures.initialize(request) -- can be determined; at some point the handlers might set them to numbers instead local w = tonumber(request.width) or 0 local h = tonumber(request.height) or 0 + local p = tonumber(request.page) or 0 request.width = w > 0 and w or nil request.height = h > 0 and h or nil -- - request.page = max(tonumber(request.page) or 1,1) + request.page = p > 0 and p or 1 + request.keepopen = p > 0 request.size = checkimagesize(request.size) request.object = request.object == v_yes request["repeat"] = request["repeat"] == v_yes @@ -1278,7 +1280,7 @@ function figures.done(data) ds.yscale = 1 end -- sort of redundant but can be limited - ds.page = ds.page or du.page or dr.page + ds.page = ds.page or du.page or dr.page return data end @@ -1395,19 +1397,22 @@ function checkers.generic(data) filename = name, page = page, pagebox = dr.size, + keepopen = dr.keepopen or false, -- visiblefilename = "", -- this prohibits the full filename ending up in the file } codeinjections.setfigurecolorspace(data,figure) codeinjections.setfiguremask(data,figure) if figure then -if page and page > 1 then - local f = scanimage{ filename = name } - if f.page and f.pages < page then - report_inclusion("no page %i in %a, using page 1",page,name) - page = 1 - figure.page = page - end -end + -- new, bonus check + if page and page > 1 then + local f = scanimage{ filename = name } + if f.page and f.pages < page then + report_inclusion("no page %i in %a, using page 1",page,name) + page = 1 + figure.page = page + end + end + -- till here local f, comment = checkimage(scanimage(figure)) if not f then ds.comment = comment |