notebook.html 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. {% extends "page.html" %}
  2. {% block favicon %}<link id="favicon" rel="shortcut icon" type="image/x-icon" href="{{static_url("base/images/favicon-notebook.ico") }}">{% endblock %}
  3. {% block stylesheet %}
  4. {% if mathjax_url %}
  5. <script type="text/javascript" src="{{mathjax_url}}?config={{mathjax_config}}&delayStartupUntil=configured" charset="utf-8"></script>
  6. {% endif %}
  7. <script type="text/javascript">
  8. // MathJax disabled, set as null to distingish from *missing* MathJax,
  9. // where it will be undefined, and should prompt a dialog later.
  10. window.mathjax_url = "{{mathjax_url}}";
  11. </script>
  12. <link rel="stylesheet" href="{{ static_url("components/bootstrap-tour/build/css/bootstrap-tour.min.css") }}" type="text/css" />
  13. <link rel="stylesheet" href="{{ static_url("components/codemirror/lib/codemirror.css") }}">
  14. {{super()}}
  15. <link rel="stylesheet" href="{{ static_url("notebook/css/override.css") }}" type="text/css" />
  16. <link rel="stylesheet" href="" id='kernel-css' type="text/css" />
  17. {% endblock %}
  18. {% block bodyclasses %}notebook_app {{super()}}{% endblock %}
  19. {% block params %}
  20. {{super()}}
  21. data-base-url="{{base_url | urlencode}}"
  22. data-ws-url="{{ws_url | urlencode}}"
  23. data-notebook-name="{{notebook_name | urlencode}}"
  24. data-notebook-path="{{notebook_path | urlencode}}"
  25. {% endblock %}
  26. {% block headercontainer %}
  27. <span id="save_widget" class="save_widget">
  28. <span id="notebook_name" class="filename"></span>
  29. <span class="checkpoint_status"></span>
  30. <span class="autosave_status"></span>
  31. </span>
  32. <span id="kernel_logo_widget">
  33. {% block kernel_logo_widget %}
  34. <img class="current_kernel_logo" alt="Current Kernel Logo" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"/>
  35. {% endblock %}
  36. </span>
  37. {% endblock headercontainer %}
  38. {% block header %}
  39. <div id="menubar-container" class="container">
  40. <div id="menubar">
  41. <div id="menus" class="navbar navbar-default" role="navigation">
  42. <div class="container-fluid">
  43. <button type="button" class="btn btn-default navbar-btn navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
  44. <i class="fa fa-bars"></i>
  45. <span class="navbar-text">{% trans %}Menu{% endtrans %}</span>
  46. </button>
  47. <p id="kernel_indicator" class="navbar-text indicator_area">
  48. <span class="kernel_indicator_name">{% trans %}Kernel{% endtrans %}</span>
  49. <i id="kernel_indicator_icon"></i>
  50. </p>
  51. <i id="readonly-indicator" class="navbar-text" title='{% trans %}This notebook is read-only{% endtrans %}'>
  52. <span class="fa-stack">
  53. <i class="fa fa-save fa-stack-1x"></i>
  54. <i class="fa fa-ban fa-stack-2x text-danger"></i>
  55. </span>
  56. </i>
  57. <i id="modal_indicator" class="navbar-text"></i>
  58. <span id="notification_area"></span>
  59. <div class="navbar-collapse collapse">
  60. <ul class="nav navbar-nav">
  61. <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">{% trans %}File{% endtrans %}</a>
  62. <ul id="file_menu" class="dropdown-menu">
  63. <li id="new_notebook" class="dropdown-submenu">
  64. <a href="#">{% trans %}New Notebook{% endtrans %}</a>
  65. <ul class="dropdown-menu" id="menu-new-notebook-submenu"></ul>
  66. </li>
  67. <li id="open_notebook"
  68. title="{% trans %}Opens a new window with the Dashboard view{% endtrans %}">
  69. <a href="#">{% trans %}Open...{% endtrans %}</a></li>
  70. <!-- <hr/> -->
  71. <li class="divider"></li>
  72. <li id="copy_notebook"
  73. title="{% trans %}Open a copy of this notebook's contents and start a new kernel{% endtrans %}">
  74. <a href="#">{% trans %}Make a Copy...{% endtrans %}</a></li>
  75. <li id="save_notebook_as"
  76. title="{% trans %}Save a copy of the notebook's contents and start a new kernel{% endtrans %}">
  77. <a href="#">{% trans %}Save as...{% endtrans %}</a></li>
  78. <li id="rename_notebook"><a href="#">{% trans %}Rename...{% endtrans %}</a></li>
  79. <li id="save_checkpoint"><a href="#">{% trans %}Save and Checkpoint{% endtrans %}</a></li>
  80. <!-- <hr/> -->
  81. <li class="divider"></li>
  82. <li id="restore_checkpoint" class="dropdown-submenu"><a href="#">{% trans %}Revert to Checkpoint{% endtrans %}</a>
  83. <ul class="dropdown-menu">
  84. <li><a href="#"></a></li>
  85. <li><a href="#"></a></li>
  86. <li><a href="#"></a></li>
  87. <li><a href="#"></a></li>
  88. <li><a href="#"></a></li>
  89. </ul>
  90. </li>
  91. <li class="divider"></li>
  92. <li id="print_preview"><a href="#">{% trans %}Print Preview{% endtrans %}</a></li>
  93. <li class="dropdown-submenu"><a href="#">{% trans %}Download as{% endtrans %}</a>
  94. <ul id="download_menu" class="dropdown-menu">
  95. {% for exporter in get_frontend_exporters() %}
  96. <li id="download_{{ exporter.name }}">
  97. <a href="#">{{ exporter.display }}</a>
  98. </li>
  99. {% endfor %}
  100. </ul>
  101. </li>
  102. <li class="dropdown-submenu hidden"><a href="#">{% trans %}Deploy as{% endtrans %}</a>
  103. <ul id="deploy_menu" class="dropdown-menu"></ul>
  104. </li>
  105. <li class="divider"></li>
  106. <li id="trust_notebook"
  107. title="{% trans %}Trust the output of this notebook{% endtrans %}">
  108. <a href="#" >{% trans %}Trust Notebook{% endtrans %}</a></li>
  109. <li class="divider"></li>
  110. <li id="close_and_halt"
  111. title="{% trans %}Shutdown this notebook's kernel, and close this window{% endtrans %}">
  112. <a href="#" >{% trans %}Close and Halt{% endtrans %}</a></li>
  113. </ul>
  114. </li>
  115. <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">{% trans %}Edit{% endtrans %}</a>
  116. <ul id="edit_menu" class="dropdown-menu">
  117. <li id="cut_cell"><a href="#">{% trans %}Cut Cells{% endtrans %}</a></li>
  118. <li id="copy_cell"><a href="#">{% trans %}Copy Cells{% endtrans %}</a></li>
  119. <li id="paste_cell_above" class="disabled"><a href="#">{% trans %}Paste Cells Above{% endtrans %}</a></li>
  120. <li id="paste_cell_below" class="disabled"><a href="#">{% trans %}Paste Cells Below{% endtrans %}</a></li>
  121. <li id="paste_cell_replace" class="disabled"><a href="#">{% trans %}Paste Cells &amp; Replace{% endtrans %}</a></li>
  122. <li id="delete_cell"><a href="#">{% trans %}Delete Cells{% endtrans %}</a></li>
  123. <li id="undelete_cell" class="disabled"><a href="#">{% trans %}Undo Delete Cells{% endtrans %}</a></li>
  124. <li class="divider"></li>
  125. <li id="split_cell"><a href="#">{% trans %}Split Cell{% endtrans %}</a></li>
  126. <li id="merge_cell_above"><a href="#">{% trans %}Merge Cell Above{% endtrans %}</a></li>
  127. <li id="merge_cell_below"><a href="#">{% trans %}Merge Cell Below{% endtrans %}</a></li>
  128. <li class="divider"></li>
  129. <li id="move_cell_up"><a href="#">{% trans %}Move Cell Up{% endtrans %}</a></li>
  130. <li id="move_cell_down"><a href="#">{% trans %}Move Cell Down{% endtrans %}</a></li>
  131. <li class="divider"></li>
  132. <li id="edit_nb_metadata"><a href="#">{% trans %}Edit Notebook Metadata{% endtrans %}</a></li>
  133. <li class="divider"></li>
  134. <li id="find_and_replace"><a href="#"> {% trans %}Find and Replace{% endtrans %} </a></li>
  135. <li class="divider"></li>
  136. <li id="cut_cell_attachments"><a href="#">{% trans %}Cut Cell Attachments{% endtrans %}</a></li>
  137. <li id="copy_cell_attachments"><a href="#">{% trans %}Copy Cell Attachments{% endtrans %}</a></li>
  138. <li id="paste_cell_attachments" class="disabled"><a href="#">{% trans %}Paste Cell Attachments{% endtrans %}</a></li>
  139. <li class="divider"></li>
  140. <li id="insert_image" class="disabled"><a href="#"> {% trans %}Insert Image{% endtrans %} </a></li>
  141. </ul>
  142. </li>
  143. <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">{% trans %}View{% endtrans %}</a>
  144. <ul id="view_menu" class="dropdown-menu">
  145. <li id="toggle_header"
  146. title="{% trans %}Show/Hide the logo and notebook title (above menu bar){% endtrans %}">
  147. <a href="#">{% trans %}Toggle Header{% endtrans %}</a>
  148. </li>
  149. <li id="toggle_toolbar"
  150. title="{% trans %}Show/Hide the action icons (below menu bar){% endtrans %}">
  151. <a href="#">{% trans %}Toggle Toolbar{% endtrans %}</a>
  152. </li>
  153. <li id="toggle_line_numbers"
  154. title="{% trans %}Show/Hide line numbers in cells{% endtrans %}">
  155. <a href="#">{% trans %}Toggle Line Numbers{% endtrans %}</a>
  156. </li>
  157. <li id="menu-cell-toolbar" class="dropdown-submenu">
  158. <a href="#">{% trans %}Cell Toolbar{% endtrans %}</a>
  159. <ul class="dropdown-menu" id="menu-cell-toolbar-submenu"></ul>
  160. </li>
  161. </ul>
  162. </li>
  163. <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">{% trans %}Insert{% endtrans %}</a>
  164. <ul id="insert_menu" class="dropdown-menu">
  165. <li id="insert_cell_above"
  166. title="{% trans %}Insert an empty Code cell above the currently active cell{% endtrans %}">
  167. <a href="#">{% trans %}Insert Cell Above{% endtrans %}</a></li>
  168. <li id="insert_cell_below"
  169. title="{% trans %}Insert an empty Code cell below the currently active cell{% endtrans %}">
  170. <a href="#">{% trans %}Insert Cell Below{% endtrans %}</a></li>
  171. </ul>
  172. </li>
  173. <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">{% trans %}Cell{% endtrans %}</a>
  174. <ul id="cell_menu" class="dropdown-menu">
  175. <li id="run_cell" title="{% trans %}Run this cell, and move cursor to the next one{% endtrans %}">
  176. <a href="#">{% trans %}Run Cells{% endtrans %}</a></li>
  177. <li id="run_cell_select_below" title="{% trans %}Run this cell, select below{% endtrans %}">
  178. <a href="#">{% trans %}Run Cells and Select Below{% endtrans %}</a></li>
  179. <li id="run_cell_insert_below" title="{% trans %}Run this cell, insert below{% endtrans %}">
  180. <a href="#">{% trans %}Run Cells and Insert Below{% endtrans %}</a></li>
  181. <li id="run_all_cells" title="{% trans %}Run all cells in the notebook{% endtrans %}">
  182. <a href="#">{% trans %}Run All{% endtrans %}</a></li>
  183. <li id="run_all_cells_above" title="{% trans %}Run all cells above (but not including) this cell{% endtrans %}">
  184. <a href="#">{% trans %}Run All Above{% endtrans %}</a></li>
  185. <li id="run_all_cells_below" title="{% trans %}Run this cell and all cells below it{% endtrans %}">
  186. <a href="#">{% trans %}Run All Below{% endtrans %}</a></li>
  187. <li class="divider"></li>
  188. <li id="change_cell_type" class="dropdown-submenu"
  189. title="{% trans %}All cells in the notebook have a cell type. By default, new cells are created as 'Code' cells{% endtrans %}">
  190. <a href="#">{% trans %}Cell Type{% endtrans %}</a>
  191. <ul class="dropdown-menu">
  192. <li id="to_code"
  193. title="{% trans %}Contents will be sent to the kernel for execution, and output will display in the footer of cell{% endtrans %}">
  194. <a href="#">Code</a></li>
  195. <li id="to_markdown"
  196. title="{% trans %}Contents will be rendered as HTML and serve as explanatory text{% endtrans %}">
  197. <a href="#">{% trans %}Markdown{% endtrans %}</a></li>
  198. <li id="to_raw"
  199. title="{% trans %}Contents will pass through nbconvert unmodified{% endtrans %}">
  200. <a href="#">{% trans %}Raw NBConvert{% endtrans %}</a></li>
  201. </ul>
  202. </li>
  203. <li class="divider"></li>
  204. <li id="current_outputs" class="dropdown-submenu"><a href="#">{% trans %}Current Outputs{% endtrans %}</a>
  205. <ul class="dropdown-menu">
  206. <li id="toggle_current_output"
  207. title="{% trans %}Hide/Show the output of the current cell{% endtrans %}">
  208. <a href="#">{% trans %}Toggle{% endtrans %}</a>
  209. </li>
  210. <li id="toggle_current_output_scroll"
  211. title="{% trans %}Scroll the output of the current cell{% endtrans %}">
  212. <a href="#">{% trans %}Toggle Scrolling{% endtrans %}</a>
  213. </li>
  214. <li id="clear_current_output"
  215. title="{% trans %}Clear the output of the current cell{% endtrans %}">
  216. <a href="#">{% trans %}Clear{% endtrans %}</a>
  217. </li>
  218. </ul>
  219. </li>
  220. <li id="all_outputs" class="dropdown-submenu"><a href="#">{% trans %}All Output{% endtrans %}</a>
  221. <ul class="dropdown-menu">
  222. <li id="toggle_all_output"
  223. title="{% trans %}Hide/Show the output of all cells{% endtrans %}">
  224. <a href="#">{% trans %}Toggle{% endtrans %}</a>
  225. </li>
  226. <li id="toggle_all_output_scroll"
  227. title="{% trans %}Scroll the output of all cells{% endtrans %}">
  228. <a href="#">{% trans %}Toggle Scrolling{% endtrans %}</a>
  229. </li>
  230. <li id="clear_all_output"
  231. title="{% trans %}Clear the output of all cells{% endtrans %}">
  232. <a href="#">{% trans %}Clear{% endtrans %}</a>
  233. </li>
  234. </ul>
  235. </li>
  236. </ul>
  237. </li>
  238. <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">{% trans %}Kernel{% endtrans %}</a>
  239. <ul id="kernel_menu" class="dropdown-menu">
  240. <li id="int_kernel"
  241. title="{% trans %}Send Keyboard Interrupt (CTRL-C) to the Kernel{% endtrans %}">
  242. <a href="#">{% trans %}Interrupt{% endtrans %}</a>
  243. </li>
  244. <li id="restart_kernel"
  245. title="{% trans %}Restart the Kernel{% endtrans %}">
  246. <a href="#">{% trans %}Restart{% endtrans %}</a>
  247. </li>
  248. <li id="restart_clear_output"
  249. title="{% trans %}Restart the Kernel and clear all output{% endtrans %}">
  250. <a href="#">{% trans %}Restart &amp; Clear Output{% endtrans %}</a>
  251. </li>
  252. <li id="restart_run_all"
  253. title="{% trans %}Restart the Kernel and re-run the notebook{% endtrans %}">
  254. <a href="#">{% trans %}Restart &amp; Run All{% endtrans %}</a>
  255. </li>
  256. <li id="reconnect_kernel"
  257. title="{% trans %}Reconnect to the Kernel{% endtrans %}">
  258. <a href="#">{% trans %}Reconnect{% endtrans %}</a>
  259. </li>
  260. <li id="shutdown_kernel"
  261. title="Shutdown the Kernel">
  262. <a href="#">{% trans %}Shutdown{% endtrans %}</a>
  263. </li>
  264. <li class="divider"></li>
  265. <li id="menu-change-kernel" class="dropdown-submenu">
  266. <a href="#">{% trans %}Change kernel{% endtrans %}</a>
  267. <ul class="dropdown-menu" id="menu-change-kernel-submenu"></ul>
  268. </li>
  269. </ul>
  270. </li>
  271. <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">{% trans %}Help{% endtrans %}</a>
  272. <ul id="help_menu" class="dropdown-menu">
  273. {% block help %}
  274. <li id="notebook_tour" title="{% trans %}A quick tour of the notebook user interface{% endtrans %}"><a href="#">{% trans %}User Interface Tour{% endtrans %}</a></li>
  275. <li id="keyboard_shortcuts" title="{% trans %}Opens a tooltip with all keyboard shortcuts{% endtrans %}"><a href="#">{% trans %}Keyboard Shortcuts{% endtrans %}</a></li>
  276. <li id="edit_keyboard_shortcuts" title="{% trans %}Opens a dialog allowing you to edit Keyboard shortcuts{% endtrans %}"><a href="#">{% trans %}Edit Keyboard Shortcuts{% endtrans %}</a></li>
  277. <li class="divider"></li>
  278. {% set
  279. sections = (
  280. (
  281. ("http://nbviewer.jupyter.org/github/ipython/ipython/blob/3.x/examples/Notebook/Index.ipynb", _("Notebook Help"), True),
  282. ("https://help.github.com/articles/markdown-basics/",_("Markdown"),True),
  283. ),
  284. )
  285. %}
  286. {% set openmsg = _("Opens in a new window") %}
  287. {% for helplinks in sections %}
  288. {% for link in helplinks %}
  289. <li><a rel="noreferrer" href="{{link[0]}}" target="{{'_blank' if link[2]}}" title="{{openmsg if link[2]}}">
  290. {% if link[2] %}
  291. <i class="fa fa-external-link menu-icon pull-right"></i>
  292. {% endif %}
  293. {{link[1]}}
  294. </a></li>
  295. {% endfor %}
  296. {% if not loop.last %}
  297. <li class="divider"></li>
  298. {% endif %}
  299. {% endfor %}
  300. <li class="divider"></li>
  301. <li title="{% trans %}About Jupyter Notebook{% endtrans %}"><a id="notebook_about" href="#">{% trans %}About{% endtrans %}</a></li>
  302. {% endblock %}
  303. </ul>
  304. </li>
  305. </ul>
  306. </div>
  307. </div>
  308. </div>
  309. </div>
  310. <div id="maintoolbar" class="navbar">
  311. <div class="toolbar-inner navbar-inner navbar-nobg">
  312. <div id="maintoolbar-container" class="container"></div>
  313. </div>
  314. </div>
  315. </div>
  316. <div class="lower-header-bar"></div>
  317. {% endblock header %}
  318. {% block site %}
  319. <div id="ipython-main-app">
  320. <div id="notebook_panel">
  321. <div id="notebook"></div>
  322. <div id='tooltip' class='ipython_tooltip' style='display:none'></div>
  323. </div>
  324. </div>
  325. {% endblock %}
  326. {% block after_site %}
  327. <div id="pager">
  328. <div id="pager-contents">
  329. <div id="pager-container" class="container"></div>
  330. </div>
  331. <div id='pager-button-area'></div>
  332. </div>
  333. {% endblock %}
  334. {% block script %}
  335. {{super()}}
  336. <script type="text/javascript">
  337. sys_info = {{sys_info|safe}};
  338. </script>
  339. <script src="{{ static_url("components/text-encoding/lib/encoding.js") }}" charset="utf-8"></script>
  340. <script src="{{ static_url("notebook/js/main.min.js") }}" type="text/javascript" charset="utf-8"></script>
  341. {% endblock %}