links

package
v5.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InterwikiLink struct {
	// contains filtered or unexported fields
}

InterwikiLink in Mycomarkup has this syntax:

[[prefix>target]]
[[prefix>target|display]]

For every prefix, there is a known link format. A link format is a format string, that might resemble Go's format strings, but they are actually not. This is DSL for link formats. It is inspired by DokuWiki's interwiki link format: https://www.dokuwiki.org/interwiki.

https://example.org/view/{NAME}

Supported instructions are (more will be added):

{NAME} is the document name without any encoding.

func (*InterwikiLink) Classes

func (l *InterwikiLink) Classes(_ mycocontext.Context) string

func (*InterwikiLink) DisplayedText

func (l *InterwikiLink) DisplayedText() string

func (*InterwikiLink) Err

func (l *InterwikiLink) Err() error

func (*InterwikiLink) HyphaProbe

func (l *InterwikiLink) HyphaProbe(mycocontext.Context) func(string)

func (*InterwikiLink) ImgSrc

func (l *InterwikiLink) ImgSrc(ctx mycocontext.Context) string

func (*InterwikiLink) LinkHref

func (l *InterwikiLink) LinkHref(ctx mycocontext.Context) string

func (*InterwikiLink) TryToGetError

func (l *InterwikiLink) TryToGetError(ctx mycocontext.Context) bool
type Link interface {
	// Classes returns a string to put into the class attr in HTML.
	Classes(ctx mycocontext.Context) string

	// LinkHref returns a string to put into the href attr of <a>.
	LinkHref(ctx mycocontext.Context) string

	// ImgSrc returns a string to put into the src attr of <img>.
	ImgSrc(ctx mycocontext.Context) string

	// DisplayedText returns a string to put inside <a>.
	DisplayedText() string

	// HyphaProbe returns a function that captures the Link. Probes are checked against all existing hyphae. This is Mycorrhiza-specific. If it is nil, do not check this link for existence. TODO: make it optional.
	HyphaProbe(ctx mycocontext.Context) func(string)
}

Link is a link of some kind.

func LinkFrom

func LinkFrom(ctx mycocontext.Context, target, display string) Link
type LocalLink struct {
	// contains filtered or unexported fields
}

func (*LocalLink) Classes

func (l *LocalLink) Classes(ctx mycocontext.Context) string

func (*LocalLink) DisplayedText

func (l *LocalLink) DisplayedText() string

func (*LocalLink) Existing

func (l *LocalLink) Existing() bool

func (*LocalLink) HyphaProbe

func (l *LocalLink) HyphaProbe(ctx mycocontext.Context) func(string)

func (*LocalLink) ImgSrc

func (l *LocalLink) ImgSrc(ctx mycocontext.Context) string

func (*LocalLink) LinkHref

func (l *LocalLink) LinkHref(ctx mycocontext.Context) string

func (*LocalLink) Target

func (l *LocalLink) Target(ctx mycocontext.Context) string
type LocalRootedLink struct {
	// contains filtered or unexported fields
}

func (*LocalRootedLink) Classes

func (l *LocalRootedLink) Classes(_ mycocontext.Context) string

func (*LocalRootedLink) DisplayedText

func (l *LocalRootedLink) DisplayedText() string

func (*LocalRootedLink) HyphaProbe

func (l *LocalRootedLink) HyphaProbe(_ mycocontext.Context) func(string)

func (*LocalRootedLink) ImgSrc

func (*LocalRootedLink) LinkHref

func (l *LocalRootedLink) LinkHref(_ mycocontext.Context) string
type URLLink struct {
	// contains filtered or unexported fields
}

func (*URLLink) Classes

func (l *URLLink) Classes(_ mycocontext.Context) string

func (*URLLink) DisplayedText

func (l *URLLink) DisplayedText() string

func (*URLLink) HyphaProbe

func (l *URLLink) HyphaProbe(_ mycocontext.Context) func(string)

func (*URLLink) ImgSrc

func (l *URLLink) ImgSrc(_ mycocontext.Context) string

func (*URLLink) LinkHref

func (l *URLLink) LinkHref(_ mycocontext.Context) string

Jump to

Keyboard shortcuts

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