浏览代码

Recognize more characters in crossreferenced repo name (#3413)

tags/v1.4.0-rc1
Lauris BH 6 年前
父节点
当前提交
a0c397df08
没有帐户链接到提交者的电子邮件
共有 2 个文件被更改,包括 4 次插入1 次删除
  1. 1
    1
      modules/markup/html.go
  2. 3
    0
      modules/markup/html_test.go

+ 1
- 1
modules/markup/html.go 查看文件

@@ -43,7 +43,7 @@ var (
IssueAlphanumericPattern = regexp.MustCompile(`( |^|\()[A-Z]{1,10}-[1-9][0-9]*\b`)
// CrossReferenceIssueNumericPattern matches string that references a numeric issue in a different repository
// 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
// Although SHA1 hashes are 40 chars long, the regex matches the hash from 7 to 40 chars in length

+ 3
- 0
modules/markup/html_test.go 查看文件

@@ -285,6 +285,9 @@ func TestRender_CrossReferences(t *testing.T) {
test(
"gogits/gogs#12345",
`<p><a href="`+URLJoin(AppURL, "gogits", "gogs", "issues", "12345")+`" rel="nofollow">gogits/gogs#12345</a></p>`)
test(
"go-gitea/gitea#12345",
`<p><a href="`+URLJoin(AppURL, "go-gitea", "gitea", "issues", "12345")+`" rel="nofollow">go-gitea/gitea#12345</a></p>`)
}

func TestRender_FullIssueURLs(t *testing.T) {

正在加载...
取消
保存