Added some more compatibilty
parent
1eaf0b12da
commit
2a52a8ec53
11
page.go
11
page.go
|
@ -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())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue