package html import ( "fmt" "math/rand" "strings" "github.com/TheLovinator1/FeedVault/pkg/models" "github.com/TheLovinator1/FeedVault/pkg/quotes" "github.com/TheLovinator1/FeedVault/pkg/stats" ) type HTMLData struct { Title string Description string Keywords string Author string CanonicalURL string Content string ParseResult []models.ParseResult } var style = ` html { max-width: 70ch; padding: calc(1vmin + 0.5rem); margin-inline: auto; font-size: clamp(1em, 0.909em + 0.45vmin, 1.25em); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color-scheme: light dark; } h1 { font-size: 2.5rem; font-weight: 600; margin: 0; } .title { text-align: center; } .search { display: flex; justify-content: center; margin-top: 1rem; margin-inline: auto; } .leftright { display: flex; justify-content: center; } .left { margin-right: auto; } .right { margin-left: auto; } textarea { width: 100%; height: 10rem; resize: vertical; } .messages { list-style-type: none; } .error { color: red; } .success { color: green; } ` func FullHTML(h HTMLData) string { var sb strings.Builder var errorBuilder strings.Builder FeedCount := 0 DatabaseSize := stats.GetDBSize() // This is the error message that will be displayed if there are any errors if len(h.ParseResult) > 0 { errorBuilder.WriteString("") } StatusMsg := errorBuilder.String() sb.WriteString(` `) if h.Description != "" { sb.WriteString(``) } if h.Keywords != "" { sb.WriteString(``) } if h.Author != "" { sb.WriteString(``) } if h.CanonicalURL != "" { sb.WriteString(``) } sb.WriteString(` ` + h.Title + ` ` + StatusMsg + `

FeedVault

Archive of web feeds. ` + fmt.Sprintf("%d", FeedCount) + ` feeds. ~` + DatabaseSize + `.

` + h.Content + `

`) return sb.String() }