MtF-wiki/themes/mtfwiki-modified/layouts/_default/_markup/render-link.html

21 lines
891 B
HTML
Raw Normal View History

2022-02-03 22:17:35 +08:00
{{- if hasPrefix .Destination "mailto:" -}}
2021-12-24 17:39:54 +08:00
{{- $text := replace (replace .Text "-" "--") "_" "__" -}}
2022-08-08 20:31:28 +08:00
<a class="shields" data-email="{{ .Destination | base64Encode }}">
<img src="https://img.shields.io/badge/email-{{ $text }}-blue.svg?style=flat-square" />
2022-02-02 07:33:57 +08:00
</a>
2022-08-09 15:23:30 +08:00
{{- 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 -}}
2021-12-25 06:56:39 +08:00
<a href="{{ .Destination }}"{{ with .Title}} title="{{ . }}"{{ end }}>
2022-08-09 10:35:44 +08:00
{{-
.Text
| replaceRE "^https?://(www\\.?)?" ""
| replaceRE "^github\\.com\\/([^/]+)\\/([^/]+)\\/issues\\/(\\d+)" "$1/$2#$3"
| replaceRE "#issuecomment-\\d+$" " (comment)"
2023-03-20 13:13:53 +08:00
| replaceRE "^project-trans/mtf-wiki#(\\d+)" "#$1"
2022-08-09 10:35:44 +08:00
| safeHTML
-}}
</a>
{{- end -}}