From a5db3f3fc1e632f908011c2d6c4a68ded86e1ed4 Mon Sep 17 00:00:00 2001
From: Herrington Darkholme <HerringtonDarkholme@users.noreply.github.com>
Date: Fri, 12 May 2017 11:34:52 +0800
Subject: [PATCH 1/5] add failing test case for pug

---
 test/expects/pug.js   | 2 +-
 test/fixtures/pug.vue | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/test/expects/pug.js b/test/expects/pug.js
index 6c2d0fc..768a018 100644
--- a/test/expects/pug.js
+++ b/test/expects/pug.js
@@ -1,3 +1,3 @@
-var pug = { template: "<div class=\"pug__test keep-me\"><article><p>foo</p></article></div>",cssModules: {"test":"pug__test"},};
+var pug = { template: "<div class=\"pug__test keep-me\" v-if=\"true\"><article><p>foo</p></article></div><p v-else=\"v-else\">nothing</p>",cssModules: {"test":"pug__test"},};
 
 export default pug;
diff --git a/test/fixtures/pug.vue b/test/fixtures/pug.vue
index a84299e..1763cf9 100644
--- a/test/fixtures/pug.vue
+++ b/test/fixtures/pug.vue
@@ -1,11 +1,13 @@
 <template lang="pug">
 
 
-  div(class=css.test class='keep-me') 
+  div(class=css.test class='keep-me' v-if="true")
     article
       p foo
+  p(v-else)
+    | nothing
+
 
-      
 </template>
 
 <script lang="babel">

From 96c138ce0f2eaa6ca29a2c96bfb2ca60b8ce818a Mon Sep 17 00:00:00 2001
From: Herrington Darkholme <HerringtonDarkholme@users.noreply.github.com>
Date: Fri, 12 May 2017 11:35:07 +0800
Subject: [PATCH 2/5] deindent template code before preprocessor

this makes pug work consistently
---
 src/vueTransform.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/vueTransform.js b/src/vueTransform.js
index e58c826..85697ad 100644
--- a/src/vueTransform.js
+++ b/src/vueTransform.js
@@ -52,7 +52,7 @@ async function processTemplate (source, id, content, options, nodes, modules) {
     debug(`Process template: ${id}`)
 
     const extras = { modules, id, lang: source.attrs.lang }
-    const { code } = source
+    const code = deIndent(source.code)
     const template = deIndent(
           await (options.disableCssModuleStaticReplacement !== true
                 ? templateProcessor(code, extras, options)

From 7ebf1abd034f94054b30d67e883d20142b7008e6 Mon Sep 17 00:00:00 2001
From: Herrington Darkholme <HerringtonDarkholme@users.noreply.github.com>
Date: Fri, 12 May 2017 11:46:27 +0800
Subject: [PATCH 3/5] remove redundant re-deindent

---
 src/vueTransform.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/vueTransform.js b/src/vueTransform.js
index 85697ad..27f1b22 100644
--- a/src/vueTransform.js
+++ b/src/vueTransform.js
@@ -53,10 +53,10 @@ async function processTemplate (source, id, content, options, nodes, modules) {
 
     const extras = { modules, id, lang: source.attrs.lang }
     const code = deIndent(source.code)
-    const template = deIndent(
-          await (options.disableCssModuleStaticReplacement !== true
-                ? templateProcessor(code, extras, options)
-                : code)
+    const template = await (
+        options.disableCssModuleStaticReplacement !== true
+            ? templateProcessor(code, extras, options)
+            : code
     )
 
     if (!options.compileTemplate) {

From 2fc916e8b4586e684aef61214c06b94d69ea01f5 Mon Sep 17 00:00:00 2001
From: Herrington Darkholme <HerringtonDarkholme@users.noreply.github.com>
Date: Fri, 12 May 2017 12:40:24 +0800
Subject: [PATCH 4/5] remove trim

---
 src/template/pug.js | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/template/pug.js b/src/template/pug.js
index 817338d..73ecadf 100644
--- a/src/template/pug.js
+++ b/src/template/pug.js
@@ -1,7 +1,6 @@
 export default async function (template, extras, options) {
     const pug = require('pug')
-    const trim = typeof template === 'string' ? template.trim() : template
-    const compiler = pug.compile(trim, { filename: extras.id, ...options.pug })
+    const compiler = pug.compile(template, { filename: extras.id, ...options.pug })
 
     return compiler({css: extras.modules || {}})
 }

From ba5448c32b324d095ea7872e0dfd868a22e19958 Mon Sep 17 00:00:00 2001
From: Herrington Darkholme <HerringtonDarkholme@users.noreply.github.com>
Date: Fri, 12 May 2017 12:50:56 +0800
Subject: [PATCH 5/5] specify pug's doctype to use boolean attributes' terse
 style

---
 src/template/pug.js | 2 +-
 test/expects/pug.js | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/template/pug.js b/src/template/pug.js
index 73ecadf..5468697 100644
--- a/src/template/pug.js
+++ b/src/template/pug.js
@@ -1,6 +1,6 @@
 export default async function (template, extras, options) {
     const pug = require('pug')
-    const compiler = pug.compile(template, { filename: extras.id, ...options.pug })
+    const compiler = pug.compile(template, { filename: extras.id, doctype: 'html', ...options.pug })
 
     return compiler({css: extras.modules || {}})
 }
diff --git a/test/expects/pug.js b/test/expects/pug.js
index 768a018..cfe497f 100644
--- a/test/expects/pug.js
+++ b/test/expects/pug.js
@@ -1,3 +1,3 @@
-var pug = { template: "<div class=\"pug__test keep-me\" v-if=\"true\"><article><p>foo</p></article></div><p v-else=\"v-else\">nothing</p>",cssModules: {"test":"pug__test"},};
+var pug = { template: "<div class=\"pug__test keep-me\" v-if=\"true\"><article><p>foo</p></article></div><p v-else>nothing</p>",cssModules: {"test":"pug__test"},};
 
 export default pug;