소스 검색

Don't include ="" for attributes with empty string

master
Dylan Baker 5 년 전
부모
커밋
60c6d9a24a
1개의 변경된 파일7개의 추가작업 그리고 2개의 파일을 삭제
  1. 7
    2
      src/compiler.js

+ 7
- 2
src/compiler.js 파일 보기

@@ -70,9 +70,14 @@ module.exports = class Compiler {
70 70
     let result = `<${node.functionName.name}`
71 71
 
72 72
     node.args.filter(arg => arg.constructor.name === 'Attribute').forEach(arg => {
73
-      result += ` ${arg.name}=`
73
+      result += ` ${arg.name}`
74
+
74 75
       let compiler = new Compiler([arg.value], this.context)
75
-      result += `"${compiler.compile()}"`
76
+      let attrValue = compiler.compile()
77
+
78
+      if (attrValue) {
79
+       result += `="${attrValue}"`
80
+      }
76 81
     })
77 82
 
78 83
     result += '>'

Loading…
취소
저장