[Pkg-javascript-commits] [node-acorn-jsx] 438/484: Allow multiline JSX string attributes.

Bastien Roucariès rouca at moszumanska.debian.org
Sat Aug 19 14:21:07 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-acorn-jsx.

commit 9f73a10f615591439e35c4c2ed7e3b29ebb0418e
Author: Andy VanWagoner <thetalecrafter at gmail.com>
Date:   Thu Feb 12 19:05:07 2015 -0700

    Allow multiline JSX string attributes.
---
 acorn.js          |  2 +-
 test/tests-jsx.js | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/acorn.js b/acorn.js
index 3cc5fa0..72c65c3 100644
--- a/acorn.js
+++ b/acorn.js
@@ -1190,7 +1190,7 @@
         out += readJSXEntity();
         chunkStart = tokPos;
       } else {
-        if (isNewLine(ch)) raise(tokStart, "Unterminated string constant");
+        if (isNewLine(ch) && !isJSX) raise(tokStart, "Unterminated string constant");
         ++tokPos;
       }
     }
diff --git a/test/tests-jsx.js b/test/tests-jsx.js
index a7dd79e..c9cfa5a 100644
--- a/test/tests-jsx.js
+++ b/test/tests-jsx.js
@@ -3587,6 +3587,42 @@ var fbTestFixture = {
         closingElement: null,
         children: []
       }
+    },
+    '<path d="M230 80\n\t\tA 45 45, 0, 1, 0, 275 125 \r\n    L 275 80 Z"/>': {
+      type: "ExpressionStatement",
+      expression: {
+        type: "JSXElement",
+        range: [0, 64],
+        openingElement: {
+          type: "JSXOpeningElement",
+          range: [0, 64],
+          attributes: [
+            {
+              type: "JSXAttribute",
+              range: [6, 62],
+              name: {
+                type: "JSXIdentifier",
+                range: [6, 7],
+                name: "d"
+              },
+              value: {
+                type: "Literal",
+                range: [8, 62],
+                value: "M230 80\n\t\tA 45 45, 0, 1, 0, 275 125 \r\n    L 275 80 Z",
+                raw: "\"M230 80\n\t\tA 45 45, 0, 1, 0, 275 125 \r\n    L 275 80 Z\""
+              }
+            }
+          ],
+          name: {
+            type: "JSXIdentifier",
+            range: [1, 5],
+            name: "path"
+          },
+          selfClosing: true
+        },
+        closingElement: null,
+        children: []
+      }
     }
   }
 };

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-acorn-jsx.git



More information about the Pkg-javascript-commits mailing list