-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create default link and image render hooks
Fixes #11933
- Loading branch information
Showing
15 changed files
with
229 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/usr/bin/env bash | ||
diff <(gofmt -d .) <(printf '') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
tpl/tplimpl/embedded/templates/_default/_markup/render-image.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{{- $u := urls.Parse .Destination -}} | ||
{{- $src := $u.String -}} | ||
{{- if not $u.IsAbs -}} | ||
{{- with or (.Page.Resources.Get $u.Path) (resources.Get $u.Path) -}} | ||
{{- $src = .RelPermalink -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- $attributes := dict "alt" .Text "src" $src "title" .Title -}} | ||
<img | ||
{{- range $k, $v := $attributes -}} | ||
{{- if $v -}} | ||
{{- printf " %s=%q" $k $v | safeHTMLAttr -}} | ||
{{- end -}} | ||
{{- end -}}> | ||
{{- /**/ -}} |
26 changes: 26 additions & 0 deletions
26
tpl/tplimpl/embedded/templates/_default/_markup/render-link.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{{- $u := urls.Parse .Destination -}} | ||
{{- $href := $u.String -}} | ||
{{- if not $u.IsAbs -}} | ||
{{- with or | ||
($.Page.GetPage $u.Path) | ||
($.Page.Resources.Get $u.Path) | ||
(resources.Get $u.Path) | ||
-}} | ||
{{- $href = .RelPermalink -}} | ||
{{- with $u.RawQuery -}} | ||
{{- $href = printf "%s?%s" $href . -}} | ||
{{- end -}} | ||
{{- with $u.Fragment -}} | ||
{{- $href = printf "%s#%s" $href . -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- $attributes := dict "href" $href "title" .Title -}} | ||
<a | ||
{{- range $k, $v := $attributes -}} | ||
{{- if $v -}} | ||
{{- printf " %s=%q" $k $v | safeHTMLAttr -}} | ||
{{- end -}} | ||
{{- end -}} | ||
>{{ .Text | safeHTML }}</a> | ||
{{- /**/ -}} |
Oops, something went wrong.