remove Emoji func; add FontAwesome func
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Simon Vieille 2022-08-29 11:57:15 +02:00
parent 1579e3b48d
commit 433cfda295
Signed by: deblan
GPG key ID: 579388D585F70417
5 changed files with 7 additions and 8 deletions

View file

@ -51,7 +51,7 @@ func main() {
func CreateChargingBlock(level int) string {
value := fmt.Sprintf("%d%%", level)
symbol := r.Emoji(emoji.UpArrow)
symbol := string(emoji.UpArrow)
options := r.NewBlockOptions()
options.FullText = r.TextWithPadding(fmt.Sprintf("%s %s", value, symbol), CreateFB(level))
@ -62,7 +62,7 @@ func CreateChargingBlock(level int) string {
func CreateDischargingBlock(level int) string {
value := fmt.Sprintf("%d%%", level)
symbol := r.Emoji(emoji.DownArrow)
symbol := string(emoji.DownArrow)
block := r.Block("battery", r.BlockOptions{
FullText: r.TextWithPadding(fmt.Sprintf("%s %s", value, symbol), CreateFB(level)),

View file

@ -28,7 +28,7 @@ func main() {
go runCalendar(&wg)
}
symbol := r.Emoji(emoji.Calendar)
symbol := string(emoji.Calendar)
date := timefmt.Format(now, argFormat)
options := r.NewBlockOptions()

View file

@ -42,7 +42,7 @@ func main() {
body, _ := io.ReadAll(resp.Body)
content := string(body)
count := strings.Count(content, "<item") + strings.Count(content, "<entry")
label := "<span font='FontAwesome'>\uf09e</span>"
label := r.FontAwesome("\uf09e")
fb := r.FB{
Foreground: os.Args[4],

View file

@ -2,9 +2,8 @@ package rendering
import (
"fmt"
"github.com/enescakir/emoji"
)
func Emoji(e emoji.Emoji) string {
return fmt.Sprintf("<span font='FontAwesome'>%s</span>", e)
func FontAwesome(str string) string {
return fmt.Sprintf(`<span font="FontAwesome">%s</span>`, str)
}

View file

@ -18,7 +18,7 @@ func Text(text string, fb FB) string {
fb.Background = Color("default_background")
}
return fmt.Sprintf("<span background='%s' foreground='%s'>%s</span>", fb.Background, fb.Foreground, text)
return fmt.Sprintf(`<span background="%s" foreground="%s">%s</span>`, fb.Background, fb.Foreground, text)
}
func TextWithPadding(text string, fb FB) string {