package yatwiki3 import ( "database/sql" "fmt" "html/template" "net/http" "net/url" ) func (this *WikiServer) routeModify(w http.ResponseWriter, r *http.Request, articleTitle string) { isNewArticle := false a, err := this.db.GetLatestVersion(articleTitle) if err != nil { if err == sql.ErrNoRows { // this is fine - we're creating it for the first time isNewArticle = true } else { this.serveErrorMessage(w, err) return } } var pageTitleHTML string var baseRev int var existingBody string if isNewArticle { pageTitleHTML = `Creating new article` baseRev = 0 } else { pageTitleHTML = `Editing article "` + template.HTMLEscapeString(articleTitle) + `"` baseRev = a.ID existingBody = string(a.Body) } content := `