mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
Fix #57
Former-commit-id: 8a967397a0af8dedcc36f56bb9adca904f77705f [formerly 84097c863b5c0b6036fb4d4757b0b56bdbd41192] [formerly adc17b2404fa552efaebf485f6f30a412ae90f9a [formerly a43305f34b1c5a4a1f29b198604d2dbe1b127bab [formerly87e5439854
]]] Former-commit-id: bd94b8dacfc04010499567541d5313dae6dc89fa [formerly 874671aa7538960f6ac236a11f4fdff8d2d3a994] Former-commit-id: 517229eb395c1cda4d125ad2014240112d9fff64 Former-commit-id:0a4549d3a7
This commit is contained in:
parent
dba80e26c7
commit
09b09f3dbc
@ -474,6 +474,12 @@ func renderList(c *gin.Context, title string) {
|
|||||||
c.Redirect(302, "/"+title+"/view")
|
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 := bluemonday.UGCPolicy()
|
||||||
pClean.AllowElements("img")
|
pClean.AllowElements("img")
|
||||||
pClean.AllowAttrs("alt").OnElements("img")
|
pClean.AllowAttrs("alt").OnElements("img")
|
||||||
|
Loading…
Reference in New Issue
Block a user