1212//============================================================================
1313// [CLASS] PopupComponent
1414//============================================================================
15+ // CHROME: notebook/js/codemirror-ipython
16+ ( function ( mod ) {
17+ if ( typeof exports == "object" && typeof module == "object" ) { // CommonJS
18+ mod ( requirejs ( "codemirror/lib/codemirror" ) ,
19+ requirejs ( "codemirror/mode/python/python" )
20+ ) ;
21+ } else if ( typeof define == "function" && define . amd ) { // AMD
22+ define ( 'notebook/js/codemirror-ipython' , [ "codemirror/lib/codemirror" ,
23+ "codemirror/mode/python/python" ] , mod ) ;
24+ } else { // Plain browser env
25+ mod ( CodeMirror ) ;
26+ }
27+ } ) ( function ( CodeMirror ) {
28+ "use strict" ;
29+
30+ CodeMirror . defineMode ( "ipython" , function ( conf , parserConf ) {
31+ var pythonConf = { } ;
32+ for ( var prop in parserConf ) {
33+ if ( parserConf . hasOwnProperty ( prop ) ) {
34+ pythonConf [ prop ] = parserConf [ prop ] ;
35+ }
36+ }
37+ pythonConf . name = 'python' ;
38+ pythonConf . singleOperators = new RegExp ( "^[\\+\\-\\*/%&|@\\^~<>!\\?]" ) ;
39+ if ( pythonConf . version === 3 ) {
40+ pythonConf . identifiers = new RegExp ( "^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*" ) ;
41+ } else if ( pythonConf . version === 2 ) {
42+ pythonConf . identifiers = new RegExp ( "^[_A-Za-z][_A-Za-z0-9]*" ) ;
43+ }
44+ return CodeMirror . getMode ( conf , pythonConf ) ;
45+ } , 'python' ) ;
46+
47+ CodeMirror . defineMIME ( "text/x-ipython" , "ipython" ) ;
48+ } ) ;
49+
1550define ( [
1651 'text!vp_base/html/component/popupComponent.html!strip' ,
1752 'css!vp_base/css/component/popupComponent' ,
@@ -25,9 +60,9 @@ define([
2560 /** codemirror */
2661 'codemirror/lib/codemirror' ,
2762 'codemirror/mode/python/python' ,
28- 'notebook/js/codemirror-ipython' ,
2963 'codemirror/addon/display/placeholder' ,
30- 'codemirror/addon/display/autorefresh'
64+ 'codemirror/addon/display/autorefresh' ,
65+ 'notebook/js/codemirror-ipython'
3166] , function ( popupComponentHtml , popupComponentCss
3267 , com_util , com_Const , com_String , com_interface , Component , DataSelector , codemirror
3368) {
0 commit comments