mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-14 06:39:40 +01:00
parent
8ad92bb8a4
commit
99812a80fd
1 changed files with 3 additions and 6 deletions
|
@ -260,12 +260,9 @@ func RenderIssueIndexPattern(rawBytes []byte, urlPrefix string, metas map[string
|
||||||
|
|
||||||
// RenderSha1CurrentPattern renders SHA1 strings to corresponding links that assumes in the same repository.
|
// RenderSha1CurrentPattern renders SHA1 strings to corresponding links that assumes in the same repository.
|
||||||
func RenderSha1CurrentPattern(rawBytes []byte, urlPrefix string) []byte {
|
func RenderSha1CurrentPattern(rawBytes []byte, urlPrefix string) []byte {
|
||||||
ms := Sha1CurrentPattern.FindAll(rawBytes, -1)
|
return []byte(Sha1CurrentPattern.ReplaceAllStringFunc(string(rawBytes[:]), func(m string) string {
|
||||||
for _, m := range ms {
|
return fmt.Sprintf(`<a href="%s/commit/%s"><code>%s</code></a>`, urlPrefix, m, base.ShortSha(string(m)))
|
||||||
rawBytes = bytes.Replace(rawBytes, m, []byte(fmt.Sprintf(
|
}))
|
||||||
`<a href="%s/commit/%s"><code>%s</code></a>`, urlPrefix, m, base.ShortSha(string(m)))), -1)
|
|
||||||
}
|
|
||||||
return rawBytes
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RenderSpecialLink renders mentions, indexes and SHA1 strings to corresponding links.
|
// RenderSpecialLink renders mentions, indexes and SHA1 strings to corresponding links.
|
||||||
|
|
Loading…
Reference in a new issue