metadecoders: Add support for native org dates in frontmatter

PR #7433 added support for Org timestamps for the DATE header. This PR widens the support with additional front matter headers LASTMOD, PUBLISHDATE and EXPIRYDATE.

Fixes #8536
This commit is contained in:
johannesengl 2023-03-06 15:29:31 +01:00 committed by Bjørn Erik Pedersen
parent 32ea40aa82
commit bdbfacb868
2 changed files with 4 additions and 1 deletions

View file

@ -126,6 +126,9 @@ func TestUnmarshalToInterface(t *testing.T) {
{[]byte(nil), JSON, map[string]any{}},
{[]byte(`#+a: b`), ORG, expect},
{[]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"}},
{[]byte(`#+EXPIRYDATE: <2020-06-26 Fri>`), ORG, map[string]any{"expirydate": "2020-06-26"}},
{[]byte(`a = "b"`), TOML, expect},
{[]byte(`a: "b"`), YAML, expect},
{[]byte(`<root><a>b</a></root>`), XML, expect},