浏览代码

Manage the whitespace produced by the compiler

master
Dylan Baker 6 年前
父节点
当前提交
69dc0975d0
共有 1 个文件被更改,包括 2 次插入6 次删除
  1. 2
    6
      src/compiler.js

+ 2
- 6
src/compiler.js 查看文件

11
         const attributes = node.args.map(arg => `${arg.attributeName}="${this.compileAttribute(arg.attributeValue)}"`)
11
         const attributes = node.args.map(arg => `${arg.attributeName}="${this.compileAttribute(arg.attributeValue)}"`)
12
         const compiler = new Compiler(node.subtree, this.context)
12
         const compiler = new Compiler(node.subtree, this.context)
13
         const content = compiler.compile()
13
         const content = compiler.compile()
14
-        this.result += `
15
-          <${node.functionName}${attributes.length ? ' ' : ''}${attributes.join(' ')}>
16
-            ${content}
17
-          </${node.functionName}>
18
-        `
14
+        this.result += `<${node.functionName}${attributes.length ? ' ' : ''}${attributes.join(' ')}>${content}</${node.functionName}>`
19
       } else if (node.type === 'string') {
15
       } else if (node.type === 'string') {
20
         this.result += node.content
16
         this.result += node.content
21
       } else if (node.type === 'identifier') {
17
       } else if (node.type === 'identifier') {
23
       }
19
       }
24
     })
20
     })
25
 
21
 
26
-    return this.result
22
+    return this.result.trim()
27
   }
23
   }
28
 
24
 
29
   compileAttribute(attribute) {
25
   compileAttribute(attribute) {

正在加载...
取消
保存