Archived
1
0

Adds renaming of the 'others' category

This commit is contained in:
Jip J. Dekker 2016-04-14 17:54:52 +02:00
parent d2a4a6b9f4
commit fb554304e3
2 changed files with 11 additions and 12 deletions

View File

@ -46,16 +46,14 @@ var bookTempl = `
{{range $i, $cat := .Categories}} {{range $i, $cat := .Categories}}
\chapter{{printf "{"}}{{ . }}{{printf "}"}} \chapter{{printf "{"}}{{ . }}{{printf "}"}}
\newpage \newpage
{{range $.Scores}} {{range $.Scores}}{{if in $cat .Categories }}
{{if in $cat .Categories }}
\phantomsection \phantomsection
\addcontentsline{toc}{section}{{printf "{"}}{{ .Name }}{{printf "}"}} \addcontentsline{toc}{section}{{printf "{"}}{{ .Name }}{{printf "}"}}
\includepdf[pages=-]{{printf "{"}}{{.OutputPath}}{{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}} {{range .Scores}}
{{ if eq (len .Categories) 0 }} {{ if eq (len .Categories) 0 }}
\phantomsection \phantomsection

View File

@ -31,6 +31,7 @@ type Settings struct {
LilypondIncludes []string // Directories to be included when running the lilypond compiler LilypondIncludes []string // Directories to be included when running the lilypond compiler
OutputDir string // Directory in which all complete file are stored OutputDir string // Directory in which all complete file are stored
HideUncategorized bool // Hide scores without a category from the book 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 // FromFile reads a settings file in json format and returns the Settings struct