ilink shortcode: add prefix parameter

This commit is contained in:
Helmut Merz 2024-11-18 09:19:03 +01:00
parent 760f561874
commit 3d541cb37c

View file

@ -7,6 +7,7 @@
{{- $fragsep := cond (eq $frag "") "" "#" -}} {{- $fragsep := cond (eq $frag "") "" "#" -}}
{{- $btext := or (.Get "btext") (printf "%d" $linkid) -}} {{- $btext := or (.Get "btext") (printf "%d" $linkid) -}}
{{- $btitle := .Get "btitle" -}} {{- $btitle := .Get "btitle" -}}
{{- $prefix := .Get "prefix" -}}
{{- $anchor := printf "link-%d" $linkid -}} {{- $anchor := printf "link-%d" $linkid -}}
{{- $inner := .Inner -}} {{- $inner := .Inner -}}
{{- $linkTitle := (.Get "title") -}} {{- $linkTitle := (.Get "title") -}}
@ -14,6 +15,6 @@
{{- $url := printf "%s%s%s" .Permalink $fragsep $frag -}} {{- $url := printf "%s%s%s" .Permalink $fragsep $frag -}}
{{- $text := or $inner .Title -}} {{- $text := or $inner .Title -}}
<a id="{{ $anchor }}"{{ with $linkTitle }} title="{{ . }}"{{ end }} <a id="{{ $anchor }}"{{ with $linkTitle }} title="{{ . }}"{{ end }}
href="{{ $url }}">{{ $text | markdownify }}</a> href="{{ $url }}">{{ with $prefix }}{{ markdownify . }}&nbsp;{{ end }}{{ $text | markdownify }}</a>
{{- .Scratch.Add "backlinks" (slice (dict "anchor" $anchor "page" $this "btext" $btext "btitle" $btitle)) -}} {{- .Scratch.Add "backlinks" (slice (dict "anchor" $anchor "page" $this "btext" $btext "btitle" $btitle)) -}}
{{- end -}} {{- end -}}