mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
Fix #57
This commit is contained in:
parent
4d089ec756
commit
87e5439854
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user