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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70\input mtx context common . tex
71
72\usemodule [ domotica settings ]
73
74\doifdocumentargument { compact } {
75 \setdocumentargument { topspace } { 5 mm }
76 \setdocumentargument { backspace } { 5 mm }
77 \setdocumentargument { bodyfont } { 8 pt }
78}
79
80\doifdocumentargument { verycompact } {
81 \setdocumentargument { topspace } { 5 mm }
82 \setdocumentargument { backspace } { 5 mm }
83 \setdocumentargument { bodyfont } { 7 pt }
84}
85
86\setupbodyfont
87 [ dejavu , 1 1 pt , \getdocumentargument { bodyfont } ]
88
89\setuplayout
90 [ header = 0 cm ,
91 footer = 1 . 5 cm ,
92 topspace = \getdocumentargumentdefault { topspace } { 1 . 5 cm } ,
93 backspace = \getdocumentargumentdefault { backspace } { 1 . 5 cm } ,
94 width = middle ,
95 height = middle ]
96
97\setuppapersize
98 [ \getdocumentargument { paperformat paper } ]
99 [ \getdocumentargument { paperformat print } ]
100
101\setuphead
102 [ section ]
103 [ style = bold ]
104
105\doifdocumentargument { openzwave } { \enablemode [ openzwave ] }
106\doifdocumentargument { hue } { \enablemode [ hue ] }
107
108\startmode [ openzwave ]
109
110 \starttext
111
112 \setuplist
113 [ chapter ]
114 [ style = bold ,
115 width = 4 em ]
116
117 \setuplist
118 [ section ]
119 [ width = 4 em ]
120
121 \setupheadertexts
122
123 \setupheadertexts
124 [ chapter ] [ pagenumber ]
125
126 \starttitle [ title = Zwave devices ]
127
128 \placelist [ chapter , section ]
129
130 \stoptitle
131
132 \startluacode
133 local arguments = document . arguments
134 local files = document . files
135 local pattern = arguments . pattern
136 local noffiles = # files
137
138 if type ( pattern ) = = " string " then
139
140 local pattern = file . addsuffix ( pattern , " xml " )
141
142 moduledata . zwave . show_settings ( pattern )
143
144 elseif noffiles > 0 then
145
146
147
148
149
150 for i = 1 , # files do
151 local filename = file . addsuffix ( files [ i ] , " xml " )
152 moduledata . zwave . show_settings ( filename )
153 end
154
155 else
156
157 context ( " no files given " )
158
159 end
160 \stopluacode
161
162 \stoptext
163
164\stopmode
165
166
167\startmode [ hue ]
168
169 \usemodule [ youless ]
170
171 \starttext
172
173 \setupheadertexts
174
175 \startluacode
176
177 local arguments = document . arguments
178 local files = document . files
179 local filename = files [ 1 ]
180 local pattern = arguments . pattern
181 local year = arguments . year
182 local month = arguments . month
183
184 local action = ( arguments . tasks and " task " )
185 or ( arguments . graphics and " graphics " )
186 or ( string . find ( filename , " tasks " ) and " tasks " )
187 or ( string . find ( filename , " electricity " ) and " graphics " )
188 or ( string . find ( filename , " pulse " ) and " graphics " )
189 or ( string . find ( filename , " gas " ) and " graphics " )
190
191 if not filename or filename = = " " then
192 logs . report ( " youless " , " provide filename " )
193 context ( " no files given " )
194 elseif action = = " tasks " then
195 context . starttitle { title = " Hue: " . . file . nameonly ( filename ) }
196 filename = file . addsuffix ( filename , " lua " )
197 if lfs . isfile ( filename ) then
198 moduledata . hue . show_state ( filename )
199 else
200 context ( " unknown file %a " , filename )
201 end
202 context . stoptitle ( )
203 elseif action = = " graphics " then
204 moduledata . youless . graphics { year = year , month = month , filename = filename }
205 else
206 logs . report ( " youless " , " provide --status or --graphics " )
207 context ( " no action given " )
208 end
209
210 \stopluacode
211
212 \stoptext
213
214\stopmode
215
216
217 |