parser: Handle org-mode filetags as slice

This adds support for filetags by slicing them according to [the org mode tag
specification](https://orgmode.org/guide/Tags.html).

Can be used to create taxonomies based on org-mode tags
This commit is contained in:
Dominik Süß 2025-02-09 22:40:28 +01:00 committed by GitHub
parent 22ee0918f3
commit f02da7fbce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View file

@ -251,6 +251,10 @@ func (d Decoder) unmarshalORG(data []byte, v any) error {
frontMatter[k[:len(k)-2]] = strings.Fields(v)
} else if strings.Contains(v, "\n") {
frontMatter[k] = strings.Split(v, "\n")
} else if k == "filetags" {
trimmed := strings.TrimPrefix(v, ":")
trimmed = strings.TrimSuffix(trimmed, ":")
frontMatter[k] = strings.Split(trimmed, ":")
} else if k == "date" || k == "lastmod" || k == "publishdate" || k == "expirydate" {
frontMatter[k] = parseORGDate(v)
} else {