summaryrefslogtreecommitdiff
path: root/tex/context/base/x-res-08.tex
blob: 74f8a7068e5e3e52d7fefd56331302fe8854282d (plain)
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
%D \module
%D   [      file=x-fig-08,
%D        version=2002.06.27,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Resource Reporting,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D Experimental module!
%D
%D \starttyping
%D <rl:library>
%D   <rl:usage>
%D     <rl:type>figure</rl:type>
%D     <rl:state>found|missing</rl:state>
%D     <rl:name>filename</rl:name>
%D     <rl:suffix>filesuffix</rl:suffix>
%D     <rl:width>width in pt</rl:width>
%D     <rl:height>height in pt</rl:height>
%D     <rl:comment>text</rl:comment>
%D   </rl:usage>
%D </rl:library>
%D \stoptyping

\unprotect

\def\XMLrlprefix{rl:}

\newwrite\XMLrllog

\def\openXMLresourcelog
  {%\global\let\openXMLresourcelog\relax
   \immediate\openout\XMLrllog\jobname.rlg\relax
   \immediate\write\XMLrllog{\XMLbanner\empty}%
   \immediate\write\XMLrllog{\writtenXMLstart{\XMLrlprefix library}}}

\def\closeXMLresourcelog
  {%\global\let\closeXMLresourcelog\relax
   \immediate\write\XMLrllog{\writtenXMLend{\XMLrlprefix library}}%
   \immediate\closeout\XMLrllog}

\let\figurefilelabel   \empty
\let\figurefileoriginal\empty
\let\figurefilefile    \empty

\def\XMLfeedbackresource#1#2%
  {\convertcommand\currentresourcecomment\to\currentresourcecomment
   \immediate\write\XMLrllog
     {\writtenXMLelement{\XMLrlprefix usage}%
        {\writtenXMLelement{\XMLrlprefix type}{#2}%
         \writtenXMLelement{\XMLrlprefix state}{#1}%
         \ifx\figurefilelabel\empty
           \ifx\figurelabel\s!dummy
             % label equals filename
           \else
             \writtenXMLelement{\XMLrlprefix label}{\figurelabel}%
           \fi
           \writtenXMLelement{\XMLrlprefix file}{\figurefilename}%
           \ifx\figurefiletype\empty\else
             \writtenXMLelement{\XMLrlprefix suffix}{\figurefiletype}%
           \fi
         \else
           % \figurefilelabel is set in x-res-04 and since
           % we fetch from this base using the normal
           % \externalfigure macro, the label becomes the
           % name of the figurebase
           \writtenXMLelement{\XMLrlprefix base}{\figurefilename}%
           \writtenXMLelement{\XMLrlprefix label}{\figurefilelabel}%
\ifx\figurefilefile\empty\else
  \writtenXMLelement{\XMLrlprefix file}{\figurefilefile}%
\fi
\ifx\figurefileoriginal\empty\else
  \writtenXMLelement{\XMLrlprefix original}{\figurefileoriginal}%
\fi
         \fi
         \ifnum\figurefilepage>\zerocount
           \writtenXMLelement{\XMLrlprefix page}{\figurefilepage}%
         \fi
\ifx\currentresourcecomment\empty\else
  \writtenXMLelement{\XMLrlprefix comment}{\currentresourcecomment}%
\fi
         \writtenXMLelement{\XMLrlprefix width}{\figurewidth}%
         \writtenXMLelement{\XMLrlprefix height}{\figureheight}}}}

\def\XMLfeedbackexternalfigure
  {\doifmodeelse{*\v!figure}%
     {\XMLfeedbackresource{found}}%
     {\XMLfeedbackresource{missing}}%
   {figure}}

\appendtoks \openXMLresourcelog  \to \everystarttext
\appendtoks \closeXMLresourcelog \to \everystoptext

\let \feedbackexternalfigure \XMLfeedbackexternalfigure

\protect \endinput