bare-script 4.1.5__tar.gz → 4.1.8__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.
- {bare_script-4.1.5/src/bare_script.egg-info → bare_script-4.1.8}/PKG-INFO +1 -1
- {bare_script-4.1.5 → bare_script-4.1.8}/setup.cfg +1 -1
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/include/markdownHighlight.bare +67 -60
- {bare_script-4.1.5 → bare_script-4.1.8/src/bare_script.egg-info}/PKG-INFO +1 -1
- {bare_script-4.1.5 → bare_script-4.1.8}/LICENSE +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/README.md +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/pyproject.toml +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/setup.py +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/__init__.py +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/__main__.py +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/bare.py +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/include/__init__.py +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/include/args.bare +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/include/baredoc.bare +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/include/baredocCLI.bare +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/include/data.bare +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/include/dataLineChart.bare +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/include/dataTable.bare +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/include/dataUtil.bare +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/include/diff.bare +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/include/draw.bare +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/include/elementModel.bare +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/include/forms.bare +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/include/markdown.bare +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/include/markdownElements.bare +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/include/markdownParser.bare +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/include/markdownUp.bare +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/include/pager.bare +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/include/qrcode.bare +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/include/schemaDoc.bare +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/include/unittest.bare +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/include/unittestMock.bare +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/library.py +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/model.py +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/options.py +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/parser.py +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/runtime.py +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/runtime_c.c +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script/value.py +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script.egg-info/SOURCES.txt +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script.egg-info/dependency_links.txt +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script.egg-info/entry_points.txt +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script.egg-info/requires.txt +0 -0
- {bare_script-4.1.5 → bare_script-4.1.8}/src/bare_script.egg-info/top_level.txt +0 -0
|
@@ -165,7 +165,7 @@ function markdownHighlightElements(highlightRegex, lines, options):
|
|
|
165
165
|
# Join the text lines
|
|
166
166
|
text = arrayJoin(lines, '\n') + '\n'
|
|
167
167
|
|
|
168
|
-
# The copy
|
|
168
|
+
# The copy button element
|
|
169
169
|
preAttr = null
|
|
170
170
|
copyElements = null
|
|
171
171
|
if options && objectGet(options, 'copyLinks'):
|
|
@@ -173,82 +173,89 @@ function markdownHighlightElements(highlightRegex, lines, options):
|
|
|
173
173
|
copyLinksIndex = objectGet(options, 'copyLinksIndex', 1)
|
|
174
174
|
objectSet(options, 'copyLinksIndex', copyLinksIndex + 1)
|
|
175
175
|
|
|
176
|
-
# Generate the code block ID and
|
|
176
|
+
# Generate the code block ID and copy button element
|
|
177
177
|
preID = '__markdown_copy_' + copyLinksIndex
|
|
178
|
-
preAttr = {'id': preID, 'style': 'margin-top: 0.
|
|
178
|
+
preAttr = {'id': preID, 'style': 'grid-area: 1 / 1; margin-top: 0; padding-right: 2.5em;'}
|
|
179
179
|
copyElements = { \
|
|
180
|
-
'
|
|
180
|
+
'svg': 'svg', \
|
|
181
181
|
'attr': { \
|
|
182
|
-
'
|
|
182
|
+
'width': '20', \
|
|
183
|
+
'height': '20', \
|
|
184
|
+
'viewBox': '0 0 24 24', \
|
|
185
|
+
'style': 'grid-area: 1 / 1; justify-self: end; align-self: start; margin: 0.4em; cursor: pointer; user-select: none;', \
|
|
186
|
+
'onclick': "window.navigator.clipboard.writeText(document.getElementById('" + preID + "').innerText);" \
|
|
183
187
|
}, \
|
|
184
188
|
'elem': { \
|
|
185
|
-
'
|
|
189
|
+
'svg': 'path', \
|
|
186
190
|
'attr': { \
|
|
187
|
-
'
|
|
188
|
-
|
|
189
|
-
|
|
191
|
+
'fill': 'var(--barescript-color-border)', \
|
|
192
|
+
'd': 'M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z' \
|
|
193
|
+
} \
|
|
190
194
|
} \
|
|
191
195
|
}
|
|
192
196
|
endif
|
|
193
197
|
|
|
194
|
-
#
|
|
198
|
+
# Determine the code element children
|
|
195
199
|
if !highlightRegex:
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
if ixSearch < highlightIndex:
|
|
212
|
-
arrayPush(spans, {'text': stringSlice(text, ixSearch, highlightIndex)})
|
|
213
|
-
endif
|
|
200
|
+
# No language specified or unknown language
|
|
201
|
+
codeChildren = {'text': text}
|
|
202
|
+
else:
|
|
203
|
+
# Match the highlight spans
|
|
204
|
+
codeChildren = []
|
|
205
|
+
ixSearch = 0
|
|
206
|
+
for mHighlight in regexMatchAll(highlightRegex, text):
|
|
207
|
+
matchGroups = objectGet(mHighlight, 'groups')
|
|
208
|
+
highlightText = objectGet(matchGroups, '0')
|
|
209
|
+
highlightIndex = objectGet(mHighlight, 'index')
|
|
210
|
+
|
|
211
|
+
# Add the pre-text span
|
|
212
|
+
if ixSearch < highlightIndex:
|
|
213
|
+
arrayPush(codeChildren, {'text': stringSlice(text, ixSearch, highlightIndex)})
|
|
214
|
+
endif
|
|
214
215
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
216
|
+
# Determine the highlight style from which named group matched
|
|
217
|
+
if objectGet(matchGroups, 'builtin'):
|
|
218
|
+
attrStyle = 'color: var(--barescript-color-highlight-builtin);'
|
|
219
|
+
elif objectGet(matchGroups, 'comment'):
|
|
220
|
+
attrStyle = 'color: var(--barescript-color-highlight-comment);'
|
|
221
|
+
elif objectGet(matchGroups, 'keyword'):
|
|
222
|
+
attrStyle = 'color: var(--barescript-color-highlight-keyword);'
|
|
223
|
+
elif objectGet(matchGroups, 'literal'):
|
|
224
|
+
attrStyle = 'color: var(--barescript-color-highlight-literal);'
|
|
225
|
+
elif objectGet(matchGroups, 'preprocessor'):
|
|
226
|
+
attrStyle = 'color: var(--barescript-color-highlight-preprocessor);'
|
|
227
|
+
elif objectGet(matchGroups, 'string'):
|
|
228
|
+
attrStyle = 'color: var(--barescript-color-highlight-string);'
|
|
229
|
+
elif objectGet(matchGroups, 'tag'):
|
|
230
|
+
attrStyle = 'color: var(--barescript-color-highlight-tag);'
|
|
231
|
+
endif
|
|
231
232
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
233
|
+
# Add the highlight span
|
|
234
|
+
arrayPush(codeChildren, { \
|
|
235
|
+
'html': 'span', \
|
|
236
|
+
'attr': {'style': attrStyle}, \
|
|
237
|
+
'elem': {'text': highlightText} \
|
|
238
|
+
})
|
|
238
239
|
|
|
239
|
-
|
|
240
|
-
|
|
240
|
+
ixSearch = highlightIndex + stringLength(highlightText)
|
|
241
|
+
endfor
|
|
241
242
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
243
|
+
# Add the final un-matched text
|
|
244
|
+
if ixSearch < stringLength(text):
|
|
245
|
+
arrayPush(codeChildren, {'text': stringSlice(text, ixSearch)})
|
|
246
|
+
endif
|
|
245
247
|
endif
|
|
246
248
|
|
|
247
|
-
# Create the code block
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
249
|
+
# Create the code block element, wrapping with the copy button when present
|
|
250
|
+
preElement = {'html': 'pre', 'attr': preAttr, 'elem': {'html': 'code', 'elem': codeChildren}}
|
|
251
|
+
if !copyElements:
|
|
252
|
+
return preElement
|
|
253
|
+
endif
|
|
254
|
+
return { \
|
|
255
|
+
'html': 'div', \
|
|
256
|
+
'attr': {'style': 'display: grid; margin-top: 1em;'}, \
|
|
257
|
+
'elem': [preElement, copyElements] \
|
|
258
|
+
}
|
|
252
259
|
endfunction
|
|
253
260
|
|
|
254
261
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|