Adds Choice of categories for the book command
This commit is contained in:
parent
66fa2fd436
commit
971fcd2fd8
@ -37,6 +37,10 @@ func MakeBook(path string, opts *settings.Settings) {
|
|||||||
|
|
||||||
templ, err := parseBookTemplate(opts)
|
templ, err := parseBookTemplate(opts)
|
||||||
|
|
||||||
|
if len(opts.DefaultCategories) == 0 {
|
||||||
|
opts.DefaultCategories = scoreCategories(&scores)
|
||||||
|
}
|
||||||
|
|
||||||
texPath := filepath.Join(opts.OutputDir, opts.Name+".tex")
|
texPath := filepath.Join(opts.OutputDir, opts.Name+".tex")
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"path": texPath,
|
"path": texPath,
|
||||||
@ -50,7 +54,7 @@ func MakeBook(path string, opts *settings.Settings) {
|
|||||||
}{
|
}{
|
||||||
Scores: &scores,
|
Scores: &scores,
|
||||||
Settings: opts,
|
Settings: opts,
|
||||||
Categories: scoreCategories(&scores),
|
Categories: opts.DefaultCategories,
|
||||||
})
|
})
|
||||||
helpers.Check(err, "error executing book template")
|
helpers.Check(err, "error executing book template")
|
||||||
f.Close()
|
f.Close()
|
||||||
|
@ -39,6 +39,7 @@ type Settings struct {
|
|||||||
LatexResources []string // Files to be copied to compile the book template
|
LatexResources []string // Files to be copied to compile the book template
|
||||||
KeepBookTemplate bool // Leave the LaTeX source for the book in the output directory
|
KeepBookTemplate bool // Leave the LaTeX source for the book in the output directory
|
||||||
FlatOutputDir bool // Keep all output file in a flat 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
|
// FromFile reads a settings file in json format and returns the Settings struct
|
||||||
|
Reference in New Issue
Block a user