Browse Source

Minor fix for PR #3436

pull/3921/merge
Unknwon 8 years ago
parent
commit
eb79532812
No known key found for this signature in database
GPG Key ID: FB9F411CDD69BEC1
  1. 2
      README.md
  2. 2
      gogs.go
  3. 19
      modules/markdown/markdown.go
  4. 2
      templates/.VERSION

2
README.md

@ -3,7 +3,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true) ![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true)
##### Current tip version: 0.9.110 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions ~~or submit a task on [alpha stage automated binary building system](https://build.gogs.io/)~~) ##### Current tip version: 0.9.111 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions ~~or submit a task on [alpha stage automated binary building system](https://build.gogs.io/)~~)
| Web | UI | Preview | | Web | UI | Preview |
|:-------------:|:-------:|:-------:| |:-------------:|:-------:|:-------:|

2
gogs.go

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.9.110.1222" const APP_VER = "0.9.111.1223"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

19
modules/markdown/markdown.go

@ -91,7 +91,7 @@ var (
IssueAlphanumericPattern = regexp.MustCompile(`( |^|\()[A-Z]{1,10}-[1-9][0-9]*\b`) IssueAlphanumericPattern = regexp.MustCompile(`( |^|\()[A-Z]{1,10}-[1-9][0-9]*\b`)
// CrossReferenceIssueNumericPattern matches string that references a numeric issue in a difference repository // CrossReferenceIssueNumericPattern matches string that references a numeric issue in a difference repository
// e.g. gogits/gogs#12345 // e.g. gogits/gogs#12345
CrossReferenceIssueNumericPattern = regexp.MustCompile(`( |^)[0-9a-zA-Z]+/[0-9a-zA-Z]+#[0-9]+\b`) CrossReferenceIssueNumericPattern = regexp.MustCompile(`( |^)[0-9a-zA-Z-_\.]+/[0-9a-zA-Z-_\.]+#[0-9]+\b`)
// Sha1CurrentPattern matches string that represents a commit SHA, e.g. d8a994ef243349f321568f9e36d5c3f444b99cae // Sha1CurrentPattern matches string that represents a commit SHA, e.g. d8a994ef243349f321568f9e36d5c3f444b99cae
// FIXME: this pattern matches pure numbers as well, right now we do a hack to check in RenderSha1CurrentPattern // FIXME: this pattern matches pure numbers as well, right now we do a hack to check in RenderSha1CurrentPattern
@ -158,16 +158,16 @@ func (r *Renderer) AutoLink(out *bytes.Buffer, link []byte, kind int) {
j = len(m) j = len(m)
} }
issue := string(m[i+7 : j]) index := string(m[i+7 : j])
fullRepoUrl := setting.AppUrl + strings.TrimPrefix(r.urlPrefix, "/") fullRepoURL := setting.AppUrl + strings.TrimPrefix(r.urlPrefix, "/")
var link string var link string
if strings.HasPrefix(string(m), fullRepoUrl) { if strings.HasPrefix(string(m), fullRepoURL) {
// Use a short issue reference if the URL refers to this repository // Use a short issue reference if the URL refers to this repository
link = fmt.Sprintf(`<a href="%s">#%s</a>`, m, issue) link = fmt.Sprintf(`<a href="%s">#%s</a>`, m, index)
} else { } else {
// Use a cross-repository issue reference if the URL refers to a different repository // Use a cross-repository issue reference if the URL refers to a different repository
repo := string(m[len(setting.AppUrl) : i-1]) repo := string(m[len(setting.AppUrl) : i-1])
link = fmt.Sprintf(`<a href="%s">%s#%s</a>`, m, repo, issue) link = fmt.Sprintf(`<a href="%s">%s#%s</a>`, m, repo, index)
} }
out.WriteString(link) out.WriteString(link)
return return
@ -284,10 +284,11 @@ func RenderCrossReferenceIssueIndexPattern(rawBytes []byte, urlPrefix string, me
m = m[1:] // ignore leading space or opening parentheses m = m[1:] // ignore leading space or opening parentheses
} }
repo := string(bytes.Split(m, []byte("#"))[0]) fields := bytes.Split(m, []byte("#"))[0]
issue := string(bytes.Split(m, []byte("#"))[1]) repo := string(fields[0])
index := string(fields[1])
link := fmt.Sprintf(`<a href="%s%s/issues/%s">%s</a>`, setting.AppUrl, repo, issue, m) link := fmt.Sprintf(`<a href="%s%s/issues/%s">%s</a>`, setting.AppUrl, repo, index, m)
rawBytes = bytes.Replace(rawBytes, m, []byte(link), 1) rawBytes = bytes.Replace(rawBytes, m, []byte(link), 1)
} }
return rawBytes return rawBytes

2
templates/.VERSION

@ -1 +1 @@
0.9.110.1222 0.9.111.1223
Loading…
Cancel
Save