This commit is contained in:
Unknwon committed 2015-12-04 21:30:33 -05:00
1 parent 76d4b9288b
commit e538ff2770
25 files changed
+248 -94

No files matched your search

+7
View File
@@ -87,6 +87,13 @@ type RepoSettingForm struct {
Branch string
Interval int
Private bool
// Advanced settings
EnableWiki bool
EnableIssues bool
EnableExternalTracker bool
TrackerURLFormat string
EnablePulls bool
}
func (f *RepoSettingForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
+67 -62
View File
@@ -137,50 +137,6 @@ var (
sha1CurrentPattern = regexp.MustCompile(`\b[0-9a-f]{40}\b`)
)
func RenderSpecialLink(rawBytes []byte, urlPrefix string) []byte {
ms := MentionPattern.FindAll(rawBytes, -1)
for _, m := range ms {
m = bytes.TrimSpace(m)
rawBytes = bytes.Replace(rawBytes, m,
[]byte(fmt.Sprintf(`<a href="%s/%s">%s</a>`, setting.AppSubUrl, m[1:], m)), -1)
}
ms = commitPattern.FindAll(rawBytes, -1)
for _, m := range ms {
m = bytes.TrimSpace(m)
i := strings.Index(string(m), "commit/")
j := strings.Index(string(m), "#")
if j == -1 {
j = len(m)
}
rawBytes = bytes.Replace(rawBytes, m, []byte(fmt.Sprintf(
` <code><a href="%s">%s</a></code>`, m, ShortSha(string(m[i+7:j])))), -1)
}
ms = issueFullPattern.FindAll(rawBytes, -1)
for _, m := range ms {
m = bytes.TrimSpace(m)
i := strings.Index(string(m), "issues/")
j := strings.Index(string(m), "#")
if j == -1 {
j = len(m)
}
rawBytes = bytes.Replace(rawBytes, m, []byte(fmt.Sprintf(
` <a href="%s">#%s</a>`, m, ShortSha(string(m[i+7:j])))), -1)
}
rawBytes = RenderIssueIndexPattern(rawBytes, urlPrefix)
rawBytes = RenderSha1CurrentPattern(rawBytes, urlPrefix)
return rawBytes
}
func RenderSha1CurrentPattern(rawBytes []byte, urlPrefix string) []byte {
ms := sha1CurrentPattern.FindAll(rawBytes, -1)
for _, m := range ms {
rawBytes = bytes.Replace(rawBytes, m, []byte(fmt.Sprintf(
`<a href="%s/commit/%s"><code>%s</code></a>`, urlPrefix, m, ShortSha(string(m)))), -1)
}
return rawBytes
}
func cutoutVerbosePrefix(prefix string) string {
count := 0
for i := 0; i < len(prefix); i++ {
@@ -194,7 +150,7 @@ func cutoutVerbosePrefix(prefix string) string {
return prefix
}
func RenderIssueIndexPattern(rawBytes []byte, urlPrefix string) []byte {
func RenderIssueIndexPattern(rawBytes []byte, urlPrefix string, metas map[string]string) []byte {
urlPrefix = cutoutVerbosePrefix(urlPrefix)
ms := issueIndexPattern.FindAll(rawBytes, -1)
for _, m := range ms {
@@ -204,24 +160,45 @@ func RenderIssueIndexPattern(rawBytes []byte, urlPrefix string) []byte {
space = " "
m2 = m2[1:]
}
rawBytes = bytes.Replace(rawBytes, m, []byte(fmt.Sprintf(`%s<a href="%s/issues/%s">%s</a>`,
space, urlPrefix, m2[1:], m2)), 1)
if metas == nil {
rawBytes = bytes.Replace(rawBytes, m, []byte(fmt.Sprintf(`%s<a href="%s/issues/%s">%s</a>`,
space, urlPrefix, m2[1:], m2)), 1)
} else {
// Support for external issue tracker
metas["index"] = string(m2[1:])
rawBytes = bytes.Replace(rawBytes, m, []byte(fmt.Sprintf(`%s<a href="%s">%s</a>`,
space, com.Expand(metas["format"], metas), m2)), 1)
}
}
return rawBytes
}
func RenderSpecialLink(rawBytes []byte, urlPrefix string, metas map[string]string) []byte {
ms := MentionPattern.FindAll(rawBytes, -1)
for _, m := range ms {
m = bytes.TrimSpace(m)
rawBytes = bytes.Replace(rawBytes, m,
[]byte(fmt.Sprintf(`<a href="%s/%s">%s</a>`, setting.AppSubUrl, m[1:], m)), -1)
}
rawBytes = RenderIssueIndexPattern(rawBytes, urlPrefix, metas)
rawBytes = RenderSha1CurrentPattern(rawBytes, urlPrefix)
return rawBytes
}
func RenderSha1CurrentPattern(rawBytes []byte, urlPrefix string) []byte {
ms := sha1CurrentPattern.FindAll(rawBytes, -1)
for _, m := range ms {
rawBytes = bytes.Replace(rawBytes, m, []byte(fmt.Sprintf(
`<a href="%s/commit/%s"><code>%s</code></a>`, urlPrefix, m, ShortSha(string(m)))), -1)
}
return rawBytes
}
func RenderRawMarkdown(body []byte, urlPrefix string) []byte {
htmlFlags := 0
// htmlFlags |= blackfriday.HTML_USE_XHTML
// htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS
// htmlFlags |= blackfriday.HTML_SMARTYPANTS_FRACTIONS
// htmlFlags |= blackfriday.HTML_SMARTYPANTS_LATEX_DASHES
// htmlFlags |= blackfriday.HTML_SKIP_HTML
htmlFlags |= blackfriday.HTML_SKIP_STYLE
// htmlFlags |= blackfriday.HTML_SKIP_SCRIPT
// htmlFlags |= blackfriday.HTML_GITHUB_BLOCKCODE
htmlFlags |= blackfriday.HTML_OMIT_CONTENTS
// htmlFlags |= blackfriday.HTML_COMPLETE_PAGE
renderer := &CustomRender{
Renderer: blackfriday.HtmlRenderer(htmlFlags, "", ""),
urlPrefix: urlPrefix,
@@ -252,9 +229,36 @@ var (
var noEndTags = []string{"img", "input", "br", "hr"}
// PreProcessMarkdown renders full links of commits, issues and pulls to shorter version.
func PreProcessMarkdown(rawHTML []byte, urlPrefix string) []byte {
ms := commitPattern.FindAll(rawHTML, -1)
for _, m := range ms {
m = bytes.TrimSpace(m)
i := strings.Index(string(m), "commit/")
j := strings.Index(string(m), "#")
if j == -1 {
j = len(m)
}
rawHTML = bytes.Replace(rawHTML, m, []byte(fmt.Sprintf(
` <code><a href="%s">%s</a></code>`, m, ShortSha(string(m[i+7:j])))), -1)
}
ms = issueFullPattern.FindAll(rawHTML, -1)
for _, m := range ms {
m = bytes.TrimSpace(m)
i := strings.Index(string(m), "issues/")
j := strings.Index(string(m), "#")
if j == -1 {
j = len(m)
}
rawHTML = bytes.Replace(rawHTML, m, []byte(fmt.Sprintf(
` <a href="%s">#%s</a>`, m, ShortSha(string(m[i+7:j])))), -1)
}
return rawHTML
}
// PostProcessMarkdown treats different types of HTML differently,
// and only renders special links for plain text blocks.
func PostProcessMarkdown(rawHtml []byte, urlPrefix string) []byte {
func PostProcessMarkdown(rawHtml []byte, urlPrefix string, metas map[string]string) []byte {
startTags := make([]string, 0, 5)
var buf bytes.Buffer
tokenizer := html.NewTokenizer(bytes.NewReader(rawHtml))
@@ -264,7 +268,7 @@ OUTER_LOOP:
token := tokenizer.Token()
switch token.Type {
case html.TextToken:
buf.Write(RenderSpecialLink([]byte(token.String()), urlPrefix))
buf.Write(RenderSpecialLink([]byte(token.String()), urlPrefix, metas))
case html.StartTagToken:
buf.WriteString(token.String())
@@ -322,13 +326,14 @@ OUTER_LOOP:
return rawHtml
}
func RenderMarkdown(rawBytes []byte, urlPrefix string) []byte {
result := RenderRawMarkdown(rawBytes, urlPrefix)
result = PostProcessMarkdown(result, urlPrefix)
func RenderMarkdown(rawBytes []byte, urlPrefix string, metas map[string]string) []byte {
result := PreProcessMarkdown(rawBytes, urlPrefix)
result = RenderRawMarkdown(result, urlPrefix)
result = PostProcessMarkdown(result, urlPrefix, metas)
result = Sanitizer.SanitizeBytes(result)
return result
}
func RenderMarkdownString(raw, urlPrefix string) string {
return string(RenderMarkdown([]byte(raw), urlPrefix))
func RenderMarkdownString(raw, urlPrefix string, metas map[string]string) string {
return string(RenderMarkdown([]byte(raw), urlPrefix, metas))
}
+2 -2
View File
@@ -4364,7 +4364,7 @@ func confLocaleLocale_deDeIni() (*asset, error) {
return a, nil
}
var _confLocaleLocale_enUsIni = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xbc\x7d\xfd\x72\xdc\xc6\xae\xe7\xff\x7c\x0a\xc6\xa7\x5c\x4e\xaa\xe4\x49\x25\xb9\xfb\x51\xa9\x38\x59\xd9\x8e\x3f\xee\xb5\x2c\x5d\x4b\x39\x67\xcf\xa6\x5c\x13\x6a\x48\x8d\x78\x3d\x43\xce\x21\x39\x56\x74\x6e\xdd\x37\xd8\x07\xd8\xe7\xdb\x27\x59\xe0\x07\xa0\x1b\x4d\x72\x24\x3b\xf7\xd4\xfa\x0f\x8b\xd3\x8d\xfe\x42\xa3\xd1\x68\x34\x80\x2e\x76\xbb\x65\x59\xf5\xab\xfc\x49\x7e\x9c\xef\x8a\xba\xd9\x54\x7d\x9f\xf7\xd5\xe6\xea\xf1\x75\xdb\x0f\x55\x99\xbf\xac\x07\xfa\xdd\x7d\xac\x57\x55\x96\x5d\xb7\xdb\x8a\x40\x5f\xd1\x9f\xac\x2c\xfa\xeb\xcb\xb6\xe8\x4a\x4a\x78\x6e\xdf\x59\xf5\xfb\x6e\xd3\x76\x0c\xf4\xb3\x7c\x65\xd7\xd5\x66\xc7\x65\xe8\x4f\xd6\xd7\xeb\x66\x59\x37\xf4\xf3\x9c\xbe\xf2\xd7\x8d\xa4\xb4\xfb\xc1\x92\x4e\xf7\x83\xa4\xed\x77\x96\xf4\xcb\x2e\xeb\xaa\x75\x4d\xbd\xe9\x28\xe9\x9d\x7e\x66\x37\xd5\x65\x5f\x0f\xdc\xd2\x5f\xe4\x2b\xfb\x58\x75\x7d\xdd\x72\xed\x7f\x96\xaf\x6c\x57\xac\x19\xe0\x8c\xfe\x64\x43\xb5\xdd\x6d\x0a\x14\xb8\xd0\xcf\x6c\x53\x34\xeb\xbd\xc0\xbc\xd1\xcf\x6c\xd5\x55\x94\xb5\x6c\xaa\x1b\x4a\x7d\x86\x1f\x8b\xc5\x22\xdb\x13\x12\x96\xbb\xae\xbd\xaa\x37\xd5\xb2\x68\xca\xe5\x56\x86\xf9\x0b\xa5\xe7\x9a\x9e\x53\x7a\xce\xe9\x18\x42\x55\xd2\x50\x97\x45\xaf\xe3\x20\x5c\xd2\xc8\x8b\x3e\x43\x55\x4d\xb1\xb5\xd2\xfc\x99\x55\xdb\xa2\xde\x30\xd6\xf8\x2f\xf5\xbb\xef\x6f\x5a\xa0\xf6\x4c\x3f\x09\x07\xcb\xe1\x76\x57\x01\x05\x8f\x2f\xe8\x2b\x5b\x15\xbb\x61\x75\x5d\x70\x37\xe5\x2b\x23\xa0\x5d\x4b\xb8\x68\xbb\x5b\xc0\xd9\x8f\xac\xed\xd6\x45\x53\xff\xbd\x18\x04\x3f\xa7\xee\x67\xb6\xad\xbb\xae\x65\xd4\x9e\xe0\x23\xa3\x91\x2f\xb9\x1e\x4a\x79\x4b\x48\x70\xb5\x70\xce\xb6\x5e\x77\x82\x45\xce\x3c\xc1\x2f\xae\x85\xf3\xae\xda\xee\x83\x66\xbc\xe0\xcf\x51\x51\xea\x84\xe6\xa6\xed\x17\x0d\xe1\x5d\x73\x4f\xf0\x23\x01\xe8\xb3\xa2\xdc\x12\x26\x77\x45\x53\x31\x8a\x8e\xf9\x17\xe1\x85\x7e\x65\xc5\x6a\xd5\xee\x9b\x61\xd9\x57\xc3\x50\x37\x6b\xc6\xf5\xb1\x24\xe5\xe7\x9a\x94\xb9\xbc\x90\x76\xdb\xee\xc3\x6c\x52\xfa\x5f\xe9\x67\x7e\x26\x3f\x25\xcf\x15\x42\x66\x28\xc9\x23\xe9\x97\x57\x55\x55\xca\x58\xfa\xfc\x05\x7d\x67\xbb\xfd\x66\x43\x58\xfb\xdb\xbe\xea\x07\x2e\x74\x46\xbf\x69\xfc\xf2\x3b\xab\xfb\x9e\x3e\x28\xf9\x35\x3e\x32\x9a\xba\x66\x85\xc1\x3c\xc3\x47\x96\xfd\xda\x57\x45\xb7\xba\x7e\x9f\xc9\x5f\xf4\x95\x3f\x98\xf4\x0e\x4d\x2a\xd3\x91\xd2\x90\xb4\x60\x0d\x64\xab\xb6\xe4\x1f\xcf\xe8\x0f\x55\x5d\x37\xfd\x50\x6c\x36\xef\x33\xfd\x60\x30\xf9\x92\x09\x18\xea\x01\x58\xd0\xc4\xfc\x7c\xa8\x76\x3d\xcf\x60\xfe\xa2\xee\xfa\xe1\xf1\x50\x13\xad\xbe\xdb\x37\x59\xd9\xae\x3e\xd0\x2a\xe0\x15\x8d\x96\x5f\x5f\xe5\x84\xac\x47\xb4\x0e\xba\x7d\xd3\x10\x7a\xf2\x97\x2d\xa1\x8c\x9a\xa9\xa9\xfd\xe7\x80\x3e\xca\x77\x9b\xaa\xe8\x09\xa4\x2a\xca\xfc\x87\x22\x1f\x8a\x6e\x5d\x0d\x4f\x1e\x2c\x2f\x69\xf5\x7d\x78\x90\x5f\x77\xd5\xd5\x93\x07\x0f\xfb\x07\x3f\xbe\xdc\x53\xb1\x4d\xdd\x54\xfd\x0f\x5f\x17\x3f\xe6\xab\x82\x72\x08\x8d\xb7\xf9\x65\x75\xc5\x8b\x8d\xda\xca\x89\xca\x9b\x35\x2f\xb4\xdb\xe1\x9a\x1b\x24\x4a\xa0\x8f\x3e\xe7\x95\xfe\x45\xc6\x13\x40\x9c\x60\x59\x5e\x1a\x57\x43\x87\x90\xdc\xd1\x04\x9c\xdc\x9e\xff\xeb\x9b\xa3\xfc\x8c\x58\xdb\xba\xab\xf0\x4d\xff\x51\x89\xef\x72\x1a\xed\x45\xfd\xfc\xe9\x22\xa3\xb2\x86\x90\xe7\xc5\x50\x5c\x72\xdf\xc3\xec\x73\xa6\x2c\xc2\x90\x87\xa5\xc8\xcc\x12\x8c\xb1\x1f\x92\x69\x99\x5b\xc8\x54\x87\xae\xfe\x50\xc7\x5b\x66\x01\x94\x1e\x30\x7b\x26\x38\xa3\xaa\xf2\xd7\x6f\xdf\x9e\x3e\x7f\x9a\x57\xcd\x9a\x30\x93\xdf\xd4\xc3\x75\xbe\x1f\xae\xfe\xfb\x72\x5d\x35\x55\x57\x6c\x96\xab\x9a\x91\xd2\x11\xc1\xe6\x84\x25\x19\xe2\x22\xeb\xfb\x0d\x71\x28\x50\xc1\xf9\xf9\x9b\xfc\x84\x29\x61\x57\x0c\xd7\xe8\xc8\x70\x9d\xf5\x7f\xdb\x30\xa2\x42\x83\x17\xd7\x55\x8e\xc5\x00\xa0\xf6\x6a\x8c\x97\xbc\xd4\xbe\x2e\xb2\xaa\xeb\x96\xc4\x40\x87\x5b\x46\xb3\xd6\x79\x08\x5a\xaa\x23\x6a\x6f\xda\x81\xa6\x31\x47\x39\xa9\xa2\x6e\x3e\x16\x9b\xba\x24\x64\x47\x84\xa4\x65\x91\x58\xb6\x34\x6f\x5c\x9a\x28\xb3\xbd\xc1\x50\x8b\x15\xf1\xff\x3e\x7f\xb0\x78\x00\x86\xfb\xe0\xf1\x83\x45\xd6\xb4\x4b\xe1\x12\xcc\x9a\xcb\xba\x2f\x2e\x89\x4d\xcb\xb6\xd1\x19\xd7\xfb\x2b\xd3\x8f\x74\x45\x21\xf2\x04\x82\x71\xcb\x5b\x11\x76\x00\x26\xae\x82\xf8\x35\x98\x8d\xb2\x19\x3f\x76\xe3\x49\x61\x7e\x85\x2d\x85\x84\xc9\x98\x33\x9b\x30\xa3\xae\xe3\xdd\x6e\x53\xaf\xa4\xe9\x97\x92\x17\x09\x8d\x37\x66\x45\x8a\x87\x03\xa1\x58\x9e\x23\x17\xea\x35\xb3\xad\x3c\xe1\xf3\x28\x7f\x5d\xd1\xca\xb9\xde\xaf\x65\x73\xda\xb4\xfb\xf2\x0b\x30\x14\x9b\xb9\xc8\x4f\xf2\x77\x2d\x75\x18\xd4\x11\x00\x62\x13\xc7\xc4\x18\x58\x16\xe8\xaa\x6d\x3b\x30\xe2\xb4\x58\x4d\xd3\x73\x53\x53\x26\x8d\xb4\x2f\x3e\x12\x5b\x1c\x5a\x59\x92\x25\x2d\xb9\x15\x57\x4c\x1c\x6c\x4f\x1b\xba\x2c\x0b\xe2\x23\xb2\x34\x2c\x2d\xa5\x41\x40\x6d\xf7\xb4\x9a\xae\xa9\x32\x46\x3c\x0b\x24\x54\xe5\x5c\x3f\x31\x24\xaa\x07\xab\x9c\x56\x6e\x4b\x9b\x27\x4f\xf4\x73\x7c\xe8\x6f\x5f\x3f\xf5\xaa\xb8\xba\xa2\x5e\xf5\xb4\x2a\x5e\xe5\xab\x4d\x4b\x4b\xea\x97\x77\x6f\x7a\x5e\x30\xd7\xcb\x5d\xdb\x41\x10\xa1\xac\x33\xfa\x0c\x69\x0e\xd1\x0c\xd1\xec\xb7\x97\xf4\xeb\xe6\xba\x26\x46\x0d\xb4\x73\x09\x16\x92\x28\x95\x9a\xd8\xf7\x3Line truncated
var _confLocaleLocale_enUsIni = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xbc\x7d\xfd\x72\xdc\x46\xae\xef\xff\x7c\x0a\xc6\x5b\x2e\x27\x55\xf2\xa4\x92\x9c\xfb\x51\xa9\x38\xb9\x8a\x1d\x7f\x9c\x63\x59\x3a\x96\xb2\x7b\xf7\xa6\x5c\x13\x6a\x48\x8d\x78\x3c\x43\xce\x92\x1c\xcb\xda\xad\x7d\x83\xfb\x00\xf7\xf9\xee\x93\x5c\xe0\x07\xa0\x1b\x4d\x72\x24\x7b\xcf\xd6\xf5\x1f\x16\xa7\x1b\xfd\x85\x46\xa3\xd1\x68\x00\x5d\xec\x76\xcb\xb2\xea\x57\xf9\x93\xfc\x38\xdf\x15\x75\xb3\xa9\xfa\x3e\xef\xab\xcd\xd5\xe3\xeb\xb6\x1f\xaa\x32\x7f\x51\x0f\xf4\xbb\xfb\x50\xaf\xaa\x2c\xbb\x6e\xb7\x15\x81\xbe\xa4\x3f\x59\x59\xf4\xd7\x97\x6d\xd1\x95\x94\xf0\xcc\xbe\xb3\xea\xe3\x6e\xd3\x76\x0c\xf4\x8b\x7c\x65\xd7\xd5\x66\xc7\x65\xe8\x4f\xd6\xd7\xeb\x66\x59\x37\xf4\xf3\x9c\xbe\xf2\x57\x8d\xa4\xb4\xfb\xc1\x92\x4e\xf7\x83\xa4\xed\x77\x96\xf4\xeb\x2e\xeb\xaa\x75\x4d\xbd\xe9\x28\xe9\xad\x7e\x66\x37\xd5\x65\x5f\x0f\xdc\xd2\x9f\xe4\x2b\xfb\x50\x75\x7d\xdd\x72\xed\x7f\x94\xaf\x6c\x57\xac\x19\xe0\x8c\xfe\x64\x43\xb5\xdd\x6d\x0a\x14\xb8\xd0\xcf\x6c\x53\x34\xeb\xbd\xc0\xbc\xd6\xcf\x6c\xd5\x55\x94\xb5\x6c\xaa\x1b\x4a\x7d\x8a\x1f\x8b\xc5\x22\xdb\x13\x12\x96\xbb\xae\xbd\xaa\x37\xd5\xb2\x68\xca\xe5\x56\x86\xf9\x2b\xa5\xe7\x9a\x9e\x53\x7a\xce\xe9\x18\x42\x55\xd2\x50\x97\x45\xaf\xe3\x20\x5c\xd2\xc8\x8b\x3e\x43\x55\x4d\xb1\xb5\xd2\xfc\x99\x55\xdb\xa2\xde\x30\xd6\xf8\x2f\xf5\xbb\xef\x6f\x5a\xa0\xf6\x4c\x3f\x09\x07\xcb\xe1\x76\x57\x01\x05\x8f\x2f\xe8\x2b\x5b\x15\xbb\x61\x75\x5d\x70\x37\xe5\x2b\x23\xa0\x5d\x4b\xb8\x68\xbb\x5b\xc0\xd9\x8f\xac\xed\xd6\x45\x53\xff\xb5\x18\x04\x3f\xa7\xee\x67\xb6\xad\xbb\xae\x65\xd4\x9e\xe0\x23\xa3\x91\x2f\xb9\x1e\x4a\x79\x43\x48\x70\xb5\x70\xce\xb6\x5e\x77\x82\x45\xce\x3c\xc1\x2f\xae\x85\xf3\xae\xda\xee\xbd\x66\x3c\xe7\xcf\x51\x51\xea\x84\xe6\xa6\xed\x17\x0d\xe1\x5d\x73\x4f\xf0\x23\x01\xe8\xb3\xa2\xdc\x12\x26\x77\x45\x53\x31\x8a\x8e\xf9\x17\xe1\x85\x7e\x65\xc5\x6a\xd5\xee\x9b\x61\xd9\x57\xc3\x50\x37\x6b\xc6\xf5\xb1\x24\xe5\xe7\x9a\x94\xb9\xbc\x90\x76\xdb\xee\xc3\x6c\x52\xfa\x9f\xe9\x67\x7e\x26\x3f\x25\xcf\x15\x42\x66\x28\xc9\x23\xe9\x97\x57\x55\x55\xca\x58\xfa\xfc\x39\x7d\x67\xbb\xfd\x66\x43\x58\xfb\xcb\xbe\xea\x07\x2e\x74\x46\xbf\x69\xfc\xf2\x3b\xab\xfb\x9e\x3e\x28\xf9\x15\x3e\x32\x9a\xba\x66\x85\xc1\x3c\xc5\x47\x96\xfd\xd6\x57\x45\xb7\xba\x7e\x97\xc9\x5f\xf4\x95\x3f\x98\xf4\x0e\x4d\x2a\xd3\x91\xd2\x90\xb4\x60\x0d\x64\xab\xb6\xe4\x1f\x4f\xe9\x0f\x55\x5d\x37\xfd\x50\x6c\x36\xef\x32\xfd\x60\x30\xf9\x92\x09\x18\xea\x01\x58\xd0\xc4\xfc\x7c\xa8\x76\x3d\xcf\x60\xfe\xbc\xee\xfa\xe1\xf1\x50\x13\xad\xbe\xdd\x37\x59\xd9\xae\xde\xd3\x2a\xe0\x15\x8d\x96\x5f\x5d\xe5\x84\xac\x47\xb4\x0e\xba\x7d\xd3\x10\x7a\xf2\x17\x2d\xa1\x8c\x9a\xa9\xa9\xfd\x67\x80\x3e\xca\x77\x9b\xaa\xe8\x09\xa4\x2a\xca\xfc\x87\x22\x1f\x8a\x6e\x5d\x0d\x4f\x1e\x2c\x2f\x69\xf5\xbd\x7f\x90\x5f\x77\xd5\xd5\x93\x07\x0f\xfb\x07\x3f\xbe\xd8\x53\xb1\x4d\xdd\x54\xfd\x0f\x5f\x17\x3f\xe6\xab\x82\x72\x08\x8d\xb7\xf9\x65\x75\xc5\x8b\x8d\xda\xca\x89\xca\x9b\x35\x2f\xb4\xdb\xe1\x9a\x1b\x24\x4a\xa0\x8f\x3e\xe7\x95\xfe\x45\xc6\x13\x40\x9c\x60\x59\x5e\x1a\x57\x43\x87\x90\xdc\xd1\x04\x9c\xdc\x9e\xff\xfb\xeb\xa3\xfc\x8c\x58\xdb\xba\xab\xf0\x4d\xff\x51\x89\xef\x72\x1a\xed\x45\xfd\xec\xe7\x45\x46\x65\x0d\x21\xcf\x8a\xa1\xb8\xe4\xbe\x87\xd9\xe7\x4c\x59\x84\x21\x0f\x4b\x91\x99\x25\x18\x63\x3f\x24\xd3\x32\xb7\x90\xa9\x0e\x5d\xfd\xa1\x8e\x37\xcc\x02\x28\x3d\x60\xf6\x4c\x70\x46\x55\xe5\xaf\xde\xbc\x39\x7d\xf6\x73\x5e\x35\x6b\xc2\x4c\x7e\x53\x0f\xd7\xf9\x7e\xb8\xfa\xef\xcb\x75\xd5\x54\x5d\xb1\x59\xae\x6a\x46\x4a\x47\x04\x9b\x13\x96\x64\x88\x8b\xac\xef\x37\xc4\xa1\x40\x05\xe7\xe7\xaf\xf3\x13\xa6\x84\x5d\x31\x5c\xa3\x23\xc3\x75\xd6\xff\x65\xc3\x88\x0a\x0d\x5e\x5c\x57\x39\x16\x03\x80\xda\xab\x31\x5e\xf2\x52\xfb\xba\xc8\xaa\xae\x5b\x12\x03\x1d\x6e\x19\xcd\x5a\xe7\x21\x68\xa9\x8e\xa8\xbd\x69\x07\x9a\xc6\x1c\xe5\xa4\x8a\xba\xf9\x50\x6c\xea\x92\x90\x1d\x11\x92\x96\x45\x62\xd9\xd2\xbc\x71\x69\xa2\xcc\xf6\x06\x43\x2d\x56\xc4\xff\xfb\xfc\xc1\xe2\x01\x18\xee\x83\xc7\x0f\x16\x59\xd3\x2e\x85\x4b\x30\x6b\x2e\xeb\xbe\xb8\x24\x36\x2d\xdb\x46\x67\x5c\xef\xcf\x4c\x3f\xd2\x15\x85\xc8\x13\x08\xc6\x2d\x6f\x45\xd8\x01\x98\xb8\x0a\xe2\xd7\x60\x36\xca\x66\xfc\xd8\x8d\x27\x85\xf9\x15\xb6\x14\x12\x26\x63\xce\x6c\xc2\x8c\xba\x8e\x77\xbb\x4d\xbd\x92\xa6\x5f\x48\x5e\x24\x34\xde\x98\x15\x29\x1e\x0e\x84\x62\x79\x8e\x5c\xa8\xd7\xcc\xb6\xf2\x84\xcf\xa3\xfc\x75\x45\x2b\xe7\x7a\xbf\x96\xcd\x69\xd3\xee\xcb\x2f\xc0\x50\x6c\xe6\x22\x3f\xc9\xdf\xb6\xd4\x61\x50\x47\x00\x88\x4d\x1c\x13\x63\x60\x59\xa0\xab\xb6\xed\xc0\x88\xd3\x62\x35\x4d\xcf\x4d\x4d\x99\x34\xd2\xbe\xf8\x40\x6c\x71\x68\x65\x49\x96\xb4\xe4\x56\x5c\x31\x71\xb0\x3d\x6d\xe8\xb2\x2c\x88\x8f\xc8\xd2\xb0\xb4\x94\x06\x01\xb5\xdd\xd3\x6a\xba\xa6\xca\x18\xf1\x2c\x90\x50\x95\x73\xfd\xc4\x90\xa8\x1e\xac\x72\x5a\xb9\x2d\x6d\x9e\x3c\xd1\xcf\xf0\xa1\xbf\x7d\xfd\xd4\xab\xe2\xea\x8a\x7a\xd5\xd3\xaa\x78\x99\xaf\x36\x2d\x2d\xa9\x5f\xdf\xbe\xee\x79\xc1\x5c\x2f\x77\x6d\x07\x41\x84\xb2\xce\xe8\x33\xa4\x39\x44\x33\x44\xb3\xdf\x5e\xd2\xaf\x9b\xeb\x9a\x18\x35\xd0\xce\x25\x58\x48\xa2\x54\x6a\x62\xdf\xdLine truncated
func confLocaleLocale_enUsIniBytes() ([]byte, error) {
return bindataRead(
@@ -4379,7 +4379,7 @@ func confLocaleLocale_enUsIni() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "conf/locale/locale_en-US.ini", size: 46411, mode: os.FileMode(420), modTime: time.Unix(1449100425, 0)}
info := bindataFileInfo{name: "conf/locale/locale_en-US.ini", size: 46933, mode: os.FileMode(420), modTime: time.Unix(1449277581, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
+2 -2
View File
@@ -125,7 +125,7 @@ func SendIssueNotifyMail(u, owner *models.User, repo *models.Repository, issue *
subject := fmt.Sprintf("[%s] %s (#%d)", repo.Name, issue.Name, issue.Index)
content := fmt.Sprintf("%s<br>-<br> <a href=\"%s%s/%s/issues/%d\">View it on Gogs</a>.",
base.RenderSpecialLink([]byte(issue.Content), owner.Name+"/"+repo.Name),
base.RenderSpecialLink([]byte(issue.Content), owner.Name+"/"+repo.Name, repo.ComposeMetas()),
setting.AppUrl, owner.Name, repo.Name, issue.Index)
msg := NewMessage(tos, subject, content)
msg.Info = fmt.Sprintf("Subject: %s, issue notify", subject)
@@ -148,7 +148,7 @@ func SendIssueMentionMail(r macaron.Render, u, owner *models.User,
data["IssueLink"] = fmt.Sprintf("%s/%s/issues/%d", owner.Name, repo.Name, issue.Index)
data["Subject"] = subject
data["ActUserName"] = u.DisplayName()
data["Content"] = string(base.RenderSpecialLink([]byte(issue.Content), owner.Name+"/"+repo.Name))
data["Content"] = string(base.RenderSpecialLink([]byte(issue.Content), owner.Name+"/"+repo.Name, repo.ComposeMetas()))
body, err := r.HTMLString(string(NOTIFY_MENTION), data)
if err != nil {
+1
View File
@@ -165,6 +165,7 @@ func RepoAssignment(args ...bool) macaron.Handler {
ctx.Data["IsRepositoryOwner"] = ctx.Repo.IsOwner()
ctx.Data["IsRepositoryAdmin"] = ctx.Repo.IsAdmin()
ctx.Data["IsRepositoryPusher"] = ctx.Repo.IsPusher()
ctx.Data["CanPullRequest"] = ctx.Repo.IsAdmin() && repo.BaseRepo != nil && repo.BaseRepo.EnablePulls
ctx.Data["DisableSSH"] = setting.DisableSSH
ctx.Data["CloneLink"] = repo.CloneLink()
+2 -2
View File
@@ -183,9 +183,9 @@ func ReplaceLeft(s, old, new string) string {
}
// RenderCommitMessage renders commit message with XSS-safe and special links.
func RenderCommitMessage(msg, urlPrefix string) template.HTML {
func RenderCommitMessage(msg, urlPrefix string, metas map[string]string) template.HTML {
cleanMsg := template.HTMLEscapeString(msg)
fullMessage := string(base.RenderIssueIndexPattern([]byte(cleanMsg), urlPrefix))
fullMessage := string(base.RenderIssueIndexPattern([]byte(cleanMsg), urlPrefix, metas))
msgLines := strings.Split(strings.TrimSpace(fullMessage), "\n")
for i := range msgLines {
msgLines[i] = ReplaceLeft(msgLines[i], " ", "&nbsp;")