MtF-wiki/layouts/_default/_markup/render-link.html

17 lines
608 B
HTML

{{- if hasPrefix .Destination "mailto:" -}}
{{- $text := replace (replace .Text "-" "--") "_" "__" -}}
<a class="shields" data-email="{{ .Destination | base64Encode }}">
<img src="https://img.shields.io/badge/email-{{ $text }}-blue.svg?style=flat-square" />
</a>
{{- else -}}
<a href="{{ .Destination }}"{{ with .Title}} title="{{ . }}"{{ end }}>
{{-
.Text
| replaceRE "^https?://(www\\.?)?" ""
| replaceRE "^github\\.com\\/([^/]+)\\/([^/]+)\\/issues\\/(\\d+)" "$1/$2#$3"
| replaceRE "#issuecomment-\\d+$" " (comment)"
| replaceRE "^mtf-wiki/MtF-wiki#(\\d+)" "#$1"
| safeHTML
-}}
</a>
{{- end -}}