21 lines
891 B
HTML
21 lines
891 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 if hasPrefix .Destination "weixin:" -}}
|
|
{{- $parsed := urls.Parse .Destination -}}
|
|
{{- $title := .Title | default (printf "微信号:%s" $parsed.Host) -}}
|
|
<a href="https://open.weixin.qq.com/qr/code?username={{ $parsed.Host }}" title="{{ $title }}">{{- .Text -}}</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 "^project-trans/mtf-wiki#(\\d+)" "#$1"
|
|
| safeHTML
|
|
-}}
|
|
</a>
|
|
{{- end -}} |