RenderCrossReferenceIssueIndexPattern renders issue indexes from other repositories to corresponding links.
(rawBytes []byte, _ string, _ map[string]string)
| 128 | |
| 129 | // RenderCrossReferenceIssueIndexPattern renders issue indexes from other repositories to corresponding links. |
| 130 | func 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. |
| 148 | func RenderSha1CurrentPattern(rawBytes []byte, urlPrefix string) []byte { |
no test coverage detected