linkresolver

package
v0.59.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReAnchorRootAbsolute added in v0.58.0

func ReAnchorRootAbsolute(link, resourcePath string, structuralDirs []string) string

ReAnchorRootAbsolute re-anchors a root-absolute link (e.g. "/docs/x.png") to the prefix docforge stripped during the original aggregation: resourcePath up to and including the first configured structural dir. Returns link unchanged when it is not root-absolute or when no structural dir is present in resourcePath.

Types

type ErrStripLink struct {
	Destination string
}

ErrStripLink is returned by ResolveResourceLink when a relative link points to a file not included in the manifest. The renderer should strip the link and keep only the label text.

func (ErrStripLink) Error added in v0.59.0

func (e ErrStripLink) Error() string

type Interface

type Interface interface {
	ResolveResourceLink(destination string, node *manifest.Node, source string) (string, error)
}

Interface represent link resolving interface

type LinkResolver

type LinkResolver struct {
	Repositoryhosts registry.Interface
	SourceToNode    map[string][]*manifest.Node
	Hugo            hugo.Hugo
}

LinkResolver represents link resolving nessesary objects

func New

func New(structure []*manifest.Node, rhs registry.Interface, hugo hugo.Hugo) *LinkResolver

New creates a new linkresolver given the manifest structure and a registry used for working with links

func (l *LinkResolver) ResolveResourceLink(resourceLink string, node *manifest.Node, source string) (string, error)

ResolveResourceLink resolves resource link from a given source

Directories

Path Synopsis
SPDX-FileCopyrightText: 2023 SAP SE or an SAP affiliate company and Gardener contributors
SPDX-FileCopyrightText: 2023 SAP SE or an SAP affiliate company and Gardener contributors

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL