diff --git a/page.go b/page.go
new file mode 100644
index 0000000..8d04538
--- /dev/null
+++ b/page.go
@@ -0,0 +1,38 @@
+package main
+
+import (
+ "bytes"
+ "text/template"
+)
+
+func GenerateEpisodeDescription(imageURL, title, content string) string {
+ // Template con sezione CDATA
+ const descTemplate = `{{end}}
+
{{.Title}}
+
+ {{.Content}}
+ ]]>`
+
+ // Dati per il template
+ data := struct {
+ ImageURL string
+ Title string
+ Content string
+ }{
+ ImageURL: imageURL,
+ Title: title,
+ Content: content,
+ }
+
+ // Esecuzione del template
+ var buf bytes.Buffer
+ tmpl := template.Must(template.New("desc").Parse(descTemplate))
+
+ if err := tmpl.Execute(&buf, data); err != nil {
+ // Fallback con CDATA
+ return "" + title + "" + content + "]]>"
+ }
+
+ return buf.String()
+}
diff --git a/rss-xml.go b/rss-xml.go
index 1a1f464..5dc5961 100644
--- a/rss-xml.go
+++ b/rss-xml.go
@@ -50,9 +50,11 @@ func generateRSS() error {
timepub = time.Now()
}
+ htmlDesc := GenerateEpisodeDescription(epBaseImg, ep.Title, ep.Description)
+
item := podcast.Item{
Title: ep.Title,
- Description: ep.Description,
+ Description: htmlDesc,
PubDate: &timepub,
Enclosure: &podcast.Enclosure{
URL: epBaseUrl,