Skip to content

Commit

Permalink
Update refresh on book to recreate itself
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Veld committed Aug 7, 2023
1 parent d002aee commit 144d642
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions pkg/providers/library.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,26 +78,8 @@ func (b *Book) Lookup() ([]string, error) {
func (b *Book) Refresh() error {
b.log.Debug("Refresh Book", "ref", b.config.Name)

libraryPath := utils.GetLibraryFolder("", 0775)
bookPath := filepath.Join(libraryPath, "content", b.config.Name)

for _, bc := range b.config.Chapters {
cr, err := b.config.ParentConfig.FindResource(bc)
if err != nil {
return err
}

c := cr.(*resources.Chapter)

chapterPath := filepath.Join(bookPath, c.Name)

for _, p := range c.Pages {
err = b.writePage(chapterPath, p)
if err != nil {
return err
}
}
}
b.Destroy()
b.Create()

return nil
}
Expand Down

0 comments on commit 144d642

Please sign in to comment.