mtx-context-ideas.tex /size: 1802 b    last modification: 2020-07-01 14:35
1
%D \module
2
%D [ file=mtx-context-ideas,
3
%D version=2009.03.21,
4
%D title=\CONTEXT\ Extra Trickry,
5
%D subtitle=Placeholder File,
6
%D author=Hans Hagen,
7
%D date=\currentdate,
8
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9
%C
10
%C This module is part of the \CONTEXT\ macro||package and is
11
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12
%C details.
13 14
% The hard coded goodies in texexec are now external. We also use this
15
% opportunity to explore mixed tex/lua user interfacing so you will see
16
% some old and new tricks here that might disappear or become extended.
17
%
18
% if users want to add their own ... go ahead but use a different
19
% namespace:
20
%
21
% mtx-context-third-somename.tex
22
% mtx-context-user-somename.tex
23 24
% \startluacode
25
% -- some day we might move the whole ui to lua
26
% context = context or { }
27
% function interfaces.tosetups(setups)
28
% if not setups then
29
% return ""
30
% elseif type(setups) == "table" then
31
% local t = { }
32
% for k,v in next, setups do
33
% t[k] = "{" .. v .. "}"
34
% end
35
% return table.concat(t,",")
36
% else
37
% return setups
38
% end
39
% end
40
% function context.setuplayout(category,setups)
41
% setups = setups or category
42
% tex.sprint(string.format("\\setuplayout[%s]",interfaces.tosetups(setups))
43
% end
44
% local topspace = document.arguments["topspace"] or 0
45
% if dimen(topspace) > dimen(0) then
46
% context.setuplayout { topspace = dimen(topspace) }
47
% end
48
% local backspace = document.arguments["backspace"] or 0
49
% if dimen(topspace) > dimen(0) then
50
% context.setuplayout { backspace = dimen(backspace) }
51
% end
52
% \stopluacode
53