Browse Source

Merge pull request #1609 from denghongcai/develop

Add allow attribute `class` to `<code>` tag
tags/v1.2.0-rc1
无闻 9 years ago
parent
commit
166d62e37b
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      modules/base/tool.go

+ 3
- 1
modules/base/tool.go View File

@@ -15,6 +15,7 @@ import (
"hash" "hash"
"html/template" "html/template"
"math" "math"
"regexp"
"strings" "strings"
"time" "time"


@@ -26,7 +27,8 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )


var Sanitizer = bluemonday.UGCPolicy()
var Sanitizer = bluemonday.UGCPolicy().AllowAttrs("class").Matching(regexp.MustCompile(`[\p{L}\p{N}\s\-_',:\[\]!\./\\\(\)&]*`)).OnElements("code")



// Encode string to md5 hex value. // Encode string to md5 hex value.
func EncodeMd5(str string) string { func EncodeMd5(str string) string {


Loading…
Cancel
Save