Create RSS from HTML
This commit is contained in:
@ -1,23 +1,25 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"streifling.com/jason/cpolis/cmd/articles"
|
||||
"streifling.com/jason/cpolis/cmd/feed"
|
||||
)
|
||||
|
||||
func HandleFinishedEdit() http.HandlerFunc {
|
||||
func HandleFinishedEdit(f feed.Feed) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
md := r.PostFormValue("editor-textarea")
|
||||
title := r.PostFormValue("editor-title")
|
||||
mdContent := r.PostFormValue("editor-text")
|
||||
|
||||
html, err := articles.ConvertToHTML(md)
|
||||
content, err := articles.ConvertToHTML(mdContent)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
log.Panicln(err)
|
||||
}
|
||||
|
||||
template.Must(template.ParseFiles("web/templates/editor.html")).ExecuteTemplate(w, "html-result", html)
|
||||
feed.AddToFeed(f, title, content)
|
||||
// template.Must(template.ParseFiles("web/templates/editor.html")).ExecuteTemplate(w, "html-result", rssItem)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user