Fix python multiline string

This commit is contained in:
Rachel Fenichel
2020-09-18 12:11:48 -07:00
parent 1d678d0860
commit afcbb7036e

View File

@@ -234,9 +234,10 @@ Blockly.Python.quote_ = function(string) {
* @private
*/
Blockly.Python.multiline_quote_ = function(string) {
// Can't use goog.string.quote since % must also be escaped.
string = string.replace(/'''/g, '\\\'\\\'\\\'');
return '\'\'\'' + string + '\'\'\'';
var lines = string.split(/\n/g).map(Blockly.Python.quote_);
// Join with the following, plus a newline:
// + '\n' +
return lines.join(' + \'\\n\' + \n');
};
/**