Added some more compatibilty
parent
1eaf0b12da
commit
2a52a8ec53
11
page.go
11
page.go
|
@ -2,19 +2,20 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"html"
|
||||||
"text/template"
|
"text/template"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GenerateEpisodeDescription(imageURL, title, content string) string {
|
func GenerateEpisodeDescription(imageURL, title, content string) string {
|
||||||
// Template con sezione CDATA
|
// Template con sezione CDATA
|
||||||
const descTemplate = `<![CDATA[
|
const descTemplate = `
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<style>
|
<style>
|
||||||
.episode-container { font-family: Arial, sans-serif; max-width: 800px; }
|
.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-title { margin-top: 0; color: #333; }
|
||||||
.episode-content { line-height: 1.6; }
|
.episode-content { line-height: 1.6; }
|
||||||
</style>
|
</style>
|
||||||
|
@ -31,7 +32,7 @@ func GenerateEpisodeDescription(imageURL, title, content string) string {
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
]]>`
|
`
|
||||||
|
|
||||||
// Dati per il template
|
// Dati per il template
|
||||||
data := struct {
|
data := struct {
|
||||||
|
@ -50,8 +51,8 @@ func GenerateEpisodeDescription(imageURL, title, content string) string {
|
||||||
|
|
||||||
if err := tmpl.Execute(&buf, data); err != nil {
|
if err := tmpl.Execute(&buf, data); err != nil {
|
||||||
// Fallback con CDATA
|
// 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