bare-script 3.2.3 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,344 @@
1
+ # Licensed under the MIT License
2
+ # https://github.com/craigahobbs/markdown-up/blob/main/LICENSE
3
+
4
+
5
+ # Include sentinel
6
+ if systemGlobalGet('argsSentinel'):
7
+ return
8
+ endif
9
+ argsSentinel = true
10
+
11
+
12
+ # The URL arguments model
13
+ argsTypes = schemaParse( \
14
+ 'group "args.bare"', \
15
+ '', \
16
+ '', \
17
+ '# An argument model list', \
18
+ 'typedef ArgsArgument[len > 0] ArgsArguments', \
19
+ '', \
20
+ '', \
21
+ '# An argument model', \
22
+ 'struct ArgsArgument', \
23
+ '', \
24
+ ' # The argument name', \
25
+ ' string(len > 0) name', \
26
+ '', \
27
+ ' # The argument type', \
28
+ ' optional ArgsType type', \
29
+ '', \
30
+ " # The argument's global variable name", \
31
+ ' optional string(len > 0) global', \
32
+ '', \
33
+ ' # If true, the argument is explicit.', \
34
+ ' # An explicit argument is only included in the URL if it is in the arguments object.', \
35
+ ' optional bool explicit', \
36
+ '', \
37
+ ' # The default argument value', \
38
+ ' optional object default', \
39
+ '', \
40
+ ' # The argument description', \
41
+ ' optional string(len > 0) description', \
42
+ '', \
43
+ '', \
44
+ '# An argument value type', \
45
+ 'enum ArgsType', \
46
+ ' bool', \
47
+ ' date', \
48
+ ' datetime', \
49
+ ' float', \
50
+ ' int', \
51
+ ' string' \
52
+ )
53
+
54
+
55
+ # $function: argsValidate
56
+ # $group: args.bare
57
+ # $doc: Validate an arguments model
58
+ # $arg arguments: The [arguments model](includeModel.html#var.vName='ArgsArguments')
59
+ # $return: The validated [arguments model](includeModel.html#var.vName='ArgsArguments') or null if validation fails
60
+ function argsValidate(arguments):
61
+ validatedArguments = schemaValidate(argsTypes, 'ArgsArguments', arguments)
62
+
63
+ # Check for duplicate arguments
64
+ if validatedArguments != null:
65
+ argNames = objectNew()
66
+ for argument in arguments:
67
+ name = objectGet(argument, 'name')
68
+ if objectHas(argNames, name):
69
+ validatedArguments = null
70
+ systemLogDebug('MarkdownUp - args.bare: Duplicate argument "' + name + '"')
71
+ else:
72
+ objectSet(argNames, name, true)
73
+ endif
74
+ endfor
75
+ endif
76
+
77
+ return validatedArguments
78
+ endfunction
79
+
80
+
81
+ # $function: argsParse
82
+ # $group: args.bare
83
+ # $doc: Parse an [arguments model](includeModel.html#var.vName='ArgsArguments').
84
+ # $doc: Argument globals are validated and added to the arguments object using the argument name.
85
+ # $arg arguments: The [arguments model](includeModel.html#var.vName='ArgsArguments')
86
+ # $return: The arguments object
87
+ function argsParse(arguments):
88
+ # Create the arguments object
89
+ args = objectNew()
90
+ for argument in arguments:
91
+ # Get the argument value
92
+ global = argsGlobalName(argument)
93
+ value = argsValidateValue(systemGlobalGet(global), objectGet(argument, 'type'), global)
94
+
95
+ # Apply the default argument value, if any
96
+ if value == null:
97
+ value = objectGet(argument, 'default')
98
+ endif
99
+
100
+ # Set the argument value, if any
101
+ if value != null:
102
+ objectSet(args, objectGet(argument, 'name'), value)
103
+ endif
104
+ endfor
105
+
106
+ return args
107
+ endfunction
108
+
109
+
110
+ # $function: argsURL
111
+ # $group: args.bare
112
+ # $doc: Create a MarkdownUp application URL
113
+ # $arg arguments: The [arguments model](includeModel.html#var.vName='ArgsArguments')
114
+ # $arg args: Optional (default is null). The arguments object. Null argument values are excluded from the URL.
115
+ # $arg explicit: Optional (default is false). If true, arguments are only included in the URL if they are in the arguments object.
116
+ # $arg headerText: Optional (default is null). If non-null, the URL's header text.
117
+ # $arg headerText: The special "_top" header ID scrolls to the top of the page.
118
+ # $arg url: Optional (default is null). If non-null, the MarkdownUp URL hash parameter.
119
+ # $return: The MarkdownUp application URL
120
+ function argsURL(arguments, args, explicit, headerText, url):
121
+ # Get the URL variables
122
+ urlVars = arrayNew()
123
+ argNames = objectNew()
124
+ for argument in arguments:
125
+ name = objectGet(argument, 'name')
126
+ type = objectGet(argument, 'type')
127
+ global = argsGlobalName(argument)
128
+ default = objectGet(argument, 'default')
129
+
130
+ # Add the argument name (for unknown argument check below)
131
+ objectSet(argNames, name, null)
132
+
133
+ # Add the URL variable, if any
134
+ value = null
135
+ if args != null && objectHas(args, name):
136
+ value = argsValidateValue(objectGet(args, name), type, global)
137
+ elif !(explicit || objectGet(argument, 'explicit')):
138
+ value = argsValidateValue(systemGlobalGet(global), type, global, false)
139
+ endif
140
+
141
+ # Add the URL variable
142
+ if value != null && (default == null || !argsValuesEqual(value, default, type)):
143
+ arrayPush(urlVars, 'var.' + global + '=' + urlEncodeComponent(argsFormatValue(value, type)))
144
+ endif
145
+ endfor
146
+
147
+ # Sort the URL variables for general consistency
148
+ arraySort(urlVars)
149
+
150
+ # Check for unknown arguments
151
+ if args != null:
152
+ for name in objectKeys(args):
153
+ if !objectHas(argNames, name):
154
+ systemLogDebug('MarkdownUp - args.bare: Unknown argument "' + name + '"')
155
+ endif
156
+ endfor
157
+ endif
158
+
159
+ # Create the URL
160
+ return '#' + if(url != null, 'url=' + urlEncodeComponent(url) + '&', '') + \
161
+ if(arrayLength(urlVars), arrayJoin(urlVars, '&'), 'var=') + \
162
+ if(headerText != null, '&' + if(headerText == argsTopHeaderId, argsTopHeaderId, markdownHeaderId(headerText)), '')
163
+ endfunction
164
+
165
+
166
+ # The special "top" header ID
167
+ argsTopHeaderId = '_top'
168
+
169
+
170
+ # $function: argsLink
171
+ # $group: args.bare
172
+ # $doc: Create a Markdown link text to a MarkdownUp application URL
173
+ # $arg arguments: The [arguments model](includeModel.html#var.vName='ArgsArguments')
174
+ # $arg text: The link text
175
+ # $arg args: Optional (default is null). The arguments object.
176
+ # $arg explicit: Optional (default is false). If true, arguments are only included in the URL if they are in the arguments object.
177
+ # $arg headerText: Optional (default is null). If non-null, the URL's header text.
178
+ # $arg headerText: The special "_top" header ID scrolls to the top of the page.
179
+ # $arg url: Optional (default is null). If non-null, the MarkdownUp URL hash parameter.
180
+ # $return: The Markdown link text
181
+ function argsLink(arguments, text, args, explicit, headerText, url):
182
+ return '[' + markdownEscape(text) + '](' + argsURL(arguments, args, explicit, headerText, url) + ')'
183
+ endfunction
184
+
185
+
186
+ # $function: argsHelp
187
+ # $group: args.bare
188
+ # $doc: Output the [arguments model's](includeModel.html#var.vName='ArgsArguments') help
189
+ # $arg arguments: The [arguments model](includeModel.html#var.vName='ArgsArguments')
190
+ function argsHelp(arguments):
191
+ # Create the help data
192
+ helpData = arrayNew()
193
+ anyDefault = false
194
+ anyExplicit = false
195
+ anyDescription = false
196
+ for argument in arguments:
197
+ type = objectGet(argument, 'type', 'string')
198
+ default = objectGet(argument, 'default')
199
+ explicit = objectGet(argument, 'explicit')
200
+ description = objectGet(argument, 'description')
201
+
202
+ # Add the help data row
203
+ arrayPush(helpData, objectNew( \
204
+ 'Variable', argsGlobalName(argument), \
205
+ 'Type', type, \
206
+ 'Default', argsFormatValue(default, type), \
207
+ 'Explicit', if(explicit, 'Yes', ''), \
208
+ 'Description', if(description != null, description, '') \
209
+ ))
210
+
211
+ # Update the "any" field bools
212
+ anyDefault = anyDefault || (default != null)
213
+ anyExplicit = anyExplicit || explicit
214
+ anyDescription = anyDescription || (description != null)
215
+ endfor
216
+
217
+ # Render the help table
218
+ helpFields = arrayNew('Variable', 'Type')
219
+ if anyDefault:
220
+ arrayPush(helpFields, 'Default')
221
+ endif
222
+ if anyExplicit:
223
+ arrayPush(helpFields, 'Explicit')
224
+ endif
225
+ if anyDescription:
226
+ arrayPush(helpFields, 'Description')
227
+ endif
228
+ dataTable(helpData, objectNew('fields', helpFields))
229
+ endfunction
230
+
231
+
232
+ # Helper function to compute an argument's global name
233
+ function argsGlobalName(argument):
234
+ global = objectGet(argument, 'global')
235
+ if global == null:
236
+ name = objectGet(argument, 'name')
237
+ global = 'v' + stringUpper(stringSlice(name, 0, 1)) + stringSlice(name, 1)
238
+ endif
239
+ return global
240
+ endfunction
241
+
242
+
243
+ # Helper function to format an argument value
244
+ function argsFormatValue(value, type):
245
+ # No value?
246
+ if value == null:
247
+ return ''
248
+ endif
249
+
250
+ # Return the formatted value
251
+ if type == 'bool':
252
+ return if(value, 'true', 'false')
253
+ elif type == 'date':
254
+ return "'" + datetimeISOFormat(value, true) + "'"
255
+ elif type == 'datetime':
256
+ return "'" + datetimeISOFormat(value) + "'"
257
+ elif type == 'float':
258
+ return stringNew(value)
259
+ elif type == 'int':
260
+ return stringNew(value)
261
+ endif
262
+
263
+ # type == 'string'
264
+ return "'" + value + "'"
265
+ endfunction
266
+
267
+
268
+ # Helper function to validate an argument value's type
269
+ function argsValidateValue(value, type, global, warn):
270
+ # No value?
271
+ if value == null:
272
+ return null
273
+ endif
274
+
275
+ # Validate the value's type
276
+ valueType = systemType(value)
277
+ if type == 'bool':
278
+ if valueType == 'number' && (value == 0 || value == 1):
279
+ value = !!value
280
+ elif valueType != 'boolean':
281
+ if warn != false:
282
+ systemLogDebug('MarkdownUp - args.bare: Invalid value ' + jsonStringify(value) + ' for URL argument "' + global + '"')
283
+ endif
284
+ value = null
285
+ endif
286
+ elif type == 'date':
287
+ valueOrig = value
288
+ if valueType == 'string':
289
+ value = datetimeISOParse(value)
290
+ valueType = systemType(value)
291
+ endif
292
+ if valueType != 'datetime' || datetimeHour(value) != 0 || datetimeMinute(value) != 0 || datetimeSecond(value) != 0:
293
+ if warn != false:
294
+ systemLogDebug('MarkdownUp - args.bare: Invalid value ' + jsonStringify(valueOrig) + ' for URL argument "' + global + '"')
295
+ endif
296
+ value = null
297
+ endif
298
+ elif type == 'datetime':
299
+ valueOrig = value
300
+ if valueType == 'string':
301
+ value = datetimeISOParse(value)
302
+ valueType = systemType(value)
303
+ endif
304
+ if valueType != 'datetime':
305
+ if warn != false:
306
+ systemLogDebug('MarkdownUp - args.bare: Invalid value ' + jsonStringify(valueOrig) + ' for URL argument "' + global + '"')
307
+ endif
308
+ value = null
309
+ endif
310
+ elif type == 'float':
311
+ if valueType != 'number':
312
+ if warn != false:
313
+ systemLogDebug('MarkdownUp - args.bare: Invalid value ' + jsonStringify(value) + ' for URL argument "' + global + '"')
314
+ endif
315
+ value = null
316
+ endif
317
+ elif type == 'int':
318
+ if valueType != 'number' || value != mathFloor(value):
319
+ if warn != false:
320
+ systemLogDebug('MarkdownUp - args.bare: Invalid value ' + jsonStringify(value) + ' for URL argument "' + global + '"')
321
+ endif
322
+ value = null
323
+ endif
324
+ else:
325
+ # type == 'string'
326
+ if valueType != 'string':
327
+ if warn != false:
328
+ systemLogDebug('MarkdownUp - args.bare: Invalid value ' + jsonStringify(value) + ' for URL argument "' + global + '"')
329
+ endif
330
+ value = null
331
+ endif
332
+ endif
333
+
334
+ return value
335
+ endfunction
336
+
337
+
338
+ # Helper function to determine if two values are equal
339
+ function argsValuesEqual(value, valueOther, type):
340
+ if type == 'date' || type == 'datetime':
341
+ return (value - valueOther) == 0
342
+ endif
343
+ return value == valueOther
344
+ endfunction
@@ -6,339 +6,7 @@
6
6
  if systemGlobalGet('argsSentinel'):
