mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
Bluemonday onto lists too
This commit is contained in:
parent
c4d9c37729
commit
2e9549e735
15
routes.go
15
routes.go
@ -9,6 +9,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/boltdb/bolt"
|
"github.com/boltdb/bolt"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@ -197,8 +198,18 @@ func renderList(c *gin.Context, title string) {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
listItems, _ := reorderList(p.CurrentText)
|
fmt.Println(p.CurrentText)
|
||||||
|
pClean := bluemonday.UGCPolicy()
|
||||||
|
pClean.AllowElements("img")
|
||||||
|
pClean.AllowAttrs("alt").OnElements("img")
|
||||||
|
pClean.AllowAttrs("src").OnElements("img")
|
||||||
|
pClean.AllowAttrs("class").OnElements("a")
|
||||||
|
pClean.AllowAttrs("href").OnElements("a")
|
||||||
|
pClean.AllowAttrs("id").OnElements("a")
|
||||||
|
pClean.AllowDataURIImages()
|
||||||
|
text := pClean.SanitizeBytes([]byte(p.CurrentText))
|
||||||
|
listItems, _ := reorderList(string(text))
|
||||||
|
fmt.Println(string(text))
|
||||||
c.HTML(http.StatusOK, "list.tmpl", gin.H{
|
c.HTML(http.StatusOK, "list.tmpl", gin.H{
|
||||||
"Title": title,
|
"Title": title,
|
||||||
"WikiName": RuntimeArgs.WikiName,
|
"WikiName": RuntimeArgs.WikiName,
|
||||||
|
Loading…
Reference in New Issue
Block a user