Skip to content

Commit

Permalink
if err...
Browse files Browse the repository at this point in the history
  • Loading branch information
pprobst committed Sep 17, 2019
1 parent 12d44d1 commit c01e218
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
title: 'Battler is a crybaby!'
description: '"A blog about my hate for Battler."'
author: 'Furudo Erika'
theme: 'dark.css'
theme: 'dark.css' # or 'light.css'
24 changes: 20 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,30 @@ import (
"fmt"
"github.com/pprobst/beatrice/src/config"
"github.com/pprobst/beatrice/src/generator"
"os"
)

func main() {
cfg, _ := config.ReadConfig()
if err := generateHTML(); err != nil {
fmt.Errorf("Error: %v", err)
os.Exit(1)
}
fmt.Println("Fin.")
}

func generateHTML() error {
cfg, err := config.ReadConfig()
if err != nil {
return fmt.Errorf("ERROR reading config file: %v", err)
}
posts := generator.GetPosts(cfg)

generator.GenerateIndexHTML(cfg, &posts)
generator.GeneratePostsHTML(cfg, posts)
if err := generator.GenerateIndexHTML(cfg, &posts); err != nil {
return fmt.Errorf("ERROR generating index HTML: %v", err)
}
if err := generator.GeneratePostsHTML(cfg, posts); err != nil {
return fmt.Errorf("ERROR generating posts HTML: %v", err)
}

fmt.Println("Fin.")
return nil
}

0 comments on commit c01e218

Please sign in to comment.