summaryrefslogtreecommitdiff
path: root/tex/context/base/publ-imp-page.mkvi
blob: 3f8fb96be38fd5486774fef3112275e6f092ae7a (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
%D \module
%D   [       file=publ-imp-page,
%D        version=2014.11.05,
%D          title=\CONTEXT\ Publication Support,
%D       subtitle=Page numbers,
%D         author=Alan Braslau and 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.

\unprotect

\setupbtxlist
  [\c!pageleft={\space (p.\nobreakspace},
   \c!pageright={)},
   \c!pagesep={,\space},
   \c!lastpagesep={\space and\space},
   \c!finalpagesep={,\space and\space},
   \c!pageconnector=\endash]

\setupbtxrendering
  [\c!pagestate=\v!stop]

\definebtxlistvariant
  [\v!page]

\startsetups \s!btx:\s!list:\s!page:concat
    \ifcase\currentbtxoverflow
        \ifcase\currentbtxconcat
        \or % first
        \or % second
            \btxlistparameter\c!pagesep
        \or % second of two
            \btxlistparameter\c!lastpagesep
        \or % last
            \btxlistparameter\c!finalpagesep
        \fi
    \fi
\stopsetups

\startsetups \s!btx:\s!list:\s!page:normal
    \fastsetup{\s!btx:\s!list:\s!page:concat}
    \btxdoifelseinteractive {page} {
        \goto {
            \currentbtxfirstpage
        } [
            internal(\currentbtxfirstinternal)
        ]
        \ifx\currentbtxlastpage\empty \else
            \btxlistvariantparameter\c!pageconnector
            \goto {
                \currentbtxlastpage
            } [
                internal(\currentbtxlastinternal)
            ]
        \fi
    } {
        \currentbtxfirstpage
        \ifx\currentbtxlastpage\empty \else
            \btxlistvariantparameter\c!pageconnector
            \currentbtxlastpage
        \fi
    }
\stopsetups

\protect