Merge pull request #4294 from rachel-fenichel/bugfix/dart_multiline

Fix dart multiline strings
This commit is contained in:
Rachel Fenichel
2020-09-18 13:51:38 -07:00
committed by GitHub

View File

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