bare-script 3.8.1 → 3.8.2
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.
- package/README.md +4 -9
- package/lib/include/args.bare +10 -10
- package/lib/include/baredoc.bare +313 -0
- package/lib/include/dataLineChart.bare +90 -0
- package/lib/include/dataTable.bare +3 -3
- package/lib/include/diff.bare +3 -3
- package/lib/include/forms.bare +1 -1
- package/lib/include/markdownUp.bare +310 -1
- package/lib/include/pager.bare +6 -6
- package/lib/include/unittest.bare +1 -1
- package/lib/include/unittestMock.bare +1 -1
- package/lib/library.js +113 -113
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -93,7 +93,7 @@ console.log(await executeScriptAsync(script, {'fetchFn': fetch}));
|
|
|
93
93
|
This outputs:
|
|
94
94
|
|
|
95
95
|
```
|
|
96
|
-
The BareScript Library has
|
|
96
|
+
The BareScript Library has 186 functions
|
|
97
97
|
```
|
|
98
98
|
|
|
99
99
|
|
|
@@ -154,14 +154,9 @@ write the body to the path.
|
|
|
154
154
|
|
|
155
155
|
## MarkdownUp, a Markdown Viewer with BareScript
|
|
156
156
|
|
|
157
|
-
[MarkdownUp](https://craigahobbs.github.io/markdown-up/)
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
extends its
|
|
161
|
-
[standard library](https://craigahobbs.github.io/markdown-up/library/)
|
|
162
|
-
with functions for dynamically rendering Markdown text, drawing SVG images, etc.
|
|
163
|
-
|
|
164
|
-
For example:
|
|
157
|
+
[MarkdownUp](https://craigahobbs.github.io/markdown-up/) is a Markdown Viewer that executes
|
|
158
|
+
BareScript embedded within Markdown documents. The MarkdownUp runtime contains functions for
|
|
159
|
+
dynamically rendering Markdown text, drawing SVG images, etc. For example:
|
|
165
160
|
|
|
166
161
|
~~~
|
|
167
162
|
# Markdown Application
|
package/lib/include/args.bare
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Licensed under the MIT License
|
|
2
|
-
# https://github.com/craigahobbs/
|
|
2
|
+
# https://github.com/craigahobbs/bare-script/blob/main/LICENSE
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
# The URL arguments model
|
|
6
6
|
argsTypes = schemaParse( \
|
|
7
|
-
'group "args.bare"', \
|
|
7
|
+
'group "<args.bare>"', \
|
|
8
8
|
'', \
|
|
9
9
|
'', \
|
|
10
10
|
'# An argument model list', \
|
|
@@ -48,8 +48,8 @@ argsTypes = schemaParse( \
|
|
|
48
48
|
# $function: argsValidate
|
|
49
49
|
# $group: args.bare
|
|
50
50
|
# $doc: Validate an arguments model
|
|
51
|
-
# $arg arguments: The [arguments model](
|
|
52
|
-
# $return: The validated [arguments model](
|
|
51
|
+
# $arg arguments: The [arguments model](model.html#var.vName='ArgsArguments')
|
|
52
|
+
# $return: The validated [arguments model](model.html#var.vName='ArgsArguments') or null if validation fails
|
|
53
53
|
function argsValidate(arguments):
|
|
54
54
|
validatedArguments = schemaValidate(argsTypes, 'ArgsArguments', arguments)
|
|
55
55
|
|
|
@@ -73,9 +73,9 @@ endfunction
|
|
|
73
73
|
|
|
74
74
|
# $function: argsParse
|
|
75
75
|
# $group: args.bare
|
|
76
|
-
# $doc: Parse an [arguments model](
|
|
76
|
+
# $doc: Parse an [arguments model](model.html#var.vName='ArgsArguments').
|
|
77
77
|
# $doc: Argument globals are validated and added to the arguments object using the argument name.
|
|
78
|
-
# $arg arguments: The [arguments model](
|
|
78
|
+
# $arg arguments: The [arguments model](model.html#var.vName='ArgsArguments')
|
|
79
79
|
# $return: The arguments object
|
|
80
80
|
function argsParse(arguments):
|
|
81
81
|
# Create the arguments object
|
|
@@ -103,7 +103,7 @@ endfunction
|
|
|
103
103
|
# $function: argsURL
|
|
104
104
|
# $group: args.bare
|
|
105
105
|
# $doc: Create a MarkdownUp application URL
|
|
106
|
-
# $arg arguments: The [arguments model](
|
|
106
|
+
# $arg arguments: The [arguments model](model.html#var.vName='ArgsArguments')
|
|
107
107
|
# $arg args: Optional (default is null). The arguments object. Null argument values are excluded from the URL.
|
|
108
108
|
# $arg explicit: Optional (default is false). If true, arguments are only included in the URL if they are in the arguments object.
|
|
109
109
|
# $arg headerText: Optional (default is null). If non-null, the URL's header text.
|
|
@@ -163,7 +163,7 @@ argsTopHeaderId = '_top'
|
|
|
163
163
|
# $function: argsLink
|
|
164
164
|
# $group: args.bare
|
|
165
165
|
# $doc: Create a Markdown link text to a MarkdownUp application URL
|
|
166
|
-
# $arg arguments: The [arguments model](
|
|
166
|
+
# $arg arguments: The [arguments model](model.html#var.vName='ArgsArguments')
|
|
167
167
|
# $arg text: The link text
|
|
168
168
|
# $arg args: Optional (default is null). The arguments object.
|
|
169
169
|
# $arg explicit: Optional (default is false). If true, arguments are only included in the URL if they are in the arguments object.
|
|
@@ -178,10 +178,10 @@ endfunction
|
|
|
178
178
|
|
|
179
179
|
# $function: argsHelp
|
|
180
180
|
# $group: args.bare
|
|
181
|
-
# $doc: Generate the [arguments model's](
|
|
181
|
+
# $doc: Generate the [arguments model's](model.html#var.vName='ArgsArguments') help content
|
|
182
182
|
# $doc:
|
|
183
183
|
# $doc: **NOTE:** Calling this function requires `include <dataTable.bare>`
|
|
184
|
-
# $arg arguments: The [arguments model](
|
|
184
|
+
# $arg arguments: The [arguments model](model.html#var.vName='ArgsArguments')
|
|
185
185
|
# $return: The array of help Markdown line strings
|
|
186
186
|
function argsHelp(arguments):
|
|
187
187
|
# Create the help data
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
# Licensed under the MIT License
|
|
2
|
+
# https://github.com/craigahobbs/bare-script/blob/main/LICENSE
|
|
3
|
+
|
|
4
|
+
include <args.bare>
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
# $function: baredocMain
|
|
8
|
+
# $group: baredocMain.bare
|
|
9
|
+
# $doc: The BareScript library documentation application main entry point
|
|
10
|
+
# $arg url: The library documentation JSON resource URL
|
|
11
|
+
# $arg title: The library title
|
|
12
|
+
# $arg menuLinks: Optional array of text/URL menu link tuples
|
|
13
|
+
# $arg groupURLs: Optional map of group name to group Markdown content URL ('' is index) or JSON resource URL
|
|
14
|
+
async function baredocMain(url, title, menuLinks, groupURLs):
|
|
15
|
+
# Parse arguments
|
|
16
|
+
args = argsParse(baredocArguments)
|
|
17
|
+
group = objectGet(args, 'group')
|
|
18
|
+
name = objectGet(args, 'name')
|
|
19
|
+
single = objectGet(args, 'single')
|
|
20
|
+
url = objectGet(args, 'url', url)
|
|
21
|
+
|
|
22
|
+
# Render library JSON documentation page?
|
|
23
|
+
if objectGet(args, 'doc'):
|
|
24
|
+
documentSetTitle('Library')
|
|
25
|
+
elementModelRender(schemaElements(baredocTypes, 'Library'))
|
|
26
|
+
return
|
|
27
|
+
endif
|
|
28
|
+
|
|
29
|
+
# Fetch and validate the library documentation resource
|
|
30
|
+
groups = {}
|
|
31
|
+
urls = if(systemType(url) == 'array', url, [url])
|
|
32
|
+
for libraryJSON, ixLibrary in systemFetch(urls):
|
|
33
|
+
libraryPart = if(libraryJSON != null, jsonParse(libraryJSON))
|
|
34
|
+
libraryPart = if(libraryPart != null, schemaValidate(baredocTypes, 'Library', libraryPart))
|
|
35
|
+
if libraryPart == null:
|
|
36
|
+
libraryURL = arrayGet(urls, ixLibrary)
|
|
37
|
+
markdownPrint('**Error:** Failed to fetch library documentation resource "' + markdownEscape(libraryURL) + '"')
|
|
38
|
+
return
|
|
39
|
+
endif
|
|
40
|
+
|
|
41
|
+
# Group the function documentation
|
|
42
|
+
for function_ in objectGet(libraryPart, 'functions'):
|
|
43
|
+
groupName = objectGet(function_, 'group')
|
|
44
|
+
groupFunctions = objectGet(groups, groupName)
|
|
45
|
+
if groupFunctions == null:
|
|
46
|
+
groupFunctions = []
|
|
47
|
+
objectSet(groups, groupName, groupFunctions)
|
|
48
|
+
endif
|
|
49
|
+
arrayPush(groupFunctions, function_)
|
|
50
|
+
endfor
|
|
51
|
+
endfor
|
|
52
|
+
|
|
53
|
+
# Group URLs?
|
|
54
|
+
if groupURLs != null:
|
|
55
|
+
# Fetch the group URLs, if necessary
|
|
56
|
+
if systemType(groupURLs) == 'string':
|
|
57
|
+
groupURLs = jsonParse(systemFetch(groupURLs))
|
|
58
|
+
endif
|
|
59
|
+
|
|
60
|
+
# Add an empty group for any missing group URLs
|
|
61
|
+
for groupName in objectKeys(groupURLs):
|
|
62
|
+
if groupName != '' && !objectHas(groups, groupName):
|
|
63
|
+
objectSet(groups, groupName, [])
|
|
64
|
+
endif
|
|
65
|
+
endfor
|
|
66
|
+
endif
|
|
67
|
+
|
|
68
|
+
# Sort the group functions
|
|
69
|
+
for groupName in objectKeys(groups):
|
|
70
|
+
groupFunctions = objectGet(groups, groupName)
|
|
71
|
+
arraySort(groupFunctions, baredocFunctionCompare)
|
|
72
|
+
|
|
73
|
+
# Function requested by name?
|
|
74
|
+
if name != null:
|
|
75
|
+
for function_ in groupFunctions:
|
|
76
|
+
functionName = objectGet(function_, 'name')
|
|
77
|
+
if functionName == name:
|
|
78
|
+
# Redirect to the actual URL
|
|
79
|
+
windowSetLocation( \
|
|
80
|
+
argsURL(baredocArguments, {'group': objectGet(function_, 'group'), 'name': null}, false, functionName) \
|
|
81
|
+
)
|
|
82
|
+
return
|
|
83
|
+
endif
|
|
84
|
+
endfor
|
|
85
|
+
endif
|
|
86
|
+
endfor
|
|
87
|
+
if name != null:
|
|
88
|
+
markdownPrint('', '**Error:** Unknown function "' + markdownEscape(name) + '"')
|
|
89
|
+
return
|
|
90
|
+
endif
|
|
91
|
+
|
|
92
|
+
# Render the page
|
|
93
|
+
title = if(title != null && !objectHas(args, 'url'), title, url)
|
|
94
|
+
if group != null:
|
|
95
|
+
baredocGroupPage(args, title, groupURLs, groups, group)
|
|
96
|
+
elif single:
|
|
97
|
+
baredocSinglePage(args, title, menuLinks, groupURLs, groups)
|
|
98
|
+
else:
|
|
99
|
+
baredocIndexPage(args, title, menuLinks, groupURLs, groups)
|
|
100
|
+
endif
|
|
101
|
+
endfunction
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
# The BareScript library documentation application arguments
|
|
105
|
+
baredocArguments = argsValidate([ \
|
|
106
|
+
{'name': 'doc', 'type': 'bool', 'default': false}, \
|
|
107
|
+
{'name': 'group'}, \
|
|
108
|
+
{'name': 'name'}, \
|
|
109
|
+
{'name': 'publish', 'type': 'bool', 'default': false}, \
|
|
110
|
+
{'name': 'single', 'type': 'bool', 'default': false}, \
|
|
111
|
+
{'name': 'url', 'global': 'vURL'} \
|
|
112
|
+
])
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
# Helper to compare library function objects by name
|
|
116
|
+
function baredocFunctionCompare(f1, f2):
|
|
117
|
+
f1Name = objectGet(f1, 'name')
|
|
118
|
+
f2Name = objectGet(f2, 'name')
|
|
119
|
+
return if(f1Name < f2Name, -1, if(f1Name == f2Name, 0, 1))
|
|
120
|
+
endfunction
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
# Render a library documentation index page
|
|
124
|
+
async function baredocIndexPage(args, title, menuLinks, groupURLs, groups):
|
|
125
|
+
publish = objectGet(args, 'publish')
|
|
126
|
+
|
|
127
|
+
# Render the menu and title
|
|
128
|
+
documentSetTitle(title)
|
|
129
|
+
if menuLinks != null && arrayLength(menuLinks) > 0 && !publish:
|
|
130
|
+
menuSpacer = ' | '
|
|
131
|
+
for menuLink, ixMenuLink in menuLinks:
|
|
132
|
+
menuLinkText = arrayGet(menuLink, 0)
|
|
133
|
+
menuLinkURL = arrayGet(menuLink, 1)
|
|
134
|
+
markdownPrint(if(ixMenuLink == 0, '', menuSpacer) + '[' + markdownEscape(menuLinkText) + '](' + urlEncode(menuLinkURL) + ')')
|
|
135
|
+
endfor
|
|
136
|
+
markdownPrint('')
|
|
137
|
+
endif
|
|
138
|
+
markdownPrint('# ' + markdownEscape(title))
|
|
139
|
+
|
|
140
|
+
# Render the index Markdown, if any
|
|
141
|
+
if groupURLs != null && objectHas(groupURLs, ''):
|
|
142
|
+
rootURL = objectGet(groupURLs, '')
|
|
143
|
+
rootMarkdown = systemFetch(rootURL)
|
|
144
|
+
markdownPrint('', if(rootMarkdown != null, rootMarkdown, '**Error:** Failed to load "' + markdownEscape(rootURL) + '"'))
|
|
145
|
+
endif
|
|
146
|
+
|
|
147
|
+
# Render the single page toggle
|
|
148
|
+
if !publish:
|
|
149
|
+
markdownPrint('', argsLink(baredocArguments, 'Single Page', {'single': true}))
|
|
150
|
+
endif
|
|
151
|
+
|
|
152
|
+
# Render the library function index
|
|
153
|
+
markdownPrint('', '## Table of Contents', '')
|
|
154
|
+
for groupName in arraySort(objectKeys(groups)):
|
|
155
|
+
markdownPrint('- ' + argsLink(baredocArguments, groupName, {'group': groupName}, false, argsTopHeaderId))
|
|
156
|
+
endfor
|
|
157
|
+
endfunction
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
# Render the single-page library documentation
|
|
161
|
+
async function baredocSinglePage(args, title, menuLinks, groupURLs, groups):
|
|
162
|
+
publish = objectGet(args, 'publish')
|
|
163
|
+
|
|
164
|
+
# Render the menu and title
|
|
165
|
+
documentSetTitle(title)
|
|
166
|
+
if menuLinks != null && arrayLength(menuLinks) > 0 && !publish:
|
|
167
|
+
menuSpacer = ' | '
|
|
168
|
+
for menuLink, ixMenuLink in menuLinks:
|
|
169
|
+
menuLinkText = arrayGet(menuLink, 0)
|
|
170
|
+
menuLinkURL = arrayGet(menuLink, 1)
|
|
171
|
+
markdownPrint(if(ixMenuLink == 0, '', menuSpacer) + '[' + markdownEscape(menuLinkText) + '](' + urlEncode(menuLinkURL) + ')')
|
|
172
|
+
endfor
|
|
173
|
+
markdownPrint('')
|
|
174
|
+
endif
|
|
175
|
+
markdownPrint('# ' + markdownEscape(title))
|
|
176
|
+
|
|
177
|
+
# Render the index Markdown, if any
|
|
178
|
+
if groupURLs != null && objectHas(groupURLs, ''):
|
|
179
|
+
rootURL = objectGet(groupURLs, '')
|
|
180
|
+
rootMarkdown = systemFetch(rootURL)
|
|
181
|
+
markdownPrint('', if(rootMarkdown != null, rootMarkdown, '**Error:** Failed to load "' + markdownEscape(rootURL) + '"'))
|
|
182
|
+
endif
|
|
183
|
+
|
|
184
|
+
# Render the single page toggle
|
|
185
|
+
if !publish:
|
|
186
|
+
markdownPrint('', argsLink(baredocArguments, 'Multi Page', {'single': false}))
|
|
187
|
+
endif
|
|
188
|
+
|
|
189
|
+
# The table of contents
|
|
190
|
+
markdownPrint('', '## Table of Contents', '')
|
|
191
|
+
for groupName in arraySort(objectKeys(groups)):
|
|
192
|
+
markdownPrint('- ' + argsLink(baredocArguments, groupName, null, false, groupName))
|
|
193
|
+
endfor
|
|
194
|
+
|
|
195
|
+
# Render the library function index
|
|
196
|
+
for groupName in arraySort(objectKeys(groups)):
|
|
197
|
+
markdownPrint('', '---', '')
|
|
198
|
+
baredocGroupPage(args, title, groupURLs, groups, groupName, true)
|
|
199
|
+
endfor
|
|
200
|
+
endfunction
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
# Render a library documentation group page
|
|
204
|
+
async function baredocGroupPage(args, title, groupURLs, groups, groupName):
|
|
205
|
+
single = objectGet(args, 'single')
|
|
206
|
+
baseHeader = if(single, '##', '#')
|
|
207
|
+
|
|
208
|
+
if !single:
|
|
209
|
+
# Set the document title
|
|
210
|
+
documentSetTitle(title + ' - ' + groupName)
|
|
211
|
+
|
|
212
|
+
# Group exist?
|
|
213
|
+
if !objectHas(groups, groupName):
|
|
214
|
+
markdownPrint('', '**Error:** Unknown group "' + markdownEscape(groupName) + '"')
|
|
215
|
+
return
|
|
216
|
+
endif
|
|
217
|
+
endif
|
|
218
|
+
|
|
219
|
+
# Render the menu and title
|
|
220
|
+
if !single:
|
|
221
|
+
markdownPrint(argsLink(baredocArguments, 'Index', {'group': null}), '')
|
|
222
|
+
endif
|
|
223
|
+
markdownPrint(baseHeader + ' ' + markdownEscape(groupName))
|
|
224
|
+
if single:
|
|
225
|
+
markdownPrint('', argsLink(baredocArguments, 'Back to top', null, false, '_top'))
|
|
226
|
+
endif
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
# Render the group Markdown, if any
|
|
230
|
+
if groupURLs != null && objectHas(groupURLs, groupName):
|
|
231
|
+
groupURL = objectGet(groupURLs, groupName)
|
|
232
|
+
groupMarkdown = systemFetch(groupURL)
|
|
233
|
+
markdownPrint('', if(groupMarkdown != null, groupMarkdown, '**Error:** Failed to load "' + markdownEscape(groupURL) + '"'))
|
|
234
|
+
endif
|
|
235
|
+
|
|
236
|
+
# Render the group function index
|
|
237
|
+
groupFunctions = objectGet(groups, groupName)
|
|
238
|
+
if arrayLength(groupFunctions) != 0:
|
|
239
|
+
markdownPrint('', baseHeader + '# Function Index', '')
|
|
240
|
+
endif
|
|
241
|
+
for function_, ixFunction in groupFunctions:
|
|
242
|
+
functionName = objectGet(function_, 'name')
|
|
243
|
+
markdownPrint('- ' + argsLink(baredocArguments, functionName, null, false, functionName))
|
|
244
|
+
endfor
|
|
245
|
+
|
|
246
|
+
# Render the group function documentation
|
|
247
|
+
for function_ in groupFunctions:
|
|
248
|
+
# Render the function header
|
|
249
|
+
markdownPrint( \
|
|
250
|
+
'', \
|
|
251
|
+
'---', \
|
|
252
|
+
'', \
|
|
253
|
+
baseHeader + '# ' + markdownEscape(objectGet(function_, 'name')), \
|
|
254
|
+
'', \
|
|
255
|
+
objectGet(function_, 'doc') \
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
# Render the functions's argument documentation
|
|
259
|
+
markdownPrint('', baseHeader + '## Arguments')
|
|
260
|
+
arguments = objectGet(function_, 'args')
|
|
261
|
+
if arguments != null:
|
|
262
|
+
for argument in arguments:
|
|
263
|
+
markdownPrint('', '**' + markdownEscape(objectGet(argument, 'name')) + ' -**', objectGet(argument, 'doc'))
|
|
264
|
+
endfor
|
|
265
|
+
else:
|
|
266
|
+
markdownPrint('', 'None')
|
|
267
|
+
endif
|
|
268
|
+
|
|
269
|
+
# Render the function's return documentation
|
|
270
|
+
markdownPrint('', baseHeader + '## Returns')
|
|
271
|
+
returnDoc = objectGet(function_, 'return')
|
|
272
|
+
markdownPrint('', if(returnDoc != null, returnDoc, 'Nothing'))
|
|
273
|
+
endfor
|
|
274
|
+
endfunction
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
# The library documentation schema
|
|
278
|
+
baredocTypes = schemaParse( \
|
|
279
|
+
'# A library documentation model', \
|
|
280
|
+
'struct Library', \
|
|
281
|
+
'', \
|
|
282
|
+
' # The library functions', \
|
|
283
|
+
' Function[len > 0] functions', \
|
|
284
|
+
'', \
|
|
285
|
+
'', \
|
|
286
|
+
'# A library function', \
|
|
287
|
+
'struct Function', \
|
|
288
|
+
'', \
|
|
289
|
+
' # The function name', \
|
|
290
|
+
' string(len > 0) name', \
|
|
291
|
+
'', \
|
|
292
|
+
' # The function group (e.g. "Math")', \
|
|
293
|
+
' string(len > 0) group', \
|
|
294
|
+
'', \
|
|
295
|
+
" # The function's documentation Markdown lines", \
|
|
296
|
+
' string[len > 0] doc', \
|
|
297
|
+
'', \
|
|
298
|
+
' # The function arguments', \
|
|
299
|
+
' optional FunctionArgument[len > 0] args', \
|
|
300
|
+
'', \
|
|
301
|
+
" # The function return's documentation Markdown lines", \
|
|
302
|
+
' optional string[len > 0] return', \
|
|
303
|
+
'', \
|
|
304
|
+
'', \
|
|
305
|
+
'# A function argument', \
|
|
306
|
+
'struct FunctionArgument', \
|
|
307
|
+
'', \
|
|
308
|
+
' # The argument name', \
|
|
309
|
+
' string(len > 0) name', \
|
|
310
|
+
'', \
|
|
311
|
+
" # The argument's documentation Markdown lines", \
|
|
312
|
+
' string[len > 0] doc' \
|
|
313
|
+
)
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Licensed under the MIT License
|
|
2
|
+
# https://github.com/craigahobbs/bare-script/blob/main/LICENSE
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
# The line chart model
|
|
6
|
+
dataLineChartTypes = schemaParse( \
|
|
7
|
+
'group "Line Chart"', \
|
|
8
|
+
'', \
|
|
9
|
+
'', \
|
|
10
|
+
'# A line chart model', \
|
|
11
|
+
'struct LineChart', \
|
|
12
|
+
'', \
|
|
13
|
+
' # The chart title', \
|
|
14
|
+
' optional string title', \
|
|
15
|
+
'', \
|
|
16
|
+
' # The chart width', \
|
|
17
|
+
' optional int width', \
|
|
18
|
+
'', \
|
|
19
|
+
' # The chart height', \
|
|
20
|
+
' optional int height', \
|
|
21
|
+
'', \
|
|
22
|
+
' # The numeric formatting precision (default is 2)', \
|
|
23
|
+
' optional int(>= 0) precision', \
|
|
24
|
+
'', \
|
|
25
|
+
' # The datetime format', \
|
|
26
|
+
' optional LineChartDatetimeFormat datetime', \
|
|
27
|
+
'', \
|
|
28
|
+
" # The line chart's X-axis field", \
|
|
29
|
+
' string x', \
|
|
30
|
+
'', \
|
|
31
|
+
" # The line chart's Y-axis fields", \
|
|
32
|
+
' string[len > 0] y', \
|
|
33
|
+
'', \
|
|
34
|
+
' # The color encoding field', \
|
|
35
|
+
' optional string color', \
|
|
36
|
+
'', \
|
|
37
|
+
' # The color encoding value order', \
|
|
38
|
+
' optional string[len > 0] colorOrder', \
|
|
39
|
+
'', \
|
|
40
|
+
' # The X-axis tick marks', \
|
|
41
|
+
' optional LineChartAxisTicks xTicks', \
|
|
42
|
+
'', \
|
|
43
|
+
' # The Y-axis tick marks', \
|
|
44
|
+
' optional LineChartAxisTicks yTicks', \
|
|
45
|
+
'', \
|
|
46
|
+
' # The X-axis annotations', \
|
|
47
|
+
' optional LineChartAxisAnnotation[len > 0] xLines', \
|
|
48
|
+
'', \
|
|
49
|
+
' # The Y-axis annotations', \
|
|
50
|
+
' optional LineChartAxisAnnotation[len > 0] yLines', \
|
|
51
|
+
'', \
|
|
52
|
+
'', \
|
|
53
|
+
'# The axis tick mark model', \
|
|
54
|
+
'struct LineChartAxisTicks', \
|
|
55
|
+
'', \
|
|
56
|
+
' # The count of evenly-spaced tick marks. The default is 3.', \
|
|
57
|
+
' optional int(>= 0) count', \
|
|
58
|
+
'', \
|
|
59
|
+
' # The value of the first tick mark. Default is the minimum axis value.', \
|
|
60
|
+
' optional any start', \
|
|
61
|
+
'', \
|
|
62
|
+
' # The value of the last tick mark. Default is the maximum axis value.', \
|
|
63
|
+
' optional any end', \
|
|
64
|
+
'', \
|
|
65
|
+
' # The number of tick mark labels to skip after a rendered label', \
|
|
66
|
+
' optional int(> 0) skip', \
|
|
67
|
+
'', \
|
|
68
|
+
'', \
|
|
69
|
+
'# An axis annotation', \
|
|
70
|
+
'struct LineChartAxisAnnotation', \
|
|
71
|
+
'', \
|
|
72
|
+
' # The axis value', \
|
|
73
|
+
' any value', \
|
|
74
|
+
'', \
|
|
75
|
+
' # The annotation label', \
|
|
76
|
+
' optional string label', \
|
|
77
|
+
'', \
|
|
78
|
+
'', \
|
|
79
|
+
'# A datetime format', \
|
|
80
|
+
'enum LineChartDatetimeFormat', \
|
|
81
|
+
'', \
|
|
82
|
+
' # ISO datetime year format', \
|
|
83
|
+
' year', \
|
|
84
|
+
'', \
|
|
85
|
+
' # ISO datetime month format', \
|
|
86
|
+
' month', \
|
|
87
|
+
'', \
|
|
88
|
+
' # ISO datetime day format', \
|
|
89
|
+
' day' \
|
|
90
|
+
)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Licensed under the MIT License
|
|
2
|
-
# https://github.com/craigahobbs/
|
|
2
|
+
# https://github.com/craigahobbs/bare-script/blob/main/LICENSE
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
# The data table model's Schema Markdown
|
|
6
6
|
dataTableTypes = schemaParse( \
|
|
7
|
-
'group "
|
|
7
|
+
'group "<dataTable.bare>"', \
|
|
8
8
|
'', \
|
|
9
9
|
'', \
|
|
10
10
|
'# A data table model', \
|
|
@@ -70,7 +70,7 @@ dataTableTypes = schemaParse( \
|
|
|
70
70
|
# $group: dataTable.bare
|
|
71
71
|
# $doc: Create the array of Markdown table line strings
|
|
72
72
|
# $arg data: The array of row objects
|
|
73
|
-
# $arg model: The [data table model](
|
|
73
|
+
# $arg model: The [data table model](model.html#var.vName='DataTable')
|
|
74
74
|
# $return: The array of Markdown table line strings
|
|
75
75
|
function dataTableMarkdown(data, model):
|
|
76
76
|
# Validate the data
|
package/lib/include/diff.bare
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Licensed under the MIT License
|
|
2
|
-
# https://github.com/craigahobbs/
|
|
2
|
+
# https://github.com/craigahobbs/bare-script/blob/main/LICENSE
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
# The text line difference model
|
|
6
6
|
diffTypes = schemaParse( \
|
|
7
|
-
'group "diff.bare"', \
|
|
7
|
+
'group "<diff.bare>"', \
|
|
8
8
|
'', \
|
|
9
9
|
'', \
|
|
10
10
|
'# A list of text line differences', \
|
|
@@ -40,7 +40,7 @@ diffTypes = schemaParse( \
|
|
|
40
40
|
# $doc: Compute the line-differences of two strings or arrays of strings
|
|
41
41
|
# $arg left: The "left" string or array of strings
|
|
42
42
|
# $arg right: The "right" string or array of strings
|
|
43
|
-
# $return: The array of [difference models](
|
|
43
|
+
# $return: The array of [difference models](model.html#var.vName='Differences')
|
|
44
44
|
function diffLines(left, right):
|
|
45
45
|
diffs = []
|
|
46
46
|
|
package/lib/include/forms.bare
CHANGED