feat: Suppression des espaces après et avant les liens
This commit is contained in:
parent
606bc67ce9
commit
4f382e7e17
|
@ -6,10 +6,10 @@
|
||||||
{{ $isTelLink := strings.HasPrefix .Destination "tel:" }}
|
{{ $isTelLink := strings.HasPrefix .Destination "tel:" }}
|
||||||
{{ $isMailtoLink := strings.HasPrefix .Destination "mailto:" }}
|
{{ $isMailtoLink := strings.HasPrefix .Destination "mailto:" }}
|
||||||
{{ $hasSlash := in .Destination "/" }}
|
{{ $hasSlash := in .Destination "/" }}
|
||||||
{{ if $isWebLink }}
|
{{- if $isWebLink -}}
|
||||||
{{ $link := cond (and $isWebLink (and (not $hasSlash) (not $isExternalLink))) (path.Join "/" .Page.Dir .Destination) .Destination }}
|
{{ $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>
|
<a href="{{ $link | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if $isExternalLink }} target="_blank" rel="noopener"{{ end }}>{{ .Text | safeHTML }}</a>
|
||||||
{{ else }}
|
{{- else -}}
|
||||||
{{- $separators := cond $isMailtoLink ":@." ":" -}}
|
{{- $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})"}}
|
{{- $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" -}}
|
{{- $replace := cond $isMailtoLink "$1" "$1 $2 $3 $4 $5" -}}
|
||||||
|
@ -32,4 +32,4 @@
|
||||||
data-replace="{{ $replace }}"
|
data-replace="{{ $replace }}"
|
||||||
>
|
>
|
||||||
</span>
|
</span>
|
||||||
{{ end }}
|
{{- end -}}
|
||||||
|
|
Loading…
Reference in New Issue