1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
%D \module
%D [ file=s-references-show.mkiv,
%D version=2015.04.13,
%D title=\CONTEXT\ Style File,
%D subtitle=Reference Checking,
%D author=Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
\startmodule[references-show]
\unprotect
% \enabletrackers[nodes.references,nodes.destinations] % also shows areas
\enabletrackers[nodes.references.show,nodes.destinations.show]
\enablehiddenbackground % trick
\edef\hiddenbackgroundlist{\hiddenbackgroundlist,trace-references}
\defineoverlay
[trace-references]
[\directsetup{trace:references:onpage}]
\startluacode
local pagelist = structures.references.tracedpages
function commands.getreferencesonpage(n)
n = tonumber(n)
if n then
local pagedata = pagelist[n]
if pagedata then
context("%s references",#pagedata)
context.blank()
for i=1,#pagedata do
local details = pagedata[i]
local prefix = details[1]
local reference = details[2]
-- local internal = details[3]
-- context("%04i = %s : %s",internal,prefix == "" and "-" or prefix,reference)
context("%s : %s",prefix == "" and "-" or prefix,reference)
context.par()
end
else
context("no references")
end
else
context("no valid page")
end
end
\stopluacode
\definecolor
[trace:references:onpage]
[b=.5,a=1,t=.25]
\defineframed
[trace:references:onpage]
[\c!offset=2\exheight,
%\c!foregroundstyle=\infofont,
\c!frame=\v!off,
\c!background=\v!color,
\c!backgroundcolor=trace:references:onpage,
\c!align=\v!normal]
\startsetups trace:references:onpage
\vbox to \vsize \bgroup
\infofont
\vskip\dimexpr-\topspace-\headerheight+2\exheight\relax
\hbox to \hsize \bgroup
\doifoddpageelse\hss{\hskip\dimexpr-\cutspace+2\exheight\relax}%
\directlocalframed [
trace:references:onpage
] {
\ctxcommand{getreferencesonpage(\the\realpageno)}
}
\doifoddpageelse{\hskip\dimexpr-\cutspace+2\exheight\relax}\hss
\egroup
\vss
\egroup
\stopsetups
\protect
\continueifinputfile{s-references-show.mkiv}
\usemodule[art-01]
\setupinteraction
[state=start]
\setuppagenumbering
[alternative=doublesided]
\starttext
\title {Contents}
\placelist[chapter]
\setupreferenceprefix[zero]
\chapter[crap]{foo}
\setupreferenceprefix[one]
test \pagereference[whatever]
\dorecurse{5}{
\placefigure
[here][bar 1.#1]
{xx}{\framed{xx #1}}
}
\setupreferenceprefix[two]
\dorecurse{5}{
\placefigure
[here][bar 2.#1]
{xx}{\framed{xx #1}}
}
\in{checked}[bar 1.1]
\in{checked}[bar 2.1]
\stoptext
|