1
0
mirror of https://github.com/makew0rld/amfora.git synced 2024-12-04 14:46:29 -05:00

🚧 Fix lint errors

This commit is contained in:
makeworld 2020-08-17 17:36:50 -04:00
parent e5fe550bc2
commit 8ea57ee5c5
2 changed files with 8 additions and 5 deletions

View File

@ -3,6 +3,7 @@ package display
import (
"fmt"
"strings"
"time"
"github.com/makeworld-the-better-one/amfora/feeds"
"github.com/makeworld-the-better-one/amfora/renderer"
@ -12,6 +13,8 @@ import (
var feedPageRaw = "# Feeds & Pages\n\nUpdates" + strings.Repeat(" ", 80-25) + "[Newest -> Oldest]\n" +
strings.Repeat("-", 80) + "\n\n"
var timeDay = 24 * time.Hour
// Feeds displays the feeds page on the current tab.
func Feeds(t *tab) {
// TODO; Decide about date in local time vs UTC
@ -19,12 +22,12 @@ func Feeds(t *tab) {
pe := feeds.GetPageEntries()
curDay := time.Time.Round(time.Day)
curDay := time.Time{}.Round(timeDay)
for _, entry := range pe.Entries {
if entry.Published.Round(time.Day).After(curDay) {
if entry.Published.Round(timeDay).After(curDay) {
// This post is on a new day, add a day header
curDay := entry.Published.Round(time.Day)
curDay := entry.Published.Round(timeDay)
feedPageRaw += fmt.Sprintf("\n## %s\n\n", curDay.Format("Jan 02, 2006"))
}
feedPageRaw += fmt.Sprintf("=>%s %s - %s\n", entry.URL, entry.Author, entry.Title)

View File

@ -47,8 +47,8 @@ func textWidth() int {
// queryEscape is the same as url.PathEscape, but it also replaces the +.
// This is because Gemini requires percent-escaping for queries.
func queryEscape(path string) string {
return strings.ReplaceAll(url.PathEscape(path), "+", "%2B")
func queryEscape(query string) string {
return strings.ReplaceAll(url.PathEscape(query), "+", "%2B")
}
// resolveRelLink returns an absolute link for the given absolute link and relative one.