bare-script 3.8.1__tar.gz → 3.8.3__tar.gz

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.
Files changed (34) hide show
  1. {bare_script-3.8.1/src/bare_script.egg-info → bare_script-3.8.3}/PKG-INFO +8 -14
  2. {bare_script-3.8.1 → bare_script-3.8.3}/README.md +7 -13
  3. {bare_script-3.8.1 → bare_script-3.8.3}/setup.cfg +1 -2
  4. {bare_script-3.8.1 → bare_script-3.8.3}/src/bare_script/data.py +3 -3
  5. {bare_script-3.8.1 → bare_script-3.8.3}/src/bare_script/include/args.bare +10 -10
  6. bare_script-3.8.3/src/bare_script/include/baredoc.bare +313 -0
  7. bare_script-3.8.3/src/bare_script/include/dataLineChart.bare +90 -0
  8. {bare_script-3.8.1 → bare_script-3.8.3}/src/bare_script/include/dataTable.bare +3 -3
  9. {bare_script-3.8.1 → bare_script-3.8.3}/src/bare_script/include/diff.bare +3 -3
  10. {bare_script-3.8.1 → bare_script-3.8.3}/src/bare_script/include/forms.bare +1 -1
  11. bare_script-3.8.3/src/bare_script/include/markdownUp.bare +662 -0
  12. {bare_script-3.8.1 → bare_script-3.8.3}/src/bare_script/include/pager.bare +6 -6
  13. {bare_script-3.8.1 → bare_script-3.8.3}/src/bare_script/include/unittest.bare +1 -1
  14. {bare_script-3.8.1 → bare_script-3.8.3}/src/bare_script/include/unittestMock.bare +1 -1
  15. {bare_script-3.8.1 → bare_script-3.8.3}/src/bare_script/library.py +116 -116
  16. {bare_script-3.8.1 → bare_script-3.8.3}/src/bare_script/parser.py +2 -2
  17. {bare_script-3.8.1 → bare_script-3.8.3}/src/bare_script/runtime.py +6 -6
  18. {bare_script-3.8.1 → bare_script-3.8.3/src/bare_script.egg-info}/PKG-INFO +8 -14
  19. {bare_script-3.8.1 → bare_script-3.8.3}/src/bare_script.egg-info/SOURCES.txt +2 -0
  20. bare_script-3.8.1/src/bare_script/include/markdownUp.bare +0 -353
  21. {bare_script-3.8.1 → bare_script-3.8.3}/LICENSE +0 -0
  22. {bare_script-3.8.1 → bare_script-3.8.3}/pyproject.toml +0 -0
  23. {bare_script-3.8.1 → bare_script-3.8.3}/src/bare_script/__init__.py +0 -0
  24. {bare_script-3.8.1 → bare_script-3.8.3}/src/bare_script/__main__.py +0 -0
  25. {bare_script-3.8.1 → bare_script-3.8.3}/src/bare_script/bare.py +0 -0
  26. {bare_script-3.8.1 → bare_script-3.8.3}/src/bare_script/baredoc.py +0 -0
  27. {bare_script-3.8.1 → bare_script-3.8.3}/src/bare_script/include/__init__.py +0 -0
  28. {bare_script-3.8.1 → bare_script-3.8.3}/src/bare_script/model.py +0 -0
  29. {bare_script-3.8.1 → bare_script-3.8.3}/src/bare_script/options.py +0 -0
  30. {bare_script-3.8.1 → bare_script-3.8.3}/src/bare_script/value.py +0 -0
  31. {bare_script-3.8.1 → bare_script-3.8.3}/src/bare_script.egg-info/dependency_links.txt +0 -0
  32. {bare_script-3.8.1 → bare_script-3.8.3}/src/bare_script.egg-info/entry_points.txt +0 -0
  33. {bare_script-3.8.1 → bare_script-3.8.3}/src/bare_script.egg-info/requires.txt +0 -0
  34. {bare_script-3.8.1 → bare_script-3.8.3}/src/bare_script.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bare-script
3
- Version: 3.8.1
3
+ Version: 3.8.3
4
4
  Summary: bare-script
5
5
  Home-page: https://github.com/craigahobbs/bare-script
6
6
  Author: Craig A. Hobbs
