summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/x-res-02.tex
blob: a29f446f345da23fd698c2a5ab62b5cdb2cbefdb (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
%D \module
%D   [      file=x-res-02,
%D        version=2001.03.21,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Figure Base Inclusion (I),
%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 This module enables non||\ConTeXt\  users to access the
%D database. For this, you need to run
%D
%D \starttyping
%D texexec --pdf --use=fig-fake yourfile.xml
%D \stoptyping
%D
%D The resulting file, \type {yourfile.fig}, can be loaded
%D in the normal way. The figures can be accessed with:
%D
%D \starttyping
%D \getfigurefile{label}
%D \getfigurepage{label}
%D \stoptyping
%D
%D A a bonus, the following macro is defined:
%D
%D \starttyping
%D \includefigurefile width 10cm {label}
%D \stoptyping

\usemodule[res-00]

\doifnothing  {\jobfullname}    {\end}
\doiffileelse {\jobfullname} {} {\end}

\defineXMLenvironment [rl:figurelibrary] \StartLibrary \StopLibrary
\defineXMLenvironment [rl:library]       \StartLibrary \StopLibrary
\defineXMLenvironment [rl:figure]        \StartFigure  \StopFigure

\def\StartLibrary
  {\immediate\openout \scratchwrite=\jobfilename.fig
   \immediate\write\scratchwrite{\string\input\space x-fig-03.tex \string\relax}
   \immediate\write\scratchwrite{}}

\def\StopLibrary
  {\immediate\write\scratchwrite{}
   \immediate\write\scratchwrite{\string\endinput}
   \immediate\closeout\scratchwrite}

\def\StartFigure
  {\bgroup}

\def\StopFigure
  {\doglobal\increment\CurrentPage
   \immediate\write\scratchwrite
     {\string\setfiguredata\space
        {\XMLpop{rl:label}}
        {\jobfilename}
        {\CurrentPage}}
   \egroup}

\doglobal\newcounter\CurrentPage

\starttext

\processXMLfilegrouped{\jobfullname}

\stoptext