1
2
3
4
5
6
7
8
9
10
11
12
13
14\startluacode
15 local combination = document.arguments['combination'] or '2*2'
16 local nx, ny = string.match(combination,"^(%d+)%s*[%*x]%s*(%d+)$")
17 if not nx then
18 nx, ny = 2, 2
19 elseif not ny then
20 nx = tonumber(combination) or 2
21 ny = nx
22 else
23 nx = tonumber(nx) or 2
24 ny = tonumber(ny) or nx or 2
25 end
26 document.setargument("combination_nx",nx)
27 document.setargument("combination_ny",ny)
28\stopluacode
29
30\startluacode
31 local paperformat = document.arguments['paperformat'] or 'A4*A4'
32
33 local f, t = string.match(paperformat,"^(.-)%s*[%*xX]%s*(.-)$")
34 if not f then
35 f, t = "A4", "A4"
36 elseif not t then
37 t = f
38 end
39 document.setargument("paperformat_paper",f)
40 document.setargument("paperformat_print",t)
41\stopluacode
42
43\endinput
44 |