links

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseLink struct {
	Path        string
	Target      string
	Description string
	Author      string
	EditURL     *url.URL
}

Link defines each individual link

func (BaseLink) Base

func (l BaseLink) Base() BaseLink

func (BaseLink) IsRegexp

func (l BaseLink) IsRegexp() bool

IsRegexp returns whether the link is a regexp match

func (BaseLink) Len

func (l BaseLink) Len() int

func (BaseLink) LiteralPrefix

func (l BaseLink) LiteralPrefix() string

func (BaseLink) Match

func (l BaseLink) Match(path string) (bool, error)

Match returns whether a link completely starts a string or includes the link as part of it's path

func (BaseLink) MatchDescription

func (l BaseLink) MatchDescription(path string) bool

MatchDescription returns whether a string matches the description

func (BaseLink) MatchPrefix

func (l BaseLink) MatchPrefix(prefix string) bool

MatchPrefix returns a suggestion if given path is a prefix for a link

func (BaseLink) PathString

func (l BaseLink) PathString() string

func (BaseLink) Transform

func (l BaseLink) Transform(path string, originalURL url.URL) (*url.URL, error)

Transform returns the target for the given path, appending the rest of the path

type Link interface {
	Base() BaseLink
	LiteralPrefix() string
	Len() int
	Match(string) (bool, error)
	MatchDescription(string) bool
	MatchPrefix(string) bool
	PathString() string
	Transform(string, url.URL) (*url.URL, error)
}
func NewLink(link BaseLink) Link

type LinkImpl

type LinkImpl struct {
	Link
}

type LinkSliceByPath

type LinkSliceByPath []Link

func (LinkSliceByPath) Len

func (s LinkSliceByPath) Len() int

func (LinkSliceByPath) Less

func (s LinkSliceByPath) Less(i, j int) bool

func (LinkSliceByPath) Swap

func (s LinkSliceByPath) Swap(i, j int)

type LinkSliceByPathLength

type LinkSliceByPathLength []Link

func (LinkSliceByPathLength) Len

func (s LinkSliceByPathLength) Len() int

func (LinkSliceByPathLength) Less

func (s LinkSliceByPathLength) Less(i, j int) bool

func (LinkSliceByPathLength) Swap

func (s LinkSliceByPathLength) Swap(i, j int)
type RegexpLink struct {
	BaseLink
}

func (RegexpLink) GetRegexp

func (l RegexpLink) GetRegexp() (*regexp.Regexp, error)

GetRegexp returns a compiled regexp or an error

func (RegexpLink) Len

func (l RegexpLink) Len() int

func (RegexpLink) LiteralPrefix

func (l RegexpLink) LiteralPrefix() string

func (RegexpLink) Match

func (l RegexpLink) Match(path string) (bool, error)

func (RegexpLink) MatchPrefix

func (l RegexpLink) MatchPrefix(prefix string) bool

func (RegexpLink) PathString

func (l RegexpLink) PathString() string

func (RegexpLink) Transform

func (l RegexpLink) Transform(path string, originalURL url.URL) (*url.URL, error)

Transform returns the target for the given path

Jump to

Keyboard shortcuts

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