Workaround for Jekyllr frontmatter

This commit is contained in:
Qiming Teng
2017-11-30 17:18:18 +08:00
parent edcb39d46c
commit b84ac59624
13 changed files with 11 additions and 15 deletions
@@ -1,4 +1,3 @@
---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
@@ -1,4 +1,3 @@
---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
-1
View File
@@ -1,4 +1,3 @@
---
apiVersion: v1 apiVersion: v1
kind: Pod kind: Pod
metadata: metadata:
@@ -1,5 +1,5 @@
kind: Service
apiVersion: v1 apiVersion: v1
kind: Service
metadata: metadata:
name: frontend name: frontend
spec: spec:
@@ -1,4 +1,3 @@
---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
@@ -1,4 +1,3 @@
---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
@@ -1,4 +1,3 @@
---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
@@ -1,4 +1,3 @@
---
apiVersion: v1 apiVersion: v1
kind: ReplicationController kind: ReplicationController
metadata: metadata:
@@ -1,4 +1,3 @@
---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
@@ -1,4 +1,3 @@
---
apiVersion: v1 apiVersion: v1
kind: ReplicationController kind: ReplicationController
metadata: metadata:
@@ -1,4 +1,3 @@
---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
-1
View File
@@ -1,4 +1,3 @@
---
apiVersion: v1 apiVersion: v1
kind: Pod kind: Pod
metadata: metadata:
+7
View File
@@ -199,6 +199,10 @@ func walkConfigFiles(inDir string, fn func(name, path string, data [][]byte)) er
if err != nil { if err != nil {
return err return err
} }
// workaround for Jekyllr limit
if bytes.HasPrefix(data, []byte("---\n")) {
return fmt.Errorf("YAML file cannot start with \"---\", please remove the first line")
}
name := strings.TrimSuffix(file, ext) name := strings.TrimSuffix(file, ext)
var docs [][]byte var docs [][]byte
@@ -217,8 +221,11 @@ func walkConfigFiles(inDir string, fn func(name, path string, data [][]byte)) er
if err != nil { if err != nil {
return fmt.Errorf("%s: %v", path, err) return fmt.Errorf("%s: %v", path, err)
} }
// deal with "empty" document (e.g. pure comments)
if string(out) != "null" {
docs = append(docs, out) docs = append(docs, out)
} }
}
} else { } else {
docs = append(docs, data) docs = append(docs, data)
} }