From a9faa503292abb66ab9d38b96fd576dce4133fea Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Thu, 14 Nov 2013 23:38:41 +0000 Subject: [PATCH] Use regular expressions when fixing button-like captions --- IPython/html/static/notebook/js/widgets/button.js | 4 ++-- IPython/html/static/notebook/js/widgets/selection.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/IPython/html/static/notebook/js/widgets/button.js b/IPython/html/static/notebook/js/widgets/button.js index de4759e00..bea17eb5d 100644 --- a/IPython/html/static/notebook/js/widgets/button.js +++ b/IPython/html/static/notebook/js/widgets/button.js @@ -38,8 +38,8 @@ define(["notebook/js/widget"], function(){ // Frontent -> Frontend Sync update : function(){ var description = this.model.get('description'); - description = description.replace(' ', ' '); - description = description.replace('\n', '
\n'); + description = description.replace(/ /g, ' ', 'm'); + description = description.replace(/\n/g, '
\n', 'm'); if (description.length == 0) { this.$el.html(' '); // Preserve button height } else { diff --git a/IPython/html/static/notebook/js/widgets/selection.js b/IPython/html/static/notebook/js/widgets/selection.js index 3bd0a8fb4..e5ae5a385 100644 --- a/IPython/html/static/notebook/js/widgets/selection.js +++ b/IPython/html/static/notebook/js/widgets/selection.js @@ -60,8 +60,8 @@ define(["notebook/js/widget"], function(){ update : function(){ var selected_item_text = this.model.get('value'); - selected_item_text = selected_item_text.replace(' ', ' '); - selected_item_text = selected_item_text.replace('\n', '
\n'); + selected_item_text = selected_item_text.replace(/ /g, ' '); + selected_item_text = selected_item_text.replace(/\n/g, '
\n'); if (selected_item_text.length == 0) { this.$droplabel.html(' '); } else {