1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00
This commit is contained in:
Zack Scholl 2016-09-10 07:06:20 -04:00
parent 4d089ec756
commit 87e5439854

View File

@ -474,6 +474,12 @@ func renderList(c *gin.Context, title string) {
c.Redirect(302, "/"+title+"/view")
}
// Convert [[page]] to [page](/page/view)
r, _ := regexp.Compile("\\[\\[(.*?)\\]\\]")
for _, s := range r.FindAllString(p.CurrentText, -1) {
p.CurrentText = strings.Replace(p.CurrentText, s, "["+s[2:len(s)-2]+"](/"+s[2:len(s)-2]+"/view)", 1)
}
pClean := bluemonday.UGCPolicy()
pClean.AllowElements("img")
pClean.AllowAttrs("alt").OnElements("img")