diff options
author | August Feng <[email protected]> | 2023-11-25 22:33:02 -0500 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-01-25 19:34:12 +0100 |
commit | 46f618756f294d4eba7601c842b9926d006e9f9d (patch) | |
tree | 38dbfda9945144623c5f0ee1fb2ecf50559676d3 /parser/metadecoders | |
parent | 8915343075e1de2d175cbd5de467ab212da5a5b9 (diff) | |
download | hugo-46f618756f294d4eba7601c842b9926d006e9f9d.tar.gz hugo-46f618756f294d4eba7601c842b9926d006e9f9d.zip |
parser/metadecoders: Accumulate org keywords into arrays
Closes #11743
Diffstat (limited to 'parser/metadecoders')
-rw-r--r-- | parser/metadecoders/decoder.go | 5 | ||||
-rw-r--r-- | parser/metadecoders/decoder_test.go | 1 |
2 files changed, 3 insertions, 3 deletions
diff --git a/parser/metadecoders/decoder.go b/parser/metadecoders/decoder.go index 35368e5a5..8d93d86a0 100644 --- a/parser/metadecoders/decoder.go +++ b/parser/metadecoders/decoder.go @@ -249,9 +249,8 @@ func (d Decoder) unmarshalORG(data []byte, v any) error { k = strings.ToLower(k) if strings.HasSuffix(k, "[]") { frontMatter[k[:len(k)-2]] = strings.Fields(v) - } else if k == "tags" || k == "categories" || k == "aliases" { - log.Printf("warn: Please use '#+%s[]:' notation, automatic conversion is deprecated.", k) - frontMatter[k] = strings.Fields(v) + } else if strings.Contains(v, "\n") { + frontMatter[k] = strings.Split(v, "\n") } else if k == "date" || k == "lastmod" || k == "publishdate" || k == "expirydate" { frontMatter[k] = parseORGDate(v) } else { diff --git a/parser/metadecoders/decoder_test.go b/parser/metadecoders/decoder_test.go index ff6f8c226..48def7d12 100644 --- a/parser/metadecoders/decoder_test.go +++ b/parser/metadecoders/decoder_test.go @@ -125,6 +125,7 @@ func TestUnmarshalToInterface(t *testing.T) { {[]byte(``), JSON, map[string]any{}}, {[]byte(nil), JSON, map[string]any{}}, {[]byte(`#+a: b`), ORG, expect}, + {[]byte("#+a: foo bar\n#+a: baz"), ORG, map[string]any{"a": []string{string("foo bar"), string("baz")}}}, {[]byte(`#+DATE: <2020-06-26 Fri>`), ORG, map[string]any{"date": "2020-06-26"}}, {[]byte(`#+LASTMOD: <2020-06-26 Fri>`), ORG, map[string]any{"lastmod": "2020-06-26"}}, {[]byte(`#+PUBLISHDATE: <2020-06-26 Fri>`), ORG, map[string]any{"publishdate": "2020-06-26"}}, |