%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