-
Notifications
You must be signed in to change notification settings - Fork 30
/
mini.dlg
237 lines (183 loc) · 6.78 KB
/
mini.dlg
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
VERSION 12
POSITION . . 377 397
// ---------------------------------------------------------
// LISTS
// =========================================================
// Specify the Document Theme
LIST style_list
BEGIN
formal
simple
stata
END
// -----------------------------------------------------------------------------
// MAIN PAGE BUTTONS
// =============================================================================
OK ok1, label("OK")
CANCEL can1, label("Cancel")
SUBMIT sub1, label("Submit")
HELP hlp1, view("help markdoc") //"browse https://github.com/haghish/MarkDoc/wiki"
RESET res1
COPY copy1
// -----------------------------------------------------------------------------
// DYNAMIC DOCUMENT TAB
// =============================================================================
DIALOG main, label("mini") tabtitle("Dynamic Document")
BEGIN
// Browse SMCL or DO file
// -------------------------------------------------------------------------
TEXT txt_file 10 5 380 . , ///
label(`"Select a file (smcl, do, ado, or mata) with Markdown notation"')
FILE sourceFile 10 +20 355 . , error("Open file") label(Browse...) ///
/// filter("smcl file|*.smcl|do file|*.do|ado file|*.ado|mata file|*.mata") ///
tooltip("MarkDoc can produce a dynamic document by translating a SCML log-file or actively executing a Do-file. Select a SMCL or Do-file to be used as the source of the document. It can also extract the documentation from the source file to create Stata help files") ///
onchange("script mainReset")
// Specify Markup, Format, Style
// -------------------------------------------------------------------------
TEXT tx_markup 10 +30 200 . , label("Document format")
//TEXT tx_format +120 -20 200 . , label("Document format")
RADIO r1 @ +20 100 ., first label("md") onclickon("program test")
RADIO r2 +60 @ @ . , middle label("html") onclickon("program test")
RADIO r3 +60 @ @ ., middle label("docx") onclickon("program test")
RADIO r4 +60 @ @ ., middle label("pdf") onclickon("program test")
RADIO r5 +60 @ @ ., middle label("slide") onclickon("program test")
RADIO r6 +60 @ @ ., last label("sthlp") onclickon("program test") ///
tooltip(`"generates Stata help file from script files"')
// GROUPBOX
// -------------------------------------------------------------------------
GROUPBOX gb_opts 10 +35 355 272, label("Options")
// replace
CHECKBOX replace +10 +25 -20 . , option(replace) ///
label("Replace the existing document") default(1)
// master
CHECKBOX master @ +17 @ . , option(master) ///
onclickon("program test") default(1) ///
label("Create HTML template") ///
tooltip("MarkDoc provides this option to improve your HTML file")
// syntax highlighter
CHECKBOX statax @ +17 @ . , option(statax) label("Statax syntax highlighter") default(1)
// current date
CHECKBOX date @ +17 @ . , option(date) label("Add the current date")
// numbered
CHECKBOX numbered @ +17 @ . , option(numbered) label("Count Stata commands") tooltip("this option will number the Stata commands, 1,2,3,... ")
// append template
CHECKBOX helplayout @ +17 @ . , option(helplayout) label("Add Markdown help-file template to a ado or mata file") default(0) tooltip("Check this button to append the template help-file to your ado or mata file")
// title of the document
TEXT tx_title @ +30 50 ., label(Title)
EDIT title 80 @ 275 18 //EDIT ed_title +30 @ 340 .
// Author of the document
TEXT tx_author 20 +20 50 ., label(Author)
EDIT author 80 @ 275 18
// Affiliation
TEXT tx_affiliation 20 +20 55 ., label(Affiliation)
EDIT affiliation 80 @ 275 18
// Address
TEXT tx_address 20 +20 50 ., label(Address)
EDIT address 80 @ 275 18
// Summary
TEXT tx_summary 20 +20 60 ., label(Summary)
EDIT summary 80 @ 275 36
// LEFT COLUMN
// ---------------------------------------------------------------------
// layout
TEXT tx_style 250 135 100 . , label("Layout style")
COMBOBOX style @ +20 100 . , dropdownlist contents(style_list)
END
// -----------------------------------------------------------------------------
// TEST PROGRAMS
// =============================================================================
// test for the main tab
// -----------------------------------------------------------------------------
PROGRAM test
BEGIN
// activate the linesize
// ----------------------
*call main.linesize.disable
*if main.activate.iseq(0) {
* call main.linesize.disable
*}
// Statax defaults
// ----------------------------------------------------------
if main.r2.iseq(1) | main.r5.iseq(1) {
call main.statax.enable
}
if main.r1.iseq(1) | main.r3.iseq(1) | main.r4.iseq(1) | main.r6.iseq(1) {
call main.statax.disable
}
else {
call main.statax.enable
}
// master defaults
// ----------------------------------------------------------
if main.r1.iseq(1) | main.r3.iseq(1) | main.r4.iseq(1) | main.r5.iseq(1) | main.r6.iseq(1) {
call main.master.disable
}
if main.r2.iseq(1) {
call main.master.enable
}
else {
call main.master.disable
}
END
// -----------------------------------------------------------------------------
// FINAL MARKDOC COMMAND
// =============================================================================
PROGRAM command
BEGIN
// You must load a file!
if ! main.sourceFile {
require main.sourceFile
}
put "markdoc "
// Main Tab
// -------------------------------------------------------------------------
if main.sourceFile {
//call sub.sourceFile.setvalue ""
put `"""'
require main.sourceFile
put main.sourceFile
put `"" , mini "'
if main.r1 {
put "export(md) "
}
if main.r2 {
put "export(html) "
}
if main.r3 {
put "export(docx) "
}
if main.r4 {
put "export(pdf) "
}
if main.r5 {
put "export(slide) "
}
if main.r6 {
put "export(sthlp) "
}
option main.helplayout // temp layout
option main.replace // replace
option main.statax // Statax syntax highlighter
option main.date // table of date
option main.numbered // numbered
option main.master // master
if main.style {
put "style(" `"""' main.style `"""' ") "
}
if main.title {
put "title(" `"""' main.title `"""' ") "
}
if main.author {
put "author(" `"""' main.author `"""' ") "
}
if main.affiliation {
put "affiliation(" `"""' main.affiliation `"""' ") "
}
if main.address {
put "address(" `"""' main.address `"""' ") "
}
if main.summary {
put "summary(" `"""' main.summary `"""' ") "
}
}
END