@@ -66,7 +66,7 @@ <h2>More Information</h2>
6666 var console = document . getElementById ( "console" ) ;
6767 var source = document . getElementById ( "schemascii" ) ;
6868 var style_elem = document . getElementById ( "custom-css" ) ;
69- var schemascii ;
69+ var schemascii_render ;
7070 async function main ( ) {
7171 try {
7272 info ( "Loading Python... " ) ;
@@ -80,7 +80,18 @@ <h2>More Information</h2>
8080 info ( `${ ver } \nInstalling schemascii-${ ver } ... ` ) ;
8181 await pyodide . pyimport ( "micropip" , { errorCallback : error , messageCallback : info } )
8282 . 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+ ` ) ;
8495 await setup ( ) ;
8596 console . textContent = "ready\n" ;
8697 } catch ( e ) {
@@ -108,7 +119,7 @@ <h2>More Information</h2>
108119 console . textContent = "" ;
109120 errors . textContent = "" ;
110121 try {
111- output . innerHTML = await schemascii . render ( "playground" , source . value ) ;
122+ output . innerHTML = await schemascii_render ( "playground" , source . value ) ;
112123 } catch ( e ) {
113124 error ( `\n${ e . stack } \n` ) ;
114125 output . innerHTML = "" ;
0 commit comments