Skip to content

Commit

Permalink
Wrap prompts in bdi for rtl layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau committed Feb 8, 2017
1 parent 423fd5e commit f06aca7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion notebook/static/notebook/js/codecell.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ define([
} else {
ns = encodeURIComponent(prompt_value);
}
return 'In [' + ns + ']:';
return '<bdi>In</bdi>&nbsp;[' + ns + ']:';
};

CodeCell.input_prompt_continuation = function (prompt_value, lines_number) {
Expand Down
9 changes: 8 additions & 1 deletion notebook/static/notebook/js/outputarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,14 @@ define([
var toinsert = this.create_output_area();
this._record_display_id(json, toinsert);
if (this.prompt_area) {
toinsert.find('div.prompt').addClass('output_prompt').text('Out[' + n + ']:');
toinsert.find('div.prompt')
.addClass('output_prompt')
.empty()
.append(
$('<bdi>').text('Out')
).append(
'[' + n + ']:'
);
}
var inserted = this.append_mime_type(json, toinsert);
if (inserted) {
Expand Down
12 changes: 6 additions & 6 deletions notebook/tests/notebook/prompt_numbers.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ casper.notebook_test(function () {
var a = 'print("a")';
var index = this.append_cell(a);

this.test.assertEquals(get_prompt(index), "In&nbsp;[&nbsp;]:", "prompt number is &nbsp; by default");
this.test.assertEquals(get_prompt(index), "<bdi>In</bdi>&nbsp;[&nbsp;]:", "prompt number is &nbsp; by default");
set_prompt(index, 2);
this.test.assertEquals(get_prompt(index), "In&nbsp;[2]:", "prompt number is 2");
this.test.assertEquals(get_prompt(index), "<bdi>In</bdi>&nbsp;[2]:", "prompt number is 2");
set_prompt(index, 0);
this.test.assertEquals(get_prompt(index), "In&nbsp;[0]:", "prompt number is 0");
this.test.assertEquals(get_prompt(index), "<bdi>In</bdi>&nbsp;[0]:", "prompt number is 0");
set_prompt(index, "*");
this.test.assertEquals(get_prompt(index), "In&nbsp;[*]:", "prompt number is *");
this.test.assertEquals(get_prompt(index), "<bdi>In</bdi>&nbsp;[*]:", "prompt number is *");
set_prompt(index, undefined);
this.test.assertEquals(get_prompt(index), "In&nbsp;[&nbsp;]:", "prompt number is &nbsp;");
this.test.assertEquals(get_prompt(index), "<bdi>In</bdi>&nbsp;[&nbsp;]:", "prompt number is &nbsp;");
set_prompt(index, null);
this.test.assertEquals(get_prompt(index), "In&nbsp;[&nbsp;]:", "prompt number is &nbsp;");
this.test.assertEquals(get_prompt(index), "<bdi>In</bdi>&nbsp;[&nbsp;]:", "prompt number is &nbsp;");
});
});

0 comments on commit f06aca7

Please sign in to comment.