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