From bfa842c9a8396052a8cb2a365ca2270f1c2bc0e8 Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Thu, 2 Jun 2016 16:31:49 -0700 Subject: [PATCH] Remove claim that good.string.quote should be used. --- generators/dart.js | 2 +- generators/javascript.js | 3 ++- generators/lua.js | 1 - generators/php.js | 1 - generators/python.js | 2 +- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/generators/dart.js b/generators/dart.js index ef898c7bf..81b011406 100644 --- a/generators/dart.js +++ b/generators/dart.js @@ -149,7 +149,7 @@ Blockly.Dart.scrubNakedValue = function(line) { * @private */ Blockly.Dart.quote_ = function(string) { - // TODO: This is a quick hack. Replace with goog.string.quote + // Can't use goog.string.quote since $ must also be escaped. string = string.replace(/\\/g, '\\\\') .replace(/\n/g, '\\\n') .replace(/\$/g, '\\$') diff --git a/generators/javascript.js b/generators/javascript.js index dad0c4931..5bd49f9d2 100644 --- a/generators/javascript.js +++ b/generators/javascript.js @@ -169,7 +169,8 @@ Blockly.JavaScript.scrubNakedValue = function(line) { * @private */ Blockly.JavaScript.quote_ = function(string) { - // TODO: This is a quick hack. Replace with goog.string.quote + // Can't use goog.string.quote since Google's style guide recommends + // JS string literals use single quotes. string = string.replace(/\\/g, '\\\\') .replace(/\n/g, '\\\n') .replace(/'/g, '\\\''); diff --git a/generators/lua.js b/generators/lua.js index a1265b669..10e732c7c 100644 --- a/generators/lua.js +++ b/generators/lua.js @@ -143,7 +143,6 @@ Blockly.Lua.scrubNakedValue = function(line) { * @private */ Blockly.Lua.quote_ = function(string) { - // TODO: This is a quick hack. Replace with goog.string.quote string = string.replace(/\\/g, '\\\\') .replace(/\n/g, '\\\n') .replace(/'/g, '\\\''); diff --git a/generators/php.js b/generators/php.js index 85af77d5b..ce2f453f7 100644 --- a/generators/php.js +++ b/generators/php.js @@ -146,7 +146,6 @@ Blockly.PHP.scrubNakedValue = function(line) { * @private */ Blockly.PHP.quote_ = function(string) { - // TODO: This is a quick hack. Replace with goog.string.quote string = string.replace(/\\/g, '\\\\') .replace(/\n/g, '\\\n') .replace(/'/g, '\\\''); diff --git a/generators/python.js b/generators/python.js index 8c576f582..ddfe2f008 100644 --- a/generators/python.js +++ b/generators/python.js @@ -152,7 +152,7 @@ Blockly.Python.scrubNakedValue = function(line) { * @private */ Blockly.Python.quote_ = function(string) { - // TODO: This is a quick hack. Replace with goog.string.quote + // Can't use goog.string.quote since % must also be escaped. string = string.replace(/\\/g, '\\\\') .replace(/\n/g, '\\\n') .replace(/\%/g, '\\%')