##// END OF EJS Templates
Inject requirejs in notebook and start using it.
Matthias BUSSONNIER -
Show More
@@ -1,1 +1,1 b''
1 Subproject commit 5548cce21d47d044438874e68a210884ba6a1549
1 Subproject commit 723c96699818e54ea31a5efe1b88042a5ac95151
@@ -8,15 +8,16 b''
8 //============================================================================
8 //============================================================================
9 // Notebook
9 // Notebook
10 //============================================================================
10 //============================================================================
11 "use strict";
11
12
12 /**
13 /**
13 * @module IPython
14 * @module IPython
14 * @namespace IPython
15 * @namespace IPython
15 **/
16 **/
16
17
17 var IPython = (function (IPython) {
18 define(function () {
18 /**
19 /**
19 * A place where some stuff can be confugured.
20 * A place where some stuff can be configured.
20 *
21 *
21 * @class config
22 * @class config
22 * @static
23 * @static
@@ -69,10 +70,9 b' var IPython = (function (IPython) {'
69 };
70 };
70
71
71 // use the same method to merge user configuration
72 // use the same method to merge user configuration
72 IPython.config = {};
73 var config = {};
73 $.extend(IPython.config, default_config);
74 $.extend(config, default_config);
74
75
75 return IPython;
76 return config;
76
77 });
77 }(IPython));
78
78
@@ -8,17 +8,30 b''
8 //============================================================================
8 //============================================================================
9 // On document ready
9 // On document ready
10 //============================================================================
10 //============================================================================
11 "use strict";
11
12
13 // for the time beeing, we have to pass marked as a parameter here,
14 // as injecting require.js make marked not to put itself in the globals,
15 // which make both this file fail at setting marked configuration, and textcell.js
16 // which search marked into global.
17 require(['static/components/marked/lib/marked.js',
18 'static/notebook/js/config.js'],
12
19
13 $(document).ready(function () {
20 function (marked, config) {
14
21
22 IPython.config = config;
23 console.log('config is',config);
24
25 window.marked = marked
15 // monkey patch CM to be able to syntax highlight cell magics
26 // monkey patch CM to be able to syntax highlight cell magics
16 // bug reported upstream,
27 // bug reported upstream,
17 // see https://github.com/marijnh/CodeMirror2/issues/670
28 // see https://github.com/marijnh/CodeMirror2/issues/670
18 if(CodeMirror.getMode(1,'text/plain').indent == undefined ){
29 if(CodeMirror.getMode(1,'text/plain').indent == undefined ){
19 console.log('patching CM for undefined indent');
30 console.log('patching CM for undefined indent');
20 CodeMirror.modes.null = function() { return {token: function(stream) {stream.skipToEnd();},indent : function(){return 0}}}
31 CodeMirror.modes.null = function() {
32 return {token: function(stream) {stream.skipToEnd();},indent : function(){return 0}}
21 }
33 }
34 }
22
35
23 CodeMirror.patchedGetMode = function(config, mode){
36 CodeMirror.patchedGetMode = function(config, mode){
24 var cmmode = CodeMirror.getMode(config, mode);
37 var cmmode = CodeMirror.getMode(config, mode);
@@ -90,10 +103,11 b' $(document).ready(function () {'
90 // only do this once
103 // only do this once
91 $([IPython.events]).off('notebook_loaded.Notebook', first_load);
104 $([IPython.events]).off('notebook_loaded.Notebook', first_load);
92 };
105 };
93
106
94 $([IPython.events]).on('notebook_loaded.Notebook', first_load);
107 $([IPython.events]).on('notebook_loaded.Notebook', first_load);
95 IPython.notebook.load_notebook($('body').data('notebookId'));
108 IPython.notebook.load_notebook($('body').data('notebookId'));
96
109
110 var marked;
97 if (marked) {
111 if (marked) {
98 marked.setOptions({
112 marked.setOptions({
99 gfm : true,
113 gfm : true,
@@ -110,6 +124,6 b' $(document).ready(function () {'
110 }
124 }
111 })
125 })
112 }
126 }
127 }
113
128
114 });
129 );
115
@@ -205,7 +205,6 b' class="notebook_app"'
205 <script src="{{ static_url("components/codemirror/mode/markdown/markdown.js") }}" charset="utf-8"></script>
205 <script src="{{ static_url("components/codemirror/mode/markdown/markdown.js") }}" charset="utf-8"></script>
206 <script src="{{ static_url("components/codemirror/mode/gfm/gfm.js") }}" charset="utf-8"></script>
206 <script src="{{ static_url("components/codemirror/mode/gfm/gfm.js") }}" charset="utf-8"></script>
207
207
208 <script src="{{ static_url("components/marked/lib/marked.js") }}" charset="utf-8"></script>
209 <script src="{{ static_url("components/highlight.js/build/highlight.pack.js") }}" charset="utf-8"></script>
208 <script src="{{ static_url("components/highlight.js/build/highlight.pack.js") }}" charset="utf-8"></script>
210
209
211 <script src="{{ static_url("dateformat/date.format.js") }}" charset="utf-8"></script>
210 <script src="{{ static_url("dateformat/date.format.js") }}" charset="utf-8"></script>
@@ -231,7 +230,6 b' class="notebook_app"'
231 <script src="{{ static_url("notebook/js/notificationwidget.js") }}" type="text/javascript" charset="utf-8"></script>
230 <script src="{{ static_url("notebook/js/notificationwidget.js") }}" type="text/javascript" charset="utf-8"></script>
232 <script src="{{ static_url("notebook/js/notificationarea.js") }}" type="text/javascript" charset="utf-8"></script>
231 <script src="{{ static_url("notebook/js/notificationarea.js") }}" type="text/javascript" charset="utf-8"></script>
233 <script src="{{ static_url("notebook/js/tooltip.js") }}" type="text/javascript" charset="utf-8"></script>
232 <script src="{{ static_url("notebook/js/tooltip.js") }}" type="text/javascript" charset="utf-8"></script>
234 <script src="{{ static_url("notebook/js/config.js") }}" type="text/javascript" charset="utf-8"></script>
235 <script src="{{ static_url("notebook/js/main.js") }}" type="text/javascript" charset="utf-8"></script>
233 <script src="{{ static_url("notebook/js/main.js") }}" type="text/javascript" charset="utf-8"></script>
236
234
237 <script src="{{ static_url("notebook/js/contexthint.js") }}" charset="utf-8"></script>
235 <script src="{{ static_url("notebook/js/contexthint.js") }}" charset="utf-8"></script>
@@ -24,7 +24,12 b''
24 {% endblock %}
24 {% endblock %}
25 {% endblock %}
25 {% endblock %}
26 <link rel="stylesheet" href="{{ static_url("custom/custom.css") }}" type="text/css" />
26 <link rel="stylesheet" href="{{ static_url("custom/custom.css") }}" type="text/css" />
27
27 <script src="{{static_url("components/requirejs/require.js") }}" type="text/javascript" charset="utf-8"></script>
28 <script>
29 require.config({
30 baseUrl: "static",
31 });
32 </script>
28
33
29 {% block meta %}
34 {% block meta %}
30 {% endblock %}
35 {% endblock %}
General Comments 0
You need to be logged in to leave comments. Login now