Przeglądaj źródła

Manage the whitespace produced by the compiler

master
Dylan Baker 5 lat temu
rodzic
commit
69dc0975d0
1 zmienionych plików z 2 dodań i 6 usunięć
  1. 2
    6
      src/compiler.js

+ 2
- 6
src/compiler.js Wyświetl plik

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) {

Ładowanie…
Anuluj
Zapisz