Show More
@@ -1,79 +1,80 | |||
|
1 | 1 | //---------------------------------------------------------------------------- |
|
2 | 2 | // Copyright (C) 2012 The IPython Development Team |
|
3 | 3 | // |
|
4 | 4 | // Distributed under the terms of the BSD License. The full license is in |
|
5 | 5 | // the file COPYING, distributed as part of this software. |
|
6 | 6 | //---------------------------------------------------------------------------- |
|
7 | 7 | |
|
8 | 8 | //============================================================================ |
|
9 | 9 | // Notebook |
|
10 | 10 | //============================================================================ |
|
11 | 11 | |
|
12 | 12 | /** |
|
13 | 13 | * @module IPython |
|
14 | 14 | * @namespace IPython |
|
15 | 15 | **/ |
|
16 | 16 | |
|
17 | 17 | var IPython = (function (IPython) { |
|
18 | 18 | "use strict"; |
|
19 | 19 | /** |
|
20 | 20 | * A place where some stuff can be confugured. |
|
21 | 21 | * |
|
22 | 22 | * @class config |
|
23 | 23 | * @static |
|
24 | 24 | * |
|
25 | 25 | **/ |
|
26 | 26 | var default_config = { |
|
27 | 27 | /** |
|
28 | 28 | * Dictionary of object to autodetect highlight mode for code cell. |
|
29 | 29 | * Item of the dictionnary should take the form : |
|
30 | 30 | * |
|
31 | 31 | * key : {'reg':[list_of_regexp]} |
|
32 | 32 | * |
|
33 | 33 | * where `key` will be the code mirror mode name |
|
34 | 34 | * and `list_of_regexp` should be a list of regext that should match |
|
35 | 35 | * the first line of the cell to trigger this mode. |
|
36 | 36 | * |
|
37 | 37 | * if `key` is prefixed by the `magic_` prefix the codemirror `mode` |
|
38 | 38 | * will be applied only at the end of the first line |
|
39 | 39 | * |
|
40 | 40 | * @attribute cell_magic_highlight |
|
41 | 41 | * @example |
|
42 | 42 | * This would trigger javascript mode |
|
43 | 43 | * from the second line if first line start with `%%javascript` or `%%jsmagic` |
|
44 | 44 | * |
|
45 | 45 | * cell_magic_highlight['magic_javascript'] = {'reg':[/^%%javascript/,/^%%jsmagic/]} |
|
46 | 46 | * @example |
|
47 | 47 | * This would trigger javascript mode |
|
48 | 48 | * from the second line if first line start with `var` |
|
49 | 49 | * |
|
50 | 50 | * cell_magic_highlight['javascript'] = {'reg':[/^var/]} |
|
51 | 51 | */ |
|
52 | 52 | cell_magic_highlight : { |
|
53 | 53 | 'magic_javascript':{'reg':[/^%%javascript/]} |
|
54 | 54 | ,'magic_perl' :{'reg':[/^%%perl/]} |
|
55 | 55 | ,'magic_ruby' :{'reg':[/^%%ruby/]} |
|
56 | 56 | ,'magic_python' :{'reg':[/^%%python3?/]} |
|
57 | 57 | ,'magic_shell' :{'reg':[/^%%bash/]} |
|
58 | 58 | ,'magic_r' :{'reg':[/^%%R/]} |
|
59 | ,'magic_text/x-cython' :{'reg':[/^%%cython/]} | |
|
59 | 60 | }, |
|
60 | 61 | |
|
61 | 62 | /** |
|
62 | 63 | * same as `cell_magic_highlight` but for raw cells |
|
63 | 64 | * @attribute raw_cell_highlight |
|
64 | 65 | */ |
|
65 | 66 | raw_cell_highlight : { |
|
66 | 67 | 'diff' :{'reg':[/^diff/]} |
|
67 | 68 | }, |
|
68 | 69 | |
|
69 | 70 | tooltip_on_tab : true, |
|
70 | 71 | }; |
|
71 | 72 | |
|
72 | 73 | // use the same method to merge user configuration |
|
73 | 74 | IPython.config = {}; |
|
74 | 75 | $.extend(IPython.config, default_config); |
|
75 | 76 | |
|
76 | 77 | return IPython; |
|
77 | 78 | |
|
78 | 79 | }(IPython)); |
|
79 | 80 |
General Comments 0
You need to be logged in to leave comments.
Login now