diff --git a/compiler/book.go b/compiler/book.go index 94c8397..cbaa31b 100644 --- a/compiler/book.go +++ b/compiler/book.go @@ -46,16 +46,14 @@ var bookTempl = ` {{range $i, $cat := .Categories}} \chapter{{printf "{"}}{{ . }}{{printf "}"}} \newpage -{{range $.Scores}} -{{if in $cat .Categories }} +{{range $.Scores}}{{if in $cat .Categories }} \phantomsection \addcontentsline{toc}{section}{{printf "{"}}{{ .Name }}{{printf "}"}} \includepdf[pages=-]{{printf "{"}}{{.OutputPath}}{{printf "}"}} -{{end}} -{{end}} -{{end}} +{{end}}{{end}}{{end}} -{{if not .Settings.HideUncategorized }}{{ if unknown .Scores }} \chapter{Others} \newpage {{end}} +{{if not .Settings.HideUncategorized }}{{ if unknown .Scores }} +\chapter{{printf "{"}}{{ if ne .Settings.UncategorizedChapter "" }}{{.Settings.UncategorizedChapter}}{{else}}Others{{end}}{{printf "}"}} \newpage {{end}} {{range .Scores}} {{ if eq (len .Categories) 0 }} \phantomsection diff --git a/settings/settings.go b/settings/settings.go index 400bbb3..d4fe6fd 100644 --- a/settings/settings.go +++ b/settings/settings.go @@ -25,12 +25,13 @@ import ( // Settings provides a structure to interact with the settings // of a Ponder library type Settings struct { - Name string // Name of the Ponder library - Author string // Author of the Ponder library - IgnoreDirs []string // Directories to be ignored on search - LilypondIncludes []string // Directories to be included when running the lilypond compiler - OutputDir string // Directory in which all complete file are stored - HideUncategorized bool // Hide scores without a category from the book + Name string // Name of the Ponder library + Author string // Author of the Ponder library + IgnoreDirs []string // Directories to be ignored on search + LilypondIncludes []string // Directories to be included when running the lilypond compiler + OutputDir string // Directory in which all complete file are stored + HideUncategorized bool // Hide scores without a category from the book + UncategorizedChapter string // Name of the chapter with uncategorized scores } // FromFile reads a settings file in json format and returns the Settings struct