28 lines
516 B
Go
Raw Normal View History

2018-04-19 13:04:25 +00:00
package utils
import (
"html"
"strings"
)
// RenderQuoteText renders the given quote text.
func RenderQuoteText(text string) string {
2019-04-30 14:59:53 +00:00
buffer := strings.Builder{}
2018-04-19 13:04:25 +00:00
buffer.WriteString("<p>")
lines := strings.Split(text, "\n")
for index, line := range lines {
buffer.WriteString("<span class='quote-line'>")
buffer.WriteString(html.EscapeString(line))
buffer.WriteString("</span>")
if index != len(lines)-1 {
buffer.WriteString("<br>")
}
}
buffer.WriteString("</p>")
return buffer.String()
}