1
0
mirror of https://github.com/gohugoio/hugo.git synced 2024-05-11 05:54:58 +00:00

Fix searching YAML/TOML delimiters in frontmatter

When a YAML/TOML's delimiter character sequence is included in a
frontmatter string, parser mistakes it as a delimiter. This fixes it by
checking a character right before the delimiter sequence is '\n' or it
is the beginning of the frontmatter.

Fix #1320
This commit is contained in:
Tatsushi Demachi
2015-08-03 23:32:51 +09:00
committed by Bjørn Erik Pedersen
parent 4bed69629e
commit 98659bf3b8
2 changed files with 2 additions and 1 deletions

View File

@@ -238,6 +238,7 @@ func TestExtractFrontMatter(t *testing.T) {
{"--- \nminc\n--- \ncontent", []byte("---\nminc\n---\n"), true},
{"---\ncnim\n---\ncontent\n", []byte("---\ncnim\n---\n"), true},
{"---\ntitle: slug doc 2\nslug: slug-doc-2\n---\ncontent\n", []byte("---\ntitle: slug doc 2\nslug: slug-doc-2\n---\n"), true},
{"---\npermalink: '/blog/title---subtitle.html'\n---\ncontent\n", []byte("---\npermalink: '/blog/title---subtitle.html'\n---\n"), true},
}
for _, test := range tests {