mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-21 04:10:17 +08:00
make output code not drop non-mimetype-keyed json
This commit is contained in:
parent
5fefd65d72
commit
2e72ab3cd6
@ -254,6 +254,9 @@ var IPython = (function (IPython) {
|
||||
this.append_output(json, true);
|
||||
};
|
||||
|
||||
var mime_types = ['application/javascript', 'application/json',
|
||||
'image/jpeg', 'image/png', 'image/svg+xml', 'text/html',
|
||||
'text/latex', 'text/plain'];
|
||||
|
||||
OutputArea.prototype.convert_mime_types = function (json, data) {
|
||||
if (data === undefined) {
|
||||
@ -283,6 +286,13 @@ var IPython = (function (IPython) {
|
||||
if (data['application/javascript'] !== undefined) {
|
||||
json.javascript = data['application/javascript'];
|
||||
}
|
||||
// non-mimetype-keyed metadata used to get dropped here, this code
|
||||
// re-injects it into the json.
|
||||
for (x in data){
|
||||
if( !(x in mime_types) ) {
|
||||
json[x] = data[x];
|
||||
}
|
||||
}
|
||||
return json;
|
||||
};
|
||||
|
||||
|
@ -21,6 +21,32 @@ casper.notebook_test(function () {
|
||||
+ "display_svg(SVG(s2), metadata=dict(isolated=True))\n"
|
||||
);
|
||||
cell.execute();
|
||||
console.log("hello" );
|
||||
});
|
||||
|
||||
this.then(function() {
|
||||
var fname=this.test.currentTestFile.split('/').pop().toLowerCase();
|
||||
this.echo(fname)
|
||||
this.echo(this.currentUrl)
|
||||
this.evaluate(function (n) {
|
||||
IPython.notebook.rename(n);
|
||||
console.write("hello" + n);
|
||||
IPython.notebook.save_notebook();
|
||||
}, {n : fname});
|
||||
this.echo(this.currentUrl)
|
||||
});
|
||||
|
||||
this.then(function() {
|
||||
|
||||
url = this.evaluate(function() {
|
||||
IPython.notebook.rename("foo");
|
||||
//$("span#notebook_name")[0].click();
|
||||
//$("input")[0].value = "please-work";
|
||||
//$(".btn-primary")[0].click();
|
||||
return document.location.href;
|
||||
})
|
||||
this.echo("renamed" + url);
|
||||
this.echo(this.currentUrl);
|
||||
});
|
||||
|
||||
this.wait_for_output(0);
|
||||
|
Loading…
Reference in New Issue
Block a user