From 0241b4ada27998522ca521347dcdeafd52c2a199 Mon Sep 17 00:00:00 2001 From: xuthus5 Date: Wed, 1 Nov 2023 21:18:21 +0800 Subject: [PATCH] feat: dependency version update --- generate_command.go | 11 +++++++++-- go.mod | 18 +++++++++--------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/generate_command.go b/generate_command.go index 248f122..abd77dc 100644 --- a/generate_command.go +++ b/generate_command.go @@ -98,6 +98,7 @@ func (o *Outter) readAllPosts() error { post.Link = fmt.Sprintf("/default/%s.html", post.FileBasename) post.Category = "default" if isDraft(post.Tags) { + post.Link = fmt.Sprintf("/draft/%s.html", post.FileBasename) o.DraftPosts = append(o.DraftPosts, post) } else { o.Posts = append(o.Posts, post) @@ -203,7 +204,12 @@ func (o *Outter) readPosts(base, category string) []*Post { post.FileBasename = strings.ReplaceAll(fsInfo.Name(), ".md", "") post.Link = fmt.Sprintf("/%s/%s.html", strings.ToLower(category), post.FileBasename) post.Category = category - posts = append(posts, post) + if isDraft(post.Tags) { + post.Link = fmt.Sprintf("/draft/%s.html", post.FileBasename) + o.DraftPosts = append(o.DraftPosts, post) + } else { + posts = append(posts, post) + } } return posts } @@ -578,7 +584,7 @@ func (o *Outter) generatePost() { func (o *Outter) generateDraftPost() { postTemplate := template.New("post") var postBuffer = new(bytes.Buffer) - for _, post := range o.Posts { + for _, post := range o.DraftPosts { instance := PostOutter{ Post: post, Config: o.Config, @@ -803,6 +809,7 @@ func (o *Outter) generateCategories() { newPost := post cats[post.Category] = append(cats[post.Category], newPost) } + cats["draft"] = o.DraftPosts for tag, posts := range cats { // 按时间归档 diff --git a/go.mod b/go.mod index 749ad98..20ab038 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/radovskyb/watcher v1.0.7 github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.7.0 - github.com/yuin/goldmark v1.5.6 + github.com/yuin/goldmark v1.6.0 github.com/yuin/goldmark-emoji v1.0.2 github.com/yuin/goldmark-meta v1.1.0 go.abhg.dev/goldmark/mermaid v0.4.0 @@ -17,21 +17,21 @@ require ( ) require ( - github.com/andybalholm/brotli v1.0.5 // indirect - github.com/bytedance/sonic v1.10.1 // indirect + github.com/andybalholm/brotli v1.0.6 // indirect + github.com/bytedance/sonic v1.10.2 // indirect github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect github.com/chenzhuoyu/iasm v0.9.0 // indirect - github.com/gabriel-vasile/mimetype v1.4.2 // indirect + github.com/gabriel-vasile/mimetype v1.4.3 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect - github.com/go-playground/validator/v10 v10.15.4 // indirect + github.com/go-playground/validator/v10 v10.15.5 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/leodido/go-urn v1.2.4 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect @@ -40,9 +40,9 @@ require ( github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.11 // indirect golang.org/x/arch v0.5.0 // indirect - golang.org/x/crypto v0.13.0 // indirect - golang.org/x/net v0.15.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect