diff --git a/integrations/jikan/types.go b/integrations/jikan/types.go index f363163..9dc1226 100644 --- a/integrations/jikan/types.go +++ b/integrations/jikan/types.go @@ -84,6 +84,22 @@ type Anime struct { } `json:"external"` } +func (a Anime) ScoredByFormatted() string { + if a.ScoredBy == 0 { + return "" + } + s := fmt.Sprintf("%d", a.ScoredBy) + var res []string + for i := len(s); i > 0; i -= 3 { + start := i - 3 + if start < 0 { + start = 0 + } + res = append([]string{s[start:i]}, res...) + } + return strings.Join(res, " ") +} + func (a Anime) ImageURL() string { return a.Images.Webp.LargeImageURL } diff --git a/templates/anime.gohtml b/templates/anime.gohtml index 4181ca2..7ec2f7a 100644 --- a/templates/anime.gohtml +++ b/templates/anime.gohtml @@ -29,8 +29,8 @@
{{if $anime.Synopsis}}{{$anime.Synopsis}}{{else}}No synopsis available.{{end}}
@@ -70,16 +70,16 @@ {{if $anime.Genres}}