Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Book
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MUDE
Book
Commits
673eac03
Commit
673eac03
authored
1 year ago
by
Max Guichard
Browse files
Options
Downloads
Patches
Plain Diff
Read-only cell tag
parent
ab1ed1af
No related branches found
No related tags found
No related merge requests found
Pipeline
#225592
passed
1 year ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
book/_toc.yml
+1
-0
1 addition, 0 deletions
book/_toc.yml
book/cookbook/benchmarks/benchmark_readonly.ipynb
+53
-0
53 additions, 0 deletions
book/cookbook/benchmarks/benchmark_readonly.ipynb
thebe_lite/_static/sphinx-thebe.js
+20
-1
20 additions, 1 deletion
thebe_lite/_static/sphinx-thebe.js
with
74 additions
and
1 deletion
book/_toc.yml
+
1
−
0
View file @
673eac03
...
...
@@ -499,6 +499,7 @@ parts:
-
file
:
cookbook/benchmarks/benchmark_load.ipynb
-
file
:
cookbook/benchmarks/benchmark_noexec.ipynb
-
file
:
cookbook/benchmarks/benchmark_figures.ipynb
-
file
:
cookbook/benchmarks/benchmark_readonly.ipynb
# Coding
-
caption
:
Coding (Last Year)
...
...
This diff is collapsed.
Click to expand it.
book/cookbook/benchmarks/benchmark_readonly.ipynb
0 → 100644
+
53
−
0
View file @
673eac03
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Benchmarks: read only\n",
"\n",
"This page includes benchmarks for the read-only tag. This tag allows you to make code cells read only."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"read-only"
]
},
"outputs": [],
"source": [
"print(\"You can run me, but you can't touch me!\")"
]
}
],
"metadata": {
"celltoolbar": "Tags",
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
},
"vscode": {
"interpreter": {
"hash": "916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
%% Cell type:markdown id: tags:
# Benchmarks: read only
This page includes benchmarks for the read-only tag. This tag allows you to make code cells read only.
%% Cell type:code id: tags:read-only
```
python
print
(
"
You can run me, but you can
'
t touch me!
"
)
```
This diff is collapsed.
Click to expand it.
thebe_lite/_static/sphinx-thebe.js
+
20
−
1
View file @
673eac03
...
...
@@ -386,6 +386,15 @@ function setupSpecialTaggedElements() {
break
;
}
case
"
read-only
"
:
{
const
codemirror
=
taggedElement
.
element
.
querySelector
(
"
.CodeMirror
"
);
codemirror
.
style
.
filter
=
"
brightness(90%)
"
;
const
textarea
=
taggedElement
.
element
.
querySelector
(
"
textarea
"
);
textarea
.
setAttribute
(
"
disabled
"
,
"
true
"
);
break
;
}
default
:
{
console
.
error
(
`Unrecognized special tag:
${
taggedElement
.
tag
}
`
);
}
...
...
@@ -424,6 +433,8 @@ var initThebe = async () => {
modifyDOMForThebe
();
await
thebelab
.
bootstrap
(
thebeLiteConfig
);
setupSpecialTaggedElements
();
document
.
querySelectorAll
(
"
.keep
"
).
forEach
((
kept
,
_
)
=>
{
//console.log(Object.valueskept.previousClasses);
Object
.
values
(
kept
.
previousClasses
).
forEach
((
clas
,
_
)
=>
...
...
@@ -468,7 +479,6 @@ var initThebe = async () => {
code
:
`import ipykernel; ipykernel.version_info = (0,0); import micropip; await micropip.install("ipywidgets")`
,
}).
done
;
updateThebeButtonStatus
(
"
Running pre-intialized cells...
"
);
setupSpecialTaggedElements
();
await
runInitCells
();
...
...
@@ -498,6 +508,13 @@ function handleThebeRemoveInputTag(element) {
element
.
classList
.
add
(
"
tag_thebe-init
"
);
}
function
handleReadOnlyTag
(
element
)
{
window
.
specialTaggedElements
.
push
({
tag
:
"
read-only
"
,
element
:
element
});
}
function
handleDisableExecutionTag
(
element
)
{
$
(
"
.dropdown-launch-buttons
"
).
remove
();
}
...
...
@@ -545,6 +562,7 @@ function consumeSpecialTags() {
{
tag
:
"
auto-execute-page
"
,
handler
:
handleAutoExecuteTag
},
{
tag
:
"
disable-execution-cell
"
,
handler
:
handleDisableExecutionCellTag
},
{
tag
:
"
thebe-remove-input-init
"
,
handler
:
handleThebeRemoveInputTag
},
{
tag
:
"
read-only
"
,
handler
:
handleReadOnlyTag
}
];
window
.
specialTaggedElements
=
[];
...
...
@@ -572,3 +590,4 @@ Promise.all(styleLoading).then(() => {
});
}
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment