Merge pull request #4292 from rachel-fenichel/bugfix/python_multiline

Fix python multiline string
This commit is contained in:
Rachel Fenichel
2020-09-18 13:25:16 -07:00
committed by GitHub

View File

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