package yatwiki import ( "database/sql" "fmt" "html/template" "net/http" "net/url" ) func (this *WikiServer) routeHistory(w http.ResponseWriter, r *http.Request, articleTitle string) { revs, err := this.db.GetRevisionHistory(articleTitle) if err != nil { if err == sql.ErrNoRows { this.serveNoSuchArticle(w, articleTitle) return } this.serveErrorMessage(w, err) return } if len(revs) == 0 { this.serveNoSuchArticle(w, articleTitle) return } pto := DefaultPageTemplateOptions(this.opts) pto.CurrentPageName = articleTitle pto.CurrentPageIsArticle = true content := `

Page History


` + `There have been ` + fmt.Sprintf("%d", len(revs)) + ` edits to the page "` + template.HTMLEscapeString(articleTitle) + `".` + `

` + `
` + `` compareRow := `` content += compareRow for _, rev := range revs { revIdStr := fmt.Sprintf("%d", rev.ArticleID) content += `` + `` + `` + `` + `` } content += compareRow content += `
` + string(this.formatTimestamp(rev.Modified)) + `` + template.HTMLEscapeString(rev.Author) + ` 
` pto.Content = template.HTML(content) this.servePageResponse(w, r, pto) return }