Răsfoiți Sursa

support multiline expressions inside attributes (close #924)

Evan You 11 ani în urmă
părinte
comite
abb30eec4b
2 a modificat fișierele cu 9 adăugiri și 1 ștergeri
  1. 1 0
      src/parsers/text.js
  2. 8 1
      test/unit/specs/parsers/text_spec.js

+ 1 - 0
src/parsers/text.js

@@ -65,6 +65,7 @@ exports.parse = function (text) {
   if (hit) {
     return hit
   }
+  text = text.replace(/\n/g, '')
   if (!tagRE.test(text)) {
     return null
   }

+ 8 - 1
test/unit/specs/parsers/text_spec.js

@@ -43,6 +43,13 @@ var testCases = [
       { tag: true, value: 'abc', html: false, oneTime: false },
       { value: ']' }
     ]
+  },
+  // multiline
+  {
+    text: '{{\n  value  \n}}',
+    expected: [
+      { tag: true, value: 'value', html: false, oneTime: false }
+    ]
   }
 ]
 
@@ -120,4 +127,4 @@ describe('Text Parser', function () {
       ',false)+" e"')
   })
 
-})
+})