7
7
  return
8
8
  endif
9
- argsSentinel = true
10
9
 
11
10
 
12
- # The URL arguments model
13
- argsTypes = schemaParse( \
14
- 'group "args.mds"', \
15
- '', \
16
- '', \
17
- '# An argument model list', \
18
- 'typedef ArgsArgument[len > 0] ArgsArguments', \
19
- '', \
20
- '', \
21
- '# An argument model', \
22
- 'struct ArgsArgument', \
23
- '', \
24
- ' # The argument name', \
25
- ' string(len > 0) name', \
26
- '', \
27
- ' # The argument type', \
28
- ' optional ArgsType type', \
29
- '', \
30
- " # The argument's global variable name", \
31
- ' optional string(len > 0) global', \
32
- '', \
33
- ' # If true, the argument is explicit.', \
34
- ' # An explicit argument is only included in the URL if it is in the arguments object.', \
35
- ' optional bool explicit', \
36
- '', \
37
- ' # The default argument value', \
38
- ' optional object default', \
39
- '', \
40
- ' # The argument description', \
41
- ' optional string(len > 0) description', \
42
- '', \
43
- '', \
44
- '# An argument value type', \
45
- 'enum ArgsType', \
46
- ' bool', \
47
- ' date', \
48
- ' datetime', \
49
- ' float', \
50
- ' int', \
51
- ' string' \
52
- )
53
-
54
-
55
- # $function: argsValidate
56
- # $group: args.mds
57
- # $doc: Validate an arguments model
58
- # $arg arguments: The [arguments model](includeModel.html#var.vName='ArgsArguments')
59
- # $return: The validated [arguments model](includeModel.html#var.vName='ArgsArguments') or null if validation fails
60
- function argsValidate(arguments):
61
- validatedArguments = schemaValidate(argsTypes, 'ArgsArguments', arguments)
62
-
63
- # Check for duplicate arguments
64
- if validatedArguments != null:
65
- argNames = objectNew()
66
- for argument in arguments:
67
- name = objectGet(argument, 'name')
68
- if objectHas(argNames, name):
69
- validatedArguments = null
70
- systemLogDebug('MarkdownUp - args.mds: Duplicate argument "' + name + '"')
71
- else:
72
- objectSet(argNames, name, true)
73
- endif
74
- endfor
75
- endif
76
-
77
- return validatedArguments
78
- endfunction
79
-
80
-
81
- # $function: argsParse
82
- # $group: args.mds
83
- # $doc: Parse an [arguments model](includeModel.html#var.vName='ArgsArguments').
84
- # $doc: Argument globals are validated and added to the arguments object using the argument name.
85
- # $arg arguments: The [arguments model](includeModel.html#var.vName='ArgsArguments')
86
- # $return: The arguments object
87
- function argsParse(arguments):
88
- # Create the arguments object
89
- args = objectNew()
90
- for argument in arguments:
91
- # Get the argument value
92
- global = argsGlobalName(argument)
93
- value = argsValidateValue(systemGlobalGet(global), objectGet(argument, 'type'), global)
94
-
95
- # Apply the default argument value, if any
96
- if value == null:
97
- value = objectGet(argument, 'default')
98
- endif
99
-
100
- # Set the argument value, if any
101
- if value != null:
102
- objectSet(args, objectGet(argument, 'name'), value)
103
- endif
104
- endfor
105
-
106
- return args
107
- endfunction
108
-
109
-
110
- # $function: argsURL
111
- # $group: args.mds
112
- # $doc: Create a MarkdownUp application URL
113
- # $arg arguments: The [arguments model](includeModel.html#var.vName='ArgsArguments')
114
- # $arg args: Optional (default is null). The arguments object. Null argument values are excluded from the URL.
115
- # $arg explicit: Optional (default is false). If true, arguments are only included in the URL if they are in the arguments object.
116
- # $arg headerText: Optional (default is null). If non-null, the URL's header text.
117
- # $arg headerText: The special "_top" header ID scrolls to the top of the page.
118
- # $arg url: Optional (default is null). If non-null, the MarkdownUp URL hash parameter.
119
- # $return: The MarkdownUp application URL
120
- function argsURL(arguments, args, explicit, headerText, url):
121
- # Get the URL variables
122
- urlVars = arrayNew()
123
- argNames = objectNew()
124
- for argument in arguments:
125
- name = objectGet(argument, 'name')
126
- type = objectGet(argument, 'type')
127
- global = argsGlobalName(argument)
128
- default = objectGet(argument, 'default')
129
-
130
- # Add the argument name (for unknown argument check below)
131
- objectSet(argNames, name, null)
132
-
133
- # Add the URL variable, if any
134
- value = null
135
- if args != null && objectHas(args, name):
136
- value = argsValidateValue(objectGet(args, name), type, global)
137
- elif !(explicit || objectGet(argument, 'explicit')):
138
- value = argsValidateValue(systemGlobalGet(global), type, global, false)
139
- endif
140
-
141
- # Add the URL variable
142
- if value != null && (default == null || !argsValuesEqual(value, default, type)):
143
- arrayPush(urlVars, 'var.' + global + '=' + urlEncodeComponent(argsFormatValue(value, type)))
144
- endif
145
- endfor
146
-
147
- # Sort the URL variables for general consistency
148
- arraySort(urlVars)
149
-
150
- # Check for unknown arguments
151
- if args != null:
152
- for name in objectKeys(args):
153
- if !objectHas(argNames, name):
154
- systemLogDebug('MarkdownUp - args.mds: Unknown argument "' + name + '"')
155
- endif
156
- endfor
157
- endif
158
-
159
- # Create the URL
160
- return '#' + if(url != null, 'url=' + urlEncodeComponent(url) + '&', '') + \
161
- if(arrayLength(urlVars), arrayJoin(urlVars, '&'), 'var=') + \
162
- if(headerText != null, '&' + if(headerText == argsTopHeaderId, argsTopHeaderId, markdownHeaderId(headerText)), '')
163
- endfunction
164
-
165
-
166
- # The special "top" header ID
167
- argsTopHeaderId = '_top'
168
-
169
-
170
- # $function: argsLink
171
- # $group: args.mds
172
- # $doc: Create a Markdown link text to a MarkdownUp application URL
173
- # $arg arguments: The [arguments model](includeModel.html#var.vName='ArgsArguments')
174
- # $arg text: The link text
175
- # $arg args: Optional (default is null). The arguments object.
176
- # $arg explicit: Optional (default is false). If true, arguments are only included in the URL if they are in the arguments object.
177
- # $arg headerText: Optional (default is null). If non-null, the URL's header text.
178
- # $arg headerText: The special "_top" header ID scrolls to the top of the page.
179
- # $arg url: Optional (default is null). If non-null, the MarkdownUp URL hash parameter.
180
- # $return: The Markdown link text
181
- function argsLink(arguments, text, args, explicit, headerText, url):
182
- return '[' + markdownEscape(text) + '](' + argsURL(arguments, args, explicit, headerText, url) + ')'
183
- endfunction
184
-
185
-
186
- # $function: argsHelp
187
- # $group: args.mds
188
- # $doc: Output the [arguments model's](includeModel.html#var.vName='ArgsArguments') help
189
- # $arg arguments: The [arguments model](includeModel.html#var.vName='ArgsArguments')
190
- function argsHelp(arguments):
191
- # Create the help data
192
- helpData = arrayNew()
193
- anyDefault = false
194
- anyExplicit = false
195
- anyDescription = false
196
- for argument in arguments:
197
- type = objectGet(argument, 'type', 'string')
198
- default = objectGet(argument, 'default')
199
- explicit = objectGet(argument, 'explicit')
200
- description = objectGet(argument, 'description')
201
-
202
- # Add the help data row
203
- arrayPush(helpData, objectNew( \
204
- 'Variable', argsGlobalName(argument), \
205
- 'Type', type, \
206
- 'Default', argsFormatValue(default, type), \
207
- 'Explicit', if(explicit, 'Yes', ''), \
208
- 'Description', if(description != null, description, '') \
209
- ))
210
-
211
- # Update the "any" field bools
212
- anyDefault = anyDefault || (default != null)
213
- anyExplicit = anyExplicit || explicit
214
- anyDescription = anyDescription || (description != null)
215
- endfor
216
-
217
- # Render the help table
218
- helpFields = arrayNew('Variable', 'Type')
219
- if anyDefault:
220
- arrayPush(helpFields, 'Default')
221
- endif
222
- if anyExplicit:
223
- arrayPush(helpFields, 'Explicit')
224
- endif
225
- if anyDescription:
226
- arrayPush(helpFields, 'Description')
227
- endif
228
- dataTable(helpData, objectNew('fields', helpFields))
229
- endfunction
230
-
231
-
232
- # Helper function to compute an argument's global name
233
- function argsGlobalName(argument):
234
- global = objectGet(argument, 'global')
235
- if global == null:
236
- name = objectGet(argument, 'name')
237
- global = 'v' + stringUpper(stringSlice(name, 0, 1)) + stringSlice(name, 1)
238
- endif
239
- return global
240
- endfunction
241
-
242
-
243
- # Helper function to format an argument value
244
- function argsFormatValue(value, type):
245
- # No value?
246
- if value == null:
247
- return ''
248
- endif
249
-
250
- # Return the formatted value
251
- if type == 'bool':
252
- return if(value, 'true', 'false')
253
- elif type == 'date':
254
- return "'" + datetimeISOFormat(value, true) + "'"
255
- elif type == 'datetime':
256
- return "'" + datetimeISOFormat(value) + "'"
257
- elif type == 'float':
258
- return stringNew(value)
259
- elif type == 'int':
260
- return stringNew(value)
261
- endif
262
-
263
- # type == 'string'
264
- return "'" + value + "'"
265
- endfunction
266
-
267
-
268
- # Helper function to validate an argument value's type
269
- function argsValidateValue(value, type, global, warn):
270
- # No value?
271
- if value == null:
272
- return null
273
- endif
274
-
275
- # Validate the value's type
276
- valueType = systemType(value)
277
- if type == 'bool':
278
- if valueType == 'number' && (value == 0 || value == 1):
279
- value = !!value
280
- elif valueType != 'boolean':
281
- if warn != false:
282
- systemLogDebug('MarkdownUp - args.mds: Invalid value ' + jsonStringify(value) + ' for URL argument "' + global + '"')
283
- endif
284
- value = null
285
- endif
286
- elif type == 'date':
287
- valueOrig = value
288
- if valueType == 'string':
289
- value = datetimeISOParse(value)
290
- valueType = systemType(value)
291
- endif
292
- if valueType != 'datetime' || datetimeHour(value) != 0 || datetimeMinute(value) != 0 || datetimeSecond(value) != 0:
293
- if warn != false:
294
- systemLogDebug('MarkdownUp - args.mds: Invalid value ' + jsonStringify(valueOrig) + ' for URL argument "' + global + '"')
295
- endif
296
- value = null
297
- endif
298
- elif type == 'datetime':
299
- valueOrig = value
300
- if valueType == 'string':
301
- value = datetimeISOParse(value)
302
- valueType = systemType(value)
303
- endif
304
- if valueType != 'datetime':
305
- if warn != false:
306
- systemLogDebug('MarkdownUp - args.mds: Invalid value ' + jsonStringify(valueOrig) + ' for URL argument "' + global + '"')
307
- endif
308
- value = null
309
- endif
310
- elif type == 'float':
311
- if valueType != 'number':
312
- if warn != false:
313
- systemLogDebug('MarkdownUp - args.mds: Invalid value ' + jsonStringify(value) + ' for URL argument "' + global + '"')
314
- endif
315
- value = null
316
- endif
317
- elif type == 'int':
318
- if valueType != 'number' || value != mathFloor(value):
319
- if warn != false:
320
- systemLogDebug('MarkdownUp - args.mds: Invalid value ' + jsonStringify(value) + ' for URL argument "' + global + '"')
321
- endif
322
- value = null
323
- endif
324
- else:
325
- # type == 'string'
326
- if valueType != 'string':
327
- if warn != false:
328
- systemLogDebug('MarkdownUp - args.mds: Invalid value ' + jsonStringify(value) + ' for URL argument "' + global + '"')
329
- endif
330
- value = null
331
- endif
332
- endif
333
-
334
- return value
335
- endfunction
336
-
337
-
338
- # Helper function to determine if two values are equal
339
- function argsValuesEqual(value, valueOther, type):
340
- if type == 'date' || type == 'datetime':
341
- return (value - valueOther) == 0
342
- endif
343
- return value == valueOther
344
- endfunction
11
+ systemLog('MarkdownUp - args.mds: args.mds is now args.bare - please update before 2025-06-01')
12
+ include 'args.bare'