blob: d10eefc76843cc68b614fd565ebfedf8a8b48f96 (
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
|
%D \module
%D [ file=mtx-context-ideas,
%D version=2009.03.21,
%D title=\CONTEXT\ Extra Trickry,
%D subtitle=Placeholder File,
%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.
% The hard coded goodies in texexec are now external. We also use this
% opportunity to explore mixed tex/lua user interfacing so you will see
% some old and new tricks here that might disappear or become extended.
%
% if users want to add their own ... go ahead but use a different
% namespace:
%
% mtx-context-third-somename.tex
% mtx-context-user-somename.tex
% \startluacode
% -- some day we might move the whole ui to lua
% context = context or { }
% function interfaces.tosetups(setups)
% if not setups then
% return ""
% elseif type(setups) == "table" then
% local t = { }
% for k,v in next, setups do
% t[k] = "{" .. v .. "}"
% end
% return table.concat(t,",")
% else
% return setups
% end
% end
% function context.setuplayout(category,setups)
% setups = setups or category
% tex.sprint(string.format("\\setuplayout[%s]",interfaces.tosetups(setups))
% end
% local topspace = document.arguments["topspace"] or 0
% if dimen(topspace) > dimen(0) then
% context.setuplayout { topspace = dimen(topspace) }
% end
% local backspace = document.arguments["backspace"] or 0
% if dimen(topspace) > dimen(0) then
% context.setuplayout { backspace = dimen(backspace) }
% end
% \stopluacode
|