1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00
Former-commit-id: 8a967397a0af8dedcc36f56bb9adca904f77705f [formerly 84097c863b5c0b6036fb4d4757b0b56bdbd41192] [formerly adc17b2404fa552efaebf485f6f30a412ae90f9a [formerly 87e5439854]]
Former-commit-id: bd94b8dacfc04010499567541d5313dae6dc89fa [formerly 874671aa7538960f6ac236a11f4fdff8d2d3a994]
Former-commit-id: 517229eb395c1cda4d125ad2014240112d9fff64
This commit is contained in:
Zack Scholl 2016-09-10 07:06:20 -04:00
parent a25a71e7a2
commit 0a4549d3a7

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")