package yatwiki import ( "fmt" "html/template" "net/http" "net/url" "time" ) func (this *WikiServer) routeRecentChangesRSS(w http.ResponseWriter, r *http.Request) { recents, err := this.db.GetRecentChanges(0, this.opts.RecentChangesRSS) if err != nil { this.serveInternalError(w, r, err) return } content := ` ` + template.HTMLEscapeString(this.opts.PageTitle) + ` ` + template.HTMLEscapeString(this.opts.ExternalBaseURL) + ` ` + template.HTMLEscapeString(this.opts.PageTitle) + ` ` + template.HTMLEscapeString(this.opts.DeclareRSSLanguage) + ` ` for _, a := range recents { content += ` ` + template.HTMLEscapeString(a.Title+` (r`+fmt.Sprintf("%d", a.ArticleID)+`)`) + ` ` + template.HTMLEscapeString(this.opts.ExternalBaseURL+`archive/`+fmt.Sprintf("%d", a.ArticleID)) + ` ` + template.HTMLEscapeString(this.opts.ExternalBaseURL+`archive/`+fmt.Sprintf("%d", a.ArticleID)) + ` ` + template.HTMLEscapeString(this.opts.DeclareRSSEmail+` (`+this.opts.PageTitle+` `+a.Author+`)`) + ` ` + template.HTMLEscapeString(time.Unix(a.Modified, 0).In(this.loc).Format(time.RFC1123Z)) + ` ` + template.HTMLEscapeString(` latest version | revision `+fmt.Sprintf("%d", a.ArticleID)+` | diff to previous `) + ` ` } content += ` ` w.Header().Set(`Content-Type`, `application/rss+xml`) w.Write([]byte(content)) }