Show More
@@ -0,0 +1,5 b'' | |||||
|
1 | @corner_radius: 3px; | |||
|
2 | @notebook_background : white; | |||
|
3 | @cell_selected_background: darken(@notebook_background, 2%); | |||
|
4 | @cell_background: darken(@notebook_background, 3.2%); | |||
|
5 | @border_color: darken(@cell_selected_background, 10%); |
@@ -1,438 +1,444 b'' | |||||
1 | /** |
|
1 | /** | |
2 | * Primary styles |
|
2 | * Primary styles | |
3 | * |
|
3 | * | |
4 | * Author: IPython Development Team |
|
4 | * Author: IPython Development Team | |
5 | */ |
|
5 | */ | |
6 |
|
6 | |||
|
7 | @import "variables.less"; | |||
|
8 | ||||
7 |
|
9 | |||
8 | body { |
|
10 | body { | |
9 | overflow: hidden; |
|
11 | overflow: hidden; | |
10 | } |
|
12 | } | |
11 |
|
13 | |||
12 | blockquote { |
|
14 | blockquote { | |
13 | border-left: 4px solid #DDD; |
|
15 | border-left: 4px solid #DDD; | |
14 | padding: 0 15px; |
|
16 | padding: 0 15px; | |
15 | color: #777; |
|
17 | color: #777; | |
16 | } |
|
18 | } | |
17 |
|
19 | |||
18 | span#save_widget { |
|
20 | span#save_widget { | |
19 | padding: 5px; |
|
21 | padding: 5px; | |
20 | margin: 0px 0px 0px 300px; |
|
22 | margin: 0px 0px 0px 300px; | |
21 | display:inline-block; |
|
23 | display:inline-block; | |
22 | } |
|
24 | } | |
23 |
|
25 | |||
24 | span#notebook_name { |
|
26 | span#notebook_name { | |
25 | height: 1em; |
|
27 | height: 1em; | |
26 | line-height: 1em; |
|
28 | line-height: 1em; | |
27 | padding: 3px; |
|
29 | padding: 3px; | |
28 | border: none; |
|
30 | border: none; | |
29 | font-size: 146.5%; |
|
31 | font-size: 146.5%; | |
30 | } |
|
32 | } | |
31 |
|
33 | |||
32 |
|
34 | |||
33 | .ui-menubar-item .ui-button .ui-button-text { |
|
35 | .ui-menubar-item .ui-button .ui-button-text { | |
34 | padding: 0.4em 1.0em; |
|
36 | padding: 0.4em 1.0em; | |
35 | font-size: 100%; |
|
37 | font-size: 100%; | |
36 | } |
|
38 | } | |
37 |
|
39 | |||
38 | .ui-menu { |
|
40 | .ui-menu { | |
39 | -moz-box-shadow: 0px 6px 10px -1px #adadad; |
|
41 | -moz-box-shadow: 0px 6px 10px -1px #adadad; | |
40 | -webkit-box-shadow: 0px 6px 10px -1px #adadad; |
|
42 | -webkit-box-shadow: 0px 6px 10px -1px #adadad; | |
41 | box-shadow: 0px 6px 10px -1px #adadad; |
|
43 | box-shadow: 0px 6px 10px -1px #adadad; | |
42 | } |
|
44 | } | |
43 |
|
45 | |||
44 | .ui-menu .ui-menu-item a { |
|
46 | .ui-menu .ui-menu-item a { | |
45 | border: 1px solid transparent; |
|
47 | border: 1px solid transparent; | |
46 | padding: 2px 1.6em; |
|
48 | padding: 2px 1.6em; | |
47 | } |
|
49 | } | |
48 |
|
50 | |||
49 | .ui-menu .ui-menu-item a.ui-state-focus { |
|
51 | .ui-menu .ui-menu-item a.ui-state-focus { | |
50 | margin: 0; |
|
52 | margin: 0; | |
51 | } |
|
53 | } | |
52 |
|
54 | |||
53 | .ui-menu hr { |
|
55 | .ui-menu hr { | |
54 | margin: 0.3em 0; |
|
56 | margin: 0.3em 0; | |
55 | } |
|
57 | } | |
56 |
|
58 | |||
57 | #menubar_container { |
|
59 | #menubar_container { | |
58 | position: relative; |
|
60 | position: relative; | |
59 | } |
|
61 | } | |
60 |
|
62 | |||
61 | #notification_area { |
|
63 | #notification_area { | |
62 | position: absolute; |
|
64 | position: absolute; | |
63 | right: 0px; |
|
65 | right: 0px; | |
64 | top: 0px; |
|
66 | top: 0px; | |
65 | height: 25px; |
|
67 | height: 25px; | |
66 | padding: 3px 0px; |
|
68 | padding: 3px 0px; | |
67 | padding-right: 3px; |
|
69 | padding-right: 3px; | |
68 | z-index: 10; |
|
70 | z-index: 10; | |
69 | } |
|
71 | } | |
70 |
|
72 | |||
71 | .notification_widget{ |
|
73 | .notification_widget{ | |
72 | float : right; |
|
74 | float : right; | |
73 | right: 0px; |
|
75 | right: 0px; | |
74 | top: 1px; |
|
76 | top: 1px; | |
75 | height: 25px; |
|
77 | height: 25px; | |
76 | padding: 3px 6px; |
|
78 | padding: 3px 6px; | |
77 | z-index: 10; |
|
79 | z-index: 10; | |
78 | } |
|
80 | } | |
79 |
|
81 | |||
80 | .toolbar { |
|
82 | .toolbar { | |
81 | padding: 3px 15px; |
|
83 | padding: 3px 15px; | |
82 | } |
|
84 | } | |
83 |
|
85 | |||
84 | #maintoolbar > select, #maintoolbar label { |
|
86 | #maintoolbar > select, #maintoolbar label { | |
85 | font-size: 85%; |
|
87 | font-size: 85%; | |
86 | margin-left:0.3em; |
|
88 | margin-left:0.3em; | |
87 | margin-right:0.3em; |
|
89 | margin-right:0.3em; | |
88 |
|
90 | |||
89 | } |
|
91 | } | |
90 |
|
92 | |||
91 |
|
93 | |||
92 | div#main_app { |
|
94 | div#main_app { | |
93 | width: 100%; |
|
95 | width: 100%; | |
94 | position: relative; |
|
96 | position: relative; | |
95 | } |
|
97 | } | |
96 |
|
98 | |||
97 | span#quick_help_area { |
|
99 | span#quick_help_area { | |
98 | position: static; |
|
100 | position: static; | |
99 | padding: 5px 0px; |
|
101 | padding: 5px 0px; | |
100 | margin: 0px 0px 0px 0px; |
|
102 | margin: 0px 0px 0px 0px; | |
101 | } |
|
103 | } | |
102 |
|
104 | |||
103 | .help_string { |
|
105 | .help_string { | |
104 | float: right; |
|
106 | float: right; | |
105 | width: 170px; |
|
107 | width: 170px; | |
106 | padding: 0px 5px; |
|
108 | padding: 0px 5px; | |
107 | text-align: left; |
|
109 | text-align: left; | |
108 | font-size: 85%; |
|
110 | font-size: 85%; | |
109 | } |
|
111 | } | |
110 |
|
112 | |||
111 | .help_string_label { |
|
113 | .help_string_label { | |
112 | float: right; |
|
114 | float: right; | |
113 | font-size: 85%; |
|
115 | font-size: 85%; | |
114 | } |
|
116 | } | |
115 |
|
117 | |||
116 | div#notebook_panel { |
|
118 | div#notebook_panel { | |
117 | margin: 0px 0px 0px 0px; |
|
119 | margin: 0px 0px 0px 0px; | |
118 | padding: 0px; |
|
120 | padding: 0px; | |
119 | } |
|
121 | } | |
120 |
|
122 | |||
121 | div#notebook { |
|
123 | div#notebook { | |
122 | overflow-y: scroll; |
|
124 | overflow-y: scroll; | |
123 | overflow-x: auto; |
|
125 | overflow-x: auto; | |
124 | width: 100%; |
|
126 | width: 100%; | |
125 | /* This spaces the cell away from the edge of the notebook area */ |
|
127 | /* This spaces the cell away from the edge of the notebook area */ | |
126 | padding: 5px 5px 15px 5px; |
|
128 | padding: 5px 5px 15px 5px; | |
127 | margin: 0px; |
|
129 | margin: 0px; | |
128 |
background-color: |
|
130 | background-color: @notebook_background; | |
129 | } |
|
131 | } | |
130 |
|
132 | |||
131 | div#pager_splitter { |
|
133 | div#pager_splitter { | |
132 | height: 8px; |
|
134 | height: 8px; | |
133 | } |
|
135 | } | |
134 |
|
136 | |||
135 | #pager_container { |
|
137 | #pager_container { | |
136 | position : relative; |
|
138 | position : relative; | |
137 | } |
|
139 | } | |
138 |
|
140 | |||
139 | div#pager { |
|
141 | div#pager { | |
140 | padding: 15px; |
|
142 | padding: 15px; | |
141 | overflow: auto; |
|
143 | overflow: auto; | |
142 | display: none; |
|
144 | display: none; | |
143 | } |
|
145 | } | |
144 |
|
146 | |||
145 | div.ui-widget-content { |
|
147 | div.ui-widget-content { | |
146 |
border: 1px solid |
|
148 | border: 1px solid @border_color; | |
147 | outline: none; |
|
149 | outline: none; | |
148 | } |
|
150 | } | |
149 |
|
151 | |||
150 | .cell { |
|
152 | .cell { | |
151 | border: 1px solid transparent; |
|
153 | border: 1px solid transparent; | |
|
154 | ||||
|
155 | &.selected { | |||
|
156 | border-radius: @corner_radius; | |||
|
157 | background-color:@cell_selected_background; | |||
|
158 | border : thin @border_color solid; | |||
|
159 | } | |||
152 | } |
|
160 | } | |
153 |
|
161 | |||
154 | div.cell { |
|
162 | div.cell { | |
155 | width: 100%; |
|
163 | width: 100%; | |
156 | padding: 5px 5px 5px 0px; |
|
164 | padding: 5px 5px 5px 0px; | |
157 | /* This acts as a spacer between cells, that is outside the border */ |
|
165 | /* This acts as a spacer between cells, that is outside the border */ | |
158 | margin: 2px 0px 2px 0px; |
|
166 | margin: 2px 0px 2px 0px; | |
159 | outline: none; |
|
167 | outline: none; | |
160 | } |
|
168 | } | |
161 |
|
169 | |||
162 | div.code_cell { |
|
170 | div.code_cell { | |
163 | background-color: white; |
|
|||
164 | } |
|
171 | } | |
165 |
|
172 | |||
166 | /* any special styling for code cells that are currently running goes here */ |
|
173 | /* any special styling for code cells that are currently running goes here */ | |
167 | div.code_cell.running { |
|
174 | div.code_cell.running { | |
168 | } |
|
175 | } | |
169 |
|
176 | |||
170 | div.prompt { |
|
177 | div.prompt { | |
171 | /* This needs to be wide enough for 3 digit prompt numbers: In[100]: */ |
|
178 | /* This needs to be wide enough for 3 digit prompt numbers: In[100]: */ | |
172 | width: 11ex; |
|
179 | width: 11ex; | |
173 | /* This 0.4em is tuned to match the padding on the CodeMirror editor. */ |
|
180 | /* This 0.4em is tuned to match the padding on the CodeMirror editor. */ | |
174 | padding: 0.4em; |
|
181 | padding: 0.4em; | |
175 | margin: 0px; |
|
182 | margin: 0px; | |
176 | font-family: monospace; |
|
183 | font-family: monospace; | |
177 | text-align: right; |
|
184 | text-align: right; | |
178 | /* This has to match that of the the CodeMirror class line-height below */ |
|
185 | /* This has to match that of the the CodeMirror class line-height below */ | |
179 | line-height: 1.231; |
|
186 | line-height: 1.231; | |
180 | } |
|
187 | } | |
181 |
|
188 | |||
182 | div.input { |
|
189 | div.input { | |
183 | page-break-inside: avoid; |
|
190 | page-break-inside: avoid; | |
184 | } |
|
191 | } | |
185 |
|
192 | |||
186 | /* input_area and input_prompt must match in top border and margin for alignment */ |
|
193 | /* input_area and input_prompt must match in top border and margin for alignment */ | |
187 | div.input_area { |
|
194 | div.input_area { | |
188 | color: black; |
|
195 | color: black; | |
189 |
border: 1px solid |
|
196 | border: 1px solid @border_color; | |
190 |
border-radius: |
|
197 | border-radius: @corner_radius; | |
191 | background: #f7f7f7; |
|
198 | background: @cell_background; | |
192 | } |
|
199 | } | |
193 |
|
200 | |||
194 | div.input_prompt { |
|
201 | div.input_prompt { | |
195 | color: navy; |
|
202 | color: navy; | |
196 | border-top: 1px solid transparent; |
|
203 | border-top: 1px solid transparent; | |
197 | } |
|
204 | } | |
198 |
|
205 | |||
199 | div.output_wrapper { |
|
206 | div.output_wrapper { | |
200 | /* This is a spacer between the input and output of each cell */ |
|
207 | /* This is a spacer between the input and output of each cell */ | |
201 | margin-top: 5px; |
|
208 | margin-top: 5px; | |
202 | margin-left: 5px; |
|
209 | margin-left: 5px; | |
203 | /* FF needs explicit width to stretch */ |
|
210 | /* FF needs explicit width to stretch */ | |
204 | width: 100%; |
|
211 | width: 100%; | |
205 | /* this position must be relative to enable descendents to be absolute within it */ |
|
212 | /* this position must be relative to enable descendents to be absolute within it */ | |
206 | position: relative; |
|
213 | position: relative; | |
207 | } |
|
214 | } | |
208 |
|
215 | |||
209 | /* class for the output area when it should be height-limited */ |
|
216 | /* class for the output area when it should be height-limited */ | |
210 | div.output_scroll { |
|
217 | div.output_scroll { | |
211 | /* ideally, this would be max-height, but FF barfs all over that */ |
|
218 | /* ideally, this would be max-height, but FF barfs all over that */ | |
212 | height: 24em; |
|
219 | height: 24em; | |
213 | /* FF needs this *and the wrapper* to specify full width, or it will shrinkwrap */ |
|
220 | /* FF needs this *and the wrapper* to specify full width, or it will shrinkwrap */ | |
214 | width: 100%; |
|
221 | width: 100%; | |
215 |
|
222 | |||
216 | overflow: auto; |
|
223 | overflow: auto; | |
217 |
border-radius: |
|
224 | border-radius: @corner_radius; | |
218 | box-shadow: inset 0 2px 8px rgba(0, 0, 0, .8); |
|
225 | box-shadow: inset 0 2px 8px rgba(0, 0, 0, .8); | |
219 | } |
|
226 | } | |
220 |
|
227 | |||
221 | /* output div while it is collapsed */ |
|
228 | /* output div while it is collapsed */ | |
222 | div.output_collapsed { |
|
229 | div.output_collapsed { | |
223 | margin-right: 5px; |
|
230 | margin-right: 5px; | |
224 | } |
|
231 | } | |
225 |
|
232 | |||
226 | div.out_prompt_overlay { |
|
233 | div.out_prompt_overlay { | |
227 | height: 100%; |
|
234 | height: 100%; | |
228 | padding: 0px; |
|
235 | padding: 0px; | |
229 | position: absolute; |
|
236 | position: absolute; | |
230 |
border-radius: |
|
237 | border-radius: @corner_radius; | |
231 | } |
|
238 | } | |
232 |
|
239 | |||
233 | div.out_prompt_overlay:hover { |
|
240 | div.out_prompt_overlay:hover { | |
234 | /* use inner shadow to get border that is computed the same on WebKit/FF */ |
|
241 | /* use inner shadow to get border that is computed the same on WebKit/FF */ | |
235 | box-shadow: inset 0 0 1px #000; |
|
242 | box-shadow: inset 0 0 1px #000; | |
236 | background: rgba(240, 240, 240, 0.5); |
|
243 | background: rgba(240, 240, 240, 0.5); | |
237 | } |
|
244 | } | |
238 |
|
245 | |||
239 | div.output_prompt { |
|
246 | div.output_prompt { | |
240 | color: darkred; |
|
247 | color: darkred; | |
241 | /* 5px right shift to account for margin in parent container */ |
|
248 | /* 5px right shift to account for margin in parent container */ | |
242 | margin: 0 5px 0 -5px; |
|
249 | margin: 0 5px 0 -5px; | |
243 | } |
|
250 | } | |
244 |
|
251 | |||
245 | /* This class is the outer container of all output sections. */ |
|
252 | /* This class is the outer container of all output sections. */ | |
246 | div.output_area { |
|
253 | div.output_area { | |
247 | padding: 0px; |
|
254 | padding: 0px; | |
248 | page-break-inside: avoid; |
|
255 | page-break-inside: avoid; | |
249 | } |
|
256 | } | |
250 |
|
257 | |||
251 |
|
258 | |||
252 | /* This is needed to protect the pre formating from global settings such |
|
259 | /* This is needed to protect the pre formating from global settings such | |
253 | as that of bootstrap */ |
|
260 | as that of bootstrap */ | |
254 | div.output_area pre { |
|
261 | div.output_area pre { | |
255 | font-family: monospace; |
|
262 | font-family: monospace; | |
256 | margin: 0; |
|
263 | margin: 0; | |
257 | padding: 0; |
|
264 | padding: 0; | |
258 | border: 0; |
|
265 | border: 0; | |
259 | font-size: 100%; |
|
266 | font-size: 100%; | |
260 | font: inherit; |
|
267 | font: inherit; | |
261 | vertical-align: baseline; |
|
268 | vertical-align: baseline; | |
262 | color: black; |
|
269 | color: black; | |
263 | background-color: white; |
|
270 | background-color: white; | |
264 | } |
|
271 | } | |
265 |
|
272 | |||
266 | /* This class is for the output subarea inside the output_area and after |
|
273 | /* This class is for the output subarea inside the output_area and after | |
267 | the prompt div. */ |
|
274 | the prompt div. */ | |
268 | div.output_subarea { |
|
275 | div.output_subarea { | |
269 | padding: 0.44em 0.4em 0.4em 1px; |
|
276 | padding: 0.44em 0.4em 0.4em 1px; | |
270 | } |
|
277 | } | |
271 |
|
278 | |||
272 | /* The rest of the output_* classes are for special styling of the different |
|
279 | /* The rest of the output_* classes are for special styling of the different | |
273 | output types */ |
|
280 | output types */ | |
274 |
|
281 | |||
275 | /* all text output has this class: */ |
|
282 | /* all text output has this class: */ | |
276 | div.output_text { |
|
283 | div.output_text { | |
277 | text-align: left; |
|
284 | text-align: left; | |
278 | color: black; |
|
285 | color: black; | |
279 | font-family: monospace; |
|
286 | font-family: monospace; | |
280 | /* This has to match that of the the CodeMirror class line-height below */ |
|
287 | /* This has to match that of the the CodeMirror class line-height below */ | |
281 | line-height: 1.231; |
|
288 | line-height: 1.231; | |
282 | } |
|
289 | } | |
283 |
|
290 | |||
284 | /* stdout/stderr are 'text' as well as 'stream', but pyout/pyerr are *not* streams */ |
|
291 | /* stdout/stderr are 'text' as well as 'stream', but pyout/pyerr are *not* streams */ | |
285 | div.output_stream { |
|
292 | div.output_stream { | |
286 | padding-top: 0.0em; |
|
293 | padding-top: 0.0em; | |
287 | padding-bottom: 0.0em; |
|
294 | padding-bottom: 0.0em; | |
288 | } |
|
295 | } | |
289 | div.output_stdout { |
|
296 | div.output_stdout { | |
290 | } |
|
297 | } | |
291 | div.output_stderr { |
|
298 | div.output_stderr { | |
292 | background: #fdd; /* very light red background for stderr */ |
|
299 | background: #fdd; /* very light red background for stderr */ | |
293 | } |
|
300 | } | |
294 |
|
301 | |||
295 | div.output_latex { |
|
302 | div.output_latex { | |
296 | text-align: left; |
|
303 | text-align: left; | |
297 | color: black; |
|
304 | color: black; | |
298 | } |
|
305 | } | |
299 |
|
306 | |||
300 | div.output_html { |
|
307 | div.output_html { | |
301 | } |
|
308 | } | |
302 |
|
309 | |||
303 | div.output_png { |
|
310 | div.output_png { | |
304 | } |
|
311 | } | |
305 |
|
312 | |||
306 | div.output_jpeg { |
|
313 | div.output_jpeg { | |
307 | } |
|
314 | } | |
308 |
|
315 | |||
309 | div.text_cell { |
|
316 | div.text_cell { | |
310 | background-color: white; |
|
|||
311 | padding: 5px 5px 5px 5px; |
|
317 | padding: 5px 5px 5px 5px; | |
312 | } |
|
318 | } | |
313 |
|
319 | |||
314 | div.text_cell_input { |
|
320 | div.text_cell_input { | |
315 | color: black; |
|
321 | color: black; | |
316 |
border: 1px solid |
|
322 | border: 1px solid @border_color; | |
317 |
border-radius: |
|
323 | border-radius: @corner_radius; | |
318 | background: #f7f7f7; |
|
324 | background: @cell_background; | |
319 | } |
|
325 | } | |
320 |
|
326 | |||
321 | div.text_cell_render { |
|
327 | div.text_cell_render { | |
322 | font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif; |
|
328 | font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif; | |
323 | outline: none; |
|
329 | outline: none; | |
324 | resize: none; |
|
330 | resize: none; | |
325 | width: inherit; |
|
331 | width: inherit; | |
326 | border-style: none; |
|
332 | border-style: none; | |
327 | padding: 5px; |
|
333 | padding: 5px; | |
328 | color: black; |
|
334 | color: black; | |
329 | } |
|
335 | } | |
330 |
|
336 | |||
331 | /* The following gets added to the <head> if it is detected that the user has a |
|
337 | /* The following gets added to the <head> if it is detected that the user has a | |
332 | * monospace font with inconsistent normal/bold/italic height. See |
|
338 | * monospace font with inconsistent normal/bold/italic height. See | |
333 | * notebookmain.js. Such fonts will have keywords vertically offset with |
|
339 | * notebookmain.js. Such fonts will have keywords vertically offset with | |
334 | * respect to the rest of the text. The user should select a better font. |
|
340 | * respect to the rest of the text. The user should select a better font. | |
335 | * See: https://github.com/ipython/ipython/issues/1503 |
|
341 | * See: https://github.com/ipython/ipython/issues/1503 | |
336 | * |
|
342 | * | |
337 | * .CodeMirror span { |
|
343 | * .CodeMirror span { | |
338 | * vertical-align: bottom; |
|
344 | * vertical-align: bottom; | |
339 | * } |
|
345 | * } | |
340 | */ |
|
346 | */ | |
341 |
|
347 | |||
342 | .CodeMirror { |
|
348 | .CodeMirror { | |
343 | line-height: 1.231; /* Changed from 1em to our global default */ |
|
349 | line-height: 1.231; /* Changed from 1em to our global default */ | |
344 | } |
|
350 | } | |
345 |
|
351 | |||
346 | .CodeMirror-scroll { |
|
352 | .CodeMirror-scroll { | |
347 | height: auto; /* Changed to auto to autogrow */ |
|
353 | height: auto; /* Changed to auto to autogrow */ | |
348 | /* The CodeMirror docs are a bit fuzzy on if overflow-y should be hidden or visible.*/ |
|
354 | /* The CodeMirror docs are a bit fuzzy on if overflow-y should be hidden or visible.*/ | |
349 | /* We have found that if it is visible, vertical scrollbars appear with font size changes.*/ |
|
355 | /* We have found that if it is visible, vertical scrollbars appear with font size changes.*/ | |
350 | overflow-y: hidden; |
|
356 | overflow-y: hidden; | |
351 | overflow-x: auto; /* Changed from auto to remove scrollbar */ |
|
357 | overflow-x: auto; /* Changed from auto to remove scrollbar */ | |
352 | } |
|
358 | } | |
353 |
|
359 | |||
354 | /* CSS font colors for translated ANSI colors. */ |
|
360 | /* CSS font colors for translated ANSI colors. */ | |
355 |
|
361 | |||
356 |
|
362 | |||
357 | .ansiblack {color: black;} |
|
363 | .ansiblack {color: black;} | |
358 | .ansired {color: darkred;} |
|
364 | .ansired {color: darkred;} | |
359 | .ansigreen {color: darkgreen;} |
|
365 | .ansigreen {color: darkgreen;} | |
360 | .ansiyellow {color: brown;} |
|
366 | .ansiyellow {color: brown;} | |
361 | .ansiblue {color: darkblue;} |
|
367 | .ansiblue {color: darkblue;} | |
362 | .ansipurple {color: darkviolet;} |
|
368 | .ansipurple {color: darkviolet;} | |
363 | .ansicyan {color: steelblue;} |
|
369 | .ansicyan {color: steelblue;} | |
364 | .ansigrey {color: grey;} |
|
370 | .ansigrey {color: grey;} | |
365 | .ansibold {font-weight: bold;} |
|
371 | .ansibold {font-weight: bold;} | |
366 |
|
372 | |||
367 | .completions { |
|
373 | .completions { | |
368 | position: absolute; |
|
374 | position: absolute; | |
369 | z-index: 10; |
|
375 | z-index: 10; | |
370 | overflow: hidden; |
|
376 | overflow: hidden; | |
371 |
border: 1px solid |
|
377 | border: 1px solid @border_color; | |
372 | } |
|
378 | } | |
373 |
|
379 | |||
374 | .completions select { |
|
380 | .completions select { | |
375 | background: white; |
|
381 | background: white; | |
376 | outline: none; |
|
382 | outline: none; | |
377 | border: none; |
|
383 | border: none; | |
378 | padding: 0px; |
|
384 | padding: 0px; | |
379 | margin: 0px; |
|
385 | margin: 0px; | |
380 | overflow: auto; |
|
386 | overflow: auto; | |
381 | font-family: monospace; |
|
387 | font-family: monospace; | |
382 | } |
|
388 | } | |
383 |
|
389 | |||
384 | option.context { |
|
390 | option.context { | |
385 | background-color: #DEF7FF; |
|
391 | background-color: #DEF7FF; | |
386 | } |
|
392 | } | |
387 | option.introspection { |
|
393 | option.introspection { | |
388 | background-color: #EBF4EB; |
|
394 | background-color: #EBF4EB; | |
389 | } |
|
395 | } | |
390 |
|
396 | |||
391 | /*fixed part of the completion*/ |
|
397 | /*fixed part of the completion*/ | |
392 | .completions p b { |
|
398 | .completions p b { | |
393 | font-weight:bold; |
|
399 | font-weight:bold; | |
394 | } |
|
400 | } | |
395 |
|
401 | |||
396 | .completions p { |
|
402 | .completions p { | |
397 | background: #DDF; |
|
403 | background: #DDF; | |
398 | /*outline: none; |
|
404 | /*outline: none; | |
399 | padding: 0px;*/ |
|
405 | padding: 0px;*/ | |
400 | border-bottom: black solid 1px; |
|
406 | border-bottom: black solid 1px; | |
401 | padding: 1px; |
|
407 | padding: 1px; | |
402 | font-family: monospace; |
|
408 | font-family: monospace; | |
403 | } |
|
409 | } | |
404 |
|
410 | |||
405 | pre.dialog { |
|
411 | pre.dialog { | |
406 |
background-color: |
|
412 | background-color: @cell_background; | |
407 | border: 1px solid #ddd; |
|
413 | border: 1px solid #ddd; | |
408 |
border-radius: |
|
414 | border-radius: @corner_radius; | |
409 | padding: 0.4em; |
|
415 | padding: 0.4em; | |
410 | padding-left: 2em; |
|
416 | padding-left: 2em; | |
411 | } |
|
417 | } | |
412 |
|
418 | |||
413 | p.dialog { |
|
419 | p.dialog { | |
414 | padding : 0.2em; |
|
420 | padding : 0.2em; | |
415 | } |
|
421 | } | |
416 |
|
422 | |||
417 | .shortcut_key { |
|
423 | .shortcut_key { | |
418 | display: inline-block; |
|
424 | display: inline-block; | |
419 | width: 15ex; |
|
425 | width: 15ex; | |
420 | text-align: right; |
|
426 | text-align: right; | |
421 | font-family: monospace; |
|
427 | font-family: monospace; | |
422 | } |
|
428 | } | |
423 |
|
429 | |||
424 | .shortcut_descr { |
|
430 | .shortcut_descr { | |
425 | } |
|
431 | } | |
426 |
|
432 | |||
427 | /* Word-wrap output correctly. This is the CSS3 spelling, though Firefox seems |
|
433 | /* Word-wrap output correctly. This is the CSS3 spelling, though Firefox seems | |
428 | to not honor it correctly. Webkit browsers (Chrome, rekonq, Safari) do. |
|
434 | to not honor it correctly. Webkit browsers (Chrome, rekonq, Safari) do. | |
429 | */ |
|
435 | */ | |
430 | pre, code, kbd, samp { white-space: pre-wrap; } |
|
436 | pre, code, kbd, samp { white-space: pre-wrap; } | |
431 |
|
437 | |||
432 | #fonttest { |
|
438 | #fonttest { | |
433 | font-family: monospace; |
|
439 | font-family: monospace; | |
434 | } |
|
440 | } | |
435 |
|
441 | |||
436 | .js-error { |
|
442 | .js-error { | |
437 | color: darkred; |
|
443 | color: darkred; | |
438 | } |
|
444 | } |
@@ -1,314 +1,314 b'' | |||||
1 | //---------------------------------------------------------------------------- |
|
1 | //---------------------------------------------------------------------------- | |
2 | // Copyright (C) 2008-2011 The IPython Development Team |
|
2 | // Copyright (C) 2008-2011 The IPython Development Team | |
3 | // |
|
3 | // | |
4 | // Distributed under the terms of the BSD License. The full license is in |
|
4 | // Distributed under the terms of the BSD License. The full license is in | |
5 | // the file COPYING, distributed as part of this software. |
|
5 | // the file COPYING, distributed as part of this software. | |
6 | //---------------------------------------------------------------------------- |
|
6 | //---------------------------------------------------------------------------- | |
7 |
|
7 | |||
8 | //============================================================================ |
|
8 | //============================================================================ | |
9 | // Cell |
|
9 | // Cell | |
10 | //============================================================================ |
|
10 | //============================================================================ | |
11 | /** |
|
11 | /** | |
12 | * An extendable module that provide base functionnality to create cell for notebook. |
|
12 | * An extendable module that provide base functionnality to create cell for notebook. | |
13 | * @module IPython |
|
13 | * @module IPython | |
14 | * @namespace IPython |
|
14 | * @namespace IPython | |
15 | * @submodule Cell |
|
15 | * @submodule Cell | |
16 | */ |
|
16 | */ | |
17 |
|
17 | |||
18 | var IPython = (function (IPython) { |
|
18 | var IPython = (function (IPython) { | |
19 |
|
19 | |||
20 | var utils = IPython.utils; |
|
20 | var utils = IPython.utils; | |
21 |
|
21 | |||
22 | /** |
|
22 | /** | |
23 | * The Base `Cell` class from which to inherit |
|
23 | * The Base `Cell` class from which to inherit | |
24 | * @class Cell |
|
24 | * @class Cell | |
25 | */ |
|
25 | */ | |
26 |
|
26 | |||
27 | /* |
|
27 | /* | |
28 | * @constructor |
|
28 | * @constructor | |
29 | */ |
|
29 | */ | |
30 | var Cell = function () { |
|
30 | var Cell = function () { | |
31 | this.placeholder = this.placeholder || ''; |
|
31 | this.placeholder = this.placeholder || ''; | |
32 | this.read_only = false; |
|
32 | this.read_only = false; | |
33 | this.selected = false; |
|
33 | this.selected = false; | |
34 | this.element = null; |
|
34 | this.element = null; | |
35 | this.metadata = {}; |
|
35 | this.metadata = {}; | |
36 | // load this from metadata later ? |
|
36 | // load this from metadata later ? | |
37 | this.user_highlight = 'auto'; |
|
37 | this.user_highlight = 'auto'; | |
38 | this.create_element(); |
|
38 | this.create_element(); | |
39 | if (this.element !== null) { |
|
39 | if (this.element !== null) { | |
40 | this.element.data("cell", this); |
|
40 | this.element.data("cell", this); | |
41 | this.bind_events(); |
|
41 | this.bind_events(); | |
42 | } |
|
42 | } | |
43 | this.cell_id = utils.uuid(); |
|
43 | this.cell_id = utils.uuid(); | |
44 | }; |
|
44 | }; | |
45 |
|
45 | |||
46 |
|
46 | |||
47 | /** |
|
47 | /** | |
48 | * Empty. Subclasses must implement create_element. |
|
48 | * Empty. Subclasses must implement create_element. | |
49 | * This should contain all the code to create the DOM element in notebook |
|
49 | * This should contain all the code to create the DOM element in notebook | |
50 | * and will be called by Base Class constructor. |
|
50 | * and will be called by Base Class constructor. | |
51 | * @method create_element |
|
51 | * @method create_element | |
52 | */ |
|
52 | */ | |
53 | Cell.prototype.create_element = function () { |
|
53 | Cell.prototype.create_element = function () { | |
54 | }; |
|
54 | }; | |
55 |
|
55 | |||
56 |
|
56 | |||
57 | /** |
|
57 | /** | |
58 | * Subclasses can implement override bind_events. |
|
58 | * Subclasses can implement override bind_events. | |
59 | * Be carefull to call the parent method when overwriting as it fires event. |
|
59 | * Be carefull to call the parent method when overwriting as it fires event. | |
60 | * this will be triggerd after create_element in constructor. |
|
60 | * this will be triggerd after create_element in constructor. | |
61 | * @method bind_events |
|
61 | * @method bind_events | |
62 | */ |
|
62 | */ | |
63 | Cell.prototype.bind_events = function () { |
|
63 | Cell.prototype.bind_events = function () { | |
64 | var that = this; |
|
64 | var that = this; | |
65 | // We trigger events so that Cell doesn't have to depend on Notebook. |
|
65 | // We trigger events so that Cell doesn't have to depend on Notebook. | |
66 | that.element.click(function (event) { |
|
66 | that.element.click(function (event) { | |
67 | if (that.selected === false) { |
|
67 | if (that.selected === false) { | |
68 | $([IPython.events]).trigger('select.Cell', {'cell':that}); |
|
68 | $([IPython.events]).trigger('select.Cell', {'cell':that}); | |
69 | } |
|
69 | } | |
70 | }); |
|
70 | }); | |
71 | that.element.focusin(function (event) { |
|
71 | that.element.focusin(function (event) { | |
72 | if (that.selected === false) { |
|
72 | if (that.selected === false) { | |
73 | $([IPython.events]).trigger('select.Cell', {'cell':that}); |
|
73 | $([IPython.events]).trigger('select.Cell', {'cell':that}); | |
74 | } |
|
74 | } | |
75 | }); |
|
75 | }); | |
76 | }; |
|
76 | }; | |
77 |
|
77 | |||
78 | /** |
|
78 | /** | |
79 | * Triger typsetting of math by mathjax on current cell element |
|
79 | * Triger typsetting of math by mathjax on current cell element | |
80 | * @method typeset |
|
80 | * @method typeset | |
81 | */ |
|
81 | */ | |
82 | Cell.prototype.typeset = function () { |
|
82 | Cell.prototype.typeset = function () { | |
83 | if (window.MathJax){ |
|
83 | if (window.MathJax){ | |
84 | var cell_math = this.element.get(0); |
|
84 | var cell_math = this.element.get(0); | |
85 | MathJax.Hub.Queue(["Typeset",MathJax.Hub,cell_math]); |
|
85 | MathJax.Hub.Queue(["Typeset",MathJax.Hub,cell_math]); | |
86 | } |
|
86 | } | |
87 | }; |
|
87 | }; | |
88 |
|
88 | |||
89 | /** |
|
89 | /** | |
90 | * should be triggerd when cell is selected |
|
90 | * should be triggerd when cell is selected | |
91 | * @method select |
|
91 | * @method select | |
92 | */ |
|
92 | */ | |
93 | Cell.prototype.select = function () { |
|
93 | Cell.prototype.select = function () { | |
94 |
this.element.addClass(' |
|
94 | this.element.addClass('selected'); | |
95 | this.selected = true; |
|
95 | this.selected = true; | |
96 | }; |
|
96 | }; | |
97 |
|
97 | |||
98 |
|
98 | |||
99 | /** |
|
99 | /** | |
100 | * should be triggerd when cell is unselected |
|
100 | * should be triggerd when cell is unselected | |
101 | * @method unselect |
|
101 | * @method unselect | |
102 | */ |
|
102 | */ | |
103 | Cell.prototype.unselect = function () { |
|
103 | Cell.prototype.unselect = function () { | |
104 |
this.element.removeClass(' |
|
104 | this.element.removeClass('selected'); | |
105 | this.selected = false; |
|
105 | this.selected = false; | |
106 | }; |
|
106 | }; | |
107 |
|
107 | |||
108 | /** |
|
108 | /** | |
109 | * should be overritten by subclass |
|
109 | * should be overritten by subclass | |
110 | * @method get_text |
|
110 | * @method get_text | |
111 | */ |
|
111 | */ | |
112 | Cell.prototype.get_text = function () { |
|
112 | Cell.prototype.get_text = function () { | |
113 | }; |
|
113 | }; | |
114 |
|
114 | |||
115 | /** |
|
115 | /** | |
116 | * should be overritten by subclass |
|
116 | * should be overritten by subclass | |
117 | * @method set_text |
|
117 | * @method set_text | |
118 | * @param {string} text |
|
118 | * @param {string} text | |
119 | */ |
|
119 | */ | |
120 | Cell.prototype.set_text = function (text) { |
|
120 | Cell.prototype.set_text = function (text) { | |
121 | }; |
|
121 | }; | |
122 |
|
122 | |||
123 | /** |
|
123 | /** | |
124 | * Refresh codemirror instance |
|
124 | * Refresh codemirror instance | |
125 | * @method refresh |
|
125 | * @method refresh | |
126 | */ |
|
126 | */ | |
127 | Cell.prototype.refresh = function () { |
|
127 | Cell.prototype.refresh = function () { | |
128 | this.code_mirror.refresh(); |
|
128 | this.code_mirror.refresh(); | |
129 | }; |
|
129 | }; | |
130 |
|
130 | |||
131 |
|
131 | |||
132 | /** |
|
132 | /** | |
133 | * should be overritten by subclass |
|
133 | * should be overritten by subclass | |
134 | * @method edit |
|
134 | * @method edit | |
135 | **/ |
|
135 | **/ | |
136 | Cell.prototype.edit = function () { |
|
136 | Cell.prototype.edit = function () { | |
137 | }; |
|
137 | }; | |
138 |
|
138 | |||
139 |
|
139 | |||
140 | /** |
|
140 | /** | |
141 | * should be overritten by subclass |
|
141 | * should be overritten by subclass | |
142 | * @method render |
|
142 | * @method render | |
143 | **/ |
|
143 | **/ | |
144 | Cell.prototype.render = function () { |
|
144 | Cell.prototype.render = function () { | |
145 | }; |
|
145 | }; | |
146 |
|
146 | |||
147 | /** |
|
147 | /** | |
148 | * should be overritten by subclass |
|
148 | * should be overritten by subclass | |
149 | * serialise cell to json. |
|
149 | * serialise cell to json. | |
150 | * @method toJSON |
|
150 | * @method toJSON | |
151 | **/ |
|
151 | **/ | |
152 | Cell.prototype.toJSON = function () { |
|
152 | Cell.prototype.toJSON = function () { | |
153 | var data = {}; |
|
153 | var data = {}; | |
154 | data.metadata = this.metadata; |
|
154 | data.metadata = this.metadata; | |
155 | return data; |
|
155 | return data; | |
156 | }; |
|
156 | }; | |
157 |
|
157 | |||
158 |
|
158 | |||
159 | /** |
|
159 | /** | |
160 | * should be overritten by subclass |
|
160 | * should be overritten by subclass | |
161 | * @method fromJSON |
|
161 | * @method fromJSON | |
162 | **/ |
|
162 | **/ | |
163 | Cell.prototype.fromJSON = function (data) { |
|
163 | Cell.prototype.fromJSON = function (data) { | |
164 | if (data.metadata !== undefined) { |
|
164 | if (data.metadata !== undefined) { | |
165 | this.metadata = data.metadata; |
|
165 | this.metadata = data.metadata; | |
166 | } |
|
166 | } | |
167 | this.celltoolbar.rebuild(); |
|
167 | this.celltoolbar.rebuild(); | |
168 | }; |
|
168 | }; | |
169 |
|
169 | |||
170 |
|
170 | |||
171 | /** |
|
171 | /** | |
172 | * can the cell be splitted in 2 cells. |
|
172 | * can the cell be splitted in 2 cells. | |
173 | * @method is_splittable |
|
173 | * @method is_splittable | |
174 | **/ |
|
174 | **/ | |
175 | Cell.prototype.is_splittable = function () { |
|
175 | Cell.prototype.is_splittable = function () { | |
176 | return true; |
|
176 | return true; | |
177 | }; |
|
177 | }; | |
178 |
|
178 | |||
179 |
|
179 | |||
180 | /** |
|
180 | /** | |
181 | * @return {String} - the text before the cursor |
|
181 | * @return {String} - the text before the cursor | |
182 | * @method get_pre_cursor |
|
182 | * @method get_pre_cursor | |
183 | **/ |
|
183 | **/ | |
184 | Cell.prototype.get_pre_cursor = function () { |
|
184 | Cell.prototype.get_pre_cursor = function () { | |
185 | var cursor = this.code_mirror.getCursor(); |
|
185 | var cursor = this.code_mirror.getCursor(); | |
186 | var text = this.code_mirror.getRange({line:0,ch:0}, cursor); |
|
186 | var text = this.code_mirror.getRange({line:0,ch:0}, cursor); | |
187 | text = text.replace(/^\n+/, '').replace(/\n+$/, ''); |
|
187 | text = text.replace(/^\n+/, '').replace(/\n+$/, ''); | |
188 | return text; |
|
188 | return text; | |
189 | } |
|
189 | } | |
190 |
|
190 | |||
191 |
|
191 | |||
192 | /** |
|
192 | /** | |
193 | * @return {String} - the text after the cursor |
|
193 | * @return {String} - the text after the cursor | |
194 | * @method get_post_cursor |
|
194 | * @method get_post_cursor | |
195 | **/ |
|
195 | **/ | |
196 | Cell.prototype.get_post_cursor = function () { |
|
196 | Cell.prototype.get_post_cursor = function () { | |
197 | var cursor = this.code_mirror.getCursor(); |
|
197 | var cursor = this.code_mirror.getCursor(); | |
198 | var last_line_num = this.code_mirror.lineCount()-1; |
|
198 | var last_line_num = this.code_mirror.lineCount()-1; | |
199 | var last_line_len = this.code_mirror.getLine(last_line_num).length; |
|
199 | var last_line_len = this.code_mirror.getLine(last_line_num).length; | |
200 | var end = {line:last_line_num, ch:last_line_len} |
|
200 | var end = {line:last_line_num, ch:last_line_len} | |
201 | var text = this.code_mirror.getRange(cursor, end); |
|
201 | var text = this.code_mirror.getRange(cursor, end); | |
202 | text = text.replace(/^\n+/, '').replace(/\n+$/, ''); |
|
202 | text = text.replace(/^\n+/, '').replace(/\n+$/, ''); | |
203 | return text; |
|
203 | return text; | |
204 | }; |
|
204 | }; | |
205 |
|
205 | |||
206 |
|
206 | |||
207 | /** Grow the cell by hand. This is used upon reloading from JSON, when the |
|
207 | /** Grow the cell by hand. This is used upon reloading from JSON, when the | |
208 | * autogrow handler is not called. |
|
208 | * autogrow handler is not called. | |
209 | * |
|
209 | * | |
210 | * could be made static |
|
210 | * could be made static | |
211 | * |
|
211 | * | |
212 | * @param {Dom element} - element |
|
212 | * @param {Dom element} - element | |
213 | * @method grow |
|
213 | * @method grow | |
214 | **/ |
|
214 | **/ | |
215 | Cell.prototype.grow = function(element) { |
|
215 | Cell.prototype.grow = function(element) { | |
216 | var dom = element.get(0); |
|
216 | var dom = element.get(0); | |
217 | var lines_count = 0; |
|
217 | var lines_count = 0; | |
218 | // modified split rule from |
|
218 | // modified split rule from | |
219 | // http://stackoverflow.com/questions/2035910/how-to-get-the-number-of-lines-in-a-textarea/2036424#2036424 |
|
219 | // http://stackoverflow.com/questions/2035910/how-to-get-the-number-of-lines-in-a-textarea/2036424#2036424 | |
220 | var lines = dom.value.split(/\r|\r\n|\n/); |
|
220 | var lines = dom.value.split(/\r|\r\n|\n/); | |
221 | lines_count = lines.length; |
|
221 | lines_count = lines.length; | |
222 | if (lines_count >= 1) { |
|
222 | if (lines_count >= 1) { | |
223 | dom.rows = lines_count; |
|
223 | dom.rows = lines_count; | |
224 | } else { |
|
224 | } else { | |
225 | dom.rows = 1; |
|
225 | dom.rows = 1; | |
226 | } |
|
226 | } | |
227 | }; |
|
227 | }; | |
228 |
|
228 | |||
229 | /** |
|
229 | /** | |
230 | * Toggle CodeMirror LineNumber |
|
230 | * Toggle CodeMirror LineNumber | |
231 | * @method toggle_line_numbers |
|
231 | * @method toggle_line_numbers | |
232 | **/ |
|
232 | **/ | |
233 | Cell.prototype.toggle_line_numbers = function () { |
|
233 | Cell.prototype.toggle_line_numbers = function () { | |
234 | if (this.code_mirror.getOption('lineNumbers') == false) { |
|
234 | if (this.code_mirror.getOption('lineNumbers') == false) { | |
235 | this.code_mirror.setOption('lineNumbers', true); |
|
235 | this.code_mirror.setOption('lineNumbers', true); | |
236 | } else { |
|
236 | } else { | |
237 | this.code_mirror.setOption('lineNumbers', false); |
|
237 | this.code_mirror.setOption('lineNumbers', false); | |
238 | } |
|
238 | } | |
239 | this.code_mirror.refresh(); |
|
239 | this.code_mirror.refresh(); | |
240 | }; |
|
240 | }; | |
241 |
|
241 | |||
242 | /** |
|
242 | /** | |
243 | * force codemirror highlight mode |
|
243 | * force codemirror highlight mode | |
244 | * @method force_highlight |
|
244 | * @method force_highlight | |
245 | * @param {object} - CodeMirror mode |
|
245 | * @param {object} - CodeMirror mode | |
246 | **/ |
|
246 | **/ | |
247 | Cell.prototype.force_highlight = function(mode) { |
|
247 | Cell.prototype.force_highlight = function(mode) { | |
248 | this.user_highlight = mode; |
|
248 | this.user_highlight = mode; | |
249 | this.auto_highlight(); |
|
249 | this.auto_highlight(); | |
250 | }; |
|
250 | }; | |
251 |
|
251 | |||
252 | /** |
|
252 | /** | |
253 | * Try to autodetect cell highlight mode, or use selected mode |
|
253 | * Try to autodetect cell highlight mode, or use selected mode | |
254 | * @methods _auto_highlight |
|
254 | * @methods _auto_highlight | |
255 | * @private |
|
255 | * @private | |
256 | * @param {String|object|undefined} - CodeMirror mode | 'auto' |
|
256 | * @param {String|object|undefined} - CodeMirror mode | 'auto' | |
257 | **/ |
|
257 | **/ | |
258 | Cell.prototype._auto_highlight = function (modes) { |
|
258 | Cell.prototype._auto_highlight = function (modes) { | |
259 | //Here we handle manually selected modes |
|
259 | //Here we handle manually selected modes | |
260 | if( this.user_highlight != undefined && this.user_highlight != 'auto' ) |
|
260 | if( this.user_highlight != undefined && this.user_highlight != 'auto' ) | |
261 | { |
|
261 | { | |
262 | var mode = this.user_highlight; |
|
262 | var mode = this.user_highlight; | |
263 | CodeMirror.autoLoadMode(this.code_mirror, mode); |
|
263 | CodeMirror.autoLoadMode(this.code_mirror, mode); | |
264 | this.code_mirror.setOption('mode', mode); |
|
264 | this.code_mirror.setOption('mode', mode); | |
265 | return; |
|
265 | return; | |
266 | } |
|
266 | } | |
267 | var first_line = this.code_mirror.getLine(0); |
|
267 | var first_line = this.code_mirror.getLine(0); | |
268 | // loop on every pairs |
|
268 | // loop on every pairs | |
269 | for( var mode in modes) { |
|
269 | for( var mode in modes) { | |
270 | var regs = modes[mode]['reg']; |
|
270 | var regs = modes[mode]['reg']; | |
271 | // only one key every time but regexp can't be keys... |
|
271 | // only one key every time but regexp can't be keys... | |
272 | for(var reg in regs ) { |
|
272 | for(var reg in regs ) { | |
273 | // here we handle non magic_modes |
|
273 | // here we handle non magic_modes | |
274 | if(first_line.match(regs[reg]) != null) { |
|
274 | if(first_line.match(regs[reg]) != null) { | |
275 | if (mode.search('magic_') != 0) { |
|
275 | if (mode.search('magic_') != 0) { | |
276 | this.code_mirror.setOption('mode',mode); |
|
276 | this.code_mirror.setOption('mode',mode); | |
277 | CodeMirror.autoLoadMode(this.code_mirror, mode); |
|
277 | CodeMirror.autoLoadMode(this.code_mirror, mode); | |
278 | return; |
|
278 | return; | |
279 | } |
|
279 | } | |
280 | var open = modes[mode]['open']|| "%%"; |
|
280 | var open = modes[mode]['open']|| "%%"; | |
281 | var close = modes[mode]['close']|| "%%end"; |
|
281 | var close = modes[mode]['close']|| "%%end"; | |
282 | var mmode = mode; |
|
282 | var mmode = mode; | |
283 | mode = mmode.substr(6); |
|
283 | mode = mmode.substr(6); | |
284 | CodeMirror.autoLoadMode(this.code_mirror, mode); |
|
284 | CodeMirror.autoLoadMode(this.code_mirror, mode); | |
285 | // create on the fly a mode that swhitch between |
|
285 | // create on the fly a mode that swhitch between | |
286 | // plain/text and smth else otherwise `%%` is |
|
286 | // plain/text and smth else otherwise `%%` is | |
287 | // source of some highlight issues. |
|
287 | // source of some highlight issues. | |
288 | // we use patchedGetMode to circumvent a bug in CM |
|
288 | // we use patchedGetMode to circumvent a bug in CM | |
289 | CodeMirror.defineMode(mmode , function(config) { |
|
289 | CodeMirror.defineMode(mmode , function(config) { | |
290 | return CodeMirror.multiplexingMode( |
|
290 | return CodeMirror.multiplexingMode( | |
291 | CodeMirror.patchedGetMode(config, 'text/plain'), |
|
291 | CodeMirror.patchedGetMode(config, 'text/plain'), | |
292 | // always set someting on close |
|
292 | // always set someting on close | |
293 | {open: open, close: close, |
|
293 | {open: open, close: close, | |
294 | mode: CodeMirror.patchedGetMode(config, mode), |
|
294 | mode: CodeMirror.patchedGetMode(config, mode), | |
295 | delimStyle: "delimit" |
|
295 | delimStyle: "delimit" | |
296 | } |
|
296 | } | |
297 | ); |
|
297 | ); | |
298 | }); |
|
298 | }); | |
299 | this.code_mirror.setOption('mode', mmode); |
|
299 | this.code_mirror.setOption('mode', mmode); | |
300 | return; |
|
300 | return; | |
301 | } |
|
301 | } | |
302 | } |
|
302 | } | |
303 | } |
|
303 | } | |
304 | // fallback on default (python) |
|
304 | // fallback on default (python) | |
305 | var default_mode = this.default_mode || 'text/plain'; |
|
305 | var default_mode = this.default_mode || 'text/plain'; | |
306 | this.code_mirror.setOption('mode', default_mode); |
|
306 | this.code_mirror.setOption('mode', default_mode); | |
307 | }; |
|
307 | }; | |
308 |
|
308 | |||
309 | IPython.Cell = Cell; |
|
309 | IPython.Cell = Cell; | |
310 |
|
310 | |||
311 | return IPython; |
|
311 | return IPython; | |
312 |
|
312 | |||
313 | }(IPython)); |
|
313 | }(IPython)); | |
314 |
|
314 |
General Comments 0
You need to be logged in to leave comments.
Login now