##// END OF EJS Templates
support pdf export in the notebook UI
MinRK -
Show More
@@ -1,140 +1,140 b''
1 1 import io
2 2 import os
3 3 import zipfile
4 4
5 5 from tornado import web
6 6
7 7 from ..base.handlers import IPythonHandler, notebook_path_regex
8 8 from IPython.nbformat.current import to_notebook_json
9 9
10 10 from IPython.utils import tz
11 11 from IPython.utils.py3compat import cast_bytes
12 12
13 13 import sys
14 14
15 15 def find_resource_files(output_files_dir):
16 16 files = []
17 17 for dirpath, dirnames, filenames in os.walk(output_files_dir):
18 18 files.extend([os.path.join(dirpath, f) for f in filenames])
19 19 return files
20 20
21 21 def respond_zip(handler, name, output, resources):
22 22 """Zip up the output and resource files and respond with the zip file.
23 23
24 24 Returns True if it has served a zip file, False if there are no resource
25 25 files, in which case we serve the plain output file.
26 26 """
27 27 # Check if we have resource files we need to zip
28 28 output_files = resources.get('outputs', None)
29 29 if not output_files:
30 30 return False
31 31
32 32 # Headers
33 33 zip_filename = os.path.splitext(name)[0] + '.zip'
34 34 handler.set_header('Content-Disposition',
35 35 'attachment; filename="%s"' % zip_filename)
36 36 handler.set_header('Content-Type', 'application/zip')
37 37
38 38 # Prepare the zip file
39 39 buffer = io.BytesIO()
40 40 zipf = zipfile.ZipFile(buffer, mode='w', compression=zipfile.ZIP_DEFLATED)
41 41 output_filename = os.path.splitext(name)[0] + '.' + resources['output_extension']
42 42 zipf.writestr(output_filename, cast_bytes(output, 'utf-8'))
43 43 for filename, data in output_files.items():
44 44 zipf.writestr(os.path.basename(filename), data)
45 45 zipf.close()
46 46
47 47 handler.finish(buffer.getvalue())
48 48 return True
49 49
50 50 def get_exporter(format, **kwargs):
51 51 """get an exporter, raising appropriate errors"""
52 52 # if this fails, will raise 500
53 53 try:
54 54 from IPython.nbconvert.exporters.export import exporter_map
55 55 except ImportError as e:
56 56 raise web.HTTPError(500, "Could not import nbconvert: %s" % e)
57 57
58 58 try:
59 59 Exporter = exporter_map[format]
60 60 except KeyError:
61 61 # should this be 400?
62 62 raise web.HTTPError(404, u"No exporter for format: %s" % format)
63 63
64 64 try:
65 65 return Exporter(**kwargs)
66 66 except Exception as e:
67 67 raise web.HTTPError(500, "Could not construct Exporter: %s" % e)
68 68
69 69 class NbconvertFileHandler(IPythonHandler):
70 70
71 71 SUPPORTED_METHODS = ('GET',)
72 72
73 73 @web.authenticated
74 74 def get(self, format, path='', name=None):
75 75
76 exporter = get_exporter(format, config=self.config)
76 exporter = get_exporter(format, config=self.config, log=self.log)
77 77
78 78 path = path.strip('/')
79 79 model = self.notebook_manager.get_notebook(name=name, path=path)
80 80
81 81 self.set_header('Last-Modified', model['last_modified'])
82 82
83 83 try:
84 84 output, resources = exporter.from_notebook_node(model['content'])
85 85 except Exception as e:
86 86 raise web.HTTPError(500, "nbconvert failed: %s" % e)
87 87
88 88 if respond_zip(self, name, output, resources):
89 89 return
90 90
91 91 # Force download if requested
92 92 if self.get_argument('download', 'false').lower() == 'true':
93 93 filename = os.path.splitext(name)[0] + '.' + resources['output_extension']
94 94 self.set_header('Content-Disposition',
95 95 'attachment; filename="%s"' % filename)
96 96
97 97 # MIME type
98 98 if exporter.output_mimetype:
99 99 self.set_header('Content-Type',
100 100 '%s; charset=utf-8' % exporter.output_mimetype)
101 101
102 102 self.finish(output)
103 103
104 104 class NbconvertPostHandler(IPythonHandler):
105 105 SUPPORTED_METHODS = ('POST',)
106 106
107 107 @web.authenticated
108 108 def post(self, format):
109 109 exporter = get_exporter(format, config=self.config)
110 110
111 111 model = self.get_json_body()
112 112 nbnode = to_notebook_json(model['content'])
113 113
114 114 try:
115 115 output, resources = exporter.from_notebook_node(nbnode)
116 116 except Exception as e:
117 117 raise web.HTTPError(500, "nbconvert failed: %s" % e)
118 118
119 119 if respond_zip(self, nbnode.metadata.name, output, resources):
120 120 return
121 121
122 122 # MIME type
123 123 if exporter.output_mimetype:
124 124 self.set_header('Content-Type',
125 125 '%s; charset=utf-8' % exporter.output_mimetype)
126 126
127 127 self.finish(output)
128 128
129 129 #-----------------------------------------------------------------------------
130 130 # URL to handler mappings
131 131 #-----------------------------------------------------------------------------
132 132
133 133 _format_regex = r"(?P<format>\w+)"
134 134
135 135
136 136 default_handlers = [
137 137 (r"/nbconvert/%s%s" % (_format_regex, notebook_path_regex),
138 138 NbconvertFileHandler),
139 139 (r"/nbconvert/%s" % _format_regex, NbconvertPostHandler),
140 140 ] No newline at end of file
@@ -1,335 +1,335 b''
1 //----------------------------------------------------------------------------
2 // Copyright (C) 2008-2011 The IPython Development Team
3 //
4 // Distributed under the terms of the BSD License. The full license is in
5 // the file COPYING, distributed as part of this software.
6 //----------------------------------------------------------------------------
1 // Copyright (c) IPython Development Team.
2 // Distributed under the terms of the Modified BSD License.
7 3
8 4 //============================================================================
9 5 // MenuBar
10 6 //============================================================================
11 7
12 8 /**
13 9 * @module IPython
14 10 * @namespace IPython
15 11 * @submodule MenuBar
16 12 */
17 13
18 14
19 15 var IPython = (function (IPython) {
20 16 "use strict";
21 17
22 18 var utils = IPython.utils;
23 19
24 20 /**
25 21 * A MenuBar Class to generate the menubar of IPython notebook
26 22 * @Class MenuBar
27 23 *
28 24 * @constructor
29 25 *
30 26 *
31 27 * @param selector {string} selector for the menubar element in DOM
32 28 * @param {object} [options]
33 29 * @param [options.base_url] {String} String to use for the
34 30 * base project url. Default is to inspect
35 31 * $('body').data('baseUrl');
36 32 * does not support change for now is set through this option
37 33 */
38 34 var MenuBar = function (selector, options) {
39 35 options = options || {};
40 36 this.base_url = options.base_url || IPython.utils.get_body_data("baseUrl");
41 37 this.selector = selector;
42 38 if (this.selector !== undefined) {
43 39 this.element = $(selector);
44 40 this.style();
45 41 this.bind_events();
46 42 }
47 43 };
48 44
49 45 MenuBar.prototype.style = function () {
50 46 this.element.addClass('border-box-sizing');
51 47 this.element.find("li").click(function (event, ui) {
52 48 // The selected cell loses focus when the menu is entered, so we
53 49 // re-select it upon selection.
54 50 var i = IPython.notebook.get_selected_index();
55 51 IPython.notebook.select(i);
56 52 }
57 53 );
58 54 };
59 55
60 56 MenuBar.prototype._nbconvert = function (format, download) {
61 57 download = download || false;
62 58 var notebook_path = IPython.notebook.notebook_path;
63 59 var notebook_name = IPython.notebook.notebook_name;
64 60 if (IPython.notebook.dirty) {
65 61 IPython.notebook.save_notebook({async : false});
66 62 }
67 63 var url = utils.url_join_encode(
68 64 this.base_url,
69 65 'nbconvert',
70 66 format,
71 67 notebook_path,
72 68 notebook_name
73 69 ) + "?download=" + download.toString();
74 70
75 71 window.open(url);
76 72 };
77 73
78 74 MenuBar.prototype.bind_events = function () {
79 75 // File
80 76 var that = this;
81 77 this.element.find('#new_notebook').click(function () {
82 78 IPython.notebook.new_notebook();
83 79 });
84 80 this.element.find('#open_notebook').click(function () {
85 81 window.open(utils.url_join_encode(
86 82 IPython.notebook.base_url,
87 83 'tree',
88 84 IPython.notebook.notebook_path
89 85 ));
90 86 });
91 87 this.element.find('#copy_notebook').click(function () {
92 88 IPython.notebook.copy_notebook();
93 89 return false;
94 90 });
95 91 this.element.find('#download_ipynb').click(function () {
96 92 var base_url = IPython.notebook.base_url;
97 93 var notebook_path = IPython.notebook.notebook_path;
98 94 var notebook_name = IPython.notebook.notebook_name;
99 95 if (IPython.notebook.dirty) {
100 96 IPython.notebook.save_notebook({async : false});
101 97 }
102 98
103 99 var url = utils.url_join_encode(
104 100 base_url,
105 101 'files',
106 102 notebook_path,
107 103 notebook_name
108 104 );
109 105 window.location.assign(url);
110 106 });
111 107
112 108 this.element.find('#print_preview').click(function () {
113 109 that._nbconvert('html', false);
114 110 });
115 111
116 112 this.element.find('#download_py').click(function () {
117 113 that._nbconvert('python', true);
118 114 });
119 115
120 116 this.element.find('#download_html').click(function () {
121 117 that._nbconvert('html', true);
122 118 });
123 119
124 120 this.element.find('#download_rst').click(function () {
125 121 that._nbconvert('rst', true);
126 122 });
127 123
124 this.element.find('#download_pdf').click(function () {
125 that._nbconvert('pdf', true);
126 });
127
128 128 this.element.find('#rename_notebook').click(function () {
129 129 IPython.save_widget.rename_notebook();
130 130 });
131 131 this.element.find('#save_checkpoint').click(function () {
132 132 IPython.notebook.save_checkpoint();
133 133 });
134 134 this.element.find('#restore_checkpoint').click(function () {
135 135 });
136 136 this.element.find('#trust_notebook').click(function () {
137 137 IPython.notebook.trust_notebook();
138 138 });
139 139 $([IPython.events]).on('trust_changed.Notebook', function (event, trusted) {
140 140 if (trusted) {
141 141 that.element.find('#trust_notebook')
142 142 .addClass("disabled")
143 143 .find("a").text("Trusted Notebook");
144 144 } else {
145 145 that.element.find('#trust_notebook')
146 146 .removeClass("disabled")
147 147 .find("a").text("Trust Notebook");
148 148 }
149 149 });
150 150 this.element.find('#kill_and_exit').click(function () {
151 151 IPython.notebook.session.delete();
152 152 setTimeout(function(){
153 153 // allow closing of new tabs in Chromium, impossible in FF
154 154 window.open('', '_self', '');
155 155 window.close();
156 156 }, 500);
157 157 });
158 158 // Edit
159 159 this.element.find('#cut_cell').click(function () {
160 160 IPython.notebook.cut_cell();
161 161 });
162 162 this.element.find('#copy_cell').click(function () {
163 163 IPython.notebook.copy_cell();
164 164 });
165 165 this.element.find('#delete_cell').click(function () {
166 166 IPython.notebook.delete_cell();
167 167 });
168 168 this.element.find('#undelete_cell').click(function () {
169 169 IPython.notebook.undelete_cell();
170 170 });
171 171 this.element.find('#split_cell').click(function () {
172 172 IPython.notebook.split_cell();
173 173 });
174 174 this.element.find('#merge_cell_above').click(function () {
175 175 IPython.notebook.merge_cell_above();
176 176 });
177 177 this.element.find('#merge_cell_below').click(function () {
178 178 IPython.notebook.merge_cell_below();
179 179 });
180 180 this.element.find('#move_cell_up').click(function () {
181 181 IPython.notebook.move_cell_up();
182 182 });
183 183 this.element.find('#move_cell_down').click(function () {
184 184 IPython.notebook.move_cell_down();
185 185 });
186 186 this.element.find('#edit_nb_metadata').click(function () {
187 187 IPython.notebook.edit_metadata();
188 188 });
189 189
190 190 // View
191 191 this.element.find('#toggle_header').click(function () {
192 192 $('div#header').toggle();
193 193 IPython.layout_manager.do_resize();
194 194 });
195 195 this.element.find('#toggle_toolbar').click(function () {
196 196 $('div#maintoolbar').toggle();
197 197 IPython.layout_manager.do_resize();
198 198 });
199 199 // Insert
200 200 this.element.find('#insert_cell_above').click(function () {
201 201 IPython.notebook.insert_cell_above('code');
202 202 IPython.notebook.select_prev();
203 203 });
204 204 this.element.find('#insert_cell_below').click(function () {
205 205 IPython.notebook.insert_cell_below('code');
206 206 IPython.notebook.select_next();
207 207 });
208 208 // Cell
209 209 this.element.find('#run_cell').click(function () {
210 210 IPython.notebook.execute_cell();
211 211 });
212 212 this.element.find('#run_cell_select_below').click(function () {
213 213 IPython.notebook.execute_cell_and_select_below();
214 214 });
215 215 this.element.find('#run_cell_insert_below').click(function () {
216 216 IPython.notebook.execute_cell_and_insert_below();
217 217 });
218 218 this.element.find('#run_all_cells').click(function () {
219 219 IPython.notebook.execute_all_cells();
220 220 });
221 221 this.element.find('#run_all_cells_above').click(function () {
222 222 IPython.notebook.execute_cells_above();
223 223 });
224 224 this.element.find('#run_all_cells_below').click(function () {
225 225 IPython.notebook.execute_cells_below();
226 226 });
227 227 this.element.find('#to_code').click(function () {
228 228 IPython.notebook.to_code();
229 229 });
230 230 this.element.find('#to_markdown').click(function () {
231 231 IPython.notebook.to_markdown();
232 232 });
233 233 this.element.find('#to_raw').click(function () {
234 234 IPython.notebook.to_raw();
235 235 });
236 236 this.element.find('#to_heading1').click(function () {
237 237 IPython.notebook.to_heading(undefined, 1);
238 238 });
239 239 this.element.find('#to_heading2').click(function () {
240 240 IPython.notebook.to_heading(undefined, 2);
241 241 });
242 242 this.element.find('#to_heading3').click(function () {
243 243 IPython.notebook.to_heading(undefined, 3);
244 244 });
245 245 this.element.find('#to_heading4').click(function () {
246 246 IPython.notebook.to_heading(undefined, 4);
247 247 });
248 248 this.element.find('#to_heading5').click(function () {
249 249 IPython.notebook.to_heading(undefined, 5);
250 250 });
251 251 this.element.find('#to_heading6').click(function () {
252 252 IPython.notebook.to_heading(undefined, 6);
253 253 });
254 254
255 255 this.element.find('#toggle_current_output').click(function () {
256 256 IPython.notebook.toggle_output();
257 257 });
258 258 this.element.find('#toggle_current_output_scroll').click(function () {
259 259 IPython.notebook.toggle_output_scroll();
260 260 });
261 261 this.element.find('#clear_current_output').click(function () {
262 262 IPython.notebook.clear_output();
263 263 });
264 264
265 265 this.element.find('#toggle_all_output').click(function () {
266 266 IPython.notebook.toggle_all_output();
267 267 });
268 268 this.element.find('#toggle_all_output_scroll').click(function () {
269 269 IPython.notebook.toggle_all_output_scroll();
270 270 });
271 271 this.element.find('#clear_all_output').click(function () {
272 272 IPython.notebook.clear_all_output();
273 273 });
274 274
275 275 // Kernel
276 276 this.element.find('#int_kernel').click(function () {
277 277 IPython.notebook.session.interrupt_kernel();
278 278 });
279 279 this.element.find('#restart_kernel').click(function () {
280 280 IPython.notebook.restart_kernel();
281 281 });
282 282 // Help
283 283 this.element.find('#notebook_tour').click(function () {
284 284 IPython.tour.start();
285 285 });
286 286 this.element.find('#keyboard_shortcuts').click(function () {
287 287 IPython.quick_help.show_keyboard_shortcuts();
288 288 });
289 289
290 290 this.update_restore_checkpoint(null);
291 291
292 292 $([IPython.events]).on('checkpoints_listed.Notebook', function (event, data) {
293 293 that.update_restore_checkpoint(IPython.notebook.checkpoints);
294 294 });
295 295
296 296 $([IPython.events]).on('checkpoint_created.Notebook', function (event, data) {
297 297 that.update_restore_checkpoint(IPython.notebook.checkpoints);
298 298 });
299 299 };
300 300
301 301 MenuBar.prototype.update_restore_checkpoint = function(checkpoints) {
302 302 var ul = this.element.find("#restore_checkpoint").find("ul");
303 303 ul.empty();
304 304 if (!checkpoints || checkpoints.length === 0) {
305 305 ul.append(
306 306 $("<li/>")
307 307 .addClass("disabled")
308 308 .append(
309 309 $("<a/>")
310 310 .text("No checkpoints")
311 311 )
312 312 );
313 313 return;
314 314 }
315 315
316 316 checkpoints.map(function (checkpoint) {
317 317 var d = new Date(checkpoint.last_modified);
318 318 ul.append(
319 319 $("<li/>").append(
320 320 $("<a/>")
321 321 .attr("href", "#")
322 322 .text(d.format("mmm dd HH:MM:ss"))
323 323 .click(function () {
324 324 IPython.notebook.restore_checkpoint_dialog(checkpoint);
325 325 })
326 326 )
327 327 );
328 328 });
329 329 };
330 330
331 331 IPython.MenuBar = MenuBar;
332 332
333 333 return IPython;
334 334
335 335 }(IPython));
@@ -1,360 +1,361 b''
1 1 {% extends "page.html" %}
2 2
3 3 {% block stylesheet %}
4 4
5 5 {% if mathjax_url %}
6 6 <script type="text/javascript" src="{{mathjax_url}}?config=TeX-AMS_HTML-full&delayStartupUntil=configured" charset="utf-8"></script>
7 7 {% endif %}
8 8 <script type="text/javascript">
9 9 // MathJax disabled, set as null to distingish from *missing* MathJax,
10 10 // where it will be undefined, and should prompt a dialog later.
11 11 window.mathjax_url = "{{mathjax_url}}";
12 12 </script>
13 13
14 14 <link rel="stylesheet" href="{{ static_url("components/bootstrap-tour/build/css/bootstrap-tour.min.css") }}" type="text/css" />
15 15 <link rel="stylesheet" href="{{ static_url("components/codemirror/lib/codemirror.css") }}">
16 16
17 17 {{super()}}
18 18
19 19 <link rel="stylesheet" href="{{ static_url("notebook/css/override.css") }}" type="text/css" />
20 20
21 21 {% endblock %}
22 22
23 23 {% block params %}
24 24
25 25 data-project="{{project}}"
26 26 data-base-url="{{base_url}}"
27 27 data-notebook-name="{{notebook_name}}"
28 28 data-notebook-path="{{notebook_path}}"
29 29 class="notebook_app"
30 30
31 31 {% endblock %}
32 32
33 33
34 34 {% block header %}
35 35
36 36 <span id="save_widget" class="nav pull-left">
37 37 <span id="notebook_name"></span>
38 38 <span id="checkpoint_status"></span>
39 39 <span id="autosave_status"></span>
40 40 </span>
41 41
42 42 {% endblock %}
43 43
44 44
45 45 {% block site %}
46 46
47 47 <div id="menubar-container" class="container">
48 48 <div id="menubar">
49 49 <div class="navbar">
50 50 <div class="navbar-inner">
51 51 <div class="container">
52 52 <ul id="menus" class="nav">
53 53 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">File</a>
54 54 <ul id="file_menu" class="dropdown-menu">
55 55 <li id="new_notebook"
56 56 title="Make a new notebook (Opens a new window)">
57 57 <a href="#">New</a></li>
58 58 <li id="open_notebook"
59 59 title="Opens a new window with the Dashboard view">
60 60 <a href="#">Open...</a></li>
61 61 <!-- <hr/> -->
62 62 <li class="divider"></li>
63 63 <li id="copy_notebook"
64 64 title="Open a copy of this notebook's contents and start a new kernel">
65 65 <a href="#">Make a Copy...</a></li>
66 66 <li id="rename_notebook"><a href="#">Rename...</a></li>
67 67 <li id="save_checkpoint"><a href="#">Save and Checkpoint</a></li>
68 68 <!-- <hr/> -->
69 69 <li class="divider"></li>
70 70 <li id="restore_checkpoint" class="dropdown-submenu"><a href="#">Revert to Checkpoint</a>
71 71 <ul class="dropdown-menu">
72 72 <li><a href="#"></a></li>
73 73 <li><a href="#"></a></li>
74 74 <li><a href="#"></a></li>
75 75 <li><a href="#"></a></li>
76 76 <li><a href="#"></a></li>
77 77 </ul>
78 78 </li>
79 79 <li class="divider"></li>
80 80 <li id="print_preview"><a href="#">Print Preview</a></li>
81 81 <li class="dropdown-submenu"><a href="#">Download as</a>
82 82 <ul class="dropdown-menu">
83 83 <li id="download_ipynb"><a href="#">IPython Notebook (.ipynb)</a></li>
84 84 <li id="download_py"><a href="#">Python (.py)</a></li>
85 85 <li id="download_html"><a href="#">HTML (.html)</a></li>
86 86 <li id="download_rst"><a href="#">reST (.rst)</a></li>
87 <li id="download_pdf"><a href="#">PDF (.pdf)</a></li>
87 88 </ul>
88 89 </li>
89 90 <li class="divider"></li>
90 91 <li id="trust_notebook"
91 92 title="Trust the output of this notebook">
92 93 <a href="#" >Trust Notebook</a></li>
93 94 <li class="divider"></li>
94 95 <li id="kill_and_exit"
95 96 title="Shutdown this notebook's kernel, and close this window">
96 97 <a href="#" >Close and halt</a></li>
97 98 </ul>
98 99 </li>
99 100 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Edit</a>
100 101 <ul id="edit_menu" class="dropdown-menu">
101 102 <li id="cut_cell"><a href="#">Cut Cell</a></li>
102 103 <li id="copy_cell"><a href="#">Copy Cell</a></li>
103 104 <li id="paste_cell_above" class="disabled"><a href="#">Paste Cell Above</a></li>
104 105 <li id="paste_cell_below" class="disabled"><a href="#">Paste Cell Below</a></li>
105 106 <li id="paste_cell_replace" class="disabled"><a href="#">Paste Cell &amp; Replace</a></li>
106 107 <li id="delete_cell"><a href="#">Delete Cell</a></li>
107 108 <li id="undelete_cell" class="disabled"><a href="#">Undo Delete Cell</a></li>
108 109 <li class="divider"></li>
109 110 <li id="split_cell"><a href="#">Split Cell</a></li>
110 111 <li id="merge_cell_above"><a href="#">Merge Cell Above</a></li>
111 112 <li id="merge_cell_below"><a href="#">Merge Cell Below</a></li>
112 113 <li class="divider"></li>
113 114 <li id="move_cell_up"><a href="#">Move Cell Up</a></li>
114 115 <li id="move_cell_down"><a href="#">Move Cell Down</a></li>
115 116 <li class="divider"></li>
116 117 <li id="edit_nb_metadata"><a href="#">Edit Notebook Metadata</a></li>
117 118 </ul>
118 119 </li>
119 120 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">View</a>
120 121 <ul id="view_menu" class="dropdown-menu">
121 122 <li id="toggle_header"
122 123 title="Show/Hide the IPython Notebook logo and notebook title (above menu bar)">
123 124 <a href="#">Toggle Header</a></li>
124 125 <li id="toggle_toolbar"
125 126 title="Show/Hide the action icons (below menu bar)">
126 127 <a href="#">Toggle Toolbar</a></li>
127 128 </ul>
128 129 </li>
129 130 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Insert</a>
130 131 <ul id="insert_menu" class="dropdown-menu">
131 132 <li id="insert_cell_above"
132 133 title="Insert an empty Code cell above the currently active cell">
133 134 <a href="#">Insert Cell Above</a></li>
134 135 <li id="insert_cell_below"
135 136 title="Insert an empty Code cell below the currently active cell">
136 137 <a href="#">Insert Cell Below</a></li>
137 138 </ul>
138 139 </li>
139 140 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Cell</a>
140 141 <ul id="cell_menu" class="dropdown-menu">
141 142 <li id="run_cell" title="Run this cell, and move cursor to the next one">
142 143 <a href="#">Run</a></li>
143 144 <li id="run_cell_select_below" title="Run this cell, select below">
144 145 <a href="#">Run and Select Below</a></li>
145 146 <li id="run_cell_insert_below" title="Run this cell, insert below">
146 147 <a href="#">Run and Insert Below</a></li>
147 148 <li id="run_all_cells" title="Run all cells in the notebook">
148 149 <a href="#">Run All</a></li>
149 150 <li id="run_all_cells_above" title="Run all cells above (but not including) this cell">
150 151 <a href="#">Run All Above</a></li>
151 152 <li id="run_all_cells_below" title="Run this cell and all cells below it">
152 153 <a href="#">Run All Below</a></li>
153 154 <li class="divider"></li>
154 155 <li id="change_cell_type" class="dropdown-submenu"
155 156 title="All cells in the notebook have a cell type. By default, new cells are created as 'Code' cells">
156 157 <a href="#">Cell Type</a>
157 158 <ul class="dropdown-menu">
158 159 <li id="to_code"
159 160 title="Contents will be sent to the kernel for execution, and output will display in the footer of cell">
160 161 <a href="#">Code</a></li>
161 162 <li id="to_markdown"
162 163 title="Contents will be rendered as HTML and serve as explanatory text">
163 164 <a href="#">Markdown</a></li>
164 165 <li id="to_raw"
165 166 title="Contents will pass through nbconvert unmodified">
166 167 <a href="#">Raw NBConvert</a></li>
167 168 <li id="to_heading1"><a href="#">Heading 1</a></li>
168 169 <li id="to_heading2"><a href="#">Heading 2</a></li>
169 170 <li id="to_heading3"><a href="#">Heading 3</a></li>
170 171 <li id="to_heading4"><a href="#">Heading 4</a></li>
171 172 <li id="to_heading5"><a href="#">Heading 5</a></li>
172 173 <li id="to_heading6"><a href="#">Heading 6</a></li>
173 174 </ul>
174 175 </li>
175 176 <li class="divider"></li>
176 177 <li id="current_outputs" class="dropdown-submenu"><a href="#">Current Output</a>
177 178 <ul class="dropdown-menu">
178 179 <li id="toggle_current_output"
179 180 title="Hide/Show the output of the current cell">
180 181 <a href="#">Toggle</a>
181 182 </li>
182 183 <li id="toggle_current_output_scroll"
183 184 title="Scroll the output of the current cell">
184 185 <a href="#">Toggle Scrolling</a>
185 186 </li>
186 187 <li id="clear_current_output"
187 188 title="Clear the output of the current cell">
188 189 <a href="#">Clear</a>
189 190 </li>
190 191 </ul>
191 192 </li>
192 193 <li id="all_outputs" class="dropdown-submenu"><a href="#">All Output</a>
193 194 <ul class="dropdown-menu">
194 195 <li id="toggle_all_output"
195 196 title="Hide/Show the output of all cells">
196 197 <a href="#">Toggle</a>
197 198 </li>
198 199 <li id="toggle_all_output_scroll"
199 200 title="Scroll the output of all cells">
200 201 <a href="#">Toggle Scrolling</a>
201 202 </li>
202 203 <li id="clear_all_output"
203 204 title="Clear the output of all cells">
204 205 <a href="#">Clear</a>
205 206 </li>
206 207 </ul>
207 208 </li>
208 209 </ul>
209 210 </li>
210 211 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Kernel</a>
211 212 <ul id="kernel_menu" class="dropdown-menu">
212 213 <li id="int_kernel"
213 214 title="Send KeyboardInterrupt (CTRL-C) to the Kernel">
214 215 <a href="#">Interrupt</a></li>
215 216 <li id="restart_kernel"
216 217 title="Restart the Kernel">
217 218 <a href="#">Restart</a></li>
218 219 </ul>
219 220 </li>
220 221 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Help</a>
221 222 <ul id="help_menu" class="dropdown-menu">
222 223 <li id="notebook_tour" title="A quick tour of the notebook user interface"><a href="#">User Interface Tour</a></li>
223 224 <li id="keyboard_shortcuts" title="Opens a tooltip with all keyboard shortcuts"><a href="#">Keyboard Shortcuts</a></li>
224 225 <li class="divider"></li>
225 226 {% set
226 227 sections = (
227 228 (
228 229 ("http://ipython.org/documentation.html","IPython Help",True),
229 230 ("http://nbviewer.ipython.org/github/ipython/ipython/tree/2.x/examples/Index.ipynb", "Notebook Help", True),
230 231 ),(
231 232 ("http://docs.python.org","Python",True),
232 233 ("http://docs.scipy.org/doc/numpy/reference/","NumPy",True),
233 234 ("http://docs.scipy.org/doc/scipy/reference/","SciPy",True),
234 235 ("http://matplotlib.org/contents.html","Matplotlib",True),
235 236 ("http://docs.sympy.org/latest/index.html","SymPy",True),
236 237 ("http://pandas.pydata.org/pandas-docs/stable/","pandas", True)
237 238 )
238 239 )
239 240 %}
240 241
241 242 {% for helplinks in sections %}
242 243 {% for link in helplinks %}
243 244 <li><a href="{{link[0]}}" {{'target="_blank" title="Opens in a new window"' if link[2]}}>
244 245 {{'<i class="icon-external-link menu-icon pull-right"></i>' if link[2]}}
245 246 {{link[1]}}
246 247 </a></li>
247 248 {% endfor %}
248 249 {% if not loop.last %}
249 250 <li class="divider"></li>
250 251 {% endif %}
251 252 {% endfor %}
252 253 </li>
253 254 </ul>
254 255 </li>
255 256 </ul>
256 257 <div id="kernel_indicator" class="indicator_area pull-right">
257 258 <i id="kernel_indicator_icon"></i>
258 259 </div>
259 260 <div id="modal_indicator" class="indicator_area pull-right">
260 261 <i id="modal_indicator_icon"></i>
261 262 </div>
262 263 <div id="notification_area"></div>
263 264 </div>
264 265 </div>
265 266 </div>
266 267 </div>
267 268 <div id="maintoolbar" class="navbar">
268 269 <div class="toolbar-inner navbar-inner navbar-nobg">
269 270 <div id="maintoolbar-container" class="container"></div>
270 271 </div>
271 272 </div>
272 273 </div>
273 274
274 275 <div id="ipython-main-app">
275 276
276 277 <div id="notebook_panel">
277 278 <div id="notebook"></div>
278 279 <div id="pager_splitter"></div>
279 280 <div id="pager">
280 281 <div id='pager_button_area'>
281 282 </div>
282 283 <div id="pager-container" class="container"></div>
283 284 </div>
284 285 </div>
285 286
286 287 </div>
287 288 <div id='tooltip' class='ipython_tooltip' style='display:none'></div>
288 289
289 290
290 291 {% endblock %}
291 292
292 293
293 294 {% block script %}
294 295
295 296 {{super()}}
296 297
297 298 <script src="{{ static_url("components/google-caja/html-css-sanitizer-minified.js") }}" charset="utf-8"></script>
298 299 <script src="{{ static_url("components/codemirror/lib/codemirror.js") }}" charset="utf-8"></script>
299 300 <script type="text/javascript">
300 301 CodeMirror.modeURL = "{{ static_url("components/codemirror/mode/%N/%N.js", include_version=False) }}";
301 302 </script>
302 303 <script src="{{ static_url("components/codemirror/addon/mode/loadmode.js") }}" charset="utf-8"></script>
303 304 <script src="{{ static_url("components/codemirror/addon/mode/multiplex.js") }}" charset="utf-8"></script>
304 305 <script src="{{ static_url("components/codemirror/addon/mode/overlay.js") }}" charset="utf-8"></script>
305 306 <script src="{{ static_url("components/codemirror/addon/edit/matchbrackets.js") }}" charset="utf-8"></script>
306 307 <script src="{{ static_url("components/codemirror/addon/edit/closebrackets.js") }}" charset="utf-8"></script>
307 308 <script src="{{ static_url("components/codemirror/addon/comment/comment.js") }}" charset="utf-8"></script>
308 309 <script src="{{ static_url("components/codemirror/mode/htmlmixed/htmlmixed.js") }}" charset="utf-8"></script>
309 310 <script src="{{ static_url("components/codemirror/mode/xml/xml.js") }}" charset="utf-8"></script>
310 311 <script src="{{ static_url("components/codemirror/mode/javascript/javascript.js") }}" charset="utf-8"></script>
311 312 <script src="{{ static_url("components/codemirror/mode/css/css.js") }}" charset="utf-8"></script>
312 313 <script src="{{ static_url("components/codemirror/mode/rst/rst.js") }}" charset="utf-8"></script>
313 314 <script src="{{ static_url("components/codemirror/mode/markdown/markdown.js") }}" charset="utf-8"></script>
314 315 <script src="{{ static_url("components/codemirror/mode/gfm/gfm.js") }}" charset="utf-8"></script>
315 316 <script src="{{ static_url("components/codemirror/mode/python/python.js") }}" charset="utf-8"></script>
316 317 <script src="{{ static_url("notebook/js/codemirror-ipython.js") }}" charset="utf-8"></script>
317 318
318 319 <script src="{{ static_url("components/highlight.js/build/highlight.pack.js") }}" charset="utf-8"></script>
319 320
320 321 <script src="{{ static_url("dateformat/date.format.js") }}" charset="utf-8"></script>
321 322
322 323 <script src="{{ static_url("base/js/events.js") }}" type="text/javascript" charset="utf-8"></script>
323 324 <script src="{{ static_url("base/js/utils.js") }}" type="text/javascript" charset="utf-8"></script>
324 325 <script src="{{ static_url("base/js/keyboard.js") }}" type="text/javascript" charset="utf-8"></script>
325 326 <script src="{{ static_url("base/js/security.js") }}" type="text/javascript" charset="utf-8"></script>
326 327 <script src="{{ static_url("base/js/dialog.js") }}" type="text/javascript" charset="utf-8"></script>
327 328 <script src="{{ static_url("services/kernels/js/kernel.js") }}" type="text/javascript" charset="utf-8"></script>
328 329 <script src="{{ static_url("services/kernels/js/comm.js") }}" type="text/javascript" charset="utf-8"></script>
329 330 <script src="{{ static_url("services/sessions/js/session.js") }}" type="text/javascript" charset="utf-8"></script>
330 331 <script src="{{ static_url("notebook/js/layoutmanager.js") }}" type="text/javascript" charset="utf-8"></script>
331 332 <script src="{{ static_url("notebook/js/mathjaxutils.js") }}" type="text/javascript" charset="utf-8"></script>
332 333 <script src="{{ static_url("notebook/js/outputarea.js") }}" type="text/javascript" charset="utf-8"></script>
333 334 <script src="{{ static_url("notebook/js/cell.js") }}" type="text/javascript" charset="utf-8"></script>
334 335 <script src="{{ static_url("notebook/js/celltoolbar.js") }}" type="text/javascript" charset="utf-8"></script>
335 336 <script src="{{ static_url("notebook/js/codecell.js") }}" type="text/javascript" charset="utf-8"></script>
336 337 <script src="{{ static_url("notebook/js/completer.js") }}" type="text/javascript" charset="utf-8"></script>
337 338 <script src="{{ static_url("notebook/js/textcell.js") }}" type="text/javascript" charset="utf-8"></script>
338 339 <script src="{{ static_url("notebook/js/savewidget.js") }}" type="text/javascript" charset="utf-8"></script>
339 340 <script src="{{ static_url("notebook/js/quickhelp.js") }}" type="text/javascript" charset="utf-8"></script>
340 341 <script src="{{ static_url("notebook/js/pager.js") }}" type="text/javascript" charset="utf-8"></script>
341 342 <script src="{{ static_url("notebook/js/menubar.js") }}" type="text/javascript" charset="utf-8"></script>
342 343 <script src="{{ static_url("notebook/js/toolbar.js") }}" type="text/javascript" charset="utf-8"></script>
343 344 <script src="{{ static_url("notebook/js/maintoolbar.js") }}" type="text/javascript" charset="utf-8"></script>
344 345 <script src="{{ static_url("notebook/js/notebook.js") }}" type="text/javascript" charset="utf-8"></script>
345 346 <script src="{{ static_url("notebook/js/keyboardmanager.js") }}" type="text/javascript" charset="utf-8"></script>
346 347 <script src="{{ static_url("notebook/js/notificationwidget.js") }}" type="text/javascript" charset="utf-8"></script>
347 348 <script src="{{ static_url("notebook/js/notificationarea.js") }}" type="text/javascript" charset="utf-8"></script>
348 349 <script src="{{ static_url("notebook/js/tooltip.js") }}" type="text/javascript" charset="utf-8"></script>
349 350 <script src="{{ static_url("notebook/js/tour.js") }}" type="text/javascript" charset="utf-8"></script>
350 351
351 352 <script src="{{ static_url("notebook/js/config.js") }}" type="text/javascript" charset="utf-8"></script>
352 353 <script src="{{ static_url("notebook/js/main.js") }}" type="text/javascript" charset="utf-8"></script>
353 354
354 355 <script src="{{ static_url("notebook/js/contexthint.js") }}" charset="utf-8"></script>
355 356
356 357 <script src="{{ static_url("notebook/js/celltoolbarpresets/default.js") }}" type="text/javascript" charset="utf-8"></script>
357 358 <script src="{{ static_url("notebook/js/celltoolbarpresets/rawcell.js") }}" type="text/javascript" charset="utf-8"></script>
358 359 <script src="{{ static_url("notebook/js/celltoolbarpresets/slideshow.js") }}" type="text/javascript" charset="utf-8"></script>
359 360
360 361 {% endblock %}
General Comments 0
You need to be logged in to leave comments. Login now