repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

commit
c2c7dc0
parent
2b0df2b
author
Eric Bower
date
2023-01-16 19:59:16 +0000 UTC
feat(feeds): render actual content
2 files changed,  +29, -4
M feeds/cron.go
+2, -2
 1@@ -31,7 +31,7 @@ func (c *UserAgentTransport) RoundTrip(r *http.Request) (*http.Response, error)
 2 type FeedItem struct {
 3 	Title   string
 4 	Link    string
 5-	Content string
 6+	Content html.HTML
 7 }
 8 
 9 type Feed struct {
10@@ -217,7 +217,7 @@ func (f *Fetcher) Fetch(fp *gofeed.Parser, url string, lastDigest *time.Time) (*
11 		items = append(items, &FeedItem{
12 			Title:   item.Title,
13 			Link:    item.Link,
14-			Content: item.Content,
15+			Content: html.HTML(item.Content),
16 		})
17 	}
18 
M feeds/html/digest.page.tmpl
+27, -2
 1@@ -1,16 +1,41 @@
 2+<style>
 3+img {
 4+    max-width: 100%;
 5+    height: auto;
 6+}
 7+
 8+.feeds {
 9+    max-width: 100%;
10+}
11+</style>
12+
13+<div class="feeds">
14 {{range .Feeds}}
15 <div style="margin-bottom: 10px;">
16-    <h2 style="margin-bottom: 3px;"><a href="{{.Link}}">{{.Title}}</a></h2>
17+    <h1 style="margin-bottom: 3px;"><a href="{{.Link}}">{{.Title}}</a></h1>
18     <div>{{.Description}}</div>
19 </div>
20 
21+<div class="summary">
22+    <h2>Summary</h2>
23+    {{range .Items}}
24+    <ul>
25+        <li><a href="{{.Link}}">{{.Title}}</a></li>
26+    </ul>
27+    {{end}}
28+    <hr />
29+</div>
30+
31 <div>
32     {{range .Items}}
33     <div>
34-        <a href="{{.Link}}">{{.Title}}</a>
35+        <h1><a href="{{.Link}}">{{.Title}}</a></h1>
36+        <div>{{.Content}}</div>
37     </div>
38+    <hr />
39     {{end}}
40 </div>
41 
42 <hr style="margin: 10px 0;" />
43 {{end}}
44+</div>