|
@@ -65,6 +65,7 @@ func NewFuncMap() []template.FuncMap {
|
|
"Safe": Safe,
|
|
"Safe": Safe,
|
|
"Sanitize": bluemonday.UGCPolicy().Sanitize,
|
|
"Sanitize": bluemonday.UGCPolicy().Sanitize,
|
|
"Str2html": Str2html,
|
|
"Str2html": Str2html,
|
|
|
|
+ "NewLine2br": NewLine2br,
|
|
"TimeSince": tool.TimeSince,
|
|
"TimeSince": tool.TimeSince,
|
|
"RawTimeSince": tool.RawTimeSince,
|
|
"RawTimeSince": tool.RawTimeSince,
|
|
"FileSize": tool.FileSize,
|
|
"FileSize": tool.FileSize,
|
|
@@ -130,6 +131,11 @@ func Str2html(raw string) template.HTML {
|
|
return template.HTML(markup.Sanitize(raw))
|
|
return template.HTML(markup.Sanitize(raw))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// Simple filter, converts newline symbols to <br>
|
|
|
|
+func NewLine2br(raw string) template.HTML {
|
|
|
|
+ return template.HTML(strings.Replace(raw, "\n", "<br>", -1))
|
|
|
|
+}
|
|
|
|
+
|
|
func List(l *list.List) chan interface{} {
|
|
func List(l *list.List) chan interface{} {
|
|
e := l.Front()
|
|
e := l.Front()
|
|
c := make(chan interface{})
|
|
c := make(chan interface{})
|