aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/main.go b/main.go
index a491337..fc243fa 100644
--- a/main.go
+++ b/main.go
@@ -46,6 +46,12 @@ type post struct {
Time time.Time
Link string
Content string
+ Images []*image // list of urls
+}
+
+type image struct {
+ Source string
+ Caption string
}
func (p *post) String() string {
@@ -61,6 +67,12 @@ func (p *post) String() string {
// time format: Mon Jan 2 15:04:05 -0700 MST 2006
s = strings.Replace(template, "{{time}}", p.Time.Format("Mon, 2 Jan 2006 15:04:05 MST"), 2)
s = strings.Replace(s, "{{content}}", p.Content, 1)
+ var imgs string
+ for i := range p.Images {
+ imgs += `<a href="` + p.Images[i].Source + `"><img src="` + p.Images[i].Source + `" title="` + p.Images[i].Caption + `"></a>`
+ }
+ s = strings.Replace(s, "{{images}}", imgs, 1)
+
return s
}