s/prompt_number/execution_count in nbformat 4

This commit is contained in:
MinRK 2014-08-18 10:40:00 -07:00 committed by Min RK
parent fc47201cc7
commit 14cfb2efc1
4 changed files with 7 additions and 7 deletions

View File

@ -60,7 +60,7 @@ class APITest(NotebookTestBase):
cc1.outputs.append(new_output(output_type="stream", data=u'12')) cc1.outputs.append(new_output(output_type="stream", data=u'12'))
cc1.outputs.append(new_output(output_type="execute_result", cc1.outputs.append(new_output(output_type="execute_result",
mime_bundle={'image/png' : png_green_pixel}, mime_bundle={'image/png' : png_green_pixel},
prompt_number=1, execution_count=1,
)) ))
nb.cells.append(cc1) nb.cells.append(cc1)

View File

@ -471,7 +471,7 @@ define([
this.code_mirror.clearHistory(); this.code_mirror.clearHistory();
this.auto_highlight(); this.auto_highlight();
} }
this.set_input_prompt(data.prompt_number); this.set_input_prompt(data.execution_count);
this.output_area.trusted = data.metadata.trusted || false; this.output_area.trusted = data.metadata.trusted || false;
this.output_area.fromJSON(data.outputs); this.output_area.fromJSON(data.outputs);
if (data.metadata.collapsed !== undefined) { if (data.metadata.collapsed !== undefined) {
@ -490,9 +490,9 @@ define([
data.source = this.get_text(); data.source = this.get_text();
// is finite protect against undefined and '*' value // is finite protect against undefined and '*' value
if (isFinite(this.input_prompt_number)) { if (isFinite(this.input_prompt_number)) {
data.prompt_number = this.input_prompt_number; data.execution_count = this.input_prompt_number;
} else { } else {
data.prompt_number = null; data.execution_count = null;
} }
var outputs = this.output_area.toJSON(); var outputs = this.output_area.toJSON();
data.outputs = outputs; data.outputs = outputs;

View File

@ -220,7 +220,7 @@ define([
json = content.data; json = content.data;
json.output_type = msg_type; json.output_type = msg_type;
json.metadata = content.metadata; json.metadata = content.metadata;
json.prompt_number = content.execution_count; json.execution_count = content.execution_count;
} else if (msg_type === "error") { } else if (msg_type === "error") {
json.ename = content.ename; json.ename = content.ename;
json.evalue = content.evalue; json.evalue = content.evalue;
@ -414,7 +414,7 @@ define([
OutputArea.prototype.append_execute_result = function (json) { OutputArea.prototype.append_execute_result = function (json) {
var n = json.prompt_number || ' '; var n = json.execution_count || ' ';
var toinsert = this.create_output_area(); var toinsert = this.create_output_area();
if (this.prompt_area) { if (this.prompt_area) {
toinsert.find('div.prompt').addClass('output_prompt').text('Out[' + n + ']:'); toinsert.find('div.prompt').addClass('output_prompt').text('Out[' + n + ']:');

View File

@ -13,7 +13,7 @@ casper.notebook_test(function () {
this.evaluate(function () { this.evaluate(function () {
var cell = IPython.notebook.get_cell(0); var cell = IPython.notebook.get_cell(0);
var json = cell.toJSON(); var json = cell.toJSON();
json.prompt_number = "<script> alert('hello from input prompts !')</script>"; json.execution_count = "<script> alert('hello from input prompts !')</script>";
cell.fromJSON(json); cell.fromJSON(json);
}); });