~ghost08/photon

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH] Use the author field on the card if it exists

Details
Message ID
<20230512110054.907357-1-cowingtonpost@gmail.com>
DKIM signature
missing
Download raw message
Patch: +22 -1
Before this, the rss feed title is used on the card but rss feeds
sometimes have an author field on an entry, so if that exists, we use
that instead.
---
 card.go | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/card.go b/card.go
index 7a94ca7..92ed47b 100644
--- a/card.go
+++ b/card.go
@@ -76,7 +76,28 @@ func (c *Card) Draw(ctx Context, s tcell.Screen, sixelScreen *imgproc.SixelScree
		}
	}
	drawLinesWordwrap(s, ctx.X+1, ctx.Height-headerHeight+ctx.Y, ctx.Width-3, 2, c.Item.Title, style.Bold(true))
	drawLine(s, ctx.X+1, ctx.Height-headerHeight+ctx.Y+2, ctx.Width-3, c.Feed.Title, style.Italic(true))

	var author string
	switch len(c.Item.Authors) {
	case 0:
		author = c.Feed.Title
		break
	case 1:
		author = c.Item.Authors[0].Name
		break
	default:
		for i, item := range c.Item.Authors {
			author += item.Name
			if i-1 == len(c.Item.Authors) {
				author += ", and "
			} else {
				author += ", "
			}
		}
		break
	}
	drawLine(s, ctx.X+1, ctx.Height-headerHeight+ctx.Y+2, ctx.Width-3, author, style.Italic(true))

	drawLine(s, ctx.X+1, ctx.Height-headerHeight+ctx.Y+3, ctx.Width-3, htime.Difference(time.Now(), *c.Item.PublishedParsed), style.Italic(true))

	if c.DownloadImage(ctx) {
-- 
2.40.1
Details
Message ID
<CSLRDDJSC1WC.3PUZK69H3Z6H8@micro-pc>
In-Reply-To
<20230512110054.907357-1-cowingtonpost@gmail.com> (view parent)
DKIM signature
missing
Download raw message
Thanks, that's a good idea.
Reply to thread Export thread (mbox)