MCPcopy Create free account
hub / github.com/gogs/gogs / RenderCrossReferenceIssueIndexPattern

Function RenderCrossReferenceIssueIndexPattern

internal/markup/markup.go:130–145  ·  view source on GitHub ↗

RenderCrossReferenceIssueIndexPattern renders issue indexes from other repositories to corresponding links.

(rawBytes []byte, _ string, _ map[string]string)

Source from the content-addressed store, hash-verified

128
129// RenderCrossReferenceIssueIndexPattern renders issue indexes from other repositories to corresponding links.
130func RenderCrossReferenceIssueIndexPattern(rawBytes []byte, _ string, _ map[string]string) []byte {
131 ms := CrossReferenceIssueNumericPattern.FindAll(rawBytes, -1)
132 for _, m := range ms {
133 if m[0] == ' ' || m[0] == '(' {
134 m = m[1:] // ignore leading space or opening parentheses
135 }
136
137 delimIdx := bytes.Index(m, pound)
138 repo := string(m[:delimIdx])
139 index := string(m[delimIdx+1:])
140
141 link := fmt.Sprintf(`<a href="%s%s/issues/%s">%s</a>`, conf.Server.ExternalURL, repo, index, m)
142 rawBytes = bytes.Replace(rawBytes, m, []byte(link), 1)
143 }
144 return rawBytes
145}
146
147// RenderSha1CurrentPattern renders SHA1 strings to corresponding links that assumes in the same repository.
148func RenderSha1CurrentPattern(rawBytes []byte, urlPrefix string) []byte {

Callers 1

RenderSpecialLinkFunction · 0.85

Calls 2

stringFunction · 0.85
FindAllMethod · 0.80

Tested by

no test coverage detected