Merge pull request #7 from vbatts/fix_format

feed: print the items as HTML
This commit is contained in:
Vincent Batts 2017-02-09 13:35:02 -06:00 committed by GitHub
commit a66095ea7c
2 changed files with 6 additions and 1 deletions

View File

@ -33,7 +33,7 @@ func ToFeed(link string, entries []Entry) (*feeds.Feed, error) {
feed.Items[i] = &feeds.Item{
Created: e.Date,
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"

View File

@ -94,6 +94,11 @@ func (e Entry) SecurityFix() bool {
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
func (e Entry) ToChangeLog() string {
str := e.Date.Format(time.UnixDate) + "\n"