mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-07-09 06:40:05 +08:00
Refactor markup render system (#32533)
Remove unmaintainable sanitizer rules. No need to add special "class" regexp rules anymore, use RenderInternal.SafeAttr instead, more details (and examples) are in the tests
This commit is contained in:
modules
html
htmlutil
markup
asciicast
common
console
csv
external
html.gohtml_codepreview.gohtml_email.gohtml_emoji.gohtml_issue.gohtml_link.gohtml_mention.gointernal
markdown
ast.gogoldmark.gomarkdown.gomarkdown_test.go
render.gosanitizer_custom.gosanitizer_default.gosanitizer_default_test.gomath
meta_test.gotransform_blockquote.gotransform_codespan.gotransform_list.gosetting
svg
templates
routers/web/repo
@ -189,13 +189,13 @@ func shortLinkProcessor(ctx *RenderContext, node *html.Node) {
|
||||
func linkProcessor(ctx *RenderContext, node *html.Node) {
|
||||
next := node.NextSibling
|
||||
for node != nil && node != next {
|
||||
m := common.LinkRegex.FindStringIndex(node.Data)
|
||||
m := common.GlobalVars().LinkRegex.FindStringIndex(node.Data)
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
|
||||
uri := node.Data[m[0]:m[1]]
|
||||
replaceContent(node, m[0], m[1], createLink(uri, uri, "link"))
|
||||
replaceContent(node, m[0], m[1], createLink(ctx, uri, uri, "" /*link*/))
|
||||
node = node.NextSibling.NextSibling
|
||||
}
|
||||
}
|
||||
@ -204,7 +204,7 @@ func linkProcessor(ctx *RenderContext, node *html.Node) {
|
||||
func descriptionLinkProcessor(ctx *RenderContext, node *html.Node) {
|
||||
next := node.NextSibling
|
||||
for node != nil && node != next {
|
||||
m := common.LinkRegex.FindStringIndex(node.Data)
|
||||
m := common.GlobalVars().LinkRegex.FindStringIndex(node.Data)
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user