feat: Suppression des espaces après et avant les liens

This commit is contained in:
Simon 2021-01-19 23:53:27 +01:00
parent 606bc67ce9
commit 4f382e7e17
1 changed files with 3 additions and 3 deletions

View File

@ -6,10 +6,10 @@
{{ $isTelLink := strings.HasPrefix .Destination "tel:" }}
{{ $isMailtoLink := strings.HasPrefix .Destination "mailto:" }}
{{ $hasSlash := in .Destination "/" }}
{{ if $isWebLink }}
{{- if $isWebLink -}}
{{ $link := cond (and $isWebLink (and (not $hasSlash) (not $isExternalLink))) (path.Join "/" .Page.Dir .Destination) .Destination }}
<a href="{{ $link | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if $isExternalLink }} target="_blank" rel="noopener"{{ end }}>{{ .Text | safeHTML }}</a>
{{ else }}
{{- else -}}
{{- $separators := cond $isMailtoLink ":@." ":" -}}
{{- $regex := cond $isMailtoLink "[a-z]*:(.*)" "[a-z]*:([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})"}}
{{- $replace := cond $isMailtoLink "$1" "$1 $2 $3 $4 $5" -}}
@ -32,4 +32,4 @@
data-replace="{{ $replace }}"
>
</span>
{{ end }}
{{- end -}}