mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-22 03:35:31 -05:00
* Fix #1997 - Bring pyscript stdlib to the PyEditor
This commit is contained in:
committed by
GitHub
parent
2f3659b676
commit
1447cb3094
2
pyscript.core/test/py-editor/config.toml
Normal file
2
pyscript.core/test/py-editor/config.toml
Normal file
@@ -0,0 +1,2 @@
|
||||
[js_modules.worker]
|
||||
"https://cdn.jsdelivr.net/npm/html-escaper/+esm" = "html_escaper"
|
||||
@@ -7,15 +7,35 @@
|
||||
<script type="module" src="../../dist/core.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="mpy-editor" src="task1.py" env="task1" setup></script>
|
||||
<!-- a setup node with a config for an env -->
|
||||
<script type="mpy-editor" src="task1.py" config="./config.toml" env="task1" setup></script>
|
||||
<script type="mpy-editor" env="task1">
|
||||
print(a)
|
||||
from pyscript.js_modules.html_escaper import escape, unescape
|
||||
print(unescape(escape("<OK>")))
|
||||
a = 1
|
||||
</script>
|
||||
<script type="mpy-editor" env="task2" setup>
|
||||
<!-- a share-nothing micropython editor -->
|
||||
<script type="mpy-editor" config="./config.toml">
|
||||
from pyscript.js_modules.html_escaper import escape, unescape
|
||||
print(unescape(escape("<OK>")))
|
||||
b = 2
|
||||
try:
|
||||
print(a)
|
||||
except:
|
||||
print("all good")
|
||||
</script>
|
||||
<!-- a config once micropython env -->
|
||||
<script type="mpy-editor" env="task2" config="./config.toml">
|
||||
from pyscript.js_modules.html_escaper import escape, unescape
|
||||
print(unescape(escape("<OK>")))
|
||||
c = 3
|
||||
try:
|
||||
print(b)
|
||||
except:
|
||||
print("all good")
|
||||
</script>
|
||||
<script type="mpy-editor" env="task2">
|
||||
print(b)
|
||||
print(c)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
from pyscript import window
|
||||
|
||||
window.console.log("OK")
|
||||
|
||||
a = 1
|
||||
|
||||
Reference in New Issue
Block a user