update main for imports

This commit is contained in:
dre 2021-07-11 00:46:01 +08:00
parent 103cd7dcac
commit 7ac987fa42

11
main.go
View file

@ -13,6 +13,7 @@ import (
"time" "time"
"github.com/gohugoio/hugo/config" "github.com/gohugoio/hugo/config"
"github.com/n0x1m/hugoext/hugov0492"
"github.com/spf13/afero" "github.com/spf13/afero"
) )
@ -157,14 +158,14 @@ type File struct {
NewBody []byte NewBody []byte
} }
func parse(fullpath string) ([]byte, *Content, error) { func parse(fullpath string) ([]byte, *hugov0492.Content, error) {
file, err := os.Open(fullpath) file, err := os.Open(fullpath)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }
defer file.Close() defer file.Close()
page, err := ReadFrom(file) page, err := hugov0492.ReadFrom(file)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }
@ -189,7 +190,7 @@ func destinationPath(file *File, pattern string) error {
file.Body = body file.Body = body
if file.Parent != "." { if file.Parent != "." {
link, err := pathPattern(pattern).Expand(c) link, err := hugov0492.PathPattern(pattern).Expand(c)
if err != nil { if err != nil {
return err return err
} }
@ -234,8 +235,8 @@ func collectFiles(fullpath string, filechan chan File) error {
}) })
} }
func NewContentFromMeta(meta map[string]interface{}) *Content { func NewContentFromMeta(meta map[string]interface{}) *hugov0492.Content {
return &Content{ return &hugov0492.Content{
Title: stringFromInterface(meta["title"]), Title: stringFromInterface(meta["title"]),
Slug: stringFromInterface(meta["slug"]), Slug: stringFromInterface(meta["slug"]),
Summary: stringFromInterface(meta["summary"]), Summary: stringFromInterface(meta["summary"]),