Show More
@@ -1,17 +1,22 | |||||
1 | // IPython mode is just a slightly altered Python Mode with `?` beeing a extra |
|
1 | // IPython mode is just a slightly altered Python Mode with `?` beeing a extra | |
2 | // single operator. Here we define `ipython` mode in the require `python` |
|
2 | // single operator. Here we define `ipython` mode in the require `python` | |
3 | // callback to auto-load python mode, which is more likely not the best things |
|
3 | // callback to auto-load python mode, which is more likely not the best things | |
4 | // to do, but at least the simple one for now. |
|
4 | // to do, but at least the simple one for now. | |
5 |
|
5 | |||
6 | CodeMirror.requireMode('python',function(){ |
|
6 | CodeMirror.requireMode('python',function(){ | |
7 | "use strict"; |
|
7 | "use strict"; | |
8 |
|
8 | |||
9 | CodeMirror.defineMode("ipython", function(conf, parserConf) { |
|
9 | CodeMirror.defineMode("ipython", function(conf, parserConf) { | |
10 |
|
10 | var pythonConf = {}; | ||
11 | parserConf.singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!\\?]"); |
|
11 | for (var prop in parserConf) { | |
12 | parserConf.name = 'python' |
|
12 | if (parserConf.hasOwnProperty(prop)) { | |
13 | return CodeMirror.getMode(conf, parserConf); |
|
13 | pythonConf[prop] = parserConf[prop]; | |
|
14 | } | |||
|
15 | } | |||
|
16 | pythonConf.name = 'python'; | |||
|
17 | pythonConf.singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!\\?]"); | |||
|
18 | return CodeMirror.getMode(conf, pythonConf); | |||
14 | }, 'python'); |
|
19 | }, 'python'); | |
15 |
|
20 | |||
16 | CodeMirror.defineMIME("text/x-ipython", "ipython"); |
|
21 | CodeMirror.defineMIME("text/x-ipython", "ipython"); | |
17 | }) |
|
22 | }) |
General Comments 0
You need to be logged in to leave comments.
Login now