mirror of
https://github.com/vbatts/sl-feeds.git
synced 2024-11-25 17:05:39 +00:00
feed: print the items as HTML
Fixes #3 Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
60a23ea96a
commit
42e7cb11c9
2 changed files with 6 additions and 1 deletions
|
@ -33,7 +33,7 @@ func ToFeed(link string, entries []Entry) (*feeds.Feed, error) {
|
||||||
feed.Items[i] = &feeds.Item{
|
feed.Items[i] = &feeds.Item{
|
||||||
Created: e.Date,
|
Created: e.Date,
|
||||||
Link: &feeds.Link{Href: fmt.Sprintf("%s/ChangeLog.txt#src=feeds&time=%d", link, e.Date.Unix())},
|
Link: &feeds.Link{Href: fmt.Sprintf("%s/ChangeLog.txt#src=feeds&time=%d", link, e.Date.Unix())},
|
||||||
Description: e.ToChangeLog(),
|
Description: e.ToHTML(),
|
||||||
}
|
}
|
||||||
|
|
||||||
updateWord := "updates"
|
updateWord := "updates"
|
||||||
|
|
|
@ -94,6 +94,11 @@ func (e Entry) SecurityFix() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ToHTML reformats the struct as the text for HTML output
|
||||||
|
func (e Entry) ToHTML() string {
|
||||||
|
return "<pre><blockquote>" + strings.Replace(e.ToChangeLog(), "\n", "<br>", -1) + "</blockquote></pre>"
|
||||||
|
}
|
||||||
|
|
||||||
// ToChangeLog reformats the struct as the text for ChangeLog.txt output
|
// ToChangeLog reformats the struct as the text for ChangeLog.txt output
|
||||||
func (e Entry) ToChangeLog() string {
|
func (e Entry) ToChangeLog() string {
|
||||||
str := e.Date.Format(time.UnixDate) + "\n"
|
str := e.Date.Format(time.UnixDate) + "\n"
|
||||||
|
|
Loading…
Reference in a new issue