mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
parser: Add horizontal YAML tags to benchmark
This commit is contained in:
parent
adc0572d29
commit
2c2ce33a39
1 changed files with 11 additions and 2 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue