/
feature_updates.go
45 lines (38 loc) · 1 KB
/
feature_updates.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package args
import "html/template"
// StyleEnum is the style enum types
type StyleEnum string
// Styles
const (
LeftRight StyleEnum = "left-right"
LargeImage StyleEnum = "large-image"
)
// FeatureUpdatesArgs is the default args for feature-updates layout
type FeatureUpdatesArgs struct {
SharedArgs
Announcements []Announcement `json:"announcements"`
Style StyleEnum `json:"style"`
}
// Announcement ...
type Announcement struct {
ImageURL string `json:"image_url"`
Title string `json:"title"`
DescriptionMarkDown Markdown `json:"description"`
DescriptionHTML template.HTML `json:"-"`
Link string `json:"link"`
}
func (f *FeatureUpdatesArgs) Process() (err error) {
f.SharedArgs.Process()
for i, a := range f.Announcements {
a.Process()
f.Announcements[i] = a
}
return
}
func (a *Announcement) Process() (err error) {
a.DescriptionHTML, err = a.DescriptionMarkDown.process()
if err != nil {
return
}
return
}