From afcbb7036e8d2d4dc8012660a73f47c07eef0cfe Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Fri, 18 Sep 2020 12:11:48 -0700 Subject: [PATCH] Fix python multiline string --- generators/python.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/generators/python.js b/generators/python.js index bee76bb19..407f90139 100644 --- a/generators/python.js +++ b/generators/python.js @@ -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'); }; /**