summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/lpdf-ano.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-09-25 20:02:27 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-09-25 20:02:27 +0200
commite5c13c74b45e08527dda1d1be1788cccd96b6dac (patch)
tree8a723643b5eba3a89a8ea752ffe427cbe64161f6 /tex/context/base/mkiv/lpdf-ano.lua
parentf7ee609d470a08a16e5cdaad14582fc8ed993c5e (diff)
downloadcontext-e5c13c74b45e08527dda1d1be1788cccd96b6dac.tar.gz
2017-09-25 19:25:00
Diffstat (limited to 'tex/context/base/mkiv/lpdf-ano.lua')
-rw-r--r--tex/context/base/mkiv/lpdf-ano.lua61
1 files changed, 26 insertions, 35 deletions
diff --git a/tex/context/base/mkiv/lpdf-ano.lua b/tex/context/base/mkiv/lpdf-ano.lua
index e89bda12b..ba8610933 100644
--- a/tex/context/base/mkiv/lpdf-ano.lua
+++ b/tex/context/base/mkiv/lpdf-ano.lua
@@ -28,9 +28,9 @@ local trace_bookmarks = false trackers.register("references.bookmarks",
local log_destinations = false directives.register("destinations.log", function(v) log_destinations = v end)
local untex_urls = true directives.register("references.untexurls", function(v) untex_urls = v end)
-local report_reference = logs.reporter("backend","references")
-local report_destination = logs.reporter("backend","destinations")
-local report_bookmark = logs.reporter("backend","bookmarks")
+local report_references = logs.reporter("backend","references")
+local report_destinations = logs.reporter("backend","destinations")
+local report_bookmarks = logs.reporter("backend","bookmarks")
local variables = interfaces.variables
local v_auto = variables.auto
@@ -160,7 +160,7 @@ local pagedestinations = setmetatableindex(function(t,k)
end
local v = rawget(t,k)
if v then
- -- report_reference("page number expected, got %s: %a",type(k),k)
+ -- report_references("page number expected, got %s: %a",type(k),k)
return v
end
local v = k > 0 and pdfarray {
@@ -197,7 +197,7 @@ local destinations = { } -- to be used soon
local function pdfregisterdestination(name,reference)
local d = destinations[name]
if d then
- report_destination("ignoring duplicate destination %a with reference %a",name,reference)
+ report_destinations("ignoring duplicate destination %a with reference %a",name,reference)
else
destinations[name] = reference
end
@@ -207,25 +207,16 @@ lpdf.registerdestination = pdfregisterdestination
local maxslice = 32 -- could be made configureable ... 64 is also ok
-luatex.registerstopactions(function()
+logs.registerfinalactions(function()
if log_destinations and next(destinations) then
- local logsnewline = logs.newline
- local log_destinations = logs.reporter("system","references")
- local log_destination = logs.reporter("destination")
- logs.pushtarget("logfile")
- logsnewline()
- log_destinations("start used destinations")
- logsnewline()
+ local report = logs.startfilelogging("references","used destinations")
local n = 0
for destination, pagenumber in table.sortedhash(destinations) do
- log_destination("% 4i : %-5s : %s",pagenumber,usedviews[destination] or defaultview,destination)
+ report("% 4i : %-5s : %s",pagenumber,usedviews[destination] or defaultview,destination)
n = n + 1
end
- logsnewline()
- log_destinations("stop used destinations")
- logsnewline()
- logs.poptarget()
- report_destination("%s destinations saved in log file",n)
+ logs.stopfilelogging()
+ report_destinations("%s destinations saved in log file",n)
end
end)
@@ -433,7 +424,7 @@ function nodeinjections.destination(width,height,depth,names,view)
-- todo check if begin end node / was comment
view = view and mapping[view] or defaultview
if trace_destinations then
- report_destination("width %p, height %p, depth %p, names %|t, view %a",width,height,depth,names,view)
+ report_destinations("width %p, height %p, depth %p, names %|t, view %a",width,height,depth,names,view)
end
local method = references.innermethod
local noview = view == defaultview
@@ -674,7 +665,7 @@ end
-- local function reference(width,height,depth,prerolled) -- keep this one
-- if prerolled then
-- if trace_references then
--- report_reference("width %p, height %p, depth %p, prerolled %a",width,height,depth,prerolled)
+-- report_references("width %p, height %p, depth %p, prerolled %a",width,height,depth,prerolled)
-- end
-- return pdfannotation_node(width,height,depth,prerolled)
-- end
@@ -728,7 +719,7 @@ end
function nodeinjections.reference(width,height,depth,prerolled)
if prerolled then
if trace_references then
- report_reference("link: width %p, height %p, depth %p, prerolled %a",width,height,depth,prerolled)
+ report_references("link: width %p, height %p, depth %p, prerolled %a",width,height,depth,prerolled)
end
return new_latelua(function() finishreference(width,height,depth,prerolled) end)
end
@@ -737,7 +728,7 @@ end
function nodeinjections.annotation(width,height,depth,prerolled,r)
if prerolled then
if trace_references then
- report_reference("special: width %p, height %p, depth %p, prerolled %a",width,height,depth,prerolled)
+ report_references("special: width %p, height %p, depth %p, prerolled %a",width,height,depth,prerolled)
end
return new_latelua(function() finishannotation(width,height,depth,prerolled,r or false) end)
end
@@ -822,7 +813,7 @@ runners["inner"] = function(var,actions)
end
runners["inner with arguments"] = function(var,actions)
- report_reference("todo: inner with arguments")
+ report_references("todo: inner with arguments")
return false
end
@@ -845,7 +836,7 @@ runners["special outer with operation"] = function(var,actions)
end
runners["special outer"] = function(var,actions)
- report_reference("todo: special outer")
+ report_references("todo: special outer")
return false
end
@@ -855,22 +846,22 @@ runners["special"] = function(var,actions)
end
runners["outer with inner with arguments"] = function(var,actions)
- report_reference("todo: outer with inner with arguments")
+ report_references("todo: outer with inner with arguments")
return false
end
runners["outer with special and operation and arguments"] = function(var,actions)
- report_reference("todo: outer with special and operation and arguments")
+ report_references("todo: outer with special and operation and arguments")
return false
end
runners["outer with special"] = function(var,actions)
- report_reference("todo: outer with special")
+ report_references("todo: outer with special")
return false
end
runners["outer with special and operation"] = function(var,actions)
- report_reference("todo: outer with special and operation")
+ report_references("todo: outer with special and operation")
return false
end
@@ -882,7 +873,7 @@ function specials.internal(var,actions) -- better resolve in strc-ref
local v = i and references.internals[i]
if not v then
-- error
- report_reference("no internal reference %a",i or "<unset>")
+ report_references("no internal reference %a",i or "<unset>")
else
flaginternals[i] = true
return pdflinkinternal(i,v.references.realpage)
@@ -1182,17 +1173,17 @@ local function build(levels,start,parent,method,nested)
if entry then
pdfflushobject(child,entry)
else
- report_bookmark("error 1")
+ report_bookmarks("error 1")
end
return i, n, first, last
else
- report_bookmark("confusing level change at level %a around %a",level,title)
+ report_bookmarks("confusing level change at level %a around %a",level,title)
startlevel = level
end
end
if level == startlevel then
if trace_bookmarks then
- report_bookmark("%3i %w%s %s",realpage,(level-1)*2,(opened and "+") or "-",title)
+ report_bookmarks("%3i %w%s %s",realpage,(level-1)*2,(opened and "+") or "-",title)
end
local prev = child
child = pdfreserveobject()
@@ -1231,7 +1222,7 @@ local function build(levels,start,parent,method,nested)
entry.Last = pdfreference(l)
end
else
- report_bookmark("error 2")
+ report_bookmarks("error 2")
end
else
-- missing intermediate level but ok
@@ -1244,7 +1235,7 @@ local function build(levels,start,parent,method,nested)
end
pdfflushobject(child,entry)
else
- report_bookmark("error 3")
+ report_bookmarks("error 3")
end
return i, n, first, last
end