diff --git a/assets/comic.html b/assets/comic.html index 2dbf768..6f23919 100644 --- a/assets/comic.html +++ b/assets/comic.html @@ -13,19 +13,19 @@

{{ .Num }} - {{ .Title }}

{{ if .Image }}
diff --git a/assets/styles.css b/assets/styles.css index 94bcb4c..95860aa 100644 --- a/assets/styles.css +++ b/assets/styles.css @@ -57,6 +57,10 @@ nav a:hover { box-shadow: none; } +nav a[aria-disabled="true"] { + cursor: not-allowed; +} + ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); diff --git a/main.go b/main.go index 17526c5..3e8c342 100644 --- a/main.go +++ b/main.go @@ -103,18 +103,11 @@ var cmd = &cobra.Command{ } data := &comicData{ - Num: id, - Title: metadata.String("title"), - Alt: metadata.String("alt"), - Image: metadata.String("img"), - } - - if id > 1 { - data.Prev = fmt.Sprintf("../%d/", id-1) - } - - if id < uint(latest) { - data.Next = fmt.Sprintf("../%d/", id+1) + Num: id, + Title: metadata.String("title"), + Alt: metadata.String("alt"), + Image: metadata.String("img"), + Latest: latest, } var b bytes.Buffer @@ -162,12 +155,11 @@ var cmd = &cobra.Command{ } type comicData struct { - Num uint - Title string - Alt string - Prev string - Next string - Image string + Latest uint + Num uint + Title string + Alt string + Image string } type homeData struct { @@ -179,7 +171,14 @@ func getTemplate(name string) (*template.Template, error) { if err != nil { return nil, err } - return template.New("").Parse(string(comicBytes)) + return template.New("").Funcs(template.FuncMap{ + "minus": func(a, b uint) uint { + return a - b + }, + "plus": func(a, b uint) uint { + return a + b + }, + }).Parse(string(comicBytes)) } func copyAsset(out, filename string) error {