diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-01-30 11:43:20 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-01-30 20:12:19 +0100 |
commit | 5b7cb258ec26d7de690099f5dc39935b8d728155 (patch) | |
tree | 53544c8ab46e3fffda4a1e33c5d6e705183e2652 /common | |
parent | 80595bbe3e7901ecd6200e59d43af142c3c85b6b (diff) | |
download | hugo-5b7cb258ec26d7de690099f5dc39935b8d728155.tar.gz hugo-5b7cb258ec26d7de690099f5dc39935b8d728155.zip |
Create default link and image render hooks
Fixes #11933
Diffstat (limited to 'common')
-rw-r--r-- | common/paths/path.go | 5 | ||||
-rw-r--r-- | common/types/types.go | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/common/paths/path.go b/common/paths/path.go index da99b16ac..906270cae 100644 --- a/common/paths/path.go +++ b/common/paths/path.go @@ -387,6 +387,11 @@ func ToSlashTrimLeading(s string) string { return strings.TrimPrefix(filepath.ToSlash(s), "/") } +// ToSlashTrimTrailing is just a filepath.ToSlash with an added / suffix trimmer. +func ToSlashTrimTrailing(s string) string { + return strings.TrimSuffix(filepath.ToSlash(s), "/") +} + // ToSlashPreserveLeading converts the path given to a forward slash separated path // and preserves the leading slash if present trimming any trailing slash. func ToSlashPreserveLeading(s string) string { diff --git a/common/types/types.go b/common/types/types.go index 11683c196..801c511a0 100644 --- a/common/types/types.go +++ b/common/types/types.go @@ -107,3 +107,8 @@ type LowHigh struct { // This is only used for debugging purposes. var InvocationCounter atomic.Int64 + +// NewTrue returns a pointer to b. +func NewBool(b bool) *bool { + return &b +} |