Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Factor out output_prompt_function, as is done with input prompt #2774

Merged
merged 2 commits into from
Sep 15, 2017
Merged

Factor out output_prompt_function, as is done with input prompt #2774

merged 2 commits into from
Sep 15, 2017

Conversation

iamlemec
Copy link
Contributor

This allows for much cleaner customization of the output prompt in custom.js, as is currently the case with the input prompt.

@takluyver takluyver added this to the 5.2 milestone Aug 18, 2017
@takluyver
Copy link
Member

Thanks!

We're just trying to make a 5.1 release - I've marked this as 5.2 as it's probably not urgent enough to go in at the last minute. Hopefully we can merge it soon after the release.

@@ -467,6 +467,11 @@ define([
this.element.trigger('changed', {output_area: this});
};

OutputArea.output_prompt_classical = function(prompt_value) {
return '<bdi>'+i18n.msg.sprintf(i18n.msg._('Out[%d]:'),prompt_value)+'</bdi>';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this construct a node like the old code does, rather than assembling an HTML string? While I don't think there's a security concern here, it's good practice to use the safer style throughout.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, just made the change. Btw, the code for input_prompt_classical in codecell.js also uses an HTML string, so it might be worth changing that too.

@gnestor
Copy link
Contributor

gnestor commented Sep 15, 2017

@iamlemec This looks good to me. I just re-ran the Travis build and it's passing now. @takluyver Is this ready to merge?

@takluyver
Copy link
Member

Yup, I think so.

@iamlemec thanks, and thanks for checking the input prompt method. If you want to make a separate PR to update that to create an element, I think we could merge that.

@takluyver takluyver merged commit 9dabaa2 into jupyter:master Sep 15, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants