@@ -66,7 +66,7 @@ <h2>More Information</h2>
66
66
var console = document . getElementById ( "console" ) ;
67
67
var source = document . getElementById ( "schemascii" ) ;
68
68
var style_elem = document . getElementById ( "custom-css" ) ;
69
- var schemascii ;
69
+ var schemascii_render ;
70
70
async function main ( ) {
71
71
try {
72
72
info ( "Loading Python... " ) ;
@@ -80,7 +80,18 @@ <h2>More Information</h2>
80
80
info ( `${ ver } \nInstalling schemascii-${ ver } ... ` ) ;
81
81
await pyodide . pyimport ( "micropip" , { errorCallback : error , messageCallback : info } )
82
82
. install ( `https://dragoncoder047.github.io/schemascii/dist/schemascii-${ ver } -py3-none-any.whl` ) ;
83
- schemascii = pyodide . pyimport ( "schemascii" ) ;
83
+ schemascii_render = await pyodide . runPythonAsync ( `
84
+ import warnings
85
+ import schemascii
86
+ def foo(*args, **kwargs):
87
+ with warnings.catch_warnings(record=True) as captured_warnings:
88
+ out = schemascii.render(*args, **kwargs)
89
+ for warn in captured_warnings:
90
+ print("warning:", warn.message)
91
+ return out
92
+
93
+ foo
94
+ ` ) ;
84
95
await setup ( ) ;
85
96
console . textContent = "ready\n" ;
86
97
} catch ( e ) {
@@ -108,7 +119,7 @@ <h2>More Information</h2>
108
119
console . textContent = "" ;
109
120
errors . textContent = "" ;
110
121
try {
111
- output . innerHTML = await schemascii . render ( "playground" , source . value ) ;
122
+ output . innerHTML = await schemascii_render ( "playground" , source . value ) ;
112
123
} catch ( e ) {
113
124
error ( `\n${ e . stack } \n` ) ;
114
125
output . innerHTML = "" ;
0 commit comments