Skip to content

Commit

Permalink
Add a flag to tune the setlist font size
Browse files Browse the repository at this point in the history
  • Loading branch information
laenzlinger committed Jul 13, 2024
1 parent 615ad14 commit c5943cf
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test-integration: clean docker-build ## run integration tests
$(RUN) clean
$(RUN) generate sheet --all
$(RUN) generate sheet
$(RUN) generate list --landscape
$(RUN) generate list --landscape --font-size 40px
$(RUN) generate suisa "Grand Ole Opry"
ls -lartR test/Repertoire/out

Expand Down
11 changes: 8 additions & 3 deletions cmd/generate_setlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ func init() {

err := viper.BindPFlag("setlist.include-columns", setlistCmd.Flags().Lookup("include-columns"))
cobra.CheckErr(err)

setlistCmd.Flags().StringP("font-size", "f", "24px", "set the main font size (css values are supported)")
err = viper.BindPFlag("generate.list.font-size", setlistCmd.Flags().Lookup("font-size"))
cobra.CheckErr(err)
}

func generateSetlist(gigName string) error {
Expand All @@ -77,9 +81,10 @@ func generateSetlist(gigName string) error {
Render()

data := tmpl.Data{
Title: gig.Name,
Margin: "0cm",
Content: template.HTML(content), //nolint: gosec // not a web application
Title: gig.Name,
FontSize: viper.GetString("generate.list.font-size"),
Margin: "0cm",
Content: template.HTML(content), //nolint: gosec // not a web application
}

filename, err := tmpl.CreateSetlist(&data)
Expand Down
1 change: 1 addition & 0 deletions docs/setlist_generate_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ setlist generate list [flags]
### Options

```
-f, --font-size string set the main font size (css values are supported) (default "24px")
-h, --help help for list
-i, --include-columns strings defines the repertoire columns to include in the output (default [Title,Year,Description])
```
Expand Down
7 changes: 4 additions & 3 deletions internal/html/template/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ func init() {
}

type Data struct {
Title string
Margin string
Content template.HTML
Title string
Margin string
FontSize string
Content template.HTML
}

func CreateSetlist(data *Data) (string, error) {
Expand Down
2 changes: 1 addition & 1 deletion internal/html/template/setlist.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
table td {
padding: 3px;
font-size: 24px;
font-size: {{.FontSize}};
}
table thead tr {
background-color: #54585d;
Expand Down

0 comments on commit c5943cf

Please sign in to comment.