Skip to content

Commit

Permalink
Added a draft accoutrement
Browse files Browse the repository at this point in the history
Signed-off-by: Sandy <sandy@sandyuraz.com>
  • Loading branch information
thecsw committed Mar 1, 2023
1 parent c88d194 commit 4756850
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions emilia/accoutrement.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const (
disableOption = `nil`
delimiterOption = ':'

optionDraft = `draft`
optionTomb = `tomb`
optionAuthorImage = `author-image`
optionMath = `math`
Expand All @@ -19,6 +20,7 @@ const (

var (
accotrementActions = map[string]func(string, *yunyun.Accoutrement){
optionDraft: accoutrementDraft,
optionTomb: accoutrementTomb,
optionAuthorImage: accoutrementAuthorImage,
optionMath: accoutrementMath,
Expand Down Expand Up @@ -67,6 +69,10 @@ func breakOption(what string) (string, string) {
return what, enableOption
}

func accoutrementDraft(what string, target *yunyun.Accoutrement) {
accoutrementBool(what, &target.Draft)
}

func accoutrementTomb(what string, target *yunyun.Accoutrement) {
accoutrementBool(what, &target.Tomb)
}
Expand Down
2 changes: 1 addition & 1 deletion ichika/misa.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func MisaCommandFunc() {

options := getEmiliaOptions(misaCmd)
if len(*rss) > 0 {
options.Dev = true
options.Dev = false
}
emilia.InitDarkness(options)

Expand Down
5 changes: 4 additions & 1 deletion ichika/rss.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const (
func rssf(rssFilename string, rssDirectories []string, dryRun bool) {
// Get all all the pages we can build out.
allPages := buildPagesSimple(rssDirectories)

// Try to retrieve the top root page to get channel description. If not found, use the
// website's title as the description.
topPage := gana.First(gana.Filter(func(page *yunyun.Page) bool { return page.Location == "." }, allPages))
Expand All @@ -47,6 +46,10 @@ func rssf(rssFilename string, rssDirectories []string, dryRun bool) {
items := make([]*rss.Item, 0, len(pages))

for _, page := range pages {
// Skip drafts.
if page.Accoutrement.Draft.IsEnabled() {
continue
}
categoryName, categoryLocation := page.Title, page.Location
if categoryPage := getCategory(page, allPages); categoryPage != nil {
categoryName = categoryPage.Title
Expand Down
2 changes: 2 additions & 0 deletions yunyun/accoutrement.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import "strings"

// Accoutrement are settings of a page.
type Accoutrement struct {
// Draft will prevent rss from showing the page.
Draft AccoutrementFlip
// Tomb enables/disables tomb on a page.
Tomb AccoutrementFlip
// AuthorImage enables/disable author's header image.
Expand Down

0 comments on commit 4756850

Please sign in to comment.