Added some more compatibilty

main
Uriel Fanelli 2025-05-05 15:34:37 +02:00
parent 1eaf0b12da
commit 2a52a8ec53
1 changed files with 6 additions and 5 deletions

11
page.go
View File

@ -2,19 +2,20 @@ package main
import (
"bytes"
"html"
"text/template"
)
func GenerateEpisodeDescription(imageURL, title, content string) string {
// Template con sezione CDATA
const descTemplate = `<![CDATA[
const descTemplate = `
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
.episode-container { font-family: Arial, sans-serif; max-width: 800px; }
.episode-image { float: right; margin: 0 0 15px 15px; max-width: 300px; }
.episode-image { float: center; margin: 0 0 15px 15px; max-width: 300px; }
.episode-title { margin-top: 0; color: #333; }
.episode-content { line-height: 1.6; }
</style>
@ -31,7 +32,7 @@ func GenerateEpisodeDescription(imageURL, title, content string) string {
</div>
</body>
</html>
]]>`
`
// Dati per il template
data := struct {
@ -50,8 +51,8 @@ func GenerateEpisodeDescription(imageURL, title, content string) string {
if err := tmpl.Execute(&buf, data); err != nil {
// Fallback con CDATA
return "<![CDATA[<h3>" + title + "</h3>" + content + "]]>"
return "<h3>" + title + "</h3>" + content + ">"
}
return buf.String()
return html.EscapeString(buf.String())
}