Show More
@@ -195,12 +195,17 b' div.input {' | |||||
195 | page-break-inside: avoid; |
|
195 | page-break-inside: avoid; | |
196 | } |
|
196 | } | |
197 |
|
197 | |||
|
198 | /* input_area and input_prompt must match in top border and margin for alignment */ | |||
198 | div.input_area { |
|
199 | div.input_area { | |
199 | color: black; |
|
200 | color: black; | |
|
201 | border: 1px solid #ddd; | |||
|
202 | border-radius: 3px; | |||
|
203 | background: #fafafa; | |||
200 | } |
|
204 | } | |
201 |
|
205 | |||
202 | div.input_prompt { |
|
206 | div.input_prompt { | |
203 | color: navy; |
|
207 | color: navy; | |
|
208 | border-top: 1px solid transparent; | |||
204 | } |
|
209 | } | |
205 |
|
210 | |||
206 | div.output { |
|
211 | div.output { | |
@@ -227,12 +232,24 b' div.output_subarea {' | |||||
227 | /* The rest of the output_* classes are for special styling of the different |
|
232 | /* The rest of the output_* classes are for special styling of the different | |
228 | output types */ |
|
233 | output types */ | |
229 |
|
234 | |||
230 | div.output_stream { |
|
235 | /* all text output has this class: */ | |
|
236 | div.output_text { | |||
231 | text-align: left; |
|
237 | text-align: left; | |
232 | color: black; |
|
238 | color: black; | |
233 | font-family: monospace; |
|
239 | font-family: monospace; | |
234 | } |
|
240 | } | |
235 |
|
241 | |||
|
242 | /* stdout/stderr are 'text' as well as 'stream', but pyout/pyerr are *not* streams */ | |||
|
243 | div.output_stream { | |||
|
244 | padding-top: 0.0em; | |||
|
245 | padding-bottom: 0.0em; | |||
|
246 | } | |||
|
247 | div.output_stdout { | |||
|
248 | } | |||
|
249 | div.output_stderr { | |||
|
250 | background: #fdd; /* very light red background for stderr */ | |||
|
251 | } | |||
|
252 | ||||
236 | div.output_latex { |
|
253 | div.output_latex { | |
237 | text-align: left; |
|
254 | text-align: left; | |
238 | color: black; |
|
255 | color: black; |
@@ -251,8 +251,26 b' var IPython = (function (IPython) {' | |||||
251 |
|
251 | |||
252 |
|
252 | |||
253 | CodeCell.prototype.append_stream = function (json) { |
|
253 | CodeCell.prototype.append_stream = function (json) { | |
|
254 | // temporary fix: if stream undefined (json file written prior to this patch), | |||
|
255 | // default to most likely stdout: | |||
|
256 | if (json.stream == undefined){ | |||
|
257 | json.stream = 'stdout'; | |||
|
258 | } | |||
|
259 | var subclass = "output_"+json.stream; | |||
|
260 | if (this.outputs.length > 0){ | |||
|
261 | // have at least one output to consider | |||
|
262 | var last = this.outputs[this.outputs.length-1]; | |||
|
263 | if (last.output_type == 'stream' && json.stream == last.stream){ | |||
|
264 | // latest output was in the same stream, | |||
|
265 | // so append directly into its pre tag | |||
|
266 | this.element.find('div.'+subclass).last().find('pre').append(json.text); | |||
|
267 | return; | |||
|
268 | } | |||
|
269 | } | |||
|
270 | ||||
|
271 | // If we got here, attach a new div | |||
254 | var toinsert = this.create_output_area(); |
|
272 | var toinsert = this.create_output_area(); | |
255 | this.append_text(json.text, toinsert); |
|
273 | this.append_text(json.text, toinsert, "output_stream "+subclass); | |
256 | this.element.find('div.output').append(toinsert); |
|
274 | this.element.find('div.output').append(toinsert); | |
257 | }; |
|
275 | }; | |
258 |
|
276 | |||
@@ -292,8 +310,11 b' var IPython = (function (IPython) {' | |||||
292 | } |
|
310 | } | |
293 |
|
311 | |||
294 |
|
312 | |||
295 | CodeCell.prototype.append_text = function (data, element) { |
|
313 | CodeCell.prototype.append_text = function (data, element, extra_class) { | |
296 |
var toinsert = $("<div/>").addClass("box_flex1 output_subarea output_ |
|
314 | var toinsert = $("<div/>").addClass("box_flex1 output_subarea output_text"); | |
|
315 | if (extra_class){ | |||
|
316 | toinsert.addClass(extra_class); | |||
|
317 | } | |||
297 | toinsert.append($("<pre/>").html(data)); |
|
318 | toinsert.append($("<pre/>").html(data)); | |
298 | element.append(toinsert); |
|
319 | element.append(toinsert); | |
299 | }; |
|
320 | }; | |
@@ -402,7 +423,7 b' var IPython = (function (IPython) {' | |||||
402 |
|
423 | |||
403 |
|
424 | |||
404 | CodeCell.prototype.fromJSON = function (data) { |
|
425 | CodeCell.prototype.fromJSON = function (data) { | |
405 |
|
|
426 | console.log('Import from JSON:', data); | |
406 | if (data.cell_type === 'code') { |
|
427 | if (data.cell_type === 'code') { | |
407 | if (data.input !== undefined) { |
|
428 | if (data.input !== undefined) { | |
408 | this.set_code(data.input); |
|
429 | this.set_code(data.input); |
@@ -710,7 +710,8 b' var IPython = (function (IPython) {' | |||||
710 | var json = {}; |
|
710 | var json = {}; | |
711 | json.output_type = msg_type; |
|
711 | json.output_type = msg_type; | |
712 | if (msg_type === "stream") { |
|
712 | if (msg_type === "stream") { | |
713 |
json.text = utils.fixConsole(content.data |
|
713 | json.text = utils.fixConsole(content.data); | |
|
714 | json.stream = content.name; | |||
714 | } else if (msg_type === "display_data") { |
|
715 | } else if (msg_type === "display_data") { | |
715 | json = this.convert_mime_types(json, content.data); |
|
716 | json = this.convert_mime_types(json, content.data); | |
716 | } else if (msg_type === "pyout") { |
|
717 | } else if (msg_type === "pyout") { |
General Comments 0
You need to be logged in to leave comments.
Login now