@@ -30,7 +30,7 @@ Dynamic: license-file
30
30
  [![GitHub](https://img.shields.io/github/license/craigahobbs/bare-script-py)](https://github.com/craigahobbs/bare-script-py/blob/main/LICENSE)
31
31
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/bare-script)](https://pypi.org/project/bare-script/)
32
32
 
33
- [BareScript](https://craigahobbs.github.io/bare-script/language/)
33
+ [BareScript](https://craigahobbs.github.io/bare-script-py/language/)
34
34
  is a simple, lightweight, and portable programming language. Its Pythonic syntax is influenced by
35
35
  JavaScript, C, and the Unix Shell. BareScript also has a library of built-in functions for common
36
36
  programming operations. BareScript can be embedded within applications or used as a stand-alone
@@ -46,7 +46,7 @@ confident that BareScript will execute the same regardless of the underlying run
46
46
 
47
47
  ## Links
48
48
 
49
- - [The BareScript Language](https://craigahobbs.github.io/bare-script/language/)
49
+ - [The BareScript Language](https://craigahobbs.github.io/bare-script-py/language/)
50
50
  - [The BareScript Library](https://craigahobbs.github.io/bare-script-py/library/)
51
51
  - [The BareScript Expression Library](https://craigahobbs.github.io/bare-script-py/library/expression.html)
52
52
  - [API Documentation](https://craigahobbs.github.io/bare-script-py/)
@@ -118,14 +118,14 @@ print(execute_script(script, {'fetchFn': fetch_http}))
118
118
  This outputs:
119
119
 
120
120
  ```
121
- The BareScript Library has 105 functions
121
+ The BareScript Library has 186 functions
122
122
  ```
123
123
 
124
124
 
125
125
  ## Evaluating BareScript Expressions
126
126
 
127
127
  To evaluate a
128
- [BareScript expression](https://craigahobbs.github.io/bare-script/language/#expressions),
128
+ [BareScript expression](https://craigahobbs.github.io/bare-script-py/language/#expressions),
129
129
  parse the expression using the
130
130
  [parse_expression](https://craigahobbs.github.io/bare-script-py/expressions.html#parse-expression)
131
131
  function. Then evaluate the expression using the
@@ -176,15 +176,9 @@ write the body to the path.
176
176
 
177
177
  ## MarkdownUp, a Markdown Viewer with BareScript
178
178
 
179
- [MarkdownUp](https://craigahobbs.github.io/markdown-up/)
180
- is a Markdown Viewer that executes BareScript embedded within Markdown documents.
181
- MarkdownUp includes the
182
- [MarkdownUp Library](https://craigahobbs.github.io/markdown-up/library/),
183
- which extends the
184
- [BareScript Library](https://craigahobbs.github.io/bare-script-py/library/)
185
- with functions for dynamically rendering Markdown text, drawing SVG images, etc.
186
-
187
- For example:
179
+ [MarkdownUp](https://craigahobbs.github.io/markdown-up/) is a Markdown Viewer that executes
180
+ BareScript embedded within Markdown documents. The MarkdownUp runtime contains functions for
181
+ dynamically rendering Markdown text, drawing SVG images, etc. For example:
188
182
 
189
183
  ~~~
190
184
  # Markdown Application
@@ -5,7 +5,7 @@
5
5
  [![GitHub](https://img.shields.io/github/license/craigahobbs/bare-script-py)](https://github.com/craigahobbs/bare-script-py/blob/main/LICENSE)
6
6
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/bare-script)](https://pypi.org/project/bare-script/)
7
7
 
8
- [BareScript](https://craigahobbs.github.io/bare-script/language/)
8
+ [BareScript](https://craigahobbs.github.io/bare-script-py/language/)
9
9
  is a simple, lightweight, and portable programming language. Its Pythonic syntax is influenced by
10
10
  JavaScript, C, and the Unix Shell. BareScript also has a library of built-in functions for common
11
11
  programming operations. BareScript can be embedded within applications or used as a stand-alone
@@ -21,7 +21,7 @@ confident that BareScript will execute the same regardless of the underlying run
21
21
 
22
22
  ## Links
23
23
 
24
- - [The BareScript Language](https://craigahobbs.github.io/bare-script/language/)
24
+ - [The BareScript Language](https://craigahobbs.github.io/bare-script-py/language/)
25
25
  - [The BareScript Library](https://craigahobbs.github.io/bare-script-py/library/)
26
26
  - [The BareScript Expression Library](https://craigahobbs.github.io/bare-script-py/library/expression.html)
27
27
  - [API Documentation](https://craigahobbs.github.io/bare-script-py/)
@@ -93,14 +93,14 @@ print(execute_script(script, {'fetchFn': fetch_http}))
93
93
  This outputs:
94
94
 
95
95
  ```
96
- The BareScript Library has 105 functions
96
+ The BareScript Library has 186 functions
97
97
  ```
98
98
 
99
99
 
100
100
  ## Evaluating BareScript Expressions
101
101
 
102
102
  To evaluate a
103
- [BareScript expression](https://craigahobbs.github.io/bare-script/language/#expressions),
103
+ [BareScript expression](https://craigahobbs.github.io/bare-script-py/language/#expressions),
104
104
  parse the expression using the
105
105
  [parse_expression](https://craigahobbs.github.io/bare-script-py/expressions.html#parse-expression)
106
106
  function. Then evaluate the expression using the
@@ -151,15 +151,9 @@ write the body to the path.
151
151
 
152
152
  ## MarkdownUp, a Markdown Viewer with BareScript
153
153
 
154
- [MarkdownUp](https://craigahobbs.github.io/markdown-up/)
155
- is a Markdown Viewer that executes BareScript embedded within Markdown documents.
156
- MarkdownUp includes the
157
- [MarkdownUp Library](https://craigahobbs.github.io/markdown-up/library/),
158
- which extends the
159
- [BareScript Library](https://craigahobbs.github.io/bare-script-py/library/)
160
- with functions for dynamically rendering Markdown text, drawing SVG images, etc.
161
-
162
- For example:
154
+ [MarkdownUp](https://craigahobbs.github.io/markdown-up/) is a Markdown Viewer that executes
155
+ BareScript embedded within Markdown documents. The MarkdownUp runtime contains functions for
156
+ dynamically rendering Markdown text, drawing SVG images, etc. For example:
163
157
 
164
158
  ~~~
165
159
  # Markdown Application
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = bare-script
3
- version = 3.8.1
3
+ version = 3.8.3
4
4
  url = https://github.com/craigahobbs/bare-script
5
5
  author = Craig A. Hobbs
6
6
  author_email = craigahobbs@gmail.com
@@ -37,7 +37,6 @@ console_scripts =
37
37
  [options.package_data]
38
38
  bare_script =
39
39
  include/*.bare
40
- include/*.txt
41
40
 
42
41
  [egg_info]
43
42
  tag_build =
@@ -143,9 +143,9 @@ def join_data(left_data, right_data, join_expr, right_expr=None, is_left_join=Fa
143
143
  :type leftData: list[dict]
144
144
  :param rightData: The left data array
145
145
  :type rightData: list[dict]
146
- :param joinExpr: The join `expression <https://craigahobbs.github.io/bare-script/language/#expressions>`__
146
+ :param joinExpr: The join `expression <https://craigahobbs.github.io/bare-script-py/language/#expressions>`__
147
147
  :type joinExpr: str
148
- :param rightExpr: The right join `expression <https://craigahobbs.github.io/bare-script/language/#expressions>`__
148
+ :param rightExpr: The right join `expression <https://craigahobbs.github.io/bare-script-py/language/#expressions>`__
149
149
  :type rightExpr: str
150
150
  :param isLeftJoin: If true, perform a left join (always include left row)
151
151
  :type isLeftJoin: bool
@@ -264,7 +264,7 @@ def filter_data(data, expr, variables=None, options=None):
264
264
 
265
265
  :param data: The data array
266
266
  :type data: list[dict]
267
- :param expr: The boolean filter `expression <https://craigahobbs.github.io/bare-script/language/#expressions>`__
267
+ :param expr: The boolean filter `expression <https://craigahobbs.github.io/bare-script-py/language/#expressions>`__
268
268
  :type expr: str
269
269
  :param variables: Additional variables for expression evaluation
270
270
  :type variables: dict
@@ -1,10 +1,10 @@
1
1
  # Licensed under the MIT License
2
- # https://github.com/craigahobbs/markdown-up/blob/main/LICENSE
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](includeModel.html#var.vName='ArgsArguments')
52
- # $return: The validated [arguments model](includeModel.html#var.vName='ArgsArguments') or null if validation fails
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](includeModel.html#var.vName='ArgsArguments').
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](includeModel.html#var.vName='ArgsArguments')
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](includeModel.html#var.vName='ArgsArguments')
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](includeModel.html#var.vName='ArgsArguments')
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](includeModel.html#var.vName='ArgsArguments') help content
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](includeModel.html#var.vName='ArgsArguments')
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 = '&nbsp;|&nbsp;'
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 = '&nbsp;|&nbsp;'
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/markdown-up/blob/main/LICENSE
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 "Data Table"', \
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](includeModel.html#var.vName='DataTable')
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
@@ -1,10 +1,10 @@
1
1
  # Licensed under the MIT License
2
- # https://github.com/craigahobbs/markdown-up/blob/main/LICENSE
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](includeModel.html#var.vName='Differences')
43
+ # $return: The array of [difference models](model.html#var.vName='Differences')
44
44
  function diffLines(left, right):
45
45
  diffs = []
46
46
 
@@ -1,5 +1,5 @@
1
1
  # Licensed under the MIT License
2
- # https://github.com/craigahobbs/markdown-up/blob/main/LICENSE
2
+ # https://github.com/craigahobbs/bare-script/blob/main/LICENSE
3
3
 
4
4
 
5
5
  # $function: formsTextElements