##// END OF EJS Templates
Create ipythongfm mode
Jonathan Frederic -
Show More
@@ -0,0 +1,45 b''
1 // IPython GFM (GitHub Flavored Markdown) mode is just a slightly altered GFM
2 // Mode with support for latex.
3 //
4 // Latex support was supported by Codemirror GFM as of
5 // https://github.com/marijnh/CodeMirror/pull/567
6 // But was later removed in
7 // https://github.com/marijnh/CodeMirror/commit/d9c9f1b1ffe984aee41307f3e927f80d1f23590c
8
9 CodeMirror.requireMode('gfm', function(){
10 CodeMirror.requireMode('stex', function(){
11 console.log('defining custom mode...');
12 CodeMirror.defineMode("ipythongfm", function(config, parserConfig) {
13
14 var gfm_mode = CodeMirror.getMode(config, "gfm");
15 var tex_mode = CodeMirror.getMode(config, "stex");
16
17 return CodeMirror.multiplexingMode(
18 gfm_mode,
19 {
20 open: "$", close: "$",
21 mode: tex_mode,
22 delimStyle: "delimit"
23 },
24 {
25 open: "$$", close: "$$",
26 mode: tex_mode,
27 delimStyle: "delimit"
28 },
29 {
30 open: "\\(", close: "\\)",
31 mode: tex_mode,
32 delimStyle: "delimit"
33 },
34 {
35 open: "\\[", close: "\\]",
36 mode: tex_mode,
37 delimStyle: "delimit"
38 }
39 // .. more multiplexed styles can follow here
40 );
41 }, 'gfm');
42
43 CodeMirror.defineMIME("text/x-ipythongfm", "ipythongfm");
44 });
45 });
@@ -1,458 +1,458 b''
1 //----------------------------------------------------------------------------
1 //----------------------------------------------------------------------------
2 // Copyright (C) 2008-2012 The IPython Development Team
2 // Copyright (C) 2008-2012 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 // TextCell
9 // TextCell
10 //============================================================================
10 //============================================================================
11
11
12
12
13
13
14 /**
14 /**
15 A module that allow to create different type of Text Cell
15 A module that allow to create different type of Text Cell
16 @module IPython
16 @module IPython
17 @namespace IPython
17 @namespace IPython
18 */
18 */
19 var IPython = (function (IPython) {
19 var IPython = (function (IPython) {
20 "use strict";
20 "use strict";
21
21
22 // TextCell base class
22 // TextCell base class
23 var keycodes = IPython.keyboard.keycodes;
23 var keycodes = IPython.keyboard.keycodes;
24 var security = IPython.security;
24 var security = IPython.security;
25
25
26 /**
26 /**
27 * Construct a new TextCell, codemirror mode is by default 'htmlmixed', and cell type is 'text'
27 * Construct a new TextCell, codemirror mode is by default 'htmlmixed', and cell type is 'text'
28 * cell start as not redered.
28 * cell start as not redered.
29 *
29 *
30 * @class TextCell
30 * @class TextCell
31 * @constructor TextCell
31 * @constructor TextCell
32 * @extend IPython.Cell
32 * @extend IPython.Cell
33 * @param {object|undefined} [options]
33 * @param {object|undefined} [options]
34 * @param [options.cm_config] {object} config to pass to CodeMirror, will extend/overwrite default config
34 * @param [options.cm_config] {object} config to pass to CodeMirror, will extend/overwrite default config
35 * @param [options.placeholder] {string} default string to use when souce in empty for rendering (only use in some TextCell subclass)
35 * @param [options.placeholder] {string} default string to use when souce in empty for rendering (only use in some TextCell subclass)
36 */
36 */
37 var TextCell = function (options) {
37 var TextCell = function (options) {
38 // in all TextCell/Cell subclasses
38 // in all TextCell/Cell subclasses
39 // do not assign most of members here, just pass it down
39 // do not assign most of members here, just pass it down
40 // in the options dict potentially overwriting what you wish.
40 // in the options dict potentially overwriting what you wish.
41 // they will be assigned in the base class.
41 // they will be assigned in the base class.
42
42
43 // we cannot put this as a class key as it has handle to "this".
43 // we cannot put this as a class key as it has handle to "this".
44 var cm_overwrite_options = {
44 var cm_overwrite_options = {
45 onKeyEvent: $.proxy(this.handle_keyevent,this)
45 onKeyEvent: $.proxy(this.handle_keyevent,this)
46 };
46 };
47
47
48 options = this.mergeopt(TextCell,options,{cm_config:cm_overwrite_options});
48 options = this.mergeopt(TextCell,options,{cm_config:cm_overwrite_options});
49
49
50 this.cell_type = this.cell_type || 'text';
50 this.cell_type = this.cell_type || 'text';
51
51
52 IPython.Cell.apply(this, [options]);
52 IPython.Cell.apply(this, [options]);
53
53
54 this.rendered = false;
54 this.rendered = false;
55 };
55 };
56
56
57 TextCell.prototype = new IPython.Cell();
57 TextCell.prototype = new IPython.Cell();
58
58
59 TextCell.options_default = {
59 TextCell.options_default = {
60 cm_config : {
60 cm_config : {
61 extraKeys: {"Tab": "indentMore","Shift-Tab" : "indentLess"},
61 extraKeys: {"Tab": "indentMore","Shift-Tab" : "indentLess"},
62 mode: 'htmlmixed',
62 mode: 'htmlmixed',
63 lineWrapping : true,
63 lineWrapping : true,
64 }
64 }
65 };
65 };
66
66
67
67
68 /**
68 /**
69 * Create the DOM element of the TextCell
69 * Create the DOM element of the TextCell
70 * @method create_element
70 * @method create_element
71 * @private
71 * @private
72 */
72 */
73 TextCell.prototype.create_element = function () {
73 TextCell.prototype.create_element = function () {
74 IPython.Cell.prototype.create_element.apply(this, arguments);
74 IPython.Cell.prototype.create_element.apply(this, arguments);
75
75
76 var cell = $("<div>").addClass('cell text_cell border-box-sizing');
76 var cell = $("<div>").addClass('cell text_cell border-box-sizing');
77 cell.attr('tabindex','2');
77 cell.attr('tabindex','2');
78
78
79 var prompt = $('<div/>').addClass('prompt input_prompt');
79 var prompt = $('<div/>').addClass('prompt input_prompt');
80 cell.append(prompt);
80 cell.append(prompt);
81 var inner_cell = $('<div/>').addClass('inner_cell');
81 var inner_cell = $('<div/>').addClass('inner_cell');
82 this.celltoolbar = new IPython.CellToolbar(this);
82 this.celltoolbar = new IPython.CellToolbar(this);
83 inner_cell.append(this.celltoolbar.element);
83 inner_cell.append(this.celltoolbar.element);
84 var input_area = $('<div/>').addClass('input_area');
84 var input_area = $('<div/>').addClass('input_area');
85 this.code_mirror = new CodeMirror(input_area.get(0), this.cm_config);
85 this.code_mirror = new CodeMirror(input_area.get(0), this.cm_config);
86 // The tabindex=-1 makes this div focusable.
86 // The tabindex=-1 makes this div focusable.
87 var render_area = $('<div/>').addClass('text_cell_render border-box-sizing').
87 var render_area = $('<div/>').addClass('text_cell_render border-box-sizing').
88 addClass('rendered_html').attr('tabindex','-1');
88 addClass('rendered_html').attr('tabindex','-1');
89 inner_cell.append(input_area).append(render_area);
89 inner_cell.append(input_area).append(render_area);
90 cell.append(inner_cell);
90 cell.append(inner_cell);
91 this.element = cell;
91 this.element = cell;
92 };
92 };
93
93
94
94
95 /**
95 /**
96 * Bind the DOM evet to cell actions
96 * Bind the DOM evet to cell actions
97 * Need to be called after TextCell.create_element
97 * Need to be called after TextCell.create_element
98 * @private
98 * @private
99 * @method bind_event
99 * @method bind_event
100 */
100 */
101 TextCell.prototype.bind_events = function () {
101 TextCell.prototype.bind_events = function () {
102 IPython.Cell.prototype.bind_events.apply(this);
102 IPython.Cell.prototype.bind_events.apply(this);
103 var that = this;
103 var that = this;
104
104
105 this.element.dblclick(function () {
105 this.element.dblclick(function () {
106 if (that.selected === false) {
106 if (that.selected === false) {
107 $([IPython.events]).trigger('select.Cell', {'cell':that});
107 $([IPython.events]).trigger('select.Cell', {'cell':that});
108 }
108 }
109 var cont = that.unrender();
109 var cont = that.unrender();
110 if (cont) {
110 if (cont) {
111 that.focus_editor();
111 that.focus_editor();
112 }
112 }
113 });
113 });
114 };
114 };
115
115
116 // Cell level actions
116 // Cell level actions
117
117
118 TextCell.prototype.select = function () {
118 TextCell.prototype.select = function () {
119 var cont = IPython.Cell.prototype.select.apply(this);
119 var cont = IPython.Cell.prototype.select.apply(this);
120 if (cont) {
120 if (cont) {
121 if (this.mode === 'edit') {
121 if (this.mode === 'edit') {
122 this.code_mirror.refresh();
122 this.code_mirror.refresh();
123 }
123 }
124 }
124 }
125 return cont;
125 return cont;
126 };
126 };
127
127
128 TextCell.prototype.unrender = function () {
128 TextCell.prototype.unrender = function () {
129 if (this.read_only) return;
129 if (this.read_only) return;
130 var cont = IPython.Cell.prototype.unrender.apply(this);
130 var cont = IPython.Cell.prototype.unrender.apply(this);
131 if (cont) {
131 if (cont) {
132 var text_cell = this.element;
132 var text_cell = this.element;
133 var output = text_cell.find("div.text_cell_render");
133 var output = text_cell.find("div.text_cell_render");
134 output.hide();
134 output.hide();
135 text_cell.find('div.input_area').show();
135 text_cell.find('div.input_area').show();
136 if (this.get_text() === this.placeholder) {
136 if (this.get_text() === this.placeholder) {
137 this.set_text('');
137 this.set_text('');
138 }
138 }
139 this.refresh();
139 this.refresh();
140 }
140 }
141 if (this.celltoolbar.ui_controls_list.length) {
141 if (this.celltoolbar.ui_controls_list.length) {
142 this.celltoolbar.show();
142 this.celltoolbar.show();
143 }
143 }
144 return cont;
144 return cont;
145 };
145 };
146
146
147 TextCell.prototype.execute = function () {
147 TextCell.prototype.execute = function () {
148 this.render();
148 this.render();
149 };
149 };
150
150
151 /**
151 /**
152 * setter: {{#crossLink "TextCell/set_text"}}{{/crossLink}}
152 * setter: {{#crossLink "TextCell/set_text"}}{{/crossLink}}
153 * @method get_text
153 * @method get_text
154 * @retrun {string} CodeMirror current text value
154 * @retrun {string} CodeMirror current text value
155 */
155 */
156 TextCell.prototype.get_text = function() {
156 TextCell.prototype.get_text = function() {
157 return this.code_mirror.getValue();
157 return this.code_mirror.getValue();
158 };
158 };
159
159
160 /**
160 /**
161 * @param {string} text - Codemiror text value
161 * @param {string} text - Codemiror text value
162 * @see TextCell#get_text
162 * @see TextCell#get_text
163 * @method set_text
163 * @method set_text
164 * */
164 * */
165 TextCell.prototype.set_text = function(text) {
165 TextCell.prototype.set_text = function(text) {
166 this.code_mirror.setValue(text);
166 this.code_mirror.setValue(text);
167 this.code_mirror.refresh();
167 this.code_mirror.refresh();
168 };
168 };
169
169
170 /**
170 /**
171 * setter :{{#crossLink "TextCell/set_rendered"}}{{/crossLink}}
171 * setter :{{#crossLink "TextCell/set_rendered"}}{{/crossLink}}
172 * @method get_rendered
172 * @method get_rendered
173 * @return {html} html of rendered element
173 * @return {html} html of rendered element
174 * */
174 * */
175 TextCell.prototype.get_rendered = function() {
175 TextCell.prototype.get_rendered = function() {
176 return this.element.find('div.text_cell_render').html();
176 return this.element.find('div.text_cell_render').html();
177 };
177 };
178
178
179 /**
179 /**
180 * @method set_rendered
180 * @method set_rendered
181 */
181 */
182 TextCell.prototype.set_rendered = function(text) {
182 TextCell.prototype.set_rendered = function(text) {
183 this.element.find('div.text_cell_render').html(text);
183 this.element.find('div.text_cell_render').html(text);
184 this.celltoolbar.hide();
184 this.celltoolbar.hide();
185 };
185 };
186
186
187
187
188 /**
188 /**
189 * Create Text cell from JSON
189 * Create Text cell from JSON
190 * @param {json} data - JSON serialized text-cell
190 * @param {json} data - JSON serialized text-cell
191 * @method fromJSON
191 * @method fromJSON
192 */
192 */
193 TextCell.prototype.fromJSON = function (data) {
193 TextCell.prototype.fromJSON = function (data) {
194 IPython.Cell.prototype.fromJSON.apply(this, arguments);
194 IPython.Cell.prototype.fromJSON.apply(this, arguments);
195 if (data.cell_type === this.cell_type) {
195 if (data.cell_type === this.cell_type) {
196 if (data.source !== undefined) {
196 if (data.source !== undefined) {
197 this.set_text(data.source);
197 this.set_text(data.source);
198 // make this value the starting point, so that we can only undo
198 // make this value the starting point, so that we can only undo
199 // to this state, instead of a blank cell
199 // to this state, instead of a blank cell
200 this.code_mirror.clearHistory();
200 this.code_mirror.clearHistory();
201 // TODO: This HTML needs to be treated as potentially dangerous
201 // TODO: This HTML needs to be treated as potentially dangerous
202 // user input and should be handled before set_rendered.
202 // user input and should be handled before set_rendered.
203 this.set_rendered(data.rendered || '');
203 this.set_rendered(data.rendered || '');
204 this.rendered = false;
204 this.rendered = false;
205 this.render();
205 this.render();
206 }
206 }
207 }
207 }
208 };
208 };
209
209
210 /** Generate JSON from cell
210 /** Generate JSON from cell
211 * @return {object} cell data serialised to json
211 * @return {object} cell data serialised to json
212 */
212 */
213 TextCell.prototype.toJSON = function () {
213 TextCell.prototype.toJSON = function () {
214 var data = IPython.Cell.prototype.toJSON.apply(this);
214 var data = IPython.Cell.prototype.toJSON.apply(this);
215 data.source = this.get_text();
215 data.source = this.get_text();
216 if (data.source == this.placeholder) {
216 if (data.source == this.placeholder) {
217 data.source = "";
217 data.source = "";
218 }
218 }
219 return data;
219 return data;
220 };
220 };
221
221
222
222
223 /**
223 /**
224 * @class MarkdownCell
224 * @class MarkdownCell
225 * @constructor MarkdownCell
225 * @constructor MarkdownCell
226 * @extends IPython.HTMLCell
226 * @extends IPython.HTMLCell
227 */
227 */
228 var MarkdownCell = function (options) {
228 var MarkdownCell = function (options) {
229 options = this.mergeopt(MarkdownCell, options);
229 options = this.mergeopt(MarkdownCell, options);
230
230
231 this.cell_type = 'markdown';
231 this.cell_type = 'markdown';
232 TextCell.apply(this, [options]);
232 TextCell.apply(this, [options]);
233 };
233 };
234
234
235 MarkdownCell.options_default = {
235 MarkdownCell.options_default = {
236 cm_config: {
236 cm_config: {
237 mode: 'gfm'
237 mode: 'ipythongfm'
238 },
238 },
239 placeholder: "Type *Markdown* and LaTeX: $\\alpha^2$"
239 placeholder: "Type *Markdown* and LaTeX: $\\alpha^2$"
240 };
240 };
241
241
242 MarkdownCell.prototype = new TextCell();
242 MarkdownCell.prototype = new TextCell();
243
243
244 /**
244 /**
245 * @method render
245 * @method render
246 */
246 */
247 MarkdownCell.prototype.render = function () {
247 MarkdownCell.prototype.render = function () {
248 var cont = IPython.TextCell.prototype.render.apply(this);
248 var cont = IPython.TextCell.prototype.render.apply(this);
249 if (cont) {
249 if (cont) {
250 var text = this.get_text();
250 var text = this.get_text();
251 var math = null;
251 var math = null;
252 if (text === "") { text = this.placeholder; }
252 if (text === "") { text = this.placeholder; }
253 var text_and_math = IPython.mathjaxutils.remove_math(text);
253 var text_and_math = IPython.mathjaxutils.remove_math(text);
254 text = text_and_math[0];
254 text = text_and_math[0];
255 math = text_and_math[1];
255 math = text_and_math[1];
256 var html = marked.parser(marked.lexer(text));
256 var html = marked.parser(marked.lexer(text));
257 html = IPython.mathjaxutils.replace_math(html, math);
257 html = IPython.mathjaxutils.replace_math(html, math);
258 html = security.sanitize_html(html);
258 html = security.sanitize_html(html);
259 html = $(html);
259 html = $(html);
260 // links in markdown cells should open in new tabs
260 // links in markdown cells should open in new tabs
261 html.find("a[href]").not('[href^="#"]').attr("target", "_blank");
261 html.find("a[href]").not('[href^="#"]').attr("target", "_blank");
262 this.set_rendered(html);
262 this.set_rendered(html);
263 this.element.find('div.input_area').hide();
263 this.element.find('div.input_area').hide();
264 this.element.find("div.text_cell_render").show();
264 this.element.find("div.text_cell_render").show();
265 this.typeset();
265 this.typeset();
266 }
266 }
267 return cont;
267 return cont;
268 };
268 };
269
269
270
270
271 // RawCell
271 // RawCell
272
272
273 /**
273 /**
274 * @class RawCell
274 * @class RawCell
275 * @constructor RawCell
275 * @constructor RawCell
276 * @extends IPython.TextCell
276 * @extends IPython.TextCell
277 */
277 */
278 var RawCell = function (options) {
278 var RawCell = function (options) {
279
279
280 options = this.mergeopt(RawCell,options);
280 options = this.mergeopt(RawCell,options);
281 TextCell.apply(this, [options]);
281 TextCell.apply(this, [options]);
282 this.cell_type = 'raw';
282 this.cell_type = 'raw';
283 // RawCell should always hide its rendered div
283 // RawCell should always hide its rendered div
284 this.element.find('div.text_cell_render').hide();
284 this.element.find('div.text_cell_render').hide();
285 };
285 };
286
286
287 RawCell.options_default = {
287 RawCell.options_default = {
288 placeholder : "Write raw LaTeX or other formats here, for use with nbconvert. " +
288 placeholder : "Write raw LaTeX or other formats here, for use with nbconvert. " +
289 "It will not be rendered in the notebook. " +
289 "It will not be rendered in the notebook. " +
290 "When passing through nbconvert, a Raw Cell's content is added to the output unmodified."
290 "When passing through nbconvert, a Raw Cell's content is added to the output unmodified."
291 };
291 };
292
292
293 RawCell.prototype = new TextCell();
293 RawCell.prototype = new TextCell();
294
294
295 /** @method bind_events **/
295 /** @method bind_events **/
296 RawCell.prototype.bind_events = function () {
296 RawCell.prototype.bind_events = function () {
297 TextCell.prototype.bind_events.apply(this);
297 TextCell.prototype.bind_events.apply(this);
298 var that = this;
298 var that = this;
299 this.element.focusout(function() {
299 this.element.focusout(function() {
300 that.auto_highlight();
300 that.auto_highlight();
301 that.render();
301 that.render();
302 });
302 });
303
303
304 this.code_mirror.on('focus', function() { that.unrender(); });
304 this.code_mirror.on('focus', function() { that.unrender(); });
305 };
305 };
306
306
307 /**
307 /**
308 * Trigger autodetection of highlight scheme for current cell
308 * Trigger autodetection of highlight scheme for current cell
309 * @method auto_highlight
309 * @method auto_highlight
310 */
310 */
311 RawCell.prototype.auto_highlight = function () {
311 RawCell.prototype.auto_highlight = function () {
312 this._auto_highlight(IPython.config.raw_cell_highlight);
312 this._auto_highlight(IPython.config.raw_cell_highlight);
313 };
313 };
314
314
315 /** @method render **/
315 /** @method render **/
316 RawCell.prototype.render = function () {
316 RawCell.prototype.render = function () {
317 var cont = IPython.TextCell.prototype.render.apply(this);
317 var cont = IPython.TextCell.prototype.render.apply(this);
318 if (cont){
318 if (cont){
319 var text = this.get_text();
319 var text = this.get_text();
320 if (text === "") { text = this.placeholder; }
320 if (text === "") { text = this.placeholder; }
321 this.set_text(text);
321 this.set_text(text);
322 this.element.removeClass('rendered');
322 this.element.removeClass('rendered');
323 }
323 }
324 return cont;
324 return cont;
325 };
325 };
326
326
327
327
328 /**
328 /**
329 * @class HeadingCell
329 * @class HeadingCell
330 * @extends IPython.TextCell
330 * @extends IPython.TextCell
331 */
331 */
332
332
333 /**
333 /**
334 * @constructor HeadingCell
334 * @constructor HeadingCell
335 * @extends IPython.TextCell
335 * @extends IPython.TextCell
336 */
336 */
337 var HeadingCell = function (options) {
337 var HeadingCell = function (options) {
338 options = this.mergeopt(HeadingCell, options);
338 options = this.mergeopt(HeadingCell, options);
339
339
340 this.level = 1;
340 this.level = 1;
341 this.cell_type = 'heading';
341 this.cell_type = 'heading';
342 TextCell.apply(this, [options]);
342 TextCell.apply(this, [options]);
343
343
344 /**
344 /**
345 * heading level of the cell, use getter and setter to access
345 * heading level of the cell, use getter and setter to access
346 * @property level
346 * @property level
347 */
347 */
348 };
348 };
349
349
350 HeadingCell.options_default = {
350 HeadingCell.options_default = {
351 placeholder: "Type Heading Here"
351 placeholder: "Type Heading Here"
352 };
352 };
353
353
354 HeadingCell.prototype = new TextCell();
354 HeadingCell.prototype = new TextCell();
355
355
356 /** @method fromJSON */
356 /** @method fromJSON */
357 HeadingCell.prototype.fromJSON = function (data) {
357 HeadingCell.prototype.fromJSON = function (data) {
358 if (data.level !== undefined){
358 if (data.level !== undefined){
359 this.level = data.level;
359 this.level = data.level;
360 }
360 }
361 TextCell.prototype.fromJSON.apply(this, arguments);
361 TextCell.prototype.fromJSON.apply(this, arguments);
362 };
362 };
363
363
364
364
365 /** @method toJSON */
365 /** @method toJSON */
366 HeadingCell.prototype.toJSON = function () {
366 HeadingCell.prototype.toJSON = function () {
367 var data = TextCell.prototype.toJSON.apply(this);
367 var data = TextCell.prototype.toJSON.apply(this);
368 data.level = this.get_level();
368 data.level = this.get_level();
369 return data;
369 return data;
370 };
370 };
371
371
372 /**
372 /**
373 * can the cell be split into two cells
373 * can the cell be split into two cells
374 * @method is_splittable
374 * @method is_splittable
375 **/
375 **/
376 HeadingCell.prototype.is_splittable = function () {
376 HeadingCell.prototype.is_splittable = function () {
377 return false;
377 return false;
378 };
378 };
379
379
380
380
381 /**
381 /**
382 * can the cell be merged with other cells
382 * can the cell be merged with other cells
383 * @method is_mergeable
383 * @method is_mergeable
384 **/
384 **/
385 HeadingCell.prototype.is_mergeable = function () {
385 HeadingCell.prototype.is_mergeable = function () {
386 return false;
386 return false;
387 };
387 };
388
388
389 /**
389 /**
390 * Change heading level of cell, and re-render
390 * Change heading level of cell, and re-render
391 * @method set_level
391 * @method set_level
392 */
392 */
393 HeadingCell.prototype.set_level = function (level) {
393 HeadingCell.prototype.set_level = function (level) {
394 this.level = level;
394 this.level = level;
395 if (this.rendered) {
395 if (this.rendered) {
396 this.rendered = false;
396 this.rendered = false;
397 this.render();
397 this.render();
398 }
398 }
399 };
399 };
400
400
401 /** The depth of header cell, based on html (h1 to h6)
401 /** The depth of header cell, based on html (h1 to h6)
402 * @method get_level
402 * @method get_level
403 * @return {integer} level - for 1 to 6
403 * @return {integer} level - for 1 to 6
404 */
404 */
405 HeadingCell.prototype.get_level = function () {
405 HeadingCell.prototype.get_level = function () {
406 return this.level;
406 return this.level;
407 };
407 };
408
408
409
409
410 HeadingCell.prototype.get_rendered = function () {
410 HeadingCell.prototype.get_rendered = function () {
411 var r = this.element.find("div.text_cell_render");
411 var r = this.element.find("div.text_cell_render");
412 return r.children().first().html();
412 return r.children().first().html();
413 };
413 };
414
414
415
415
416 HeadingCell.prototype.render = function () {
416 HeadingCell.prototype.render = function () {
417 var cont = IPython.TextCell.prototype.render.apply(this);
417 var cont = IPython.TextCell.prototype.render.apply(this);
418 if (cont) {
418 if (cont) {
419 var text = this.get_text();
419 var text = this.get_text();
420 var math = null;
420 var math = null;
421 // Markdown headings must be a single line
421 // Markdown headings must be a single line
422 text = text.replace(/\n/g, ' ');
422 text = text.replace(/\n/g, ' ');
423 if (text === "") { text = this.placeholder; }
423 if (text === "") { text = this.placeholder; }
424 text = Array(this.level + 1).join("#") + " " + text;
424 text = Array(this.level + 1).join("#") + " " + text;
425 var text_and_math = IPython.mathjaxutils.remove_math(text);
425 var text_and_math = IPython.mathjaxutils.remove_math(text);
426 text = text_and_math[0];
426 text = text_and_math[0];
427 math = text_and_math[1];
427 math = text_and_math[1];
428 var html = marked.parser(marked.lexer(text));
428 var html = marked.parser(marked.lexer(text));
429 html = IPython.mathjaxutils.replace_math(html, math);
429 html = IPython.mathjaxutils.replace_math(html, math);
430 html = security.sanitize_html(html);
430 html = security.sanitize_html(html);
431 var h = $(html);
431 var h = $(html);
432 // add id and linkback anchor
432 // add id and linkback anchor
433 var hash = h.text().replace(/ /g, '-');
433 var hash = h.text().replace(/ /g, '-');
434 h.attr('id', hash);
434 h.attr('id', hash);
435 h.append(
435 h.append(
436 $('<a/>')
436 $('<a/>')
437 .addClass('anchor-link')
437 .addClass('anchor-link')
438 .attr('href', '#' + hash)
438 .attr('href', '#' + hash)
439 .text('ΒΆ')
439 .text('ΒΆ')
440 );
440 );
441 this.set_rendered(h);
441 this.set_rendered(h);
442 this.element.find('div.input_area').hide();
442 this.element.find('div.input_area').hide();
443 this.element.find("div.text_cell_render").show();
443 this.element.find("div.text_cell_render").show();
444 this.typeset();
444 this.typeset();
445 }
445 }
446 return cont;
446 return cont;
447 };
447 };
448
448
449 IPython.TextCell = TextCell;
449 IPython.TextCell = TextCell;
450 IPython.MarkdownCell = MarkdownCell;
450 IPython.MarkdownCell = MarkdownCell;
451 IPython.RawCell = RawCell;
451 IPython.RawCell = RawCell;
452 IPython.HeadingCell = HeadingCell;
452 IPython.HeadingCell = HeadingCell;
453
453
454
454
455 return IPython;
455 return IPython;
456
456
457 }(IPython));
457 }(IPython));
458
458
@@ -1,362 +1,363 b''
1 {% extends "page.html" %}
1 {% extends "page.html" %}
2
2
3 {% block stylesheet %}
3 {% block stylesheet %}
4
4
5 {% if mathjax_url %}
5 {% if mathjax_url %}
6 <script type="text/javascript" src="{{mathjax_url}}?config=TeX-AMS_HTML-full&delayStartupUntil=configured" charset="utf-8"></script>
6 <script type="text/javascript" src="{{mathjax_url}}?config=TeX-AMS_HTML-full&delayStartupUntil=configured" charset="utf-8"></script>
7 {% endif %}
7 {% endif %}
8 <script type="text/javascript">
8 <script type="text/javascript">
9 // MathJax disabled, set as null to distingish from *missing* MathJax,
9 // MathJax disabled, set as null to distingish from *missing* MathJax,
10 // where it will be undefined, and should prompt a dialog later.
10 // where it will be undefined, and should prompt a dialog later.
11 window.mathjax_url = "{{mathjax_url}}";
11 window.mathjax_url = "{{mathjax_url}}";
12 </script>
12 </script>
13
13
14 <link rel="stylesheet" href="{{ static_url("components/bootstrap-tour/build/css/bootstrap-tour.min.css") }}" type="text/css" />
14 <link rel="stylesheet" href="{{ static_url("components/bootstrap-tour/build/css/bootstrap-tour.min.css") }}" type="text/css" />
15 <link rel="stylesheet" href="{{ static_url("components/codemirror/lib/codemirror.css") }}">
15 <link rel="stylesheet" href="{{ static_url("components/codemirror/lib/codemirror.css") }}">
16
16
17 {{super()}}
17 {{super()}}
18
18
19 <link rel="stylesheet" href="{{ static_url("notebook/css/override.css") }}" type="text/css" />
19 <link rel="stylesheet" href="{{ static_url("notebook/css/override.css") }}" type="text/css" />
20
20
21 {% endblock %}
21 {% endblock %}
22
22
23 {% block params %}
23 {% block params %}
24
24
25 data-project="{{project}}"
25 data-project="{{project}}"
26 data-base-url="{{base_url}}"
26 data-base-url="{{base_url}}"
27 data-notebook-name="{{notebook_name}}"
27 data-notebook-name="{{notebook_name}}"
28 data-notebook-path="{{notebook_path}}"
28 data-notebook-path="{{notebook_path}}"
29 class="notebook_app"
29 class="notebook_app"
30
30
31 {% endblock %}
31 {% endblock %}
32
32
33
33
34 {% block header %}
34 {% block header %}
35
35
36 <span id="save_widget" class="nav pull-left">
36 <span id="save_widget" class="nav pull-left">
37 <span id="notebook_name"></span>
37 <span id="notebook_name"></span>
38 <span id="checkpoint_status"></span>
38 <span id="checkpoint_status"></span>
39 <span id="autosave_status"></span>
39 <span id="autosave_status"></span>
40 </span>
40 </span>
41
41
42 {% endblock %}
42 {% endblock %}
43
43
44
44
45 {% block site %}
45 {% block site %}
46
46
47 <div id="menubar-container" class="container">
47 <div id="menubar-container" class="container">
48 <div id="menubar">
48 <div id="menubar">
49 <div class="navbar">
49 <div class="navbar">
50 <div class="navbar-inner">
50 <div class="navbar-inner">
51 <div class="container">
51 <div class="container">
52 <ul id="menus" class="nav">
52 <ul id="menus" class="nav">
53 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">File</a>
53 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">File</a>
54 <ul id="file_menu" class="dropdown-menu">
54 <ul id="file_menu" class="dropdown-menu">
55 <li id="new_notebook"
55 <li id="new_notebook"
56 title="Make a new notebook (Opens a new window)">
56 title="Make a new notebook (Opens a new window)">
57 <a href="#">New</a></li>
57 <a href="#">New</a></li>
58 <li id="open_notebook"
58 <li id="open_notebook"
59 title="Opens a new window with the Dashboard view">
59 title="Opens a new window with the Dashboard view">
60 <a href="#">Open...</a></li>
60 <a href="#">Open...</a></li>
61 <!-- <hr/> -->
61 <!-- <hr/> -->
62 <li class="divider"></li>
62 <li class="divider"></li>
63 <li id="copy_notebook"
63 <li id="copy_notebook"
64 title="Open a copy of this notebook's contents and start a new kernel">
64 title="Open a copy of this notebook's contents and start a new kernel">
65 <a href="#">Make a Copy...</a></li>
65 <a href="#">Make a Copy...</a></li>
66 <li id="rename_notebook"><a href="#">Rename...</a></li>
66 <li id="rename_notebook"><a href="#">Rename...</a></li>
67 <li id="save_checkpoint"><a href="#">Save and Checkpoint</a></li>
67 <li id="save_checkpoint"><a href="#">Save and Checkpoint</a></li>
68 <!-- <hr/> -->
68 <!-- <hr/> -->
69 <li class="divider"></li>
69 <li class="divider"></li>
70 <li id="restore_checkpoint" class="dropdown-submenu"><a href="#">Revert to Checkpoint</a>
70 <li id="restore_checkpoint" class="dropdown-submenu"><a href="#">Revert to Checkpoint</a>
71 <ul class="dropdown-menu">
71 <ul class="dropdown-menu">
72 <li><a href="#"></a></li>
72 <li><a href="#"></a></li>
73 <li><a href="#"></a></li>
73 <li><a href="#"></a></li>
74 <li><a href="#"></a></li>
74 <li><a href="#"></a></li>
75 <li><a href="#"></a></li>
75 <li><a href="#"></a></li>
76 <li><a href="#"></a></li>
76 <li><a href="#"></a></li>
77 </ul>
77 </ul>
78 </li>
78 </li>
79 <li class="divider"></li>
79 <li class="divider"></li>
80 <li id="print_preview"><a href="#">Print Preview</a></li>
80 <li id="print_preview"><a href="#">Print Preview</a></li>
81 <li class="dropdown-submenu"><a href="#">Download as</a>
81 <li class="dropdown-submenu"><a href="#">Download as</a>
82 <ul class="dropdown-menu">
82 <ul class="dropdown-menu">
83 <li id="download_ipynb"><a href="#">IPython Notebook (.ipynb)</a></li>
83 <li id="download_ipynb"><a href="#">IPython Notebook (.ipynb)</a></li>
84 <li id="download_py"><a href="#">Python (.py)</a></li>
84 <li id="download_py"><a href="#">Python (.py)</a></li>
85 <li id="download_html"><a href="#">HTML (.html)</a></li>
85 <li id="download_html"><a href="#">HTML (.html)</a></li>
86 <li id="download_rst"><a href="#">reST (.rst)</a></li>
86 <li id="download_rst"><a href="#">reST (.rst)</a></li>
87 <li id="download_pdf"><a href="#">PDF (.pdf)</a></li>
87 <li id="download_pdf"><a href="#">PDF (.pdf)</a></li>
88 </ul>
88 </ul>
89 </li>
89 </li>
90 <li class="divider"></li>
90 <li class="divider"></li>
91 <li id="trust_notebook"
91 <li id="trust_notebook"
92 title="Trust the output of this notebook">
92 title="Trust the output of this notebook">
93 <a href="#" >Trust Notebook</a></li>
93 <a href="#" >Trust Notebook</a></li>
94 <li class="divider"></li>
94 <li class="divider"></li>
95 <li id="kill_and_exit"
95 <li id="kill_and_exit"
96 title="Shutdown this notebook's kernel, and close this window">
96 title="Shutdown this notebook's kernel, and close this window">
97 <a href="#" >Close and halt</a></li>
97 <a href="#" >Close and halt</a></li>
98 </ul>
98 </ul>
99 </li>
99 </li>
100 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Edit</a>
100 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Edit</a>
101 <ul id="edit_menu" class="dropdown-menu">
101 <ul id="edit_menu" class="dropdown-menu">
102 <li id="cut_cell"><a href="#">Cut Cell</a></li>
102 <li id="cut_cell"><a href="#">Cut Cell</a></li>
103 <li id="copy_cell"><a href="#">Copy Cell</a></li>
103 <li id="copy_cell"><a href="#">Copy Cell</a></li>
104 <li id="paste_cell_above" class="disabled"><a href="#">Paste Cell Above</a></li>
104 <li id="paste_cell_above" class="disabled"><a href="#">Paste Cell Above</a></li>
105 <li id="paste_cell_below" class="disabled"><a href="#">Paste Cell Below</a></li>
105 <li id="paste_cell_below" class="disabled"><a href="#">Paste Cell Below</a></li>
106 <li id="paste_cell_replace" class="disabled"><a href="#">Paste Cell &amp; Replace</a></li>
106 <li id="paste_cell_replace" class="disabled"><a href="#">Paste Cell &amp; Replace</a></li>
107 <li id="delete_cell"><a href="#">Delete Cell</a></li>
107 <li id="delete_cell"><a href="#">Delete Cell</a></li>
108 <li id="undelete_cell" class="disabled"><a href="#">Undo Delete Cell</a></li>
108 <li id="undelete_cell" class="disabled"><a href="#">Undo Delete Cell</a></li>
109 <li class="divider"></li>
109 <li class="divider"></li>
110 <li id="split_cell"><a href="#">Split Cell</a></li>
110 <li id="split_cell"><a href="#">Split Cell</a></li>
111 <li id="merge_cell_above"><a href="#">Merge Cell Above</a></li>
111 <li id="merge_cell_above"><a href="#">Merge Cell Above</a></li>
112 <li id="merge_cell_below"><a href="#">Merge Cell Below</a></li>
112 <li id="merge_cell_below"><a href="#">Merge Cell Below</a></li>
113 <li class="divider"></li>
113 <li class="divider"></li>
114 <li id="move_cell_up"><a href="#">Move Cell Up</a></li>
114 <li id="move_cell_up"><a href="#">Move Cell Up</a></li>
115 <li id="move_cell_down"><a href="#">Move Cell Down</a></li>
115 <li id="move_cell_down"><a href="#">Move Cell Down</a></li>
116 <li class="divider"></li>
116 <li class="divider"></li>
117 <li id="edit_nb_metadata"><a href="#">Edit Notebook Metadata</a></li>
117 <li id="edit_nb_metadata"><a href="#">Edit Notebook Metadata</a></li>
118 </ul>
118 </ul>
119 </li>
119 </li>
120 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">View</a>
120 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">View</a>
121 <ul id="view_menu" class="dropdown-menu">
121 <ul id="view_menu" class="dropdown-menu">
122 <li id="toggle_header"
122 <li id="toggle_header"
123 title="Show/Hide the IPython Notebook logo and notebook title (above menu bar)">
123 title="Show/Hide the IPython Notebook logo and notebook title (above menu bar)">
124 <a href="#">Toggle Header</a></li>
124 <a href="#">Toggle Header</a></li>
125 <li id="toggle_toolbar"
125 <li id="toggle_toolbar"
126 title="Show/Hide the action icons (below menu bar)">
126 title="Show/Hide the action icons (below menu bar)">
127 <a href="#">Toggle Toolbar</a></li>
127 <a href="#">Toggle Toolbar</a></li>
128 </ul>
128 </ul>
129 </li>
129 </li>
130 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Insert</a>
130 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Insert</a>
131 <ul id="insert_menu" class="dropdown-menu">
131 <ul id="insert_menu" class="dropdown-menu">
132 <li id="insert_cell_above"
132 <li id="insert_cell_above"
133 title="Insert an empty Code cell above the currently active cell">
133 title="Insert an empty Code cell above the currently active cell">
134 <a href="#">Insert Cell Above</a></li>
134 <a href="#">Insert Cell Above</a></li>
135 <li id="insert_cell_below"
135 <li id="insert_cell_below"
136 title="Insert an empty Code cell below the currently active cell">
136 title="Insert an empty Code cell below the currently active cell">
137 <a href="#">Insert Cell Below</a></li>
137 <a href="#">Insert Cell Below</a></li>
138 </ul>
138 </ul>
139 </li>
139 </li>
140 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Cell</a>
140 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Cell</a>
141 <ul id="cell_menu" class="dropdown-menu">
141 <ul id="cell_menu" class="dropdown-menu">
142 <li id="run_cell" title="Run this cell, and move cursor to the next one">
142 <li id="run_cell" title="Run this cell, and move cursor to the next one">
143 <a href="#">Run</a></li>
143 <a href="#">Run</a></li>
144 <li id="run_cell_select_below" title="Run this cell, select below">
144 <li id="run_cell_select_below" title="Run this cell, select below">
145 <a href="#">Run and Select Below</a></li>
145 <a href="#">Run and Select Below</a></li>
146 <li id="run_cell_insert_below" title="Run this cell, insert below">
146 <li id="run_cell_insert_below" title="Run this cell, insert below">
147 <a href="#">Run and Insert Below</a></li>
147 <a href="#">Run and Insert Below</a></li>
148 <li id="run_all_cells" title="Run all cells in the notebook">
148 <li id="run_all_cells" title="Run all cells in the notebook">
149 <a href="#">Run All</a></li>
149 <a href="#">Run All</a></li>
150 <li id="run_all_cells_above" title="Run all cells above (but not including) this cell">
150 <li id="run_all_cells_above" title="Run all cells above (but not including) this cell">
151 <a href="#">Run All Above</a></li>
151 <a href="#">Run All Above</a></li>
152 <li id="run_all_cells_below" title="Run this cell and all cells below it">
152 <li id="run_all_cells_below" title="Run this cell and all cells below it">
153 <a href="#">Run All Below</a></li>
153 <a href="#">Run All Below</a></li>
154 <li class="divider"></li>
154 <li class="divider"></li>
155 <li id="change_cell_type" class="dropdown-submenu"
155 <li id="change_cell_type" class="dropdown-submenu"
156 title="All cells in the notebook have a cell type. By default, new cells are created as 'Code' cells">
156 title="All cells in the notebook have a cell type. By default, new cells are created as 'Code' cells">
157 <a href="#">Cell Type</a>
157 <a href="#">Cell Type</a>
158 <ul class="dropdown-menu">
158 <ul class="dropdown-menu">
159 <li id="to_code"
159 <li id="to_code"
160 title="Contents will be sent to the kernel for execution, and output will display in the footer of cell">
160 title="Contents will be sent to the kernel for execution, and output will display in the footer of cell">
161 <a href="#">Code</a></li>
161 <a href="#">Code</a></li>
162 <li id="to_markdown"
162 <li id="to_markdown"
163 title="Contents will be rendered as HTML and serve as explanatory text">
163 title="Contents will be rendered as HTML and serve as explanatory text">
164 <a href="#">Markdown</a></li>
164 <a href="#">Markdown</a></li>
165 <li id="to_raw"
165 <li id="to_raw"
166 title="Contents will pass through nbconvert unmodified">
166 title="Contents will pass through nbconvert unmodified">
167 <a href="#">Raw NBConvert</a></li>
167 <a href="#">Raw NBConvert</a></li>
168 <li id="to_heading1"><a href="#">Heading 1</a></li>
168 <li id="to_heading1"><a href="#">Heading 1</a></li>
169 <li id="to_heading2"><a href="#">Heading 2</a></li>
169 <li id="to_heading2"><a href="#">Heading 2</a></li>
170 <li id="to_heading3"><a href="#">Heading 3</a></li>
170 <li id="to_heading3"><a href="#">Heading 3</a></li>
171 <li id="to_heading4"><a href="#">Heading 4</a></li>
171 <li id="to_heading4"><a href="#">Heading 4</a></li>
172 <li id="to_heading5"><a href="#">Heading 5</a></li>
172 <li id="to_heading5"><a href="#">Heading 5</a></li>
173 <li id="to_heading6"><a href="#">Heading 6</a></li>
173 <li id="to_heading6"><a href="#">Heading 6</a></li>
174 </ul>
174 </ul>
175 </li>
175 </li>
176 <li class="divider"></li>
176 <li class="divider"></li>
177 <li id="current_outputs" class="dropdown-submenu"><a href="#">Current Output</a>
177 <li id="current_outputs" class="dropdown-submenu"><a href="#">Current Output</a>
178 <ul class="dropdown-menu">
178 <ul class="dropdown-menu">
179 <li id="toggle_current_output"
179 <li id="toggle_current_output"
180 title="Hide/Show the output of the current cell">
180 title="Hide/Show the output of the current cell">
181 <a href="#">Toggle</a>
181 <a href="#">Toggle</a>
182 </li>
182 </li>
183 <li id="toggle_current_output_scroll"
183 <li id="toggle_current_output_scroll"
184 title="Scroll the output of the current cell">
184 title="Scroll the output of the current cell">
185 <a href="#">Toggle Scrolling</a>
185 <a href="#">Toggle Scrolling</a>
186 </li>
186 </li>
187 <li id="clear_current_output"
187 <li id="clear_current_output"
188 title="Clear the output of the current cell">
188 title="Clear the output of the current cell">
189 <a href="#">Clear</a>
189 <a href="#">Clear</a>
190 </li>
190 </li>
191 </ul>
191 </ul>
192 </li>
192 </li>
193 <li id="all_outputs" class="dropdown-submenu"><a href="#">All Output</a>
193 <li id="all_outputs" class="dropdown-submenu"><a href="#">All Output</a>
194 <ul class="dropdown-menu">
194 <ul class="dropdown-menu">
195 <li id="toggle_all_output"
195 <li id="toggle_all_output"
196 title="Hide/Show the output of all cells">
196 title="Hide/Show the output of all cells">
197 <a href="#">Toggle</a>
197 <a href="#">Toggle</a>
198 </li>
198 </li>
199 <li id="toggle_all_output_scroll"
199 <li id="toggle_all_output_scroll"
200 title="Scroll the output of all cells">
200 title="Scroll the output of all cells">
201 <a href="#">Toggle Scrolling</a>
201 <a href="#">Toggle Scrolling</a>
202 </li>
202 </li>
203 <li id="clear_all_output"
203 <li id="clear_all_output"
204 title="Clear the output of all cells">
204 title="Clear the output of all cells">
205 <a href="#">Clear</a>
205 <a href="#">Clear</a>
206 </li>
206 </li>
207 </ul>
207 </ul>
208 </li>
208 </li>
209 </ul>
209 </ul>
210 </li>
210 </li>
211 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Kernel</a>
211 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Kernel</a>
212 <ul id="kernel_menu" class="dropdown-menu">
212 <ul id="kernel_menu" class="dropdown-menu">
213 <li id="int_kernel"
213 <li id="int_kernel"
214 title="Send KeyboardInterrupt (CTRL-C) to the Kernel">
214 title="Send KeyboardInterrupt (CTRL-C) to the Kernel">
215 <a href="#">Interrupt</a></li>
215 <a href="#">Interrupt</a></li>
216 <li id="restart_kernel"
216 <li id="restart_kernel"
217 title="Restart the Kernel">
217 title="Restart the Kernel">
218 <a href="#">Restart</a></li>
218 <a href="#">Restart</a></li>
219 </ul>
219 </ul>
220 </li>
220 </li>
221 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Help</a>
221 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Help</a>
222 <ul id="help_menu" class="dropdown-menu">
222 <ul id="help_menu" class="dropdown-menu">
223 <li id="notebook_tour" title="A quick tour of the notebook user interface"><a href="#">User Interface Tour</a></li>
223 <li id="notebook_tour" title="A quick tour of the notebook user interface"><a href="#">User Interface Tour</a></li>
224 <li id="keyboard_shortcuts" title="Opens a tooltip with all keyboard shortcuts"><a href="#">Keyboard Shortcuts</a></li>
224 <li id="keyboard_shortcuts" title="Opens a tooltip with all keyboard shortcuts"><a href="#">Keyboard Shortcuts</a></li>
225 <li class="divider"></li>
225 <li class="divider"></li>
226 {% set
226 {% set
227 sections = (
227 sections = (
228 (
228 (
229 ("http://ipython.org/documentation.html","IPython Help",True),
229 ("http://ipython.org/documentation.html","IPython Help",True),
230 ("http://nbviewer.ipython.org/github/ipython/ipython/tree/2.x/examples/Index.ipynb", "Notebook Help", True),
230 ("http://nbviewer.ipython.org/github/ipython/ipython/tree/2.x/examples/Index.ipynb", "Notebook Help", True),
231 ),(
231 ),(
232 ("http://docs.python.org","Python",True),
232 ("http://docs.python.org","Python",True),
233 ("http://help.github.com/articles/github-flavored-markdown","Markdown",True),
233 ("http://help.github.com/articles/github-flavored-markdown","Markdown",True),
234 ("http://docs.scipy.org/doc/numpy/reference/","NumPy",True),
234 ("http://docs.scipy.org/doc/numpy/reference/","NumPy",True),
235 ("http://docs.scipy.org/doc/scipy/reference/","SciPy",True),
235 ("http://docs.scipy.org/doc/scipy/reference/","SciPy",True),
236 ("http://matplotlib.org/contents.html","Matplotlib",True),
236 ("http://matplotlib.org/contents.html","Matplotlib",True),
237 ("http://docs.sympy.org/latest/index.html","SymPy",True),
237 ("http://docs.sympy.org/latest/index.html","SymPy",True),
238 ("http://pandas.pydata.org/pandas-docs/stable/","pandas", True)
238 ("http://pandas.pydata.org/pandas-docs/stable/","pandas", True)
239 )
239 )
240 )
240 )
241 %}
241 %}
242
242
243 {% for helplinks in sections %}
243 {% for helplinks in sections %}
244 {% for link in helplinks %}
244 {% for link in helplinks %}
245 <li><a href="{{link[0]}}" {{'target="_blank" title="Opens in a new window"' if link[2]}}>
245 <li><a href="{{link[0]}}" {{'target="_blank" title="Opens in a new window"' if link[2]}}>
246 {{'<i class="icon-external-link menu-icon pull-right"></i>' if link[2]}}
246 {{'<i class="icon-external-link menu-icon pull-right"></i>' if link[2]}}
247 {{link[1]}}
247 {{link[1]}}
248 </a></li>
248 </a></li>
249 {% endfor %}
249 {% endfor %}
250 {% if not loop.last %}
250 {% if not loop.last %}
251 <li class="divider"></li>
251 <li class="divider"></li>
252 {% endif %}
252 {% endif %}
253 {% endfor %}
253 {% endfor %}
254 </li>
254 </li>
255 </ul>
255 </ul>
256 </li>
256 </li>
257 </ul>
257 </ul>
258 <div id="kernel_indicator" class="indicator_area pull-right">
258 <div id="kernel_indicator" class="indicator_area pull-right">
259 <i id="kernel_indicator_icon"></i>
259 <i id="kernel_indicator_icon"></i>
260 </div>
260 </div>
261 <div id="modal_indicator" class="indicator_area pull-right">
261 <div id="modal_indicator" class="indicator_area pull-right">
262 <i id="modal_indicator_icon"></i>
262 <i id="modal_indicator_icon"></i>
263 </div>
263 </div>
264 <div id="notification_area"></div>
264 <div id="notification_area"></div>
265 </div>
265 </div>
266 </div>
266 </div>
267 </div>
267 </div>
268 </div>
268 </div>
269 <div id="maintoolbar" class="navbar">
269 <div id="maintoolbar" class="navbar">
270 <div class="toolbar-inner navbar-inner navbar-nobg">
270 <div class="toolbar-inner navbar-inner navbar-nobg">
271 <div id="maintoolbar-container" class="container"></div>
271 <div id="maintoolbar-container" class="container"></div>
272 </div>
272 </div>
273 </div>
273 </div>
274 </div>
274 </div>
275
275
276 <div id="ipython-main-app">
276 <div id="ipython-main-app">
277
277
278 <div id="notebook_panel">
278 <div id="notebook_panel">
279 <div id="notebook"></div>
279 <div id="notebook"></div>
280 <div id="pager_splitter"></div>
280 <div id="pager_splitter"></div>
281 <div id="pager">
281 <div id="pager">
282 <div id='pager_button_area'>
282 <div id='pager_button_area'>
283 </div>
283 </div>
284 <div id="pager-container" class="container"></div>
284 <div id="pager-container" class="container"></div>
285 </div>
285 </div>
286 </div>
286 </div>
287
287
288 </div>
288 </div>
289 <div id='tooltip' class='ipython_tooltip' style='display:none'></div>
289 <div id='tooltip' class='ipython_tooltip' style='display:none'></div>
290
290
291
291
292 {% endblock %}
292 {% endblock %}
293
293
294
294
295 {% block script %}
295 {% block script %}
296
296
297 {{super()}}
297 {{super()}}
298
298
299 <script src="{{ static_url("components/google-caja/html-css-sanitizer-minified.js") }}" charset="utf-8"></script>
299 <script src="{{ static_url("components/google-caja/html-css-sanitizer-minified.js") }}" charset="utf-8"></script>
300 <script src="{{ static_url("components/codemirror/lib/codemirror.js") }}" charset="utf-8"></script>
300 <script src="{{ static_url("components/codemirror/lib/codemirror.js") }}" charset="utf-8"></script>
301 <script type="text/javascript">
301 <script type="text/javascript">
302 CodeMirror.modeURL = "{{ static_url("components/codemirror/mode/%N/%N.js", include_version=False) }}";
302 CodeMirror.modeURL = "{{ static_url("components/codemirror/mode/%N/%N.js", include_version=False) }}";
303 </script>
303 </script>
304 <script src="{{ static_url("components/codemirror/addon/mode/loadmode.js") }}" charset="utf-8"></script>
304 <script src="{{ static_url("components/codemirror/addon/mode/loadmode.js") }}" charset="utf-8"></script>
305 <script src="{{ static_url("components/codemirror/addon/mode/multiplex.js") }}" charset="utf-8"></script>
305 <script src="{{ static_url("components/codemirror/addon/mode/multiplex.js") }}" charset="utf-8"></script>
306 <script src="{{ static_url("components/codemirror/addon/mode/overlay.js") }}" charset="utf-8"></script>
306 <script src="{{ static_url("components/codemirror/addon/mode/overlay.js") }}" charset="utf-8"></script>
307 <script src="{{ static_url("components/codemirror/addon/edit/matchbrackets.js") }}" charset="utf-8"></script>
307 <script src="{{ static_url("components/codemirror/addon/edit/matchbrackets.js") }}" charset="utf-8"></script>
308 <script src="{{ static_url("components/codemirror/addon/edit/closebrackets.js") }}" charset="utf-8"></script>
308 <script src="{{ static_url("components/codemirror/addon/edit/closebrackets.js") }}" charset="utf-8"></script>
309 <script src="{{ static_url("components/codemirror/addon/comment/comment.js") }}" charset="utf-8"></script>
309 <script src="{{ static_url("components/codemirror/addon/comment/comment.js") }}" charset="utf-8"></script>
310 <script src="{{ static_url("components/codemirror/mode/htmlmixed/htmlmixed.js") }}" charset="utf-8"></script>
310 <script src="{{ static_url("components/codemirror/mode/htmlmixed/htmlmixed.js") }}" charset="utf-8"></script>
311 <script src="{{ static_url("components/codemirror/mode/xml/xml.js") }}" charset="utf-8"></script>
311 <script src="{{ static_url("components/codemirror/mode/xml/xml.js") }}" charset="utf-8"></script>
312 <script src="{{ static_url("components/codemirror/mode/javascript/javascript.js") }}" charset="utf-8"></script>
312 <script src="{{ static_url("components/codemirror/mode/javascript/javascript.js") }}" charset="utf-8"></script>
313 <script src="{{ static_url("components/codemirror/mode/css/css.js") }}" charset="utf-8"></script>
313 <script src="{{ static_url("components/codemirror/mode/css/css.js") }}" charset="utf-8"></script>
314 <script src="{{ static_url("components/codemirror/mode/rst/rst.js") }}" charset="utf-8"></script>
314 <script src="{{ static_url("components/codemirror/mode/rst/rst.js") }}" charset="utf-8"></script>
315 <script src="{{ static_url("components/codemirror/mode/markdown/markdown.js") }}" charset="utf-8"></script>
315 <script src="{{ static_url("components/codemirror/mode/markdown/markdown.js") }}" charset="utf-8"></script>
316 <script src="{{ static_url("components/codemirror/mode/gfm/gfm.js") }}" charset="utf-8"></script>
316 <script src="{{ static_url("components/codemirror/mode/gfm/gfm.js") }}" charset="utf-8"></script>
317 <script src="{{ static_url("components/codemirror/mode/python/python.js") }}" charset="utf-8"></script>
317 <script src="{{ static_url("components/codemirror/mode/python/python.js") }}" charset="utf-8"></script>
318 <script src="{{ static_url("notebook/js/codemirror-ipython.js") }}" charset="utf-8"></script>
318 <script src="{{ static_url("notebook/js/codemirror-ipython.js") }}" charset="utf-8"></script>
319 <script src="{{ static_url("notebook/js/codemirror-ipythongfm.js") }}" charset="utf-8"></script>
319
320
320 <script src="{{ static_url("components/highlight.js/build/highlight.pack.js") }}" charset="utf-8"></script>
321 <script src="{{ static_url("components/highlight.js/build/highlight.pack.js") }}" charset="utf-8"></script>
321
322
322 <script src="{{ static_url("dateformat/date.format.js") }}" charset="utf-8"></script>
323 <script src="{{ static_url("dateformat/date.format.js") }}" charset="utf-8"></script>
323
324
324 <script src="{{ static_url("base/js/events.js") }}" type="text/javascript" charset="utf-8"></script>
325 <script src="{{ static_url("base/js/events.js") }}" type="text/javascript" charset="utf-8"></script>
325 <script src="{{ static_url("base/js/utils.js") }}" type="text/javascript" charset="utf-8"></script>
326 <script src="{{ static_url("base/js/utils.js") }}" type="text/javascript" charset="utf-8"></script>
326 <script src="{{ static_url("base/js/keyboard.js") }}" type="text/javascript" charset="utf-8"></script>
327 <script src="{{ static_url("base/js/keyboard.js") }}" type="text/javascript" charset="utf-8"></script>
327 <script src="{{ static_url("base/js/security.js") }}" type="text/javascript" charset="utf-8"></script>
328 <script src="{{ static_url("base/js/security.js") }}" type="text/javascript" charset="utf-8"></script>
328 <script src="{{ static_url("base/js/dialog.js") }}" type="text/javascript" charset="utf-8"></script>
329 <script src="{{ static_url("base/js/dialog.js") }}" type="text/javascript" charset="utf-8"></script>
329 <script src="{{ static_url("services/kernels/js/kernel.js") }}" type="text/javascript" charset="utf-8"></script>
330 <script src="{{ static_url("services/kernels/js/kernel.js") }}" type="text/javascript" charset="utf-8"></script>
330 <script src="{{ static_url("services/kernels/js/comm.js") }}" type="text/javascript" charset="utf-8"></script>
331 <script src="{{ static_url("services/kernels/js/comm.js") }}" type="text/javascript" charset="utf-8"></script>
331 <script src="{{ static_url("services/sessions/js/session.js") }}" type="text/javascript" charset="utf-8"></script>
332 <script src="{{ static_url("services/sessions/js/session.js") }}" type="text/javascript" charset="utf-8"></script>
332 <script src="{{ static_url("notebook/js/layoutmanager.js") }}" type="text/javascript" charset="utf-8"></script>
333 <script src="{{ static_url("notebook/js/layoutmanager.js") }}" type="text/javascript" charset="utf-8"></script>
333 <script src="{{ static_url("notebook/js/mathjaxutils.js") }}" type="text/javascript" charset="utf-8"></script>
334 <script src="{{ static_url("notebook/js/mathjaxutils.js") }}" type="text/javascript" charset="utf-8"></script>
334 <script src="{{ static_url("notebook/js/outputarea.js") }}" type="text/javascript" charset="utf-8"></script>
335 <script src="{{ static_url("notebook/js/outputarea.js") }}" type="text/javascript" charset="utf-8"></script>
335 <script src="{{ static_url("notebook/js/cell.js") }}" type="text/javascript" charset="utf-8"></script>
336 <script src="{{ static_url("notebook/js/cell.js") }}" type="text/javascript" charset="utf-8"></script>
336 <script src="{{ static_url("notebook/js/celltoolbar.js") }}" type="text/javascript" charset="utf-8"></script>
337 <script src="{{ static_url("notebook/js/celltoolbar.js") }}" type="text/javascript" charset="utf-8"></script>
337 <script src="{{ static_url("notebook/js/codecell.js") }}" type="text/javascript" charset="utf-8"></script>
338 <script src="{{ static_url("notebook/js/codecell.js") }}" type="text/javascript" charset="utf-8"></script>
338 <script src="{{ static_url("notebook/js/completer.js") }}" type="text/javascript" charset="utf-8"></script>
339 <script src="{{ static_url("notebook/js/completer.js") }}" type="text/javascript" charset="utf-8"></script>
339 <script src="{{ static_url("notebook/js/textcell.js") }}" type="text/javascript" charset="utf-8"></script>
340 <script src="{{ static_url("notebook/js/textcell.js") }}" type="text/javascript" charset="utf-8"></script>
340 <script src="{{ static_url("notebook/js/savewidget.js") }}" type="text/javascript" charset="utf-8"></script>
341 <script src="{{ static_url("notebook/js/savewidget.js") }}" type="text/javascript" charset="utf-8"></script>
341 <script src="{{ static_url("notebook/js/quickhelp.js") }}" type="text/javascript" charset="utf-8"></script>
342 <script src="{{ static_url("notebook/js/quickhelp.js") }}" type="text/javascript" charset="utf-8"></script>
342 <script src="{{ static_url("notebook/js/pager.js") }}" type="text/javascript" charset="utf-8"></script>
343 <script src="{{ static_url("notebook/js/pager.js") }}" type="text/javascript" charset="utf-8"></script>
343 <script src="{{ static_url("notebook/js/menubar.js") }}" type="text/javascript" charset="utf-8"></script>
344 <script src="{{ static_url("notebook/js/menubar.js") }}" type="text/javascript" charset="utf-8"></script>
344 <script src="{{ static_url("notebook/js/toolbar.js") }}" type="text/javascript" charset="utf-8"></script>
345 <script src="{{ static_url("notebook/js/toolbar.js") }}" type="text/javascript" charset="utf-8"></script>
345 <script src="{{ static_url("notebook/js/maintoolbar.js") }}" type="text/javascript" charset="utf-8"></script>
346 <script src="{{ static_url("notebook/js/maintoolbar.js") }}" type="text/javascript" charset="utf-8"></script>
346 <script src="{{ static_url("notebook/js/notebook.js") }}" type="text/javascript" charset="utf-8"></script>
347 <script src="{{ static_url("notebook/js/notebook.js") }}" type="text/javascript" charset="utf-8"></script>
347 <script src="{{ static_url("notebook/js/keyboardmanager.js") }}" type="text/javascript" charset="utf-8"></script>
348 <script src="{{ static_url("notebook/js/keyboardmanager.js") }}" type="text/javascript" charset="utf-8"></script>
348 <script src="{{ static_url("notebook/js/notificationwidget.js") }}" type="text/javascript" charset="utf-8"></script>
349 <script src="{{ static_url("notebook/js/notificationwidget.js") }}" type="text/javascript" charset="utf-8"></script>
349 <script src="{{ static_url("notebook/js/notificationarea.js") }}" type="text/javascript" charset="utf-8"></script>
350 <script src="{{ static_url("notebook/js/notificationarea.js") }}" type="text/javascript" charset="utf-8"></script>
350 <script src="{{ static_url("notebook/js/tooltip.js") }}" type="text/javascript" charset="utf-8"></script>
351 <script src="{{ static_url("notebook/js/tooltip.js") }}" type="text/javascript" charset="utf-8"></script>
351 <script src="{{ static_url("notebook/js/tour.js") }}" type="text/javascript" charset="utf-8"></script>
352 <script src="{{ static_url("notebook/js/tour.js") }}" type="text/javascript" charset="utf-8"></script>
352
353
353 <script src="{{ static_url("notebook/js/config.js") }}" type="text/javascript" charset="utf-8"></script>
354 <script src="{{ static_url("notebook/js/config.js") }}" type="text/javascript" charset="utf-8"></script>
354 <script src="{{ static_url("notebook/js/main.js") }}" type="text/javascript" charset="utf-8"></script>
355 <script src="{{ static_url("notebook/js/main.js") }}" type="text/javascript" charset="utf-8"></script>
355
356
356 <script src="{{ static_url("notebook/js/contexthint.js") }}" charset="utf-8"></script>
357 <script src="{{ static_url("notebook/js/contexthint.js") }}" charset="utf-8"></script>
357
358
358 <script src="{{ static_url("notebook/js/celltoolbarpresets/default.js") }}" type="text/javascript" charset="utf-8"></script>
359 <script src="{{ static_url("notebook/js/celltoolbarpresets/default.js") }}" type="text/javascript" charset="utf-8"></script>
359 <script src="{{ static_url("notebook/js/celltoolbarpresets/rawcell.js") }}" type="text/javascript" charset="utf-8"></script>
360 <script src="{{ static_url("notebook/js/celltoolbarpresets/rawcell.js") }}" type="text/javascript" charset="utf-8"></script>
360 <script src="{{ static_url("notebook/js/celltoolbarpresets/slideshow.js") }}" type="text/javascript" charset="utf-8"></script>
361 <script src="{{ static_url("notebook/js/celltoolbarpresets/slideshow.js") }}" type="text/javascript" charset="utf-8"></script>
361
362
362 {% endblock %}
363 {% endblock %}
General Comments 0
You need to be logged in to leave comments. Login now