RenderSha1CurrentPattern renders SHA1 strings to corresponding links that assumes in the same repository.
(rawBytes []byte, urlPrefix string)
| 146 | |
| 147 | // RenderSha1CurrentPattern renders SHA1 strings to corresponding links that assumes in the same repository. |
| 148 | func RenderSha1CurrentPattern(rawBytes []byte, urlPrefix string) []byte { |
| 149 | return []byte(Sha1CurrentPattern.ReplaceAllStringFunc(string(rawBytes), func(m string) string { |
| 150 | if com.StrTo(m).MustInt() > 0 { |
| 151 | return m |
| 152 | } |
| 153 | |
| 154 | return fmt.Sprintf(`<a href="%s/commit/%s"><code>%s</code></a>`, urlPrefix, m, tool.ShortSHA1(m)) |
| 155 | })) |
| 156 | } |
| 157 | |
| 158 | // RenderSpecialLink renders mentions, indexes and SHA1 strings to corresponding links. |
| 159 | func RenderSpecialLink(rawBytes []byte, urlPrefix string, metas map[string]string) []byte { |