From 31983ae15a370c5be7c9824c5513da77401db5ba Mon Sep 17 00:00:00 2001 From: Moritz Biering Date: Mon, 15 Jan 2024 21:20:25 +0100 Subject: [PATCH] Minor bugfixes and goreleaser revert --- .github/workflows/release.yml | 7 +++++-- pkg/tagesschau/convert.go | 14 ++++++++++++-- pkg/tui/keybinds.go | 8 ++++++-- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b78bf65..cd23715 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,8 +30,11 @@ jobs: with: go-version: stable - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v4 + uses: goreleaser/goreleaser-action@v5 with: + distribution: goreleaser version: latest - args: release --snapshot --skip-publish --skip-sign --rm-dist + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.PUBLISHER_TOKEN }} diff --git a/pkg/tagesschau/convert.go b/pkg/tagesschau/convert.go index d18c8f9..3ca2cd2 100644 --- a/pkg/tagesschau/convert.go +++ b/pkg/tagesschau/convert.go @@ -3,6 +3,7 @@ package tagesschau import ( "regexp" "strings" + "unicode" ) const ( @@ -44,7 +45,7 @@ func ContentToParagraphs(content []Content) []string { sec := isSection(text) if (prevType != c.Type || sec || prevSection) && paragraph != "" || i == len(content)-1 { - paragraphs = append(paragraphs, paragraph) + paragraphs = append(paragraphs, clean(paragraph)) paragraph = "" } paragraph += text + " " @@ -52,10 +53,19 @@ func ContentToParagraphs(content []Content) []string { } prevType = c.Type } - paragraphs = append(paragraphs, formatLastLine(paragraph)) + paragraphs = append(paragraphs, clean(formatLastLine(paragraph))) return paragraphs } +func clean(s string) string { + return strings.Map(func(r rune) rune { + if unicode.IsGraphic(r) { + return r + } + return -1 + }, s) +} + func isSection(text string) bool { return isHighlighted(text, "strong") || isHighlighted(text, "em") } diff --git a/pkg/tui/keybinds.go b/pkg/tui/keybinds.go index f97a41c..4be65b3 100644 --- a/pkg/tui/keybinds.go +++ b/pkg/tui/keybinds.go @@ -56,8 +56,12 @@ func toHelpBinding(binds []string, name string) key.Binding { ) } -func keybindsToHelpText(keybinds []string) string { - for i := range keybinds { +func keybindsToHelpText(binds []string) string { + keybinds := []string{} + + for i := range binds { + keybinds = append(keybinds, binds[i]) + if keybinds[i] == "up" { keybinds[i] = "↑" }