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:
parent
e5fe550bc2
commit
8ea57ee5c5
@ -3,6 +3,7 @@ package display
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/makeworld-the-better-one/amfora/feeds"
|
"github.com/makeworld-the-better-one/amfora/feeds"
|
||||||
"github.com/makeworld-the-better-one/amfora/renderer"
|
"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" +
|
var feedPageRaw = "# Feeds & Pages\n\nUpdates" + strings.Repeat(" ", 80-25) + "[Newest -> Oldest]\n" +
|
||||||
strings.Repeat("-", 80) + "\n\n"
|
strings.Repeat("-", 80) + "\n\n"
|
||||||
|
|
||||||
|
var timeDay = 24 * time.Hour
|
||||||
|
|
||||||
// Feeds displays the feeds page on the current tab.
|
// Feeds displays the feeds page on the current tab.
|
||||||
func Feeds(t *tab) {
|
func Feeds(t *tab) {
|
||||||
// TODO; Decide about date in local time vs UTC
|
// TODO; Decide about date in local time vs UTC
|
||||||
@ -19,12 +22,12 @@ func Feeds(t *tab) {
|
|||||||
|
|
||||||
pe := feeds.GetPageEntries()
|
pe := feeds.GetPageEntries()
|
||||||
|
|
||||||
curDay := time.Time.Round(time.Day)
|
curDay := time.Time{}.Round(timeDay)
|
||||||
|
|
||||||
for _, entry := range pe.Entries {
|
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
|
// 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("\n## %s\n\n", curDay.Format("Jan 02, 2006"))
|
||||||
}
|
}
|
||||||
feedPageRaw += fmt.Sprintf("=>%s %s - %s\n", entry.URL, entry.Author, entry.Title)
|
feedPageRaw += fmt.Sprintf("=>%s %s - %s\n", entry.URL, entry.Author, entry.Title)
|
||||||
|
@ -47,8 +47,8 @@ func textWidth() int {
|
|||||||
|
|
||||||
// queryEscape is the same as url.PathEscape, but it also replaces the +.
|
// queryEscape is the same as url.PathEscape, but it also replaces the +.
|
||||||
// This is because Gemini requires percent-escaping for queries.
|
// This is because Gemini requires percent-escaping for queries.
|
||||||
func queryEscape(path string) string {
|
func queryEscape(query string) string {
|
||||||
return strings.ReplaceAll(url.PathEscape(path), "+", "%2B")
|
return strings.ReplaceAll(url.PathEscape(query), "+", "%2B")
|
||||||
}
|
}
|
||||||
|
|
||||||
// resolveRelLink returns an absolute link for the given absolute link and relative one.
|
// resolveRelLink returns an absolute link for the given absolute link and relative one.
|
||||||
|
Loading…
Reference in New Issue
Block a user