mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-28 06:30:33 +03:00
parent
0e79446586
commit
7c9fada778
80 changed files with 1273 additions and 1082 deletions
|
@ -18,6 +18,7 @@ import (
|
|||
"encoding/csv"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
|
@ -28,7 +29,6 @@ import (
|
|||
toml "github.com/pelletier/go-toml/v2"
|
||||
"github.com/spf13/afero"
|
||||
"github.com/spf13/cast"
|
||||
jww "github.com/spf13/jwalterweatherman"
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
|
@ -231,7 +231,7 @@ func parseORGDate(s string) string {
|
|||
|
||||
func (d Decoder) unmarshalORG(data []byte, v any) error {
|
||||
config := org.New()
|
||||
config.Log = jww.WARN
|
||||
config.Log = log.Default() // TODO(bep)
|
||||
document := config.Parse(bytes.NewReader(data), "")
|
||||
if document.Error != nil {
|
||||
return document.Error
|
||||
|
@ -242,7 +242,7 @@ func (d Decoder) unmarshalORG(data []byte, v any) error {
|
|||
if strings.HasSuffix(k, "[]") {
|
||||
frontMatter[k[:len(k)-2]] = strings.Fields(v)
|
||||
} else if k == "tags" || k == "categories" || k == "aliases" {
|
||||
jww.WARN.Printf("Please use '#+%s[]:' notation, automatic conversion is deprecated.", k)
|
||||
log.Printf("warn: Please use '#+%s[]:' notation, automatic conversion is deprecated.", k)
|
||||
frontMatter[k] = strings.Fields(v)
|
||||
} else if k == "date" || k == "lastmod" || k == "publishdate" || k == "expirydate" {
|
||||
frontMatter[k] = parseORGDate(v)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue