This repository was archived by the owner on Jun 7, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +21
-9
lines changed
Expand file tree Collapse file tree 1 file changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -205,6 +205,7 @@ ActiveCode.prototype.createOutput = function () {
205205 $ ( outDiv ) . addClass ( "ac_output col-md-6" ) ;
206206 this . outDiv = outDiv ;
207207 this . output = document . createElement ( 'pre' ) ;
208+ $ ( this . output ) . css ( "visibility" , "hidden" ) ;
208209
209210 this . graphics = document . createElement ( 'div' ) ;
210211 $ ( this . graphics ) . addClass ( "ac-canvas" ) ;
@@ -567,17 +568,28 @@ ActiveCode.prototype.builtinRead = function (x) {
567568
568569ActiveCode . prototype . outputfun = function ( text ) {
569570 // bnm python 3
570- var x = text ;
571- if ( x . charAt ( 0 ) == '(' ) {
572- x = x . slice ( 1 , - 1 ) ;
573- x = '[' + x + ']' ;
574- try {
575- var xl = eval ( x ) ;
576- xl = xl . map ( pyStr ) ;
577- x = xl . join ( ' ' ) ;
578- } catch ( err ) {
571+ pyStr = function ( x ) {
572+ if ( x instanceof Array ) {
573+ return '[' + x . join ( ", " ) + ']' ;
574+ } else {
575+ return x
576+ }
577+ }
578+
579+ var x = text ;
580+ if ( ! this . python3 ) {
581+ if ( x . charAt ( 0 ) == '(' ) {
582+ x = x . slice ( 1 , - 1 ) ;
583+ x = '[' + x + ']' ;
584+ try {
585+ var xl = eval ( x ) ;
586+ xl = xl . map ( pyStr ) ;
587+ x = xl . join ( ' ' ) ;
588+ } catch ( err ) {
589+ }
579590 }
580591 }
592+ $ ( this . output ) . css ( "visibility" , "visible" ) ;
581593 text = x ;
582594 text = text . replace ( / < / g, "<" ) . replace ( / > / g, ">" ) . replace ( / \n / g, "<br/>" ) ;
583595 $ ( this . output ) . append ( text ) ;
You can’t perform that action at this time.
0 commit comments