shithub: hugo

Download patch

ref: 2c2ce33a39d5fd70e812ac088fa04401ea623d3b
parent: adc0572d2941cc7193f360c50c9367786cf29f26
author: Bjørn Erik Pedersen <[email protected]>
date: Sat Jun 3 08:31:31 EDT 2017

parser: Add horizontal YAML tags to benchmark

--- a/parser/frontmatter_test.go
+++ b/parser/frontmatter_test.go
@@ -322,8 +322,8 @@
 
 func BenchmarkFrontmatterTags(b *testing.B) {
 
-	for _, frontmatter := range []string{"JSON", "YAML", "TOML"} {
-		for i := 1; i < 30; i += 10 {
+	for _, frontmatter := range []string{"JSON", "YAML", "YAML2", "TOML"} {
+		for i := 1; i < 60; i += 20 {
 			doBenchmarkFrontmatter(b, frontmatter, i)
 		}
 	}
@@ -336,6 +336,12 @@
 %s
 ---
 `
+
+	yaml2Template := `---
+name: "Tags"
+tags: %s
+---
+`
 	tomlTemplate := `+++
 name = "Tags"
 tags = %s
@@ -363,6 +369,9 @@
 			tagsStr = strings.Replace(fmt.Sprintf("%q", tags), " ", ", ", -1)
 		} else if fileformat == "JSON" {
 			frontmatterTemplate = jsonTemplate
+			tagsStr = strings.Replace(fmt.Sprintf("%q", tags), " ", ", ", -1)
+		} else if fileformat == "YAML2" {
+			frontmatterTemplate = yaml2Template
 			tagsStr = strings.Replace(fmt.Sprintf("%q", tags), " ", ", ", -1)
 		} else {
 			frontmatterTemplate = yamlTemplate