This repository was archived by the owner on Jun 7, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 2020from docutils .parsers .rst import directives
2121from docutils .parsers .rst import Directive
2222from .textfield import *
23- import cgi
23+
24+ try :
25+ from html import escape # py3
26+ except ImportError :
27+ from cgi import escape # py2
2428
2529def setup (app ):
2630 app .add_directive ('activecode' , ActiveCode )
@@ -206,7 +210,7 @@ def run(self):
206210
207211 if self .options ['language' ] == 'html' :
208212 self .options ['language' ] = 'htmlmixed'
209- self .options ['initialcode' ] = cgi . escape (self .options ['initialcode' ])
213+ self .options ['initialcode' ] = escape (self .options ['initialcode' ])
210214
211215 if 'nocodelens' in self .options or self .options ['language' ] != 'python' :
212216 self .options ['codelens' ] = ''
Original file line number Diff line number Diff line change @@ -513,7 +513,7 @@ HTMLActiveCode.prototype.runProg = function () {
513513
514514HTMLActiveCode . prototype . init = function ( opts ) {
515515 ActiveCode . prototype . init . apply ( this , arguments )
516- this . code = $ ( '<textarea />' ) . html ( orig . innerHTML ) . text ( ) ;
516+ this . code = $ ( '<textarea />' ) . html ( this . origElem . innerHTML ) . text ( ) ;
517517 this . editor . setValue ( this . code ) ;
518518 } ;
519519
You can’t perform that action at this time.
0 commit comments