12
12
//============================================================================
13
13
// [CLASS] PopupComponent
14
14
//============================================================================
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
+
15
50
define ( [
16
51
'text!vp_base/html/component/popupComponent.html!strip' ,
17
52
'css!vp_base/css/component/popupComponent' ,
@@ -25,9 +60,9 @@ define([
25
60
/** codemirror */
26
61
'codemirror/lib/codemirror' ,
27
62
'codemirror/mode/python/python' ,
28
- 'notebook/js/codemirror-ipython' ,
29
63
'codemirror/addon/display/placeholder' ,
30
- 'codemirror/addon/display/autorefresh'
64
+ 'codemirror/addon/display/autorefresh' ,
65
+ 'notebook/js/codemirror-ipython'
31
66
] , function ( popupComponentHtml , popupComponentCss
32
67
, com_util , com_Const , com_String , com_interface , Component , DataSelector , codemirror
33
68
) {
0 commit comments