Documentation ¶
Overview ¶
Package Shortcut contains types and methods for manipulating shortcuts.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeURL ¶
NormalizeURL takes the urls that we get and puts some sane defaults to it.
Types ¶
type Index ¶
An Index is a searchable collection of shortcuts.
func (Index) AddShortcut ¶
AddShortcut adds a given shortcut to this index, and returns the normalized URL string.
func (Index) FindShortcut ¶
FindShortcut attempts to find a given string by first searching for an absolute match. If that doesn't exist, it will perform a partial match on all the text. Results is a list of 0, 1 or more shortcuts that were found. If sole is true, that result was an absolute match.
type Shortcut ¶
type Shortcut struct { URL, ShortForm, Description string }
A Shortcut is a mapping from a shortform string to an alternative url.
func FromFields ¶
FromFields creates a Shortcut from a dictionary of fields.