Show More
@@ -0,0 +1,16 b'' | |||||
|
1 | { | |||
|
2 | "tags": { | |||
|
3 | "allowUnknownTags": true | |||
|
4 | }, | |||
|
5 | "source": { | |||
|
6 | "include": [ | |||
|
7 | "../IPython/html/static/notebook/js/notebook.js" | |||
|
8 | ] | |||
|
9 | }, | |||
|
10 | "plugins": [], | |||
|
11 | "templates": { | |||
|
12 | "cleverLinks": false, | |||
|
13 | "monospaceLinks": false | |||
|
14 | }, | |||
|
15 | "destination": "./out/" | |||
|
16 | } No newline at end of file |
@@ -1,6 +1,9 b'' | |||||
1 | // Copyright (c) IPython Development Team. |
|
1 | // Copyright (c) IPython Development Team. | |
2 | // Distributed under the terms of the Modified BSD License. |
|
2 | // Distributed under the terms of the Modified BSD License. | |
3 |
|
3 | |||
|
4 | /** | |||
|
5 | * @module notebook | |||
|
6 | */ | |||
4 | define([ |
|
7 | define([ | |
5 | 'base/js/namespace', |
|
8 | 'base/js/namespace', | |
6 | 'jquery', |
|
9 | 'jquery', | |
@@ -44,25 +47,14 b' define([' | |||||
44 | ) { |
|
47 | ) { | |
45 | "use strict"; |
|
48 | "use strict"; | |
46 |
|
49 | |||
47 | var Notebook = function (selector, options) { |
|
|||
48 |
|
|
50 | /** | |
49 | * Constructor |
|
|||
50 |
|
|
51 | * | |
51 | * A notebook contains and manages cells. |
|
52 | * @exports Notebook | |
52 | * |
|
53 | * @class | |
53 | * Parameters: |
|
54 | * @param {String} selector | |
54 | * selector: string |
|
55 | * @param {dictionary} options | |
55 | * options: dictionary |
|
|||
56 | * Dictionary of keyword arguments. |
|
|||
57 | * events: $(Events) instance |
|
|||
58 | * keyboard_manager: KeyboardManager instance |
|
|||
59 | * contents: Contents instance |
|
|||
60 | * save_widget: SaveWidget instance |
|
|||
61 | * config: dictionary |
|
|||
62 | * base_url : string |
|
|||
63 | * notebook_path : string |
|
|||
64 | * notebook_name : string |
|
|||
65 |
|
|
56 | */ | |
|
57 | var Notebook = function (selector, options) { | |||
66 | this.config = utils.mergeopt(Notebook, options.config); |
|
58 | this.config = utils.mergeopt(Notebook, options.config); | |
67 | this.base_url = options.base_url; |
|
59 | this.base_url = options.base_url; | |
68 | this.notebook_path = options.notebook_path; |
|
60 | this.notebook_path = options.notebook_path; | |
@@ -180,8 +172,6 b' define([' | |||||
180 |
|
172 | |||
181 | /** |
|
173 | /** | |
182 | * Create an HTML and CSS representation of the notebook. |
|
174 | * Create an HTML and CSS representation of the notebook. | |
183 | * |
|
|||
184 | * @method create_elements |
|
|||
185 | */ |
|
175 | */ | |
186 | Notebook.prototype.create_elements = function () { |
|
176 | Notebook.prototype.create_elements = function () { | |
187 | var that = this; |
|
177 | var that = this; | |
@@ -202,8 +192,6 b' define([' | |||||
202 |
|
192 | |||
203 | /** |
|
193 | /** | |
204 | * Bind JavaScript events: key presses and custom IPython events. |
|
194 | * Bind JavaScript events: key presses and custom IPython events. | |
205 | * |
|
|||
206 | * @method bind_events |
|
|||
207 | */ |
|
195 | */ | |
208 | Notebook.prototype.bind_events = function () { |
|
196 | Notebook.prototype.bind_events = function () { | |
209 | var that = this; |
|
197 | var that = this; | |
@@ -346,8 +334,6 b' define([' | |||||
346 |
|
334 | |||
347 | /** |
|
335 | /** | |
348 | * Set the dirty flag, and trigger the set_dirty.Notebook event |
|
336 | * Set the dirty flag, and trigger the set_dirty.Notebook event | |
349 | * |
|
|||
350 | * @method set_dirty |
|
|||
351 | */ |
|
337 | */ | |
352 | Notebook.prototype.set_dirty = function (value) { |
|
338 | Notebook.prototype.set_dirty = function (value) { | |
353 | if (value === undefined) { |
|
339 | if (value === undefined) { | |
@@ -362,7 +348,6 b' define([' | |||||
362 | /** |
|
348 | /** | |
363 | * Scroll the top of the page to a given cell. |
|
349 | * Scroll the top of the page to a given cell. | |
364 | * |
|
350 | * | |
365 | * @method scroll_to_cell |
|
|||
366 | * @param {Number} cell_number An index of the cell to view |
|
351 | * @param {Number} cell_number An index of the cell to view | |
367 | * @param {Number} time Animation time in milliseconds |
|
352 | * @param {Number} time Animation time in milliseconds | |
368 | * @return {Number} Pixel offset from the top of the container |
|
353 | * @return {Number} Pixel offset from the top of the container | |
@@ -379,8 +364,6 b' define([' | |||||
379 |
|
364 | |||
380 | /** |
|
365 | /** | |
381 | * Scroll to the bottom of the page. |
|
366 | * Scroll to the bottom of the page. | |
382 | * |
|
|||
383 | * @method scroll_to_bottom |
|
|||
384 | */ |
|
367 | */ | |
385 | Notebook.prototype.scroll_to_bottom = function () { |
|
368 | Notebook.prototype.scroll_to_bottom = function () { | |
386 | this.element.animate({scrollTop:this.element.get(0).scrollHeight}, 0); |
|
369 | this.element.animate({scrollTop:this.element.get(0).scrollHeight}, 0); | |
@@ -388,8 +371,6 b' define([' | |||||
388 |
|
371 | |||
389 | /** |
|
372 | /** | |
390 | * Scroll to the top of the page. |
|
373 | * Scroll to the top of the page. | |
391 | * |
|
|||
392 | * @method scroll_to_top |
|
|||
393 | */ |
|
374 | */ | |
394 | Notebook.prototype.scroll_to_top = function () { |
|
375 | Notebook.prototype.scroll_to_top = function () { | |
395 | this.element.animate({scrollTop:0}, 0); |
|
376 | this.element.animate({scrollTop:0}, 0); | |
@@ -414,7 +395,6 b' define([' | |||||
414 | /** |
|
395 | /** | |
415 | * Get all cell elements in the notebook. |
|
396 | * Get all cell elements in the notebook. | |
416 | * |
|
397 | * | |
417 | * @method get_cell_elements |
|
|||
418 | * @return {jQuery} A selector of all cell elements |
|
398 | * @return {jQuery} A selector of all cell elements | |
419 | */ |
|
399 | */ | |
420 | Notebook.prototype.get_cell_elements = function () { |
|
400 | Notebook.prototype.get_cell_elements = function () { | |
@@ -424,7 +404,6 b' define([' | |||||
424 | /** |
|
404 | /** | |
425 | * Get a particular cell element. |
|
405 | * Get a particular cell element. | |
426 | * |
|
406 | * | |
427 | * @method get_cell_element |
|
|||
428 | * @param {Number} index An index of a cell to select |
|
407 | * @param {Number} index An index of a cell to select | |
429 | * @return {jQuery} A selector of the given cell. |
|
408 | * @return {jQuery} A selector of the given cell. | |
430 | */ |
|
409 | */ | |
@@ -440,7 +419,6 b' define([' | |||||
440 | /** |
|
419 | /** | |
441 | * Try to get a particular cell by msg_id. |
|
420 | * Try to get a particular cell by msg_id. | |
442 | * |
|
421 | * | |
443 | * @method get_msg_cell |
|
|||
444 | * @param {String} msg_id A message UUID |
|
422 | * @param {String} msg_id A message UUID | |
445 | * @return {Cell} Cell or null if no cell was found. |
|
423 | * @return {Cell} Cell or null if no cell was found. | |
446 | */ |
|
424 | */ | |
@@ -451,7 +429,6 b' define([' | |||||
451 | /** |
|
429 | /** | |
452 | * Count the cells in this notebook. |
|
430 | * Count the cells in this notebook. | |
453 | * |
|
431 | * | |
454 | * @method ncells |
|
|||
455 | * @return {Number} The number of cells in this notebook |
|
432 | * @return {Number} The number of cells in this notebook | |
456 | */ |
|
433 | */ | |
457 | Notebook.prototype.ncells = function () { |
|
434 | Notebook.prototype.ncells = function () { | |
@@ -461,7 +438,6 b' define([' | |||||
461 | /** |
|
438 | /** | |
462 | * Get all Cell objects in this notebook. |
|
439 | * Get all Cell objects in this notebook. | |
463 | * |
|
440 | * | |
464 | * @method get_cells |
|
|||
465 | * @return {Array} This notebook's Cell objects |
|
441 | * @return {Array} This notebook's Cell objects | |
466 | */ |
|
442 | */ | |
467 | // TODO: we are often calling cells as cells()[i], which we should optimize |
|
443 | // TODO: we are often calling cells as cells()[i], which we should optimize | |
@@ -475,7 +451,6 b' define([' | |||||
475 | /** |
|
451 | /** | |
476 | * Get a Cell object from this notebook. |
|
452 | * Get a Cell object from this notebook. | |
477 | * |
|
453 | * | |
478 | * @method get_cell |
|
|||
479 | * @param {Number} index An index of a cell to retrieve |
|
454 | * @param {Number} index An index of a cell to retrieve | |
480 | * @return {Cell} Cell or null if no cell was found. |
|
455 | * @return {Cell} Cell or null if no cell was found. | |
481 | */ |
|
456 | */ | |
@@ -491,7 +466,6 b' define([' | |||||
491 | /** |
|
466 | /** | |
492 | * Get the cell below a given cell. |
|
467 | * Get the cell below a given cell. | |
493 | * |
|
468 | * | |
494 | * @method get_next_cell |
|
|||
495 | * @param {Cell} cell The provided cell |
|
469 | * @param {Cell} cell The provided cell | |
496 | * @return {Cell} the next cell or null if no cell was found. |
|
470 | * @return {Cell} the next cell or null if no cell was found. | |
497 | */ |
|
471 | */ | |
@@ -507,7 +481,6 b' define([' | |||||
507 | /** |
|
481 | /** | |
508 | * Get the cell above a given cell. |
|
482 | * Get the cell above a given cell. | |
509 | * |
|
483 | * | |
510 | * @method get_prev_cell |
|
|||
511 | * @param {Cell} cell The provided cell |
|
484 | * @param {Cell} cell The provided cell | |
512 | * @return {Cell} The previous cell or null if no cell was found. |
|
485 | * @return {Cell} The previous cell or null if no cell was found. | |
513 | */ |
|
486 | */ | |
@@ -523,7 +496,6 b' define([' | |||||
523 | /** |
|
496 | /** | |
524 | * Get the numeric index of a given cell. |
|
497 | * Get the numeric index of a given cell. | |
525 | * |
|
498 | * | |
526 | * @method find_cell_index |
|
|||
527 | * @param {Cell} cell The provided cell |
|
499 | * @param {Cell} cell The provided cell | |
528 | * @return {Number} The cell's numeric index or null if no cell was found. |
|
500 | * @return {Number} The cell's numeric index or null if no cell was found. | |
529 | */ |
|
501 | */ | |
@@ -540,7 +512,6 b' define([' | |||||
540 | /** |
|
512 | /** | |
541 | * Get a given index , or the selected index if none is provided. |
|
513 | * Get a given index , or the selected index if none is provided. | |
542 | * |
|
514 | * | |
543 | * @method index_or_selected |
|
|||
544 | * @param {Number} index A cell's index |
|
515 | * @param {Number} index A cell's index | |
545 | * @return {Number} The given index, or selected index if none is provided. |
|
516 | * @return {Number} The given index, or selected index if none is provided. | |
546 | */ |
|
517 | */ | |
@@ -559,7 +530,6 b' define([' | |||||
559 |
|
530 | |||
560 | /** |
|
531 | /** | |
561 | * Get the currently selected cell. |
|
532 | * Get the currently selected cell. | |
562 | * @method get_selected_cell |
|
|||
563 | * @return {Cell} The selected cell |
|
533 | * @return {Cell} The selected cell | |
564 | */ |
|
534 | */ | |
565 | Notebook.prototype.get_selected_cell = function () { |
|
535 | Notebook.prototype.get_selected_cell = function () { | |
@@ -570,7 +540,6 b' define([' | |||||
570 | /** |
|
540 | /** | |
571 | * Check whether a cell index is valid. |
|
541 | * Check whether a cell index is valid. | |
572 | * |
|
542 | * | |
573 | * @method is_valid_cell_index |
|
|||
574 | * @param {Number} index A cell index |
|
543 | * @param {Number} index A cell index | |
575 | * @return True if the index is valid, false otherwise |
|
544 | * @return True if the index is valid, false otherwise | |
576 | */ |
|
545 | */ | |
@@ -585,7 +554,6 b' define([' | |||||
585 | /** |
|
554 | /** | |
586 | * Get the index of the currently selected cell. |
|
555 | * Get the index of the currently selected cell. | |
587 |
|
556 | |||
588 | * @method get_selected_index |
|
|||
589 | * @return {Number} The selected cell's numeric index |
|
557 | * @return {Number} The selected cell's numeric index | |
590 | */ |
|
558 | */ | |
591 | Notebook.prototype.get_selected_index = function () { |
|
559 | Notebook.prototype.get_selected_index = function () { | |
@@ -604,7 +572,6 b' define([' | |||||
604 | /** |
|
572 | /** | |
605 | * Programmatically select a cell. |
|
573 | * Programmatically select a cell. | |
606 | * |
|
574 | * | |
607 | * @method select |
|
|||
608 | * @param {Number} index A cell's index |
|
575 | * @param {Number} index A cell's index | |
609 | * @return {Notebook} This notebook |
|
576 | * @return {Notebook} This notebook | |
610 | */ |
|
577 | */ | |
@@ -637,7 +604,6 b' define([' | |||||
637 | /** |
|
604 | /** | |
638 | * Programmatically select the next cell. |
|
605 | * Programmatically select the next cell. | |
639 | * |
|
606 | * | |
640 | * @method select_next |
|
|||
641 | * @return {Notebook} This notebook |
|
607 | * @return {Notebook} This notebook | |
642 | */ |
|
608 | */ | |
643 | Notebook.prototype.select_next = function () { |
|
609 | Notebook.prototype.select_next = function () { | |
@@ -649,7 +615,6 b' define([' | |||||
649 | /** |
|
615 | /** | |
650 | * Programmatically select the previous cell. |
|
616 | * Programmatically select the previous cell. | |
651 | * |
|
617 | * | |
652 | * @method select_prev |
|
|||
653 | * @return {Notebook} This notebook |
|
618 | * @return {Notebook} This notebook | |
654 | */ |
|
619 | */ | |
655 | Notebook.prototype.select_prev = function () { |
|
620 | Notebook.prototype.select_prev = function () { | |
@@ -664,8 +629,6 b' define([' | |||||
664 | /** |
|
629 | /** | |
665 | * Gets the index of the cell that is in edit mode. |
|
630 | * Gets the index of the cell that is in edit mode. | |
666 | * |
|
631 | * | |
667 | * @method get_edit_index |
|
|||
668 | * |
|
|||
669 | * @return index {int} |
|
632 | * @return index {int} | |
670 | **/ |
|
633 | **/ | |
671 | Notebook.prototype.get_edit_index = function () { |
|
634 | Notebook.prototype.get_edit_index = function () { | |
@@ -681,7 +644,6 b' define([' | |||||
681 | /** |
|
644 | /** | |
682 | * Handle when a a cell blurs and the notebook should enter command mode. |
|
645 | * Handle when a a cell blurs and the notebook should enter command mode. | |
683 | * |
|
646 | * | |
684 | * @method handle_command_mode |
|
|||
685 | * @param [cell] {Cell} Cell to enter command mode on. |
|
647 | * @param [cell] {Cell} Cell to enter command mode on. | |
686 | **/ |
|
648 | **/ | |
687 | Notebook.prototype.handle_command_mode = function (cell) { |
|
649 | Notebook.prototype.handle_command_mode = function (cell) { | |
@@ -695,8 +657,6 b' define([' | |||||
695 |
|
657 | |||
696 | /** |
|
658 | /** | |
697 | * Make the notebook enter command mode. |
|
659 | * Make the notebook enter command mode. | |
698 | * |
|
|||
699 | * @method command_mode |
|
|||
700 | **/ |
|
660 | **/ | |
701 | Notebook.prototype.command_mode = function () { |
|
661 | Notebook.prototype.command_mode = function () { | |
702 | var cell = this.get_cell(this.get_edit_index()); |
|
662 | var cell = this.get_cell(this.get_edit_index()); | |
@@ -711,7 +671,6 b' define([' | |||||
711 | /** |
|
671 | /** | |
712 | * Handle when a cell fires it's edit_mode event. |
|
672 | * Handle when a cell fires it's edit_mode event. | |
713 | * |
|
673 | * | |
714 | * @method handle_edit_mode |
|
|||
715 | * @param [cell] {Cell} Cell to enter edit mode on. |
|
674 | * @param [cell] {Cell} Cell to enter edit mode on. | |
716 | **/ |
|
675 | **/ | |
717 | Notebook.prototype.handle_edit_mode = function (cell) { |
|
676 | Notebook.prototype.handle_edit_mode = function (cell) { | |
@@ -725,8 +684,6 b' define([' | |||||
725 |
|
684 | |||
726 | /** |
|
685 | /** | |
727 | * Make a cell enter edit mode. |
|
686 | * Make a cell enter edit mode. | |
728 | * |
|
|||
729 | * @method edit_mode |
|
|||
730 | **/ |
|
687 | **/ | |
731 | Notebook.prototype.edit_mode = function () { |
|
688 | Notebook.prototype.edit_mode = function () { | |
732 | var cell = this.get_selected_cell(); |
|
689 | var cell = this.get_selected_cell(); | |
@@ -738,8 +695,6 b' define([' | |||||
738 |
|
695 | |||
739 | /** |
|
696 | /** | |
740 | * Focus the currently selected cell. |
|
697 | * Focus the currently selected cell. | |
741 | * |
|
|||
742 | * @method focus_cell |
|
|||
743 | **/ |
|
698 | **/ | |
744 | Notebook.prototype.focus_cell = function () { |
|
699 | Notebook.prototype.focus_cell = function () { | |
745 | var cell = this.get_selected_cell(); |
|
700 | var cell = this.get_selected_cell(); | |
@@ -752,7 +707,6 b' define([' | |||||
752 | /** |
|
707 | /** | |
753 | * Move given (or selected) cell up and select it. |
|
708 | * Move given (or selected) cell up and select it. | |
754 | * |
|
709 | * | |
755 | * @method move_cell_up |
|
|||
756 | * @param [index] {integer} cell index |
|
710 | * @param [index] {integer} cell index | |
757 | * @return {Notebook} This notebook |
|
711 | * @return {Notebook} This notebook | |
758 | **/ |
|
712 | **/ | |
@@ -777,7 +731,6 b' define([' | |||||
777 | /** |
|
731 | /** | |
778 | * Move given (or selected) cell down and select it |
|
732 | * Move given (or selected) cell down and select it | |
779 | * |
|
733 | * | |
780 | * @method move_cell_down |
|
|||
781 | * @param [index] {integer} cell index |
|
734 | * @param [index] {integer} cell index | |
782 | * @return {Notebook} This notebook |
|
735 | * @return {Notebook} This notebook | |
783 | **/ |
|
736 | **/ | |
@@ -804,7 +757,6 b' define([' | |||||
804 | /** |
|
757 | /** | |
805 | * Delete a cell from the notebook. |
|
758 | * Delete a cell from the notebook. | |
806 | * |
|
759 | * | |
807 | * @method delete_cell |
|
|||
808 | * @param [index] A cell's numeric index |
|
760 | * @param [index] A cell's numeric index | |
809 | * @return {Notebook} This notebook |
|
761 | * @return {Notebook} This notebook | |
810 | */ |
|
762 | */ | |
@@ -846,8 +798,6 b' define([' | |||||
846 |
|
798 | |||
847 | /** |
|
799 | /** | |
848 | * Restore the most recently deleted cell. |
|
800 | * Restore the most recently deleted cell. | |
849 | * |
|
|||
850 | * @method undelete |
|
|||
851 | */ |
|
801 | */ | |
852 | Notebook.prototype.undelete_cell = function() { |
|
802 | Notebook.prototype.undelete_cell = function() { | |
853 | if (this.undelete_backup !== null && this.undelete_index !== null) { |
|
803 | if (this.undelete_backup !== null && this.undelete_index !== null) { | |
@@ -890,7 +840,6 b' define([' | |||||
890 | * |
|
840 | * | |
891 | * Index will be brought back into the accessible range [0,n] |
|
841 | * Index will be brought back into the accessible range [0,n] | |
892 | * |
|
842 | * | |
893 | * @method insert_cell_at_index |
|
|||
894 | * @param [type] {string} in ['code','markdown', 'raw'], defaults to 'code' |
|
843 | * @param [type] {string} in ['code','markdown', 'raw'], defaults to 'code' | |
895 | * @param [index] {int} a valid index where to insert cell |
|
844 | * @param [index] {int} a valid index where to insert cell | |
896 | * |
|
845 | * | |
@@ -960,13 +909,11 b' define([' | |||||
960 |
|
909 | |||
961 | /** |
|
910 | /** | |
962 | * Insert an element at given cell index. |
|
911 | * Insert an element at given cell index. | |
|
912 | * return true if everything whent fine. | |||
963 | * |
|
913 | * | |
964 | * @method _insert_element_at_index |
|
|||
965 | * @param element {dom_element} a cell element |
|
914 | * @param element {dom_element} a cell element | |
966 | * @param [index] {int} a valid index where to inser cell |
|
915 | * @param [index] {int} a valid index where to inser cell | |
967 | * @private |
|
916 | * @private | |
968 | * |
|
|||
969 | * return true if everything whent fine. |
|
|||
970 | **/ |
|
917 | **/ | |
971 | Notebook.prototype._insert_element_at_index = function(element, index){ |
|
918 | Notebook.prototype._insert_element_at_index = function(element, index){ | |
972 | if (element === undefined){ |
|
919 | if (element === undefined){ | |
@@ -1001,7 +948,6 b' define([' | |||||
1001 | * |
|
948 | * | |
1002 | * default index value is the one of currently selected cell |
|
949 | * default index value is the one of currently selected cell | |
1003 | * |
|
950 | * | |
1004 | * @method insert_cell_above |
|
|||
1005 | * @param [type] {string} cell type |
|
951 | * @param [type] {string} cell type | |
1006 | * @param [index] {integer} |
|
952 | * @param [index] {integer} | |
1007 | * |
|
953 | * | |
@@ -1018,12 +964,10 b' define([' | |||||
1018 | * |
|
964 | * | |
1019 | * default index value is the one of currently selected cell |
|
965 | * default index value is the one of currently selected cell | |
1020 | * |
|
966 | * | |
1021 | * @method insert_cell_below |
|
|||
1022 | * @param [type] {string} cell type |
|
967 | * @param [type] {string} cell type | |
1023 | * @param [index] {integer} |
|
968 | * @param [index] {integer} | |
1024 | * |
|
969 | * | |
1025 | * @return handle to created cell or null |
|
970 | * @return handle to created cell or null | |
1026 | * |
|
|||
1027 | **/ |
|
971 | **/ | |
1028 | Notebook.prototype.insert_cell_below = function (type, index) { |
|
972 | Notebook.prototype.insert_cell_below = function (type, index) { | |
1029 | index = this.index_or_selected(index); |
|
973 | index = this.index_or_selected(index); | |
@@ -1034,7 +978,6 b' define([' | |||||
1034 | /** |
|
978 | /** | |
1035 | * Insert cell at end of notebook |
|
979 | * Insert cell at end of notebook | |
1036 | * |
|
980 | * | |
1037 | * @method insert_cell_at_bottom |
|
|||
1038 | * @param {String} type cell type |
|
981 | * @param {String} type cell type | |
1039 | * |
|
982 | * | |
1040 | * @return the added cell; or null |
|
983 | * @return the added cell; or null | |
@@ -1047,7 +990,6 b' define([' | |||||
1047 | /** |
|
990 | /** | |
1048 | * Turn a cell into a code cell. |
|
991 | * Turn a cell into a code cell. | |
1049 | * |
|
992 | * | |
1050 | * @method to_code |
|
|||
1051 | * @param {Number} [index] A cell's index |
|
993 | * @param {Number} [index] A cell's index | |
1052 | */ |
|
994 | */ | |
1053 | Notebook.prototype.to_code = function (index) { |
|
995 | Notebook.prototype.to_code = function (index) { | |
@@ -1079,7 +1021,6 b' define([' | |||||
1079 | /** |
|
1021 | /** | |
1080 | * Turn a cell into a Markdown cell. |
|
1022 | * Turn a cell into a Markdown cell. | |
1081 | * |
|
1023 | * | |
1082 | * @method to_markdown |
|
|||
1083 | * @param {Number} [index] A cell's index |
|
1024 | * @param {Number} [index] A cell's index | |
1084 | */ |
|
1025 | */ | |
1085 | Notebook.prototype.to_markdown = function (index) { |
|
1026 | Notebook.prototype.to_markdown = function (index) { | |
@@ -1117,7 +1058,6 b' define([' | |||||
1117 | /** |
|
1058 | /** | |
1118 | * Turn a cell into a raw text cell. |
|
1059 | * Turn a cell into a raw text cell. | |
1119 | * |
|
1060 | * | |
1120 | * @method to_raw |
|
|||
1121 | * @param {Number} [index] A cell's index |
|
1061 | * @param {Number} [index] A cell's index | |
1122 | */ |
|
1062 | */ | |
1123 | Notebook.prototype.to_raw = function (index) { |
|
1063 | Notebook.prototype.to_raw = function (index) { | |
@@ -1151,8 +1091,9 b' define([' | |||||
1151 |
|
1091 | |||
1152 | Notebook.prototype._warn_heading = function () { |
|
1092 | Notebook.prototype._warn_heading = function () { | |
1153 | /** |
|
1093 | /** | |
1154 | * warn about heading cells being removed |
|
1094 | * @private | |
1155 | */ |
|
1095 | */ | |
|
1096 | // warn about heading cells being removed | |||
1156 | dialog.modal({ |
|
1097 | dialog.modal({ | |
1157 | notebook: this, |
|
1098 | notebook: this, | |
1158 | keyboard_manager: this.keyboard_manager, |
|
1099 | keyboard_manager: this.keyboard_manager, | |
@@ -1169,14 +1110,13 b' define([' | |||||
1169 | }); |
|
1110 | }); | |
1170 | }; |
|
1111 | }; | |
1171 |
|
1112 | |||
|
1113 | Notebook.prototype.to_heading = function (index, level) { | |||
1172 | /** |
|
1114 | /** | |
1173 | * Turn a cell into a markdown cell with a heading. |
|
1115 | * Turn a cell into a markdown cell with a heading. | |
1174 | * |
|
1116 | * | |
1175 | * @method to_heading |
|
|||
1176 | * @param {Number} [index] A cell's index |
|
1117 | * @param {Number} [index] A cell's index | |
1177 | * @param {Number} [level] A heading level (e.g., 1 for h1) |
|
1118 | * @param {Number} [level] A heading level (e.g., 1 for h1) | |
1178 | */ |
|
1119 | */ | |
1179 | Notebook.prototype.to_heading = function (index, level) { |
|
|||
1180 | this.to_markdown(index); |
|
1120 | this.to_markdown(index); | |
1181 | level = level || 1; |
|
1121 | level = level || 1; | |
1182 | var i = this.index_or_selected(index); |
|
1122 | var i = this.index_or_selected(index); | |
@@ -1192,8 +1132,6 b' define([' | |||||
1192 |
|
1132 | |||
1193 | /** |
|
1133 | /** | |
1194 | * Enable UI elements for pasting cells. |
|
1134 | * Enable UI elements for pasting cells. | |
1195 | * |
|
|||
1196 | * @method enable_paste |
|
|||
1197 | */ |
|
1135 | */ | |
1198 | Notebook.prototype.enable_paste = function () { |
|
1136 | Notebook.prototype.enable_paste = function () { | |
1199 | var that = this; |
|
1137 | var that = this; | |
@@ -1210,8 +1148,6 b' define([' | |||||
1210 |
|
1148 | |||
1211 | /** |
|
1149 | /** | |
1212 | * Disable UI elements for pasting cells. |
|
1150 | * Disable UI elements for pasting cells. | |
1213 | * |
|
|||
1214 | * @method disable_paste |
|
|||
1215 | */ |
|
1151 | */ | |
1216 | Notebook.prototype.disable_paste = function () { |
|
1152 | Notebook.prototype.disable_paste = function () { | |
1217 | if (this.paste_enabled) { |
|
1153 | if (this.paste_enabled) { | |
@@ -1224,8 +1160,6 b' define([' | |||||
1224 |
|
1160 | |||
1225 | /** |
|
1161 | /** | |
1226 | * Cut a cell. |
|
1162 | * Cut a cell. | |
1227 | * |
|
|||
1228 | * @method cut_cell |
|
|||
1229 | */ |
|
1163 | */ | |
1230 | Notebook.prototype.cut_cell = function () { |
|
1164 | Notebook.prototype.cut_cell = function () { | |
1231 | this.copy_cell(); |
|
1165 | this.copy_cell(); | |
@@ -1234,8 +1168,6 b' define([' | |||||
1234 |
|
1168 | |||
1235 | /** |
|
1169 | /** | |
1236 | * Copy a cell. |
|
1170 | * Copy a cell. | |
1237 | * |
|
|||
1238 | * @method copy_cell |
|
|||
1239 | */ |
|
1171 | */ | |
1240 | Notebook.prototype.copy_cell = function () { |
|
1172 | Notebook.prototype.copy_cell = function () { | |
1241 | var cell = this.get_selected_cell(); |
|
1173 | var cell = this.get_selected_cell(); | |
@@ -1249,8 +1181,6 b' define([' | |||||
1249 |
|
1181 | |||
1250 | /** |
|
1182 | /** | |
1251 | * Replace the selected cell with a cell in the clipboard. |
|
1183 | * Replace the selected cell with a cell in the clipboard. | |
1252 | * |
|
|||
1253 | * @method paste_cell_replace |
|
|||
1254 | */ |
|
1184 | */ | |
1255 | Notebook.prototype.paste_cell_replace = function () { |
|
1185 | Notebook.prototype.paste_cell_replace = function () { | |
1256 | if (this.clipboard !== null && this.paste_enabled) { |
|
1186 | if (this.clipboard !== null && this.paste_enabled) { | |
@@ -1265,8 +1195,6 b' define([' | |||||
1265 |
|
1195 | |||
1266 | /** |
|
1196 | /** | |
1267 | * Paste a cell from the clipboard above the selected cell. |
|
1197 | * Paste a cell from the clipboard above the selected cell. | |
1268 | * |
|
|||
1269 | * @method paste_cell_above |
|
|||
1270 | */ |
|
1198 | */ | |
1271 | Notebook.prototype.paste_cell_above = function () { |
|
1199 | Notebook.prototype.paste_cell_above = function () { | |
1272 | if (this.clipboard !== null && this.paste_enabled) { |
|
1200 | if (this.clipboard !== null && this.paste_enabled) { | |
@@ -1279,8 +1207,6 b' define([' | |||||
1279 |
|
1207 | |||
1280 | /** |
|
1208 | /** | |
1281 | * Paste a cell from the clipboard below the selected cell. |
|
1209 | * Paste a cell from the clipboard below the selected cell. | |
1282 | * |
|
|||
1283 | * @method paste_cell_below |
|
|||
1284 | */ |
|
1210 | */ | |
1285 | Notebook.prototype.paste_cell_below = function () { |
|
1211 | Notebook.prototype.paste_cell_below = function () { | |
1286 | if (this.clipboard !== null && this.paste_enabled) { |
|
1212 | if (this.clipboard !== null && this.paste_enabled) { | |
@@ -1295,8 +1221,6 b' define([' | |||||
1295 |
|
1221 | |||
1296 | /** |
|
1222 | /** | |
1297 | * Split the selected cell into two, at the cursor. |
|
1223 | * Split the selected cell into two, at the cursor. | |
1298 | * |
|
|||
1299 | * @method split_cell |
|
|||
1300 | */ |
|
1224 | */ | |
1301 | Notebook.prototype.split_cell = function () { |
|
1225 | Notebook.prototype.split_cell = function () { | |
1302 | var cell = this.get_selected_cell(); |
|
1226 | var cell = this.get_selected_cell(); | |
@@ -1313,8 +1237,6 b' define([' | |||||
1313 |
|
1237 | |||
1314 | /** |
|
1238 | /** | |
1315 | * Combine the selected cell into the cell above it. |
|
1239 | * Combine the selected cell into the cell above it. | |
1316 | * |
|
|||
1317 | * @method merge_cell_above |
|
|||
1318 | */ |
|
1240 | */ | |
1319 | Notebook.prototype.merge_cell_above = function () { |
|
1241 | Notebook.prototype.merge_cell_above = function () { | |
1320 | var index = this.get_selected_index(); |
|
1242 | var index = this.get_selected_index(); | |
@@ -1348,8 +1270,6 b' define([' | |||||
1348 |
|
1270 | |||
1349 | /** |
|
1271 | /** | |
1350 | * Combine the selected cell into the cell below it. |
|
1272 | * Combine the selected cell into the cell below it. | |
1351 | * |
|
|||
1352 | * @method merge_cell_below |
|
|||
1353 | */ |
|
1273 | */ | |
1354 | Notebook.prototype.merge_cell_below = function () { |
|
1274 | Notebook.prototype.merge_cell_below = function () { | |
1355 | var index = this.get_selected_index(); |
|
1275 | var index = this.get_selected_index(); | |
@@ -1387,7 +1307,6 b' define([' | |||||
1387 | /** |
|
1307 | /** | |
1388 | * Hide a cell's output. |
|
1308 | * Hide a cell's output. | |
1389 | * |
|
1309 | * | |
1390 | * @method collapse_output |
|
|||
1391 | * @param {Number} index A cell's numeric index |
|
1310 | * @param {Number} index A cell's numeric index | |
1392 | */ |
|
1311 | */ | |
1393 | Notebook.prototype.collapse_output = function (index) { |
|
1312 | Notebook.prototype.collapse_output = function (index) { | |
@@ -1401,8 +1320,6 b' define([' | |||||
1401 |
|
1320 | |||
1402 | /** |
|
1321 | /** | |
1403 | * Hide each code cell's output area. |
|
1322 | * Hide each code cell's output area. | |
1404 | * |
|
|||
1405 | * @method collapse_all_output |
|
|||
1406 | */ |
|
1323 | */ | |
1407 | Notebook.prototype.collapse_all_output = function () { |
|
1324 | Notebook.prototype.collapse_all_output = function () { | |
1408 | this.get_cells().map(function (cell, i) { |
|
1325 | this.get_cells().map(function (cell, i) { | |
@@ -1417,7 +1334,6 b' define([' | |||||
1417 | /** |
|
1334 | /** | |
1418 | * Show a cell's output. |
|
1335 | * Show a cell's output. | |
1419 | * |
|
1336 | * | |
1420 | * @method expand_output |
|
|||
1421 | * @param {Number} index A cell's numeric index |
|
1337 | * @param {Number} index A cell's numeric index | |
1422 | */ |
|
1338 | */ | |
1423 | Notebook.prototype.expand_output = function (index) { |
|
1339 | Notebook.prototype.expand_output = function (index) { | |
@@ -1431,8 +1347,6 b' define([' | |||||
1431 |
|
1347 | |||
1432 | /** |
|
1348 | /** | |
1433 | * Expand each code cell's output area, and remove scrollbars. |
|
1349 | * Expand each code cell's output area, and remove scrollbars. | |
1434 | * |
|
|||
1435 | * @method expand_all_output |
|
|||
1436 | */ |
|
1350 | */ | |
1437 | Notebook.prototype.expand_all_output = function () { |
|
1351 | Notebook.prototype.expand_all_output = function () { | |
1438 | this.get_cells().map(function (cell, i) { |
|
1352 | this.get_cells().map(function (cell, i) { | |
@@ -1447,7 +1361,6 b' define([' | |||||
1447 | /** |
|
1361 | /** | |
1448 | * Clear the selected CodeCell's output area. |
|
1362 | * Clear the selected CodeCell's output area. | |
1449 | * |
|
1363 | * | |
1450 | * @method clear_output |
|
|||
1451 | * @param {Number} index A cell's numeric index |
|
1364 | * @param {Number} index A cell's numeric index | |
1452 | */ |
|
1365 | */ | |
1453 | Notebook.prototype.clear_output = function (index) { |
|
1366 | Notebook.prototype.clear_output = function (index) { | |
@@ -1461,8 +1374,6 b' define([' | |||||
1461 |
|
1374 | |||
1462 | /** |
|
1375 | /** | |
1463 | * Clear each code cell's output area. |
|
1376 | * Clear each code cell's output area. | |
1464 | * |
|
|||
1465 | * @method clear_all_output |
|
|||
1466 | */ |
|
1377 | */ | |
1467 | Notebook.prototype.clear_all_output = function () { |
|
1378 | Notebook.prototype.clear_all_output = function () { | |
1468 | this.get_cells().map(function (cell, i) { |
|
1379 | this.get_cells().map(function (cell, i) { | |
@@ -1476,7 +1387,6 b' define([' | |||||
1476 | /** |
|
1387 | /** | |
1477 | * Scroll the selected CodeCell's output area. |
|
1388 | * Scroll the selected CodeCell's output area. | |
1478 | * |
|
1389 | * | |
1479 | * @method scroll_output |
|
|||
1480 | * @param {Number} index A cell's numeric index |
|
1390 | * @param {Number} index A cell's numeric index | |
1481 | */ |
|
1391 | */ | |
1482 | Notebook.prototype.scroll_output = function (index) { |
|
1392 | Notebook.prototype.scroll_output = function (index) { | |
@@ -1490,8 +1400,6 b' define([' | |||||
1490 |
|
1400 | |||
1491 | /** |
|
1401 | /** | |
1492 | * Expand each code cell's output area, and add a scrollbar for long output. |
|
1402 | * Expand each code cell's output area, and add a scrollbar for long output. | |
1493 | * |
|
|||
1494 | * @method scroll_all_output |
|
|||
1495 | */ |
|
1403 | */ | |
1496 | Notebook.prototype.scroll_all_output = function () { |
|
1404 | Notebook.prototype.scroll_all_output = function () { | |
1497 | this.get_cells().map(function (cell, i) { |
|
1405 | this.get_cells().map(function (cell, i) { | |
@@ -1505,7 +1413,6 b' define([' | |||||
1505 |
|
1413 | |||
1506 | /** Toggle whether a cell's output is collapsed or expanded. |
|
1414 | /** Toggle whether a cell's output is collapsed or expanded. | |
1507 | * |
|
1415 | * | |
1508 | * @method toggle_output |
|
|||
1509 | * @param {Number} index A cell's numeric index |
|
1416 | * @param {Number} index A cell's numeric index | |
1510 | */ |
|
1417 | */ | |
1511 | Notebook.prototype.toggle_output = function (index) { |
|
1418 | Notebook.prototype.toggle_output = function (index) { | |
@@ -1519,8 +1426,6 b' define([' | |||||
1519 |
|
1426 | |||
1520 | /** |
|
1427 | /** | |
1521 | * Hide/show the output of all cells. |
|
1428 | * Hide/show the output of all cells. | |
1522 | * |
|
|||
1523 | * @method toggle_all_output |
|
|||
1524 | */ |
|
1429 | */ | |
1525 | Notebook.prototype.toggle_all_output = function () { |
|
1430 | Notebook.prototype.toggle_all_output = function () { | |
1526 | this.get_cells().map(function (cell, i) { |
|
1431 | this.get_cells().map(function (cell, i) { | |
@@ -1535,7 +1440,6 b' define([' | |||||
1535 | /** |
|
1440 | /** | |
1536 | * Toggle a scrollbar for long cell outputs. |
|
1441 | * Toggle a scrollbar for long cell outputs. | |
1537 | * |
|
1442 | * | |
1538 | * @method toggle_output_scroll |
|
|||
1539 | * @param {Number} index A cell's numeric index |
|
1443 | * @param {Number} index A cell's numeric index | |
1540 | */ |
|
1444 | */ | |
1541 | Notebook.prototype.toggle_output_scroll = function (index) { |
|
1445 | Notebook.prototype.toggle_output_scroll = function (index) { | |
@@ -1549,8 +1453,6 b' define([' | |||||
1549 |
|
1453 | |||
1550 | /** |
|
1454 | /** | |
1551 | * Toggle the scrolling of long output on all cells. |
|
1455 | * Toggle the scrolling of long output on all cells. | |
1552 | * |
|
|||
1553 | * @method toggle_all_output_scrolling |
|
|||
1554 | */ |
|
1456 | */ | |
1555 | Notebook.prototype.toggle_all_output_scroll = function () { |
|
1457 | Notebook.prototype.toggle_all_output_scroll = function () { | |
1556 | this.get_cells().map(function (cell, i) { |
|
1458 | this.get_cells().map(function (cell, i) { | |
@@ -1566,8 +1468,6 b' define([' | |||||
1566 |
|
1468 | |||
1567 | /** |
|
1469 | /** | |
1568 | * Toggle line numbers in the selected cell's input area. |
|
1470 | * Toggle line numbers in the selected cell's input area. | |
1569 | * |
|
|||
1570 | * @method cell_toggle_line_numbers |
|
|||
1571 | */ |
|
1471 | */ | |
1572 | Notebook.prototype.cell_toggle_line_numbers = function() { |
|
1472 | Notebook.prototype.cell_toggle_line_numbers = function() { | |
1573 | this.get_selected_cell().toggle_line_numbers(); |
|
1473 | this.get_selected_cell().toggle_line_numbers(); | |
@@ -1576,8 +1476,6 b' define([' | |||||
1576 | /** |
|
1476 | /** | |
1577 | * Set the codemirror mode for all code cells, including the default for |
|
1477 | * Set the codemirror mode for all code cells, including the default for | |
1578 | * new code cells. |
|
1478 | * new code cells. | |
1579 | * |
|
|||
1580 | * @method set_codemirror_mode |
|
|||
1581 | */ |
|
1479 | */ | |
1582 | Notebook.prototype.set_codemirror_mode = function(newmode){ |
|
1480 | Notebook.prototype.set_codemirror_mode = function(newmode){ | |
1583 | if (newmode === this.codemirror_mode) { |
|
1481 | if (newmode === this.codemirror_mode) { | |
@@ -1604,8 +1502,6 b' define([' | |||||
1604 |
|
1502 | |||
1605 | /** |
|
1503 | /** | |
1606 | * Start a new session and set it on each code cell. |
|
1504 | * Start a new session and set it on each code cell. | |
1607 | * |
|
|||
1608 | * @method start_session |
|
|||
1609 | */ |
|
1505 | */ | |
1610 | Notebook.prototype.start_session = function (kernel_name) { |
|
1506 | Notebook.prototype.start_session = function (kernel_name) { | |
1611 | if (this._session_starting) { |
|
1507 | if (this._session_starting) { | |
@@ -1637,7 +1533,7 b' define([' | |||||
1637 | /** |
|
1533 | /** | |
1638 | * Once a session is started, link the code cells to the kernel and pass the |
|
1534 | * Once a session is started, link the code cells to the kernel and pass the | |
1639 | * comm manager to the widget manager |
|
1535 | * comm manager to the widget manager | |
1640 | * |
|
1536 | * @private | |
1641 | */ |
|
1537 | */ | |
1642 | Notebook.prototype._session_started = function (){ |
|
1538 | Notebook.prototype._session_started = function (){ | |
1643 | this._session_starting = false; |
|
1539 | this._session_starting = false; | |
@@ -1650,6 +1546,9 b' define([' | |||||
1650 | } |
|
1546 | } | |
1651 | } |
|
1547 | } | |
1652 | }; |
|
1548 | }; | |
|
1549 | /** | |||
|
1550 | * @private | |||
|
1551 | */ | |||
1653 | Notebook.prototype._session_start_failed = function (jqxhr, status, error){ |
|
1552 | Notebook.prototype._session_start_failed = function (jqxhr, status, error){ | |
1654 | this._session_starting = false; |
|
1553 | this._session_starting = false; | |
1655 | utils.log_ajax_error(jqxhr, status, error); |
|
1554 | utils.log_ajax_error(jqxhr, status, error); | |
@@ -1657,8 +1556,6 b' define([' | |||||
1657 |
|
1556 | |||
1658 | /** |
|
1557 | /** | |
1659 | * Prompt the user to restart the IPython kernel. |
|
1558 | * Prompt the user to restart the IPython kernel. | |
1660 | * |
|
|||
1661 | * @method restart_kernel |
|
|||
1662 | */ |
|
1559 | */ | |
1663 | Notebook.prototype.restart_kernel = function () { |
|
1560 | Notebook.prototype.restart_kernel = function () { | |
1664 | var that = this; |
|
1561 | var that = this; | |
@@ -1683,13 +1580,9 b' define([' | |||||
1683 |
|
1580 | |||
1684 | /** |
|
1581 | /** | |
1685 | * Execute or render cell outputs and go into command mode. |
|
1582 | * Execute or render cell outputs and go into command mode. | |
1686 | * |
|
|||
1687 | * @method execute_cell |
|
|||
1688 | */ |
|
1583 | */ | |
1689 | Notebook.prototype.execute_cell = function () { |
|
1584 | Notebook.prototype.execute_cell = function () { | |
1690 | /** |
|
1585 | // mode = shift, ctrl, alt | |
1691 | * mode = shift, ctrl, alt |
|
|||
1692 | */ |
|
|||
1693 | var cell = this.get_selected_cell(); |
|
1586 | var cell = this.get_selected_cell(); | |
1694 |
|
1587 | |||
1695 | cell.execute(); |
|
1588 | cell.execute(); | |
@@ -1699,8 +1592,6 b' define([' | |||||
1699 |
|
1592 | |||
1700 | /** |
|
1593 | /** | |
1701 | * Execute or render cell outputs and insert a new cell below. |
|
1594 | * Execute or render cell outputs and insert a new cell below. | |
1702 | * |
|
|||
1703 | * @method execute_cell_and_insert_below |
|
|||
1704 | */ |
|
1595 | */ | |
1705 | Notebook.prototype.execute_cell_and_insert_below = function () { |
|
1596 | Notebook.prototype.execute_cell_and_insert_below = function () { | |
1706 | var cell = this.get_selected_cell(); |
|
1597 | var cell = this.get_selected_cell(); | |
@@ -1728,8 +1619,6 b' define([' | |||||
1728 |
|
1619 | |||
1729 | /** |
|
1620 | /** | |
1730 | * Execute or render cell outputs and select the next cell. |
|
1621 | * Execute or render cell outputs and select the next cell. | |
1731 | * |
|
|||
1732 | * @method execute_cell_and_select_below |
|
|||
1733 | */ |
|
1622 | */ | |
1734 | Notebook.prototype.execute_cell_and_select_below = function () { |
|
1623 | Notebook.prototype.execute_cell_and_select_below = function () { | |
1735 |
|
1624 | |||
@@ -1757,8 +1646,6 b' define([' | |||||
1757 |
|
1646 | |||
1758 | /** |
|
1647 | /** | |
1759 | * Execute all cells below the selected cell. |
|
1648 | * Execute all cells below the selected cell. | |
1760 | * |
|
|||
1761 | * @method execute_cells_below |
|
|||
1762 | */ |
|
1649 | */ | |
1763 | Notebook.prototype.execute_cells_below = function () { |
|
1650 | Notebook.prototype.execute_cells_below = function () { | |
1764 | this.execute_cell_range(this.get_selected_index(), this.ncells()); |
|
1651 | this.execute_cell_range(this.get_selected_index(), this.ncells()); | |
@@ -1767,8 +1654,6 b' define([' | |||||
1767 |
|
1654 | |||
1768 | /** |
|
1655 | /** | |
1769 | * Execute all cells above the selected cell. |
|
1656 | * Execute all cells above the selected cell. | |
1770 | * |
|
|||
1771 | * @method execute_cells_above |
|
|||
1772 | */ |
|
1657 | */ | |
1773 | Notebook.prototype.execute_cells_above = function () { |
|
1658 | Notebook.prototype.execute_cells_above = function () { | |
1774 | this.execute_cell_range(0, this.get_selected_index()); |
|
1659 | this.execute_cell_range(0, this.get_selected_index()); | |
@@ -1776,8 +1661,6 b' define([' | |||||
1776 |
|
1661 | |||
1777 | /** |
|
1662 | /** | |
1778 | * Execute all cells. |
|
1663 | * Execute all cells. | |
1779 | * |
|
|||
1780 | * @method execute_all_cells |
|
|||
1781 | */ |
|
1664 | */ | |
1782 | Notebook.prototype.execute_all_cells = function () { |
|
1665 | Notebook.prototype.execute_all_cells = function () { | |
1783 | this.execute_cell_range(0, this.ncells()); |
|
1666 | this.execute_cell_range(0, this.ncells()); | |
@@ -1787,7 +1670,6 b' define([' | |||||
1787 | /** |
|
1670 | /** | |
1788 | * Execute a contiguous range of cells. |
|
1671 | * Execute a contiguous range of cells. | |
1789 | * |
|
1672 | * | |
1790 | * @method execute_cell_range |
|
|||
1791 | * @param {Number} start Index of the first cell to execute (inclusive) |
|
1673 | * @param {Number} start Index of the first cell to execute (inclusive) | |
1792 | * @param {Number} end Index of the last cell to execute (exclusive) |
|
1674 | * @param {Number} end Index of the last cell to execute (exclusive) | |
1793 | */ |
|
1675 | */ | |
@@ -1804,7 +1686,6 b' define([' | |||||
1804 | /** |
|
1686 | /** | |
1805 | * Getter method for this notebook's name. |
|
1687 | * Getter method for this notebook's name. | |
1806 | * |
|
1688 | * | |
1807 | * @method get_notebook_name |
|
|||
1808 | * @return {String} This notebook's name (excluding file extension) |
|
1689 | * @return {String} This notebook's name (excluding file extension) | |
1809 | */ |
|
1690 | */ | |
1810 | Notebook.prototype.get_notebook_name = function () { |
|
1691 | Notebook.prototype.get_notebook_name = function () { | |
@@ -1815,7 +1696,6 b' define([' | |||||
1815 | /** |
|
1696 | /** | |
1816 | * Setter method for this notebook's name. |
|
1697 | * Setter method for this notebook's name. | |
1817 | * |
|
1698 | * | |
1818 | * @method set_notebook_name |
|
|||
1819 | * @param {String} name A new name for this notebook |
|
1699 | * @param {String} name A new name for this notebook | |
1820 | */ |
|
1700 | */ | |
1821 | Notebook.prototype.set_notebook_name = function (name) { |
|
1701 | Notebook.prototype.set_notebook_name = function (name) { | |
@@ -1827,7 +1707,6 b' define([' | |||||
1827 | /** |
|
1707 | /** | |
1828 | * Check that a notebook's name is valid. |
|
1708 | * Check that a notebook's name is valid. | |
1829 | * |
|
1709 | * | |
1830 | * @method test_notebook_name |
|
|||
1831 | * @param {String} nbname A name for this notebook |
|
1710 | * @param {String} nbname A name for this notebook | |
1832 | * @return {Boolean} True if the name is valid, false if invalid |
|
1711 | * @return {Boolean} True if the name is valid, false if invalid | |
1833 | */ |
|
1712 | */ | |
@@ -1843,7 +1722,6 b' define([' | |||||
1843 | /** |
|
1722 | /** | |
1844 | * Load a notebook from JSON (.ipynb). |
|
1723 | * Load a notebook from JSON (.ipynb). | |
1845 | * |
|
1724 | * | |
1846 | * @method fromJSON |
|
|||
1847 | * @param {Object} data JSON representation of a notebook |
|
1725 | * @param {Object} data JSON representation of a notebook | |
1848 | */ |
|
1726 | */ | |
1849 | Notebook.prototype.fromJSON = function (data) { |
|
1727 | Notebook.prototype.fromJSON = function (data) { | |
@@ -1896,13 +1774,10 b' define([' | |||||
1896 | /** |
|
1774 | /** | |
1897 | * Dump this notebook into a JSON-friendly object. |
|
1775 | * Dump this notebook into a JSON-friendly object. | |
1898 | * |
|
1776 | * | |
1899 | * @method toJSON |
|
|||
1900 | * @return {Object} A JSON-friendly representation of this notebook. |
|
1777 | * @return {Object} A JSON-friendly representation of this notebook. | |
1901 | */ |
|
1778 | */ | |
1902 | Notebook.prototype.toJSON = function () { |
|
1779 | Notebook.prototype.toJSON = function () { | |
1903 | /** |
|
1780 | // remove the conversion indicator, which only belongs in-memory | |
1904 | * remove the conversion indicator, which only belongs in-memory |
|
|||
1905 | */ |
|
|||
1906 | delete this.metadata.orig_nbformat; |
|
1781 | delete this.metadata.orig_nbformat; | |
1907 | delete this.metadata.orig_nbformat_minor; |
|
1782 | delete this.metadata.orig_nbformat_minor; | |
1908 |
|
1783 | |||
@@ -1933,7 +1808,6 b' define([' | |||||
1933 | /** |
|
1808 | /** | |
1934 | * Start an autosave timer, for periodically saving the notebook. |
|
1809 | * Start an autosave timer, for periodically saving the notebook. | |
1935 | * |
|
1810 | * | |
1936 | * @method set_autosave_interval |
|
|||
1937 | * @param {Integer} interval the autosave interval in milliseconds |
|
1811 | * @param {Integer} interval the autosave interval in milliseconds | |
1938 | */ |
|
1812 | */ | |
1939 | Notebook.prototype.set_autosave_interval = function (interval) { |
|
1813 | Notebook.prototype.set_autosave_interval = function (interval) { | |
@@ -1964,8 +1838,6 b' define([' | |||||
1964 | /** |
|
1838 | /** | |
1965 | * Save this notebook on the server. This becomes a notebook instance's |
|
1839 | * Save this notebook on the server. This becomes a notebook instance's | |
1966 | * .save_notebook method *after* the entire notebook has been loaded. |
|
1840 | * .save_notebook method *after* the entire notebook has been loaded. | |
1967 | * |
|
|||
1968 | * @method save_notebook |
|
|||
1969 | */ |
|
1841 | */ | |
1970 | Notebook.prototype.save_notebook = function () { |
|
1842 | Notebook.prototype.save_notebook = function () { | |
1971 | if (!this._fully_loaded) { |
|
1843 | if (!this._fully_loaded) { | |
@@ -2004,7 +1876,6 b' define([' | |||||
2004 | /** |
|
1876 | /** | |
2005 | * Success callback for saving a notebook. |
|
1877 | * Success callback for saving a notebook. | |
2006 | * |
|
1878 | * | |
2007 | * @method save_notebook_success |
|
|||
2008 | * @param {Integer} start Time when the save request start |
|
1879 | * @param {Integer} start Time when the save request start | |
2009 | * @param {Object} data JSON representation of a notebook |
|
1880 | * @param {Object} data JSON representation of a notebook | |
2010 | */ |
|
1881 | */ | |
@@ -2045,8 +1916,8 b' define([' | |||||
2045 | /** |
|
1916 | /** | |
2046 | * update the autosave interval based on how long the last save took |
|
1917 | * update the autosave interval based on how long the last save took | |
2047 | * |
|
1918 | * | |
2048 | * @method _update_autosave_interval |
|
|||
2049 | * @param {Integer} timestamp when the save request started |
|
1919 | * @param {Integer} timestamp when the save request started | |
|
1920 | * @private | |||
2050 | */ |
|
1921 | */ | |
2051 | Notebook.prototype._update_autosave_interval = function (start) { |
|
1922 | Notebook.prototype._update_autosave_interval = function (start) { | |
2052 | var duration = (new Date().getTime() - start); |
|
1923 | var duration = (new Date().getTime() - start); | |
@@ -2065,7 +1936,6 b' define([' | |||||
2065 | /** |
|
1936 | /** | |
2066 | * Explicitly trust the output of this notebook. |
|
1937 | * Explicitly trust the output of this notebook. | |
2067 | * |
|
1938 | * | |
2068 | * @method trust_notebook |
|
|||
2069 | */ |
|
1939 | */ | |
2070 | Notebook.prototype.trust_notebook = function () { |
|
1940 | Notebook.prototype.trust_notebook = function () { | |
2071 | var body = $("<div>").append($("<p>") |
|
1941 | var body = $("<div>").append($("<p>") | |
@@ -2155,7 +2025,6 b' define([' | |||||
2155 | /** |
|
2025 | /** | |
2156 | * Request a notebook's data from the server. |
|
2026 | * Request a notebook's data from the server. | |
2157 | * |
|
2027 | * | |
2158 | * @method load_notebook |
|
|||
2159 | * @param {String} notebook_path A notebook to load |
|
2028 | * @param {String} notebook_path A notebook to load | |
2160 | */ |
|
2029 | */ | |
2161 | Notebook.prototype.load_notebook = function (notebook_path) { |
|
2030 | Notebook.prototype.load_notebook = function (notebook_path) { | |
@@ -2173,7 +2042,6 b' define([' | |||||
2173 | * |
|
2042 | * | |
2174 | * Load notebook data from the JSON response. |
|
2043 | * Load notebook data from the JSON response. | |
2175 | * |
|
2044 | * | |
2176 | * @method load_notebook_success |
|
|||
2177 | * @param {Object} data JSON representation of a notebook |
|
2045 | * @param {Object} data JSON representation of a notebook | |
2178 | */ |
|
2046 | */ | |
2179 | Notebook.prototype.load_notebook_success = function (data) { |
|
2047 | Notebook.prototype.load_notebook_success = function (data) { | |
@@ -2311,7 +2179,6 b' define([' | |||||
2311 | /** |
|
2179 | /** | |
2312 | * Failure callback for loading a notebook from the server. |
|
2180 | * Failure callback for loading a notebook from the server. | |
2313 | * |
|
2181 | * | |
2314 | * @method load_notebook_error |
|
|||
2315 | * @param {Error} error |
|
2182 | * @param {Error} error | |
2316 | */ |
|
2183 | */ | |
2317 | Notebook.prototype.load_notebook_error = function (error) { |
|
2184 | Notebook.prototype.load_notebook_error = function (error) { | |
@@ -2340,8 +2207,6 b' define([' | |||||
2340 |
|
2207 | |||
2341 | /** |
|
2208 | /** | |
2342 | * Save the notebook then immediately create a checkpoint. |
|
2209 | * Save the notebook then immediately create a checkpoint. | |
2343 | * |
|
|||
2344 | * @method save_checkpoint |
|
|||
2345 | */ |
|
2210 | */ | |
2346 | Notebook.prototype.save_checkpoint = function () { |
|
2211 | Notebook.prototype.save_checkpoint = function () { | |
2347 | this._checkpoint_after_save = true; |
|
2212 | this._checkpoint_after_save = true; | |
@@ -2351,8 +2216,6 b' define([' | |||||
2351 | /** |
|
2216 | /** | |
2352 | * Add a checkpoint for this notebook. |
|
2217 | * Add a checkpoint for this notebook. | |
2353 | * for use as a callback from checkpoint creation. |
|
2218 | * for use as a callback from checkpoint creation. | |
2354 | * |
|
|||
2355 | * @method add_checkpoint |
|
|||
2356 | */ |
|
2219 | */ | |
2357 | Notebook.prototype.add_checkpoint = function (checkpoint) { |
|
2220 | Notebook.prototype.add_checkpoint = function (checkpoint) { | |
2358 | var found = false; |
|
2221 | var found = false; | |
@@ -2372,8 +2235,6 b' define([' | |||||
2372 |
|
2235 | |||
2373 | /** |
|
2236 | /** | |
2374 | * List checkpoints for this notebook. |
|
2237 | * List checkpoints for this notebook. | |
2375 | * |
|
|||
2376 | * @method list_checkpoints |
|
|||
2377 | */ |
|
2238 | */ | |
2378 | Notebook.prototype.list_checkpoints = function () { |
|
2239 | Notebook.prototype.list_checkpoints = function () { | |
2379 | var that = this; |
|
2240 | var that = this; | |
@@ -2388,7 +2249,6 b' define([' | |||||
2388 | /** |
|
2249 | /** | |
2389 | * Success callback for listing checkpoints. |
|
2250 | * Success callback for listing checkpoints. | |
2390 | * |
|
2251 | * | |
2391 | * @method list_checkpoint_success |
|
|||
2392 | * @param {Object} data JSON representation of a checkpoint |
|
2252 | * @param {Object} data JSON representation of a checkpoint | |
2393 | */ |
|
2253 | */ | |
2394 | Notebook.prototype.list_checkpoints_success = function (data) { |
|
2254 | Notebook.prototype.list_checkpoints_success = function (data) { | |
@@ -2403,8 +2263,6 b' define([' | |||||
2403 |
|
2263 | |||
2404 | /** |
|
2264 | /** | |
2405 | * Create a checkpoint of this notebook on the server from the most recent save. |
|
2265 | * Create a checkpoint of this notebook on the server from the most recent save. | |
2406 | * |
|
|||
2407 | * @method create_checkpoint |
|
|||
2408 | */ |
|
2266 | */ | |
2409 | Notebook.prototype.create_checkpoint = function () { |
|
2267 | Notebook.prototype.create_checkpoint = function () { | |
2410 | var that = this; |
|
2268 | var that = this; | |
@@ -2419,7 +2277,6 b' define([' | |||||
2419 | /** |
|
2277 | /** | |
2420 | * Success callback for creating a checkpoint. |
|
2278 | * Success callback for creating a checkpoint. | |
2421 | * |
|
2279 | * | |
2422 | * @method create_checkpoint_success |
|
|||
2423 | * @param {Object} data JSON representation of a checkpoint |
|
2280 | * @param {Object} data JSON representation of a checkpoint | |
2424 | */ |
|
2281 | */ | |
2425 | Notebook.prototype.create_checkpoint_success = function (data) { |
|
2282 | Notebook.prototype.create_checkpoint_success = function (data) { | |
@@ -2471,7 +2328,6 b' define([' | |||||
2471 | /** |
|
2328 | /** | |
2472 | * Restore the notebook to a checkpoint state. |
|
2329 | * Restore the notebook to a checkpoint state. | |
2473 | * |
|
2330 | * | |
2474 | * @method restore_checkpoint |
|
|||
2475 | * @param {String} checkpoint ID |
|
2331 | * @param {String} checkpoint ID | |
2476 | */ |
|
2332 | */ | |
2477 | Notebook.prototype.restore_checkpoint = function (checkpoint) { |
|
2333 | Notebook.prototype.restore_checkpoint = function (checkpoint) { | |
@@ -2487,8 +2343,6 b' define([' | |||||
2487 |
|
2343 | |||
2488 | /** |
|
2344 | /** | |
2489 | * Success callback for restoring a notebook to a checkpoint. |
|
2345 | * Success callback for restoring a notebook to a checkpoint. | |
2490 | * |
|
|||
2491 | * @method restore_checkpoint_success |
|
|||
2492 | */ |
|
2346 | */ | |
2493 | Notebook.prototype.restore_checkpoint_success = function () { |
|
2347 | Notebook.prototype.restore_checkpoint_success = function () { | |
2494 | this.events.trigger('checkpoint_restored.Notebook'); |
|
2348 | this.events.trigger('checkpoint_restored.Notebook'); | |
@@ -2498,7 +2352,6 b' define([' | |||||
2498 | /** |
|
2352 | /** | |
2499 | * Delete a notebook checkpoint. |
|
2353 | * Delete a notebook checkpoint. | |
2500 | * |
|
2354 | * | |
2501 | * @method delete_checkpoint |
|
|||
2502 | * @param {String} checkpoint ID |
|
2355 | * @param {String} checkpoint ID | |
2503 | */ |
|
2356 | */ | |
2504 | Notebook.prototype.delete_checkpoint = function (checkpoint) { |
|
2357 | Notebook.prototype.delete_checkpoint = function (checkpoint) { | |
@@ -2514,8 +2367,6 b' define([' | |||||
2514 |
|
2367 | |||
2515 | /** |
|
2368 | /** | |
2516 | * Success callback for deleting a notebook checkpoint |
|
2369 | * Success callback for deleting a notebook checkpoint | |
2517 | * |
|
|||
2518 | * @method delete_checkpoint_success |
|
|||
2519 | */ |
|
2370 | */ | |
2520 | Notebook.prototype.delete_checkpoint_success = function () { |
|
2371 | Notebook.prototype.delete_checkpoint_success = function () { | |
2521 | this.events.trigger('checkpoint_deleted.Notebook'); |
|
2372 | this.events.trigger('checkpoint_deleted.Notebook'); |
@@ -7,11 +7,12 b' Requirements' | |||||
7 | ------------ |
|
7 | ------------ | |
8 | The following tools are needed to build the documentation: |
|
8 | The following tools are needed to build the documentation: | |
9 |
|
9 | |||
10 | sphinx |
|
10 | sphinx jsdoc | |
11 |
|
11 | |||
12 | On Debian-based systems, you should be able to run:: |
|
12 | On Debian-based systems, you should be able to run:: | |
13 |
|
13 | |||
14 | sudo apt-get install sphinx |
|
14 | sudo apt-get install sphinx npm | |
|
15 | sudo npm install -g jsdoc@"<=3.3.0" | |||
15 |
|
|
16 | ||
16 | The documentation gets built using ``make``, and comes in several flavors. |
|
17 | The documentation gets built using ``make``, and comes in several flavors. | |
17 |
|
18 |
General Comments 0
You need to be logged in to leave comments.
Login now