1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus{loading}{ConTeXt Page Macros Postponing}
15
16\registerctxluafile{pagepst}{}
17
18\unprotect
19
20
21
22\newevery\everytopofpage\relax
23
24\appendtoks
25 \the\everytopofpage
26\to \everystarttext
27
28\appendtoks
29 \global\everytopofpage\emptytoks
30\to \everystoptext
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54\newcount \c_page_postponed_blocks_next_page
55\newconditional\c_page_postponed_busy
56
57\unexpanded\setvalue{\e!start\v!postponing}
58 {\bgroup
59 \obeylines
60 \doifelsenextoptional{\egroup\page_postponed_blocks_start}{\egroup\page_postponed_blocks_start[0]}}
61
62\unexpanded\setvalue{\e!stop\v!postponing}
63 {\clf_registerpostponedblock{\currentpostponedpage}\relax}
64
65\def\page_postponed_blocks_start[#1]
66 {\edef\currentpostponedpage{#1}
67 \grabbufferdatadirect{postponedblock}{\e!start\v!postponing}{\e!stop\v!postponing}}
68
69
70
71
72\c_page_postponed_mode\plusone
73
74\unexpanded\def\page_postponed_blocks_flush_indeed
75 {\begingroup
76 \setsystemmode\v!postponing
77 \settrue\c_page_postponed_busy
78 \ifnum\c_page_postponed_mode=\plusone
79 \savepagecontent
80 \fi
81 \pagetotal\zeropoint
82 \the\everytopofpage\relax
83
84 \page_floats_flush_page_floats
85 \setnormalcatcodes
86 \uncatcodespacetokens
87 \restoreglobalbodyfont
88 \clf_flushpostponedblocks
89
90 \relax
91 \page_otr_command_flush_floats
92 \ifnum\c_page_postponed_mode=\plusone
93 \flushpagecontent
94 \fi
95 \endgroup}
96
97\unexpanded\def\page_postponed_blocks_flush
98 {\ifconditional\c_page_postponed_busy
99
100 \else\ifnum\c_page_postponed_blocks_next_page=\zerocount
101
102 \else\ifnum\c_page_postponed_blocks_next_page<\zerocount
103
104 \page_postponed_blocks_flush_indeed
105 \else\ifnum\c_page_postponed_blocks_next_page>\realpageno
106
107 \else
108
109 \page_postponed_blocks_flush_indeed
110 \fi\fi\fi\fi}
111
112\protect \endinput
113 |