bare-script 4.2.1__tar.gz → 4.2.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 (44) hide show
  1. {bare_script-4.2.1/src/bare_script.egg-info → bare_script-4.2.3}/PKG-INFO +13 -4
  2. {bare_script-4.2.1 → bare_script-4.2.3}/README.md +12 -3
  3. {bare_script-4.2.1 → bare_script-4.2.3}/setup.cfg +1 -1
  4. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/include/data.bare +5 -2
  5. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/include/dataTable.bare +35 -20
  6. {bare_script-4.2.1 → bare_script-4.2.3/src/bare_script.egg-info}/PKG-INFO +13 -4
  7. {bare_script-4.2.1 → bare_script-4.2.3}/LICENSE +0 -0
  8. {bare_script-4.2.1 → bare_script-4.2.3}/pyproject.toml +0 -0
  9. {bare_script-4.2.1 → bare_script-4.2.3}/setup.py +0 -0
  10. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/__init__.py +0 -0
  11. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/__main__.py +0 -0
  12. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/bare.py +0 -0
  13. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/include/__init__.py +0 -0
  14. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/include/args.bare +0 -0
  15. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/include/baredoc.bare +0 -0
  16. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/include/baredocCLI.bare +0 -0
  17. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/include/dataLineChart.bare +0 -0
  18. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/include/dataUtil.bare +0 -0
  19. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/include/diff.bare +0 -0
  20. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/include/draw.bare +0 -0
  21. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/include/elementModel.bare +0 -0
  22. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/include/forms.bare +0 -0
  23. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/include/markdown.bare +0 -0
  24. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/include/markdownElements.bare +0 -0
  25. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/include/markdownHighlight.bare +0 -0
  26. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/include/markdownParser.bare +0 -0
  27. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/include/markdownUp.bare +0 -0
  28. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/include/pager.bare +0 -0
  29. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/include/qrcode.bare +0 -0
  30. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/include/schemaDoc.bare +0 -0
  31. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/include/unittest.bare +0 -0
  32. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/include/unittestMock.bare +0 -0
  33. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/library.py +0 -0
  34. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/model.py +0 -0
  35. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/options.py +0 -0
  36. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/parser.py +0 -0
  37. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/runtime.py +0 -0
  38. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/runtime_c.c +0 -0
  39. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script/value.py +0 -0
  40. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script.egg-info/SOURCES.txt +0 -0
  41. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script.egg-info/dependency_links.txt +0 -0
  42. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script.egg-info/entry_points.txt +0 -0
  43. {bare_script-4.2.1 → bare_script-4.2.3}/src/bare_script.egg-info/requires.txt +0 -0
  44. {bare_script-4.2.1 → bare_script-4.2.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: 4.2.1
3
+ Version: 4.2.3
4
4
  Summary: bare-script
5
5
  Home-page: https://github.com/craigahobbs/bare-script
6
6
  Author: Craig A. Hobbs
@@ -219,10 +219,19 @@ cp SKILL.md .claude/skills/bare-script/SKILL.md
219
219
  Use `~/.claude/skills/bare-script/SKILL.md` instead to make it available across all projects. For
220
220
  other assistants, include the file's contents in your system prompt or rules file.
221
221
 
222
- Once installed, you can prompt the assistant with tasks like:
222
+ Once installed, prompt the assistant with a task like:
223
223
 
224
- > Build a MarkdownUp application that plays tic-tac-toe against the user, with a reset button
225
- > and a running win/loss/draw tally rendered as a bar chart.
224
+ ```
225
+ claude "Build a MarkdownUp application that plays tic-tac-toe against the user, with a reset button and a running win/loss/draw tally rendered as a bar chart. Save it as ticTacToe.md"
226
+ ```
227
+
228
+ To run the resulting MarkdownUp application locally, install the
229
+ [markdown-up](https://pypi.org/project/markdown-up/) viewer and point it at the Markdown file:
230
+
231
+ ```
232
+ pip install markdown-up
233
+ markdown-up ticTacToe.md
234
+ ```
226
235
 
227
236
  The BareScript library is also documented as single-page Markdown, which can be fetched directly
228
237
  into an assistant's context alongside `SKILL.md`:
@@ -194,10 +194,19 @@ cp SKILL.md .claude/skills/bare-script/SKILL.md
194
194
  Use `~/.claude/skills/bare-script/SKILL.md` instead to make it available across all projects. For
195
195
  other assistants, include the file's contents in your system prompt or rules file.
196
196
 
197
- Once installed, you can prompt the assistant with tasks like:
197
+ Once installed, prompt the assistant with a task like:
198
198
 
199
- > Build a MarkdownUp application that plays tic-tac-toe against the user, with a reset button
200
- > and a running win/loss/draw tally rendered as a bar chart.
199
+ ```
200
+ claude "Build a MarkdownUp application that plays tic-tac-toe against the user, with a reset button and a running win/loss/draw tally rendered as a bar chart. Save it as ticTacToe.md"
201
+ ```
202
+
203
+ To run the resulting MarkdownUp application locally, install the
204
+ [markdown-up](https://pypi.org/project/markdown-up/) viewer and point it at the Markdown file:
205
+
206
+ ```
207
+ pip install markdown-up
208
+ markdown-up ticTacToe.md
209
+ ```
201
210
 
202
211
  The BareScript library is also documented as single-page Markdown, which can be fetched directly
203
212
  into an assistant's context alongside `SKILL.md`:
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = bare-script
3
- version = 4.2.1
3
+ version = 4.2.3
4
4
  url = https://github.com/craigahobbs/bare-script
5
5
  author = Craig A. Hobbs
6
6
  author_email = craigahobbs@gmail.com
@@ -549,7 +549,10 @@ dataAggregationTypes = schemaParse( \
549
549
  # $group: data.bare
550
550
  # $doc: Sort a data array
551
551
  # $arg data: The data array
552
- # $arg sorts: The sort field-name/descending-sort tuples
552
+ # $arg sorts: The array of sort tuples. Each tuple is a one- or two-element array, \[field\] or
553
+ # $arg sorts: \[field, descending\]. "field" is the field name to sort by. "descending" is an
554
+ # $arg sorts: optional boolean - if true, the field is sorted in descending order (default is
555
+ # $arg sorts: ascending).
553
556
  # $return: The sorted data array
554
557
  function dataSort(data, sorts):
555
558
  return arraySort(data, systemPartial(dataSortCompare, sorts))
@@ -561,7 +564,7 @@ function dataSortCompare(sorts, row1, row2):
561
564
  result = 0
562
565
  for sort in sorts:
563
566
  field = arrayGet(sort, 0)
564
- result = if(arrayGet(sort, 1), \
567
+ result = if(arrayLength(sort) >= 2 && arrayGet(sort, 1), \
565
568
  systemCompare(objectGet(row2, field), objectGet(row1, field)), \
566
569
  systemCompare(objectGet(row1, field), objectGet(row2, field)))
567
570
  if result != 0:
@@ -87,19 +87,26 @@ endfunction
87
87
  # $arg model: The [data table model](model.html#var.vName='DataTable')
88
88
  # $return: The array of Markdown table line strings
89
89
  function dataTableMarkdown(data, model):
90
- # Determine the table fields
90
+ # Determine the table fields - categories first, then the value fields
91
91
  fields = []
92
92
  modelFields = if(model != null, objectGet(model, 'fields'))
93
93
  modelCategories = if(model != null, objectGet(model, 'categories'))
94
- if modelFields != null || modelCategories != null:
95
- if modelCategories != null:
96
- arrayExtend(fields, modelCategories)
97
- endif
98
- if modelFields != null:
99
- arrayExtend(fields, modelFields)
100
- endif
101
- elif arrayLength(data) > 0:
102
- arrayExtend(fields, objectKeys(arrayGet(data, 0)))
94
+ if modelCategories != null:
95
+ arrayExtend(fields, modelCategories)
96
+ endif
97
+ if modelFields != null:
98
+ arrayExtend(fields, modelFields)
99
+ else:
100
+ # Compute the data's fields (union of all row keys), excluding category fields
101
+ fieldNames = {}
102
+ for row in data:
103
+ for field in objectKeys(row):
104
+ if modelCategories == null || arrayIndexOf(modelCategories, field) == -1:
105
+ objectSet(fieldNames, field, null)
106
+ endif
107
+ endfor
108
+ endfor
109
+ arrayExtend(fields, objectKeys(fieldNames))
103
110
  endif
104
111
  if !arrayLength(fields):
105
112
  return null
@@ -118,7 +125,6 @@ function dataTableMarkdown(data, model):
118
125
  endfor
119
126
 
120
127
  # Compute the formatted field value strings and widths
121
- hasDatetimeFormat = precisionDatetime != null
122
128
  dataFormat = []
123
129
  for row in data:
124
130
  rowFormat = {}
@@ -127,10 +133,8 @@ function dataTableMarkdown(data, model):
127
133
  # Format the value (newline regex only on string/other types - numbers and datetimes can't contain newlines)
128
134
  value = objectGet(row, field)
129
135
  valueType = systemType(value)
130
- if valueType == 'number':
131
- valueFormat = numberToFixed(value, precisionNumber, precisionTrim)
132
- elif valueType == 'datetime':
133
- valueFormat = datetimeISOFormat(value, hasDatetimeFormat)
136
+ if valueType == 'number' || valueType == 'datetime':
137
+ valueFormat = dataUtilFormatValue(value, precisionNumber, precisionDatetime, precisionTrim)
134
138
  else:
135
139
  valueFormat = if(valueType == 'string', stringTrim(value), stringNew(value))
136
140
  valueFormat = regexReplace(dataTableMarkdownRegexMultipleNewline, valueFormat, '<br><br>')
@@ -148,7 +152,7 @@ function dataTableMarkdown(data, model):
148
152
  endfor
149
153
  endfor
150
154
 
151
- # Precompute per-field rendering metadata: [field, width, align, header]
155
+ # Precompute per-field rendering metadata: [field, width, align, header, isCategory]
152
156
  fieldMeta = []
153
157
  for field in fields:
154
158
  format = if(formats != null, objectGet(formats, field))
@@ -156,7 +160,8 @@ function dataTableMarkdown(data, model):
156
160
  field, \
157
161
  objectGet(widths, field), \
158
162
  if(format != null, objectGet(format, 'align')), \
159
- if(format != null, objectGet(format, 'header', field), field) \
163
+ if(format != null, objectGet(format, 'header', field), field), \
164
+ modelCategories != null && arrayIndexOf(modelCategories, field) != -1 \
160
165
  ])
161
166
  endfor
162
167
 
@@ -186,14 +191,24 @@ function dataTableMarkdown(data, model):
186
191
  arrayPush(lines, headerFields)
187
192
  arrayPush(lines, headerSeparator)
188
193
 
189
- # Output each row
190
- for row in dataFormat:
194
+ # Output each row, blanking duplicate leading category cell values
195
+ for row, ixRow in dataFormat:
196
+ rowRaw = arrayGet(data, ixRow)
197
+ rowPrevRaw = if(ixRow > 0, arrayGet(data, ixRow - 1))
198
+ skip = rowPrevRaw != null
191
199
  parts = []
192
200
  for meta in fieldMeta:
193
201
  field = arrayGet(meta, 0)
194
202
  width = arrayGet(meta, 1)
195
203
  align = arrayGet(meta, 2)
196
- arrayPush(parts, dataTableMarkdownField(objectGet(row, field), width, align, ' '))
204
+
205
+ # Skip this value? (blank a category cell matching the previous row)
206
+ if skip:
207
+ isCategory = arrayGet(meta, 4)
208
+ skip = isCategory && systemCompare(objectGet(rowRaw, field), objectGet(rowPrevRaw, field)) == 0
209
+ endif
210
+
211
+ arrayPush(parts, dataTableMarkdownField(if(skip, '', objectGet(row, field)), width, align, ' '))
197
212
  endfor
198
213
  arrayPush(lines, '| ' + arrayJoin(parts, ' | ') + ' |')
199
214
  endfor
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bare-script
3
- Version: 4.2.1
3
+ Version: 4.2.3
4
4
  Summary: bare-script
5
5
  Home-page: https://github.com/craigahobbs/bare-script
6
6
  Author: Craig A. Hobbs
@@ -219,10 +219,19 @@ cp SKILL.md .claude/skills/bare-script/SKILL.md
219
219
  Use `~/.claude/skills/bare-script/SKILL.md` instead to make it available across all projects. For
220
220
  other assistants, include the file's contents in your system prompt or rules file.
221
221
 
222
- Once installed, you can prompt the assistant with tasks like:
222
+ Once installed, prompt the assistant with a task like:
223
223
 
224
- > Build a MarkdownUp application that plays tic-tac-toe against the user, with a reset button
225
- > and a running win/loss/draw tally rendered as a bar chart.
224
+ ```
225
+ claude "Build a MarkdownUp application that plays tic-tac-toe against the user, with a reset button and a running win/loss/draw tally rendered as a bar chart. Save it as ticTacToe.md"
226
+ ```
227
+
228
+ To run the resulting MarkdownUp application locally, install the
229
+ [markdown-up](https://pypi.org/project/markdown-up/) viewer and point it at the Markdown file:
230
+
231
+ ```
232
+ pip install markdown-up
233
+ markdown-up ticTacToe.md
234
+ ```
226
235
 
227
236
  The BareScript library is also documented as single-page Markdown, which can be fetched directly
228
237
  into an assistant's context alongside `SKILL.md`:
File without changes
File without changes
File without changes