Various design improvements

This commit is contained in:
2018-04-19 15:04:25 +02:00
parent 0a83c00c78
commit fc493fc567
20 changed files with 153 additions and 61 deletions

28
utils/RenderQuoteText.go Normal file
View File

@ -0,0 +1,28 @@
package utils
import (
"bytes"
"html"
"strings"
)
// RenderQuoteText renders the given quote text.
func RenderQuoteText(text string) string {
buffer := bytes.Buffer{}
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()
}