diff --git a/compiler/book.go b/compiler/book.go index 2bb12a3..26dbb74 100644 --- a/compiler/book.go +++ b/compiler/book.go @@ -37,6 +37,10 @@ func MakeBook(path string, opts *settings.Settings) { templ, err := parseBookTemplate(opts) + if len(opts.DefaultCategories) == 0 { + opts.DefaultCategories = scoreCategories(&scores) + } + texPath := filepath.Join(opts.OutputDir, opts.Name+".tex") log.WithFields(log.Fields{ "path": texPath, @@ -50,7 +54,7 @@ func MakeBook(path string, opts *settings.Settings) { }{ Scores: &scores, Settings: opts, - Categories: scoreCategories(&scores), + Categories: opts.DefaultCategories, }) helpers.Check(err, "error executing book template") f.Close() diff --git a/settings/settings.go b/settings/settings.go index cc7a4d1..ac32759 100644 --- a/settings/settings.go +++ b/settings/settings.go @@ -39,6 +39,7 @@ type Settings struct { LatexResources []string // Files to be copied to compile the book template KeepBookTemplate bool // Leave the LaTeX source for the book in the output directory FlatOutputDir bool // Keep all output file in a flat output directory + DefaultCategories []string // Categories included in the book by default } // FromFile reads a settings file in json format and returns the Settings struct