Skip to content

Commit

Permalink
Improve css for lists and song sheets (#47)
Browse files Browse the repository at this point in the history
* Improvement for first setlist generator

* Improve rendering of tables (css) for song sheets

* Add a flag to tune the setlist font size

* Don't hardcode text align in tables on song sheets

* Remove duplicate subject in css
  • Loading branch information
laenzlinger authored Jul 14, 2024
1 parent e13e84b commit c9006b3
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 20 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
5 changes: 5 additions & 0 deletions internal/html/template/setlist.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
}
table td {
padding: 3px;
font-size: {{.FontSize}};
}
table thead tr {
background-color: #54585d;
Expand All @@ -35,6 +36,10 @@
}
table tbody tr:nth-child(odd) {
background-color: #ffffff;
}
a:link {
text-decoration: none;
color: #636363;
}
</style>
<script>
Expand Down
6 changes: 5 additions & 1 deletion internal/html/template/songsheet.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@
margin: 0;
padding: 0;
}
html, body {
body {
font-size: 28px;
font-family: Tahoma, Geneva, sans-serif;
font-weight: bold;
}
table, th, td {
border: 1px solid;
border-color: DarkGray;
border-collapse: collapse;
font-size: 28px;
font-family: Tahoma, Geneva, sans-serif;
font-weight: bold;
}
table {
width: 100%;
Expand Down
15 changes: 3 additions & 12 deletions test/Repertoire/Band/Songs/Her Song.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,9 @@
Lyrics of Her Song
Are great to sing along

<table>
<tr>
<td>
You can sing<br>
a tabular song
</td>
<td>
That greatly helps<br>
to use all the real estate
</td>
</tr>
</table>
| You can sing<br> a tabular Song |That greatly helps<br> to use all the real estate|
|:--|:--:|
| Even for a second verse | Lyrics will render to sing along |

```
Amin7 D7 Gmaj7
Expand Down

0 comments on commit c9006b3

Please sign in to comment.