mirror of
https://github.com/gohugoio/hugo.git
synced 2024-05-11 05:54:58 +00:00
parser: Add horizontal YAML tags to benchmark
This commit is contained in:
@ -322,8 +322,8 @@ func TestRemoveTOMLIdentifier(t *testing.T) {
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
@ -335,6 +335,12 @@ name: "Tags"
|
||||
tags:
|
||||
%s
|
||||
---
|
||||
`
|
||||
|
||||
yaml2Template := `---
|
||||
name: "Tags"
|
||||
tags: %s
|
||||
---
|
||||
`
|
||||
tomlTemplate := `+++
|
||||
name = "Tags"
|
||||
@ -364,6 +370,9 @@ tags = %s
|
||||
} 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
|
||||
for _, tag := range tags {
|
||||
|
Reference in New Issue
Block a user