mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-28 06:30:33 +03:00
Trim trailing spaces from YAML and TOML delimiters
When someone hits space after typing "---" (or "+++") but before they hit return, hugo silently failed to parse the file. This corrects that.
This commit is contained in:
parent
211b757fee
commit
8d28686edc
2 changed files with 14 additions and 14 deletions
|
@ -200,6 +200,8 @@ func TestPageHasFrontMatter(t *testing.T) {
|
|||
{[]byte("---"), false},
|
||||
{[]byte("---\n"), true},
|
||||
{[]byte("---\n"), true},
|
||||
{[]byte("--- \n"), true},
|
||||
{[]byte("--- \n"), true},
|
||||
{[]byte{'a'}, false},
|
||||
{[]byte{'{'}, true},
|
||||
{[]byte("{\n "), true},
|
||||
|
@ -230,7 +232,10 @@ func TestExtractFrontMatter(t *testing.T) {
|
|||
{"---\nblar\n-\n", nil, false},
|
||||
{"---\nralb\n---\n", []byte("---\nralb\n---\n"), true},
|
||||
{"---\neof\n---", []byte("---\neof\n---"), true},
|
||||
{"--- \neof\n---", []byte("---\neof\n---"), true},
|
||||
{"---\nminc\n---\ncontent", []byte("---\nminc\n---\n"), true},
|
||||
{"---\nminc\n--- \ncontent", []byte("---\nminc\n---\n"), true},
|
||||
{"--- \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},